doc/texinfo.tex
changeset 18 7c88989ea45b
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/doc/texinfo.tex	Tue Jan 20 11:21:42 2004 +0000
     1.3 @@ -0,0 +1,6615 @@
     1.4 +% texinfo.tex -- TeX macros to handle Texinfo files.
     1.5 +%
     1.6 +% Load plain if necessary, i.e., if running under initex.
     1.7 +\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
     1.8 +%
     1.9 +\def\texinfoversion{2003-07-28.08}
    1.10 +%
    1.11 +% Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
    1.12 +% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
    1.13 +%
    1.14 +% This texinfo.tex file is free software; you can redistribute it and/or
    1.15 +% modify it under the terms of the GNU General Public License as
    1.16 +% published by the Free Software Foundation; either version 2, or (at
    1.17 +% your option) any later version.
    1.18 +%
    1.19 +% This texinfo.tex file is distributed in the hope that it will be
    1.20 +% useful, but WITHOUT ANY WARRANTY; without even the implied warranty
    1.21 +% of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    1.22 +% General Public License for more details.
    1.23 +%
    1.24 +% You should have received a copy of the GNU General Public License
    1.25 +% along with this texinfo.tex file; see the file COPYING.  If not, write
    1.26 +% to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    1.27 +% Boston, MA 02111-1307, USA.
    1.28 +%
    1.29 +% In other words, you are welcome to use, share and improve this program.
    1.30 +% You are forbidden to forbid anyone else to use, share and improve
    1.31 +% what you give them.   Help stamp out software-hoarding!
    1.32 +%
    1.33 +% Please try the latest version of texinfo.tex before submitting bug
    1.34 +% reports; you can get the latest version from:
    1.35 +%   ftp://ftp.gnu.org/gnu/texinfo/texinfo.tex
    1.36 +%     (and all GNU mirrors, see http://www.gnu.org/order/ftp.html)
    1.37 +%   ftp://tug.org/tex/texinfo.tex
    1.38 +%     (and all CTAN mirrors, see http://www.ctan.org),
    1.39 +%   and /home/gd/gnu/doc/texinfo.tex on the GNU machines.
    1.40 +%
    1.41 +% The GNU Texinfo home page is http://www.gnu.org/software/texinfo.
    1.42 +%
    1.43 +% The texinfo.tex in any given Texinfo distribution could well be out
    1.44 +% of date, so if that's what you're using, please check.
    1.45 +%
    1.46 +% Send bug reports to bug-texinfo@gnu.org.  Please include including a
    1.47 +% complete document in each bug report with which we can reproduce the
    1.48 +% problem.  Patches are, of course, greatly appreciated.
    1.49 +%
    1.50 +% To process a Texinfo manual with TeX, it's most reliable to use the
    1.51 +% texi2dvi shell script that comes with the distribution.  For a simple
    1.52 +% manual foo.texi, however, you can get away with this:
    1.53 +%   tex foo.texi
    1.54 +%   texindex foo.??
    1.55 +%   tex foo.texi
    1.56 +%   tex foo.texi
    1.57 +%   dvips foo.dvi -o  # or whatever; this makes foo.ps.
    1.58 +% The extra TeX runs get the cross-reference information correct.
    1.59 +% Sometimes one run after texindex suffices, and sometimes you need more
    1.60 +% than two; texi2dvi does it as many times as necessary.
    1.61 +%
    1.62 +% It is possible to adapt texinfo.tex for other languages, to some
    1.63 +% extent.  You can get the existing language-specific files from the
    1.64 +% full Texinfo distribution.
    1.65 +
    1.66 +\message{Loading texinfo [version \texinfoversion]:}
    1.67 +
    1.68 +% If in a .fmt file, print the version number
    1.69 +% and turn on active characters that we couldn't do earlier because
    1.70 +% they might have appeared in the input file name.
    1.71 +\everyjob{\message{[Texinfo version \texinfoversion]}%
    1.72 +  \catcode`+=\active \catcode`\_=\active}
    1.73 +
    1.74 +\message{Basics,}
    1.75 +\chardef\other=12
    1.76 +
    1.77 +% We never want plain's \outer definition of \+ in Texinfo.
    1.78 +% For @tex, we can use \tabalign.
    1.79 +\let\+ = \relax
    1.80 +
    1.81 +% Save some plain tex macros whose names we will redefine.
    1.82 +\let\ptexb=\b
    1.83 +\let\ptexbullet=\bullet
    1.84 +\let\ptexc=\c
    1.85 +\let\ptexcomma=\,
    1.86 +\let\ptexdot=\.
    1.87 +\let\ptexdots=\dots
    1.88 +\let\ptexend=\end
    1.89 +\let\ptexequiv=\equiv
    1.90 +\let\ptexexclam=\!
    1.91 +\let\ptexgtr=>
    1.92 +\let\ptexhat=^
    1.93 +\let\ptexi=\i
    1.94 +\let\ptexindent=\indent
    1.95 +\let\ptexlbrace=\{
    1.96 +\let\ptexless=<
    1.97 +\let\ptexplus=+
    1.98 +\let\ptexrbrace=\}
    1.99 +\let\ptexslash=\/
   1.100 +\let\ptexstar=\*
   1.101 +\let\ptext=\t
   1.102 +
   1.103 +% If this character appears in an error message or help string, it
   1.104 +% starts a new line in the output.
   1.105 +\newlinechar = `^^J
   1.106 +
   1.107 +% Set up fixed words for English if not already set.
   1.108 +\ifx\putwordAppendix\undefined  \gdef\putwordAppendix{Appendix}\fi
   1.109 +\ifx\putwordChapter\undefined   \gdef\putwordChapter{Chapter}\fi
   1.110 +\ifx\putwordfile\undefined      \gdef\putwordfile{file}\fi
   1.111 +\ifx\putwordin\undefined        \gdef\putwordin{in}\fi
   1.112 +\ifx\putwordIndexIsEmpty\undefined     \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
   1.113 +\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
   1.114 +\ifx\putwordInfo\undefined      \gdef\putwordInfo{Info}\fi
   1.115 +\ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
   1.116 +\ifx\putwordMethodon\undefined  \gdef\putwordMethodon{Method on}\fi
   1.117 +\ifx\putwordNoTitle\undefined   \gdef\putwordNoTitle{No Title}\fi
   1.118 +\ifx\putwordof\undefined        \gdef\putwordof{of}\fi
   1.119 +\ifx\putwordon\undefined        \gdef\putwordon{on}\fi
   1.120 +\ifx\putwordpage\undefined      \gdef\putwordpage{page}\fi
   1.121 +\ifx\putwordsection\undefined   \gdef\putwordsection{section}\fi
   1.122 +\ifx\putwordSection\undefined   \gdef\putwordSection{Section}\fi
   1.123 +\ifx\putwordsee\undefined       \gdef\putwordsee{see}\fi
   1.124 +\ifx\putwordSee\undefined       \gdef\putwordSee{See}\fi
   1.125 +\ifx\putwordShortTOC\undefined  \gdef\putwordShortTOC{Short Contents}\fi
   1.126 +\ifx\putwordTOC\undefined       \gdef\putwordTOC{Table of Contents}\fi
   1.127 +%
   1.128 +\ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
   1.129 +\ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
   1.130 +\ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
   1.131 +\ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
   1.132 +\ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
   1.133 +\ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
   1.134 +\ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
   1.135 +\ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
   1.136 +\ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
   1.137 +\ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
   1.138 +\ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
   1.139 +\ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
   1.140 +%
   1.141 +\ifx\putwordDefmac\undefined    \gdef\putwordDefmac{Macro}\fi
   1.142 +\ifx\putwordDefspec\undefined   \gdef\putwordDefspec{Special Form}\fi
   1.143 +\ifx\putwordDefvar\undefined    \gdef\putwordDefvar{Variable}\fi
   1.144 +\ifx\putwordDefopt\undefined    \gdef\putwordDefopt{User Option}\fi
   1.145 +\ifx\putwordDeftypevar\undefined\gdef\putwordDeftypevar{Variable}\fi
   1.146 +\ifx\putwordDeffunc\undefined   \gdef\putwordDeffunc{Function}\fi
   1.147 +\ifx\putwordDeftypefun\undefined\gdef\putwordDeftypefun{Function}\fi
   1.148 +
   1.149 +% In some macros, we cannot use the `\? notation---the left quote is
   1.150 +% in some cases the escape char.
   1.151 +\chardef\colonChar = `\:
   1.152 +\chardef\commaChar = `\,
   1.153 +\chardef\dotChar   = `\.
   1.154 +\chardef\equalChar = `\=
   1.155 +\chardef\exclamChar= `\!
   1.156 +\chardef\questChar = `\?
   1.157 +\chardef\semiChar  = `\;
   1.158 +\chardef\spaceChar = `\ %
   1.159 +\chardef\underChar = `\_
   1.160 +
   1.161 +% Ignore a token.
   1.162 +%
   1.163 +\def\gobble#1{}
   1.164 +
   1.165 +% True if #1 is the empty string, i.e., called like `\ifempty{}'.
   1.166 +%
   1.167 +\def\ifempty#1{\ifemptyx #1\emptymarkA\emptymarkB}%
   1.168 +\def\ifemptyx#1#2\emptymarkB{\ifx #1\emptymarkA}%
   1.169 +
   1.170 +% Hyphenation fixes.
   1.171 +\hyphenation{ap-pen-dix}
   1.172 +\hyphenation{eshell}
   1.173 +\hyphenation{mini-buf-fer mini-buf-fers}
   1.174 +\hyphenation{time-stamp}
   1.175 +\hyphenation{white-space}
   1.176 +
   1.177 +% Margin to add to right of even pages, to left of odd pages.
   1.178 +\newdimen\bindingoffset
   1.179 +\newdimen\normaloffset
   1.180 +\newdimen\pagewidth \newdimen\pageheight
   1.181 +
   1.182 +% Sometimes it is convenient to have everything in the transcript file
   1.183 +% and nothing on the terminal.  We don't just call \tracingall here,
   1.184 +% since that produces some useless output on the terminal.  We also make
   1.185 +% some effort to order the tracing commands to reduce output in the log
   1.186 +% file; cf. trace.sty in LaTeX.
   1.187 +%
   1.188 +\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
   1.189 +\def\loggingall{%
   1.190 +  \tracingstats2
   1.191 +  \tracingpages1
   1.192 +  \tracinglostchars2  % 2 gives us more in etex
   1.193 +  \tracingparagraphs1
   1.194 +  \tracingoutput1
   1.195 +  \tracingmacros2
   1.196 +  \tracingrestores1
   1.197 +  \showboxbreadth\maxdimen \showboxdepth\maxdimen
   1.198 +  \ifx\eTeXversion\undefined\else % etex gives us more logging
   1.199 +    \tracingscantokens1
   1.200 +    \tracingifs1
   1.201 +    \tracinggroups1
   1.202 +    \tracingnesting2
   1.203 +    \tracingassigns1
   1.204 +  \fi
   1.205 +  \tracingcommands3  % 3 gives us more in etex
   1.206 +  \errorcontextlines\maxdimen
   1.207 +}%
   1.208 +
   1.209 +% add check for \lastpenalty to plain's definitions.  If the last thing
   1.210 +% we did was a \nobreak, we don't want to insert more space.
   1.211 +%
   1.212 +\def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount
   1.213 +  \removelastskip\penalty-50\smallskip\fi\fi}
   1.214 +\def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount
   1.215 +  \removelastskip\penalty-100\medskip\fi\fi}
   1.216 +\def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
   1.217 +  \removelastskip\penalty-200\bigskip\fi\fi}
   1.218 +
   1.219 +% For @cropmarks command.
   1.220 +% Do @cropmarks to get crop marks.
   1.221 +%
   1.222 +\newif\ifcropmarks
   1.223 +\let\cropmarks = \cropmarkstrue
   1.224 +%
   1.225 +% Dimensions to add cropmarks at corners.
   1.226 +% Added by P. A. MacKay, 12 Nov. 1986
   1.227 +%
   1.228 +\newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
   1.229 +\newdimen\cornerlong  \cornerlong=1pc
   1.230 +\newdimen\cornerthick \cornerthick=.3pt
   1.231 +\newdimen\topandbottommargin \topandbottommargin=.75in
   1.232 +
   1.233 +% Main output routine.
   1.234 +\chardef\PAGE = 255
   1.235 +\output = {\onepageout{\pagecontents\PAGE}}
   1.236 +
   1.237 +\newbox\headlinebox
   1.238 +\newbox\footlinebox
   1.239 +
   1.240 +% \onepageout takes a vbox as an argument.  Note that \pagecontents
   1.241 +% does insertions, but you have to call it yourself.
   1.242 +\def\onepageout#1{%
   1.243 +  \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
   1.244 +  %
   1.245 +  \ifodd\pageno  \advance\hoffset by \bindingoffset
   1.246 +  \else \advance\hoffset by -\bindingoffset\fi
   1.247 +  %
   1.248 +  % Do this outside of the \shipout so @code etc. will be expanded in
   1.249 +  % the headline as they should be, not taken literally (outputting ''code).
   1.250 +  \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}%
   1.251 +  \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}%
   1.252 +  %
   1.253 +  {%
   1.254 +    % Have to do this stuff outside the \shipout because we want it to
   1.255 +    % take effect in \write's, yet the group defined by the \vbox ends
   1.256 +    % before the \shipout runs.
   1.257 +    %
   1.258 +    \escapechar = `\\     % use backslash in output files.
   1.259 +    \indexdummies         % don't expand commands in the output.
   1.260 +    \normalturnoffactive  % \ in index entries must not stay \, e.g., if
   1.261 +                   % the page break happens to be in the middle of an example.
   1.262 +    \shipout\vbox{%
   1.263 +      % Do this early so pdf references go to the beginning of the page.
   1.264 +      \ifpdfmakepagedest \pdfmkdest{\the\pageno} \fi
   1.265 +      %
   1.266 +      \ifcropmarks \vbox to \outervsize\bgroup
   1.267 +        \hsize = \outerhsize
   1.268 +        \vskip-\topandbottommargin
   1.269 +        \vtop to0pt{%
   1.270 +          \line{\ewtop\hfil\ewtop}%
   1.271 +          \nointerlineskip
   1.272 +          \line{%
   1.273 +            \vbox{\moveleft\cornerthick\nstop}%
   1.274 +            \hfill
   1.275 +            \vbox{\moveright\cornerthick\nstop}%
   1.276 +          }%
   1.277 +          \vss}%
   1.278 +        \vskip\topandbottommargin
   1.279 +        \line\bgroup
   1.280 +          \hfil % center the page within the outer (page) hsize.
   1.281 +          \ifodd\pageno\hskip\bindingoffset\fi
   1.282 +          \vbox\bgroup
   1.283 +      \fi
   1.284 +      %
   1.285 +      \unvbox\headlinebox
   1.286 +      \pagebody{#1}%
   1.287 +      \ifdim\ht\footlinebox > 0pt
   1.288 +        % Only leave this space if the footline is nonempty.
   1.289 +        % (We lessened \vsize for it in \oddfootingxxx.)
   1.290 +        % The \baselineskip=24pt in plain's \makefootline has no effect.
   1.291 +        \vskip 2\baselineskip
   1.292 +        \unvbox\footlinebox
   1.293 +      \fi
   1.294 +      %
   1.295 +      \ifcropmarks
   1.296 +          \egroup % end of \vbox\bgroup
   1.297 +        \hfil\egroup % end of (centering) \line\bgroup
   1.298 +        \vskip\topandbottommargin plus1fill minus1fill
   1.299 +        \boxmaxdepth = \cornerthick
   1.300 +        \vbox to0pt{\vss
   1.301 +          \line{%
   1.302 +            \vbox{\moveleft\cornerthick\nsbot}%
   1.303 +            \hfill
   1.304 +            \vbox{\moveright\cornerthick\nsbot}%
   1.305 +          }%
   1.306 +          \nointerlineskip
   1.307 +          \line{\ewbot\hfil\ewbot}%
   1.308 +        }%
   1.309 +      \egroup % \vbox from first cropmarks clause
   1.310 +      \fi
   1.311 +    }% end of \shipout\vbox
   1.312 +  }% end of group with \normalturnoffactive
   1.313 +  \advancepageno
   1.314 +  \ifnum\outputpenalty>-20000 \else\dosupereject\fi
   1.315 +}
   1.316 +
   1.317 +\newinsert\margin \dimen\margin=\maxdimen
   1.318 +
   1.319 +\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
   1.320 +{\catcode`\@ =11
   1.321 +\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
   1.322 +% marginal hacks, juha@viisa.uucp (Juha Takala)
   1.323 +\ifvoid\margin\else % marginal info is present
   1.324 +  \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
   1.325 +\dimen@=\dp#1 \unvbox#1
   1.326 +\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
   1.327 +\ifr@ggedbottom \kern-\dimen@ \vfil \fi}
   1.328 +}
   1.329 +
   1.330 +% Here are the rules for the cropmarks.  Note that they are
   1.331 +% offset so that the space between them is truly \outerhsize or \outervsize
   1.332 +% (P. A. MacKay, 12 November, 1986)
   1.333 +%
   1.334 +\def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
   1.335 +\def\nstop{\vbox
   1.336 +  {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
   1.337 +\def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
   1.338 +\def\nsbot{\vbox
   1.339 +  {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
   1.340 +
   1.341 +% Parse an argument, then pass it to #1.  The argument is the rest of
   1.342 +% the input line (except we remove a trailing comment).  #1 should be a
   1.343 +% macro which expects an ordinary undelimited TeX argument.
   1.344 +%
   1.345 +\def\parsearg#1{%
   1.346 +  \let\next = #1%
   1.347 +  \begingroup
   1.348 +    \obeylines
   1.349 +    \futurelet\temp\parseargx
   1.350 +}
   1.351 +
   1.352 +% If the next token is an obeyed space (from an @example environment or
   1.353 +% the like), remove it and recurse.  Otherwise, we're done.
   1.354 +\def\parseargx{%
   1.355 +  % \obeyedspace is defined far below, after the definition of \sepspaces.
   1.356 +  \ifx\obeyedspace\temp
   1.357 +    \expandafter\parseargdiscardspace
   1.358 +  \else
   1.359 +    \expandafter\parseargline
   1.360 +  \fi
   1.361 +}
   1.362 +
   1.363 +% Remove a single space (as the delimiter token to the macro call).
   1.364 +{\obeyspaces %
   1.365 + \gdef\parseargdiscardspace {\futurelet\temp\parseargx}}
   1.366 +
   1.367 +{\obeylines %
   1.368 +  \gdef\parseargline#1^^M{%
   1.369 +    \endgroup % End of the group started in \parsearg.
   1.370 +    %
   1.371 +    % First remove any @c comment, then any @comment.
   1.372 +    % Result of each macro is put in \toks0.
   1.373 +    \argremovec #1\c\relax %
   1.374 +    \expandafter\argremovecomment \the\toks0 \comment\relax %
   1.375 +    %
   1.376 +    % Call the caller's macro, saved as \next in \parsearg.
   1.377 +    \expandafter\next\expandafter{\the\toks0}%
   1.378 +  }%
   1.379 +}
   1.380 +
   1.381 +% Since all \c{,omment} does is throw away the argument, we can let TeX
   1.382 +% do that for us.  The \relax here is matched by the \relax in the call
   1.383 +% in \parseargline; it could be more or less anything, its purpose is
   1.384 +% just to delimit the argument to the \c.
   1.385 +\def\argremovec#1\c#2\relax{\toks0 = {#1}}
   1.386 +\def\argremovecomment#1\comment#2\relax{\toks0 = {#1}}
   1.387 +
   1.388 +% \argremovec{,omment} might leave us with trailing spaces, though; e.g.,
   1.389 +%    @end itemize  @c foo
   1.390 +% will have two active spaces as part of the argument with the
   1.391 +% `itemize'.  Here we remove all active spaces from #1, and assign the
   1.392 +% result to \toks0.
   1.393 +%
   1.394 +% This loses if there are any *other* active characters besides spaces
   1.395 +% in the argument -- _ ^ +, for example -- since they get expanded.
   1.396 +% Fortunately, Texinfo does not define any such commands.  (If it ever
   1.397 +% does, the catcode of the characters in questionwill have to be changed
   1.398 +% here.)  But this means we cannot call \removeactivespaces as part of
   1.399 +% \argremovec{,omment}, since @c uses \parsearg, and thus the argument
   1.400 +% that \parsearg gets might well have any character at all in it.
   1.401 +%
   1.402 +\def\removeactivespaces#1{%
   1.403 +  \begingroup
   1.404 +    \ignoreactivespaces
   1.405 +    \edef\temp{#1}%
   1.406 +    \global\toks0 = \expandafter{\temp}%
   1.407 +  \endgroup
   1.408 +}
   1.409 +
   1.410 +% Change the active space to expand to nothing.
   1.411 +%
   1.412 +\begingroup
   1.413 +  \obeyspaces
   1.414 +  \gdef\ignoreactivespaces{\obeyspaces\let =\empty}
   1.415 +\endgroup
   1.416 +
   1.417 +
   1.418 +\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
   1.419 +
   1.420 +%% These are used to keep @begin/@end levels from running away
   1.421 +%% Call \inENV within environments (after a \begingroup)
   1.422 +\newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
   1.423 +\def\ENVcheck{%
   1.424 +\ifENV\errmessage{Still within an environment; press RETURN to continue}
   1.425 +\endgroup\fi} % This is not perfect, but it should reduce lossage
   1.426 +
   1.427 +% @begin foo  is the same as @foo, for now.
   1.428 +\newhelp\EMsimple{Press RETURN to continue.}
   1.429 +
   1.430 +\outer\def\begin{\parsearg\beginxxx}
   1.431 +
   1.432 +\def\beginxxx #1{%
   1.433 +\expandafter\ifx\csname #1\endcsname\relax
   1.434 +{\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
   1.435 +\csname #1\endcsname\fi}
   1.436 +
   1.437 +% @end foo executes the definition of \Efoo.
   1.438 +%
   1.439 +\def\end{\parsearg\endxxx}
   1.440 +\def\endxxx #1{%
   1.441 +  \removeactivespaces{#1}%
   1.442 +  \edef\endthing{\the\toks0}%
   1.443 +  %
   1.444 +  \expandafter\ifx\csname E\endthing\endcsname\relax
   1.445 +    \expandafter\ifx\csname \endthing\endcsname\relax
   1.446 +      % There's no \foo, i.e., no ``environment'' foo.
   1.447 +      \errhelp = \EMsimple
   1.448 +      \errmessage{Undefined command `@end \endthing'}%
   1.449 +    \else
   1.450 +      \unmatchedenderror\endthing
   1.451 +    \fi
   1.452 +  \else
   1.453 +    % Everything's ok; the right environment has been started.
   1.454 +    \csname E\endthing\endcsname
   1.455 +  \fi
   1.456 +}
   1.457 +
   1.458 +% There is an environment #1, but it hasn't been started.  Give an error.
   1.459 +%
   1.460 +\def\unmatchedenderror#1{%
   1.461 +  \errhelp = \EMsimple
   1.462 +  \errmessage{This `@end #1' doesn't have a matching `@#1'}%
   1.463 +}
   1.464 +
   1.465 +% Define the control sequence \E#1 to give an unmatched @end error.
   1.466 +%
   1.467 +\def\defineunmatchedend#1{%
   1.468 +  \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}%
   1.469 +}
   1.470 +
   1.471 +
   1.472 +%% Simple single-character @ commands
   1.473 +
   1.474 +% @@ prints an @
   1.475 +% Kludge this until the fonts are right (grr).
   1.476 +\def\@{{\tt\char64}}
   1.477 +
   1.478 +% This is turned off because it was never documented
   1.479 +% and you can use @w{...} around a quote to suppress ligatures.
   1.480 +%% Define @` and @' to be the same as ` and '
   1.481 +%% but suppressing ligatures.
   1.482 +%\def\`{{`}}
   1.483 +%\def\'{{'}}
   1.484 +
   1.485 +% Used to generate quoted braces.
   1.486 +\def\mylbrace {{\tt\char123}}
   1.487 +\def\myrbrace {{\tt\char125}}
   1.488 +\let\{=\mylbrace
   1.489 +\let\}=\myrbrace
   1.490 +\begingroup
   1.491 +  % Definitions to produce \{ and \} commands for indices,
   1.492 +  % and @{ and @} for the aux file.
   1.493 +  \catcode`\{ = \other \catcode`\} = \other
   1.494 +  \catcode`\[ = 1 \catcode`\] = 2
   1.495 +  \catcode`\! = 0 \catcode`\\ = \other
   1.496 +  !gdef!lbracecmd[\{]%
   1.497 +  !gdef!rbracecmd[\}]%
   1.498 +  !gdef!lbraceatcmd[@{]%
   1.499 +  !gdef!rbraceatcmd[@}]%
   1.500 +!endgroup
   1.501 +
   1.502 +% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
   1.503 +% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
   1.504 +\let\, = \c
   1.505 +\let\dotaccent = \.
   1.506 +\def\ringaccent#1{{\accent23 #1}}
   1.507 +\let\tieaccent = \t
   1.508 +\let\ubaraccent = \b
   1.509 +\let\udotaccent = \d
   1.510 +
   1.511 +% Other special characters: @questiondown @exclamdown
   1.512 +% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
   1.513 +\def\questiondown{?`}
   1.514 +\def\exclamdown{!`}
   1.515 +
   1.516 +% Dotless i and dotless j, used for accents.
   1.517 +\def\imacro{i}
   1.518 +\def\jmacro{j}
   1.519 +\def\dotless#1{%
   1.520 +  \def\temp{#1}%
   1.521 +  \ifx\temp\imacro \ptexi
   1.522 +  \else\ifx\temp\jmacro \j
   1.523 +  \else \errmessage{@dotless can be used only with i or j}%
   1.524 +  \fi\fi
   1.525 +}
   1.526 +
   1.527 +% Be sure we're in horizontal mode when doing a tie, since we make space
   1.528 +% equivalent to this in @example-like environments. Otherwise, a space
   1.529 +% at the beginning of a line will start with \penalty -- and
   1.530 +% since \penalty is valid in vertical mode, we'd end up putting the
   1.531 +% penalty on the vertical list instead of in the new paragraph.
   1.532 +{\catcode`@ = 11
   1.533 + % Avoid using \@M directly, because that causes trouble
   1.534 + % if the definition is written into an index file.
   1.535 + \global\let\tiepenalty = \@M
   1.536 + \gdef\tie{\leavevmode\penalty\tiepenalty\ }
   1.537 +}
   1.538 +
   1.539 +% @: forces normal size whitespace following.
   1.540 +\def\:{\spacefactor=1000 }
   1.541 +
   1.542 +% @* forces a line break.
   1.543 +\def\*{\hfil\break\hbox{}\ignorespaces}
   1.544 +
   1.545 +% @/ allows a line break.
   1.546 +\let\/=\allowbreak
   1.547 +
   1.548 +% @. is an end-of-sentence period.
   1.549 +\def\.{.\spacefactor=3000 }
   1.550 +
   1.551 +% @! is an end-of-sentence bang.
   1.552 +\def\!{!\spacefactor=3000 }
   1.553 +
   1.554 +% @? is an end-of-sentence query.
   1.555 +\def\?{?\spacefactor=3000 }
   1.556 +
   1.557 +% @w prevents a word break.  Without the \leavevmode, @w at the
   1.558 +% beginning of a paragraph, when TeX is still in vertical mode, would
   1.559 +% produce a whole line of output instead of starting the paragraph.
   1.560 +\def\w#1{\leavevmode\hbox{#1}}
   1.561 +
   1.562 +% @group ... @end group forces ... to be all on one page, by enclosing
   1.563 +% it in a TeX vbox.  We use \vtop instead of \vbox to construct the box
   1.564 +% to keep its height that of a normal line.  According to the rules for
   1.565 +% \topskip (p.114 of the TeXbook), the glue inserted is
   1.566 +% max (\topskip - \ht (first item), 0).  If that height is large,
   1.567 +% therefore, no glue is inserted, and the space between the headline and
   1.568 +% the text is small, which looks bad.
   1.569 +%
   1.570 +% Another complication is that the group might be very large.  This can
   1.571 +% cause the glue on the previous page to be unduly stretched, because it
   1.572 +% does not have much material.  In this case, it's better to add an
   1.573 +% explicit \vfill so that the extra space is at the bottom.  The
   1.574 +% threshold for doing this is if the group is more than \vfilllimit
   1.575 +% percent of a page (\vfilllimit can be changed inside of @tex).
   1.576 +%
   1.577 +\newbox\groupbox
   1.578 +\def\vfilllimit{0.7}
   1.579 +%
   1.580 +\def\group{\begingroup
   1.581 +  \ifnum\catcode13=\active \else
   1.582 +    \errhelp = \groupinvalidhelp
   1.583 +    \errmessage{@group invalid in context where filling is enabled}%
   1.584 +  \fi
   1.585 +  %
   1.586 +  % The \vtop we start below produces a box with normal height and large
   1.587 +  % depth; thus, TeX puts \baselineskip glue before it, and (when the
   1.588 +  % next line of text is done) \lineskip glue after it.  (See p.82 of
   1.589 +  % the TeXbook.)  Thus, space below is not quite equal to space
   1.590 +  % above.  But it's pretty close.
   1.591 +  \def\Egroup{%
   1.592 +    \egroup           % End the \vtop.
   1.593 +    % \dimen0 is the vertical size of the group's box.
   1.594 +    \dimen0 = \ht\groupbox  \advance\dimen0 by \dp\groupbox
   1.595 +    % \dimen2 is how much space is left on the page (more or less).
   1.596 +    \dimen2 = \pageheight   \advance\dimen2 by -\pagetotal
   1.597 +    % if the group doesn't fit on the current page, and it's a big big
   1.598 +    % group, force a page break.
   1.599 +    \ifdim \dimen0 > \dimen2
   1.600 +      \ifdim \pagetotal < \vfilllimit\pageheight
   1.601 +        \page
   1.602 +      \fi
   1.603 +    \fi
   1.604 +    \copy\groupbox
   1.605 +    \endgroup         % End the \group.
   1.606 +  }%
   1.607 +  %
   1.608 +  \setbox\groupbox = \vtop\bgroup
   1.609 +    % We have to put a strut on the last line in case the @group is in
   1.610 +    % the midst of an example, rather than completely enclosing it.
   1.611 +    % Otherwise, the interline space between the last line of the group
   1.612 +    % and the first line afterwards is too small.  But we can't put the
   1.613 +    % strut in \Egroup, since there it would be on a line by itself.
   1.614 +    % Hence this just inserts a strut at the beginning of each line.
   1.615 +    \everypar = {\strut}%
   1.616 +    %
   1.617 +    % Since we have a strut on every line, we don't need any of TeX's
   1.618 +    % normal interline spacing.
   1.619 +    \offinterlineskip
   1.620 +    %
   1.621 +    % OK, but now we have to do something about blank
   1.622 +    % lines in the input in @example-like environments, which normally
   1.623 +    % just turn into \lisppar, which will insert no space now that we've
   1.624 +    % turned off the interline space.  Simplest is to make them be an
   1.625 +    % empty paragraph.
   1.626 +    \ifx\par\lisppar
   1.627 +      \edef\par{\leavevmode \par}%
   1.628 +      %
   1.629 +      % Reset ^^M's definition to new definition of \par.
   1.630 +      \obeylines
   1.631 +    \fi
   1.632 +    %
   1.633 +    % Do @comment since we are called inside an environment such as
   1.634 +    % @example, where each end-of-line in the input causes an
   1.635 +    % end-of-line in the output.  We don't want the end-of-line after
   1.636 +    % the `@group' to put extra space in the output.  Since @group
   1.637 +    % should appear on a line by itself (according to the Texinfo
   1.638 +    % manual), we don't worry about eating any user text.
   1.639 +    \comment
   1.640 +}
   1.641 +%
   1.642 +% TeX puts in an \escapechar (i.e., `@') at the beginning of the help
   1.643 +% message, so this ends up printing `@group can only ...'.
   1.644 +%
   1.645 +\newhelp\groupinvalidhelp{%
   1.646 +group can only be used in environments such as @example,^^J%
   1.647 +where each line of input produces a line of output.}
   1.648 +
   1.649 +% @need space-in-mils
   1.650 +% forces a page break if there is not space-in-mils remaining.
   1.651 +
   1.652 +\newdimen\mil  \mil=0.001in
   1.653 +
   1.654 +\def\need{\parsearg\needx}
   1.655 +
   1.656 +% Old definition--didn't work.
   1.657 +%\def\needx #1{\par %
   1.658 +%% This method tries to make TeX break the page naturally
   1.659 +%% if the depth of the box does not fit.
   1.660 +%{\baselineskip=0pt%
   1.661 +%\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak
   1.662 +%\prevdepth=-1000pt
   1.663 +%}}
   1.664 +
   1.665 +\def\needx#1{%
   1.666 +  % Ensure vertical mode, so we don't make a big box in the middle of a
   1.667 +  % paragraph.
   1.668 +  \par
   1.669 +  %
   1.670 +  % If the @need value is less than one line space, it's useless.
   1.671 +  \dimen0 = #1\mil
   1.672 +  \dimen2 = \ht\strutbox
   1.673 +  \advance\dimen2 by \dp\strutbox
   1.674 +  \ifdim\dimen0 > \dimen2
   1.675 +    %
   1.676 +    % Do a \strut just to make the height of this box be normal, so the
   1.677 +    % normal leading is inserted relative to the preceding line.
   1.678 +    % And a page break here is fine.
   1.679 +    \vtop to #1\mil{\strut\vfil}%
   1.680 +    %
   1.681 +    % TeX does not even consider page breaks if a penalty added to the
   1.682 +    % main vertical list is 10000 or more.  But in order to see if the
   1.683 +    % empty box we just added fits on the page, we must make it consider
   1.684 +    % page breaks.  On the other hand, we don't want to actually break the
   1.685 +    % page after the empty box.  So we use a penalty of 9999.
   1.686 +    %
   1.687 +    % There is an extremely small chance that TeX will actually break the
   1.688 +    % page at this \penalty, if there are no other feasible breakpoints in
   1.689 +    % sight.  (If the user is using lots of big @group commands, which
   1.690 +    % almost-but-not-quite fill up a page, TeX will have a hard time doing
   1.691 +    % good page breaking, for example.)  However, I could not construct an
   1.692 +    % example where a page broke at this \penalty; if it happens in a real
   1.693 +    % document, then we can reconsider our strategy.
   1.694 +    \penalty9999
   1.695 +    %
   1.696 +    % Back up by the size of the box, whether we did a page break or not.
   1.697 +    \kern -#1\mil
   1.698 +    %
   1.699 +    % Do not allow a page break right after this kern.
   1.700 +    \nobreak
   1.701 +  \fi
   1.702 +}
   1.703 +
   1.704 +% @br   forces paragraph break
   1.705 +
   1.706 +\let\br = \par
   1.707 +
   1.708 +% @dots{} output an ellipsis using the current font.
   1.709 +% We do .5em per period so that it has the same spacing in a typewriter
   1.710 +% font as three actual period characters.
   1.711 +%
   1.712 +\def\dots{%
   1.713 +  \leavevmode
   1.714 +  \hbox to 1.5em{%
   1.715 +    \hskip 0pt plus 0.25fil minus 0.25fil
   1.716 +    .\hss.\hss.%
   1.717 +    \hskip 0pt plus 0.5fil minus 0.5fil
   1.718 +  }%
   1.719 +}
   1.720 +
   1.721 +% @enddots{} is an end-of-sentence ellipsis.
   1.722 +%
   1.723 +\def\enddots{%
   1.724 +  \leavevmode
   1.725 +  \hbox to 2em{%
   1.726 +    \hskip 0pt plus 0.25fil minus 0.25fil
   1.727 +    .\hss.\hss.\hss.%
   1.728 +    \hskip 0pt plus 0.5fil minus 0.5fil
   1.729 +  }%
   1.730 +  \spacefactor=3000
   1.731 +}
   1.732 +
   1.733 +% @page forces the start of a new page.
   1.734 +%
   1.735 +\def\page{\par\vfill\supereject}
   1.736 +
   1.737 +% @exdent text....
   1.738 +% outputs text on separate line in roman font, starting at standard page margin
   1.739 +
   1.740 +% This records the amount of indent in the innermost environment.
   1.741 +% That's how much \exdent should take out.
   1.742 +\newskip\exdentamount
   1.743 +
   1.744 +% This defn is used inside fill environments such as @defun.
   1.745 +\def\exdent{\parsearg\exdentyyy}
   1.746 +\def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}}
   1.747 +
   1.748 +% This defn is used inside nofill environments such as @example.
   1.749 +\def\nofillexdent{\parsearg\nofillexdentyyy}
   1.750 +\def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount
   1.751 +\leftline{\hskip\leftskip{\rm#1}}}}
   1.752 +
   1.753 +% @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
   1.754 +% paragraph.  For more general purposes, use the \margin insertion
   1.755 +% class.  WHICH is `l' or `r'.
   1.756 +%
   1.757 +\newskip\inmarginspacing \inmarginspacing=1cm
   1.758 +\def\strutdepth{\dp\strutbox}
   1.759 +%
   1.760 +\def\doinmargin#1#2{\strut\vadjust{%
   1.761 +  \nobreak
   1.762 +  \kern-\strutdepth
   1.763 +  \vtop to \strutdepth{%
   1.764 +    \baselineskip=\strutdepth
   1.765 +    \vss
   1.766 +    % if you have multiple lines of stuff to put here, you'll need to
   1.767 +    % make the vbox yourself of the appropriate size.
   1.768 +    \ifx#1l%
   1.769 +      \llap{\ignorespaces #2\hskip\inmarginspacing}%
   1.770 +    \else
   1.771 +      \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
   1.772 +    \fi
   1.773 +    \null
   1.774 +  }%
   1.775 +}}
   1.776 +\def\inleftmargin{\doinmargin l}
   1.777 +\def\inrightmargin{\doinmargin r}
   1.778 +%
   1.779 +% @inmargin{TEXT [, RIGHT-TEXT]}
   1.780 +% (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
   1.781 +% else use TEXT for both).
   1.782 +%
   1.783 +\def\inmargin#1{\parseinmargin #1,,\finish}
   1.784 +\def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
   1.785 +  \setbox0 = \hbox{\ignorespaces #2}%
   1.786 +  \ifdim\wd0 > 0pt
   1.787 +    \def\lefttext{#1}%  have both texts
   1.788 +    \def\righttext{#2}%
   1.789 +  \else
   1.790 +    \def\lefttext{#1}%  have only one text
   1.791 +    \def\righttext{#1}%
   1.792 +  \fi
   1.793 +  %
   1.794 +  \ifodd\pageno
   1.795 +    \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
   1.796 +  \else
   1.797 +    \def\temp{\inleftmargin\lefttext}%
   1.798 +  \fi
   1.799 +  \temp
   1.800 +}
   1.801 +
   1.802 +% @include file    insert text of that file as input.
   1.803 +% Allow normal characters that  we make active in the argument (a file name).
   1.804 +\def\include{\begingroup
   1.805 +  \catcode`\\=\other
   1.806 +  \catcode`~=\other
   1.807 +  \catcode`^=\other
   1.808 +  \catcode`_=\other
   1.809 +  \catcode`|=\other
   1.810 +  \catcode`<=\other
   1.811 +  \catcode`>=\other
   1.812 +  \catcode`+=\other
   1.813 +  \parsearg\includezzz}
   1.814 +% Restore active chars for included file.
   1.815 +\def\includezzz#1{\endgroup\begingroup
   1.816 +  % Read the included file in a group so nested @include's work.
   1.817 +  \def\thisfile{#1}%
   1.818 +  \let\value=\expandablevalue
   1.819 +  \input\thisfile
   1.820 +\endgroup}
   1.821 +
   1.822 +\def\thisfile{}
   1.823 +
   1.824 +% @center line
   1.825 +% outputs that line, centered.
   1.826 +%
   1.827 +\def\center{\parsearg\docenter}
   1.828 +\def\docenter#1{{%
   1.829 +  \ifhmode \hfil\break \fi
   1.830 +  \advance\hsize by -\leftskip
   1.831 +  \advance\hsize by -\rightskip
   1.832 +  \line{\hfil \ignorespaces#1\unskip \hfil}%
   1.833 +  \ifhmode \break \fi
   1.834 +}}
   1.835 +
   1.836 +% @sp n   outputs n lines of vertical space
   1.837 +
   1.838 +\def\sp{\parsearg\spxxx}
   1.839 +\def\spxxx #1{\vskip #1\baselineskip}
   1.840 +
   1.841 +% @comment ...line which is ignored...
   1.842 +% @c is the same as @comment
   1.843 +% @ignore ... @end ignore  is another way to write a comment
   1.844 +
   1.845 +\def\comment{\begingroup \catcode`\^^M=\other%
   1.846 +\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
   1.847 +\commentxxx}
   1.848 +{\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}}
   1.849 +
   1.850 +\let\c=\comment
   1.851 +
   1.852 +% @paragraphindent NCHARS
   1.853 +% We'll use ems for NCHARS, close enough.
   1.854 +% NCHARS can also be the word `asis' or `none'.
   1.855 +% We cannot feasibly implement @paragraphindent asis, though.
   1.856 +%
   1.857 +\def\asisword{asis} % no translation, these are keywords
   1.858 +\def\noneword{none}
   1.859 +%
   1.860 +\def\paragraphindent{\parsearg\doparagraphindent}
   1.861 +\def\doparagraphindent#1{%
   1.862 +  \def\temp{#1}%
   1.863 +  \ifx\temp\asisword
   1.864 +  \else
   1.865 +    \ifx\temp\noneword
   1.866 +      \defaultparindent = 0pt
   1.867 +    \else
   1.868 +      \defaultparindent = #1em
   1.869 +    \fi
   1.870 +  \fi
   1.871 +  \parindent = \defaultparindent
   1.872 +}
   1.873 +
   1.874 +% @exampleindent NCHARS
   1.875 +% We'll use ems for NCHARS like @paragraphindent.
   1.876 +% It seems @exampleindent asis isn't necessary, but
   1.877 +% I preserve it to make it similar to @paragraphindent.
   1.878 +\def\exampleindent{\parsearg\doexampleindent}
   1.879 +\def\doexampleindent#1{%
   1.880 +  \def\temp{#1}%
   1.881 +  \ifx\temp\asisword
   1.882 +  \else
   1.883 +    \ifx\temp\noneword
   1.884 +      \lispnarrowing = 0pt
   1.885 +    \else
   1.886 +      \lispnarrowing = #1em
   1.887 +    \fi
   1.888 +  \fi
   1.889 +}
   1.890 +
   1.891 +% @firstparagraphindent WORD
   1.892 +% If WORD is `none', then suppress indentation of the first paragraph
   1.893 +% after a section heading.  If WORD is `insert', then do indent at such
   1.894 +% paragraphs.
   1.895 +%
   1.896 +% The paragraph indentation is suppressed or not by calling
   1.897 +% \suppressfirstparagraphindent, which the sectioning commands do.
   1.898 +% We switch the definition of this back and forth according to WORD.
   1.899 +% By default, we suppress indentation.
   1.900 +%
   1.901 +\def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
   1.902 +\newdimen\currentparindent
   1.903 +%
   1.904 +\def\insertword{insert}
   1.905 +%
   1.906 +\def\firstparagraphindent{\parsearg\dofirstparagraphindent}
   1.907 +\def\dofirstparagraphindent#1{%
   1.908 +  \def\temp{#1}%
   1.909 +  \ifx\temp\noneword
   1.910 +    \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
   1.911 +  \else\ifx\temp\insertword
   1.912 +    \let\suppressfirstparagraphindent = \relax
   1.913 +  \else
   1.914 +    \errhelp = \EMsimple
   1.915 +    \errmessage{Unknown @firstparagraphindent option `\temp'}%
   1.916 +  \fi\fi
   1.917 +}
   1.918 +
   1.919 +% Here is how we actually suppress indentation.  Redefine \everypar to
   1.920 +% \kern backwards by \parindent, and then reset itself to empty.
   1.921 +%
   1.922 +% We also make \indent itself not actually do anything until the next
   1.923 +% paragraph.
   1.924 +%
   1.925 +\gdef\dosuppressfirstparagraphindent{%
   1.926 +  \gdef\indent{%
   1.927 +    \global\let\indent=\ptexindent
   1.928 +    \global\everypar = {}%
   1.929 +  }%
   1.930 +  \global\everypar = {%
   1.931 +    \kern-\parindent
   1.932 +    \global\let\indent=\ptexindent
   1.933 +    \global\everypar = {}%
   1.934 +  }%
   1.935 +}%
   1.936 +
   1.937 +
   1.938 +% @asis just yields its argument.  Used with @table, for example.
   1.939 +%
   1.940 +\def\asis#1{#1}
   1.941 +
   1.942 +% @math outputs its argument in math mode.
   1.943 +% We don't use $'s directly in the definition of \math because we need
   1.944 +% to set catcodes according to plain TeX first, to allow for subscripts,
   1.945 +% superscripts, special math chars, etc.
   1.946 +%
   1.947 +\let\implicitmath = $%$ font-lock fix
   1.948 +%
   1.949 +% One complication: _ usually means subscripts, but it could also mean
   1.950 +% an actual _ character, as in @math{@var{some_variable} + 1}.  So make
   1.951 +% _ within @math be active (mathcode "8000), and distinguish by seeing
   1.952 +% if the current family is \slfam, which is what @var uses.
   1.953 +%
   1.954 +{\catcode\underChar = \active
   1.955 +\gdef\mathunderscore{%
   1.956 +  \catcode\underChar=\active
   1.957 +  \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
   1.958 +}}
   1.959 +%
   1.960 +% Another complication: we want \\ (and @\) to output a \ character.
   1.961 +% FYI, plain.tex uses \\ as a temporary control sequence (why?), but
   1.962 +% this is not advertised and we don't care.  Texinfo does not
   1.963 +% otherwise define @\.
   1.964 +%
   1.965 +% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
   1.966 +\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
   1.967 +%
   1.968 +\def\math{%
   1.969 +  \tex
   1.970 +  \mathcode`\_="8000 \mathunderscore
   1.971 +  \let\\ = \mathbackslash
   1.972 +  \mathactive
   1.973 +  \implicitmath\finishmath}
   1.974 +\def\finishmath#1{#1\implicitmath\Etex}
   1.975 +
   1.976 +% Some active characters (such as <) are spaced differently in math.
   1.977 +% We have to reset their definitions in case the @math was an
   1.978 +% argument to a command which set the catcodes (such as @item or @section).
   1.979 +%
   1.980 +{
   1.981 +  \catcode`^ = \active
   1.982 +  \catcode`< = \active
   1.983 +  \catcode`> = \active
   1.984 +  \catcode`+ = \active
   1.985 +  \gdef\mathactive{%
   1.986 +    \let^ = \ptexhat
   1.987 +    \let< = \ptexless
   1.988 +    \let> = \ptexgtr
   1.989 +    \let+ = \ptexplus
   1.990 +  }
   1.991 +}
   1.992 +
   1.993 +% @bullet and @minus need the same treatment as @math, just above.
   1.994 +\def\bullet{\implicitmath\ptexbullet\implicitmath}
   1.995 +\def\minus{\implicitmath-\implicitmath}
   1.996 +
   1.997 +% @refill is a no-op.
   1.998 +\let\refill=\relax
   1.999 +
  1.1000 +% If working on a large document in chapters, it is convenient to
  1.1001 +% be able to disable indexing, cross-referencing, and contents, for test runs.
  1.1002 +% This is done with @novalidate (before @setfilename).
  1.1003 +%
  1.1004 +\newif\iflinks \linkstrue % by default we want the aux files.
  1.1005 +\let\novalidate = \linksfalse
  1.1006 +
  1.1007 +% @setfilename is done at the beginning of every texinfo file.
  1.1008 +% So open here the files we need to have open while reading the input.
  1.1009 +% This makes it possible to make a .fmt file for texinfo.
  1.1010 +\def\setfilename{%
  1.1011 +   \iflinks
  1.1012 +     \readauxfile
  1.1013 +   \fi % \openindices needs to do some work in any case.
  1.1014 +   \openindices
  1.1015 +   \fixbackslash  % Turn off hack to swallow `\input texinfo'.
  1.1016 +   \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
  1.1017 +   %
  1.1018 +   % If texinfo.cnf is present on the system, read it.
  1.1019 +   % Useful for site-wide @afourpaper, etc.
  1.1020 +   % Just to be on the safe side, close the input stream before the \input.
  1.1021 +   \openin 1 texinfo.cnf
  1.1022 +   \ifeof1 \let\temp=\relax \else \def\temp{\input texinfo.cnf }\fi
  1.1023 +   \closein1
  1.1024 +   \temp
  1.1025 +   %
  1.1026 +   \comment % Ignore the actual filename.
  1.1027 +}
  1.1028 +
  1.1029 +% Called from \setfilename.
  1.1030 +%
  1.1031 +\def\openindices{%
  1.1032 +  \newindex{cp}%
  1.1033 +  \newcodeindex{fn}%
  1.1034 +  \newcodeindex{vr}%
  1.1035 +  \newcodeindex{tp}%
  1.1036 +  \newcodeindex{ky}%
  1.1037 +  \newcodeindex{pg}%
  1.1038 +}
  1.1039 +
  1.1040 +% @bye.
  1.1041 +\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
  1.1042 +
  1.1043 +
  1.1044 +\message{pdf,}
  1.1045 +% adobe `portable' document format
  1.1046 +\newcount\tempnum
  1.1047 +\newcount\lnkcount
  1.1048 +\newtoks\filename
  1.1049 +\newcount\filenamelength
  1.1050 +\newcount\pgn
  1.1051 +\newtoks\toksA
  1.1052 +\newtoks\toksB
  1.1053 +\newtoks\toksC
  1.1054 +\newtoks\toksD
  1.1055 +\newbox\boxA
  1.1056 +\newcount\countA
  1.1057 +\newif\ifpdf
  1.1058 +\newif\ifpdfmakepagedest
  1.1059 +
  1.1060 +\ifx\pdfoutput\undefined
  1.1061 +  \pdffalse
  1.1062 +  \let\pdfmkdest = \gobble
  1.1063 +  \let\pdfurl = \gobble
  1.1064 +  \let\endlink = \relax
  1.1065 +  \let\linkcolor = \relax
  1.1066 +  \let\pdfmakeoutlines = \relax
  1.1067 +\else
  1.1068 +  \pdftrue
  1.1069 +  \pdfoutput = 1
  1.1070 +  \input pdfcolor
  1.1071 +  \def\dopdfimage#1#2#3{%
  1.1072 +    \def\imagewidth{#2}%
  1.1073 +    \def\imageheight{#3}%
  1.1074 +    % without \immediate, pdftex seg faults when the same image is
  1.1075 +    % included twice.  (Version 3.14159-pre-1.0-unofficial-20010704.)
  1.1076 +    \ifnum\pdftexversion < 14
  1.1077 +      \immediate\pdfimage
  1.1078 +    \else
  1.1079 +      \immediate\pdfximage
  1.1080 +    \fi
  1.1081 +      \ifx\empty\imagewidth\else width \imagewidth \fi
  1.1082 +      \ifx\empty\imageheight\else height \imageheight \fi
  1.1083 +      \ifnum\pdftexversion<13
  1.1084 +         #1.pdf%
  1.1085 +       \else
  1.1086 +         {#1.pdf}%
  1.1087 +       \fi
  1.1088 +    \ifnum\pdftexversion < 14 \else
  1.1089 +      \pdfrefximage \pdflastximage
  1.1090 +    \fi}
  1.1091 +  \def\pdfmkdest#1{{\normalturnoffactive \pdfdest name{#1} xyz}}
  1.1092 +  \def\pdfmkpgn#1{#1}
  1.1093 +  \let\linkcolor = \Blue  % was Cyan, but that seems light?
  1.1094 +  \def\endlink{\Black\pdfendlink}
  1.1095 +  % Adding outlines to PDF; macros for calculating structure of outlines
  1.1096 +  % come from Petr Olsak
  1.1097 +  \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
  1.1098 +    \else \csname#1\endcsname \fi}
  1.1099 +  \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
  1.1100 +    \advance\tempnum by1
  1.1101 +    \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
  1.1102 +  \def\pdfmakeoutlines{{%
  1.1103 +    \openin 1 \jobname.toc
  1.1104 +    \ifeof 1\else\begingroup
  1.1105 +      \closein 1
  1.1106 +      % Thanh's hack / proper braces in bookmarks
  1.1107 +      \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace
  1.1108 +      \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace
  1.1109 +      %
  1.1110 +      \def\chapentry ##1##2##3{}
  1.1111 +      \def\secentry ##1##2##3##4{\advancenumber{chap##2}}
  1.1112 +      \def\subsecentry ##1##2##3##4##5{\advancenumber{sec##2.##3}}
  1.1113 +      \def\subsubsecentry ##1##2##3##4##5##6{\advancenumber{subsec##2.##3.##4}}
  1.1114 +      \let\appendixentry = \chapentry
  1.1115 +      \let\unnumbchapentry = \chapentry
  1.1116 +      \let\unnumbsecentry = \secentry
  1.1117 +      \let\unnumbsubsecentry = \subsecentry
  1.1118 +      \let\unnumbsubsubsecentry = \subsubsecentry
  1.1119 +      \input \jobname.toc
  1.1120 +      \def\chapentry ##1##2##3{%
  1.1121 +        \pdfoutline goto name{\pdfmkpgn{##3}}count-\expnumber{chap##2}{##1}}
  1.1122 +      \def\secentry ##1##2##3##4{%
  1.1123 +        \pdfoutline goto name{\pdfmkpgn{##4}}count-\expnumber{sec##2.##3}{##1}}
  1.1124 +      \def\subsecentry ##1##2##3##4##5{%
  1.1125 +        \pdfoutline goto name{\pdfmkpgn{##5}}count-\expnumber{subsec##2.##3.##4}{##1}}
  1.1126 +      \def\subsubsecentry ##1##2##3##4##5##6{%
  1.1127 +        \pdfoutline goto name{\pdfmkpgn{##6}}{##1}}
  1.1128 +      \let\appendixentry = \chapentry
  1.1129 +      \let\unnumbchapentry = \chapentry
  1.1130 +      \let\unnumbsecentry = \secentry
  1.1131 +      \let\unnumbsubsecentry = \subsecentry
  1.1132 +      \let\unnumbsubsubsecentry = \subsubsecentry
  1.1133 +      %
  1.1134 +      % Make special characters normal for writing to the pdf file.
  1.1135 +      %
  1.1136 +      \indexnofonts
  1.1137 +      \let\tt=\relax
  1.1138 +      \turnoffactive
  1.1139 +      \input \jobname.toc
  1.1140 +    \endgroup\fi
  1.1141 +  }}
  1.1142 +  \def\makelinks #1,{%
  1.1143 +    \def\params{#1}\def\E{END}%
  1.1144 +    \ifx\params\E
  1.1145 +      \let\nextmakelinks=\relax
  1.1146 +    \else
  1.1147 +      \let\nextmakelinks=\makelinks
  1.1148 +      \ifnum\lnkcount>0,\fi
  1.1149 +      \picknum{#1}%
  1.1150 +      \startlink attr{/Border [0 0 0]}
  1.1151 +        goto name{\pdfmkpgn{\the\pgn}}%
  1.1152 +      \linkcolor #1%
  1.1153 +      \advance\lnkcount by 1%
  1.1154 +      \endlink
  1.1155 +    \fi
  1.1156 +    \nextmakelinks
  1.1157 +  }
  1.1158 +  \def\picknum#1{\expandafter\pn#1}
  1.1159 +  \def\pn#1{%
  1.1160 +    \def\p{#1}%
  1.1161 +    \ifx\p\lbrace
  1.1162 +      \let\nextpn=\ppn
  1.1163 +    \else
  1.1164 +      \let\nextpn=\ppnn
  1.1165 +      \def\first{#1}
  1.1166 +    \fi
  1.1167 +    \nextpn
  1.1168 +  }
  1.1169 +  \def\ppn#1{\pgn=#1\gobble}
  1.1170 +  \def\ppnn{\pgn=\first}
  1.1171 +  \def\pdfmklnk#1{\lnkcount=0\makelinks #1,END,}
  1.1172 +  \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
  1.1173 +  \def\skipspaces#1{\def\PP{#1}\def\D{|}%
  1.1174 +    \ifx\PP\D\let\nextsp\relax
  1.1175 +    \else\let\nextsp\skipspaces
  1.1176 +      \ifx\p\space\else\addtokens{\filename}{\PP}%
  1.1177 +        \advance\filenamelength by 1
  1.1178 +      \fi
  1.1179 +    \fi
  1.1180 +    \nextsp}
  1.1181 +  \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax}
  1.1182 +  \ifnum\pdftexversion < 14
  1.1183 +    \let \startlink \pdfannotlink
  1.1184 +  \else
  1.1185 +    \let \startlink \pdfstartlink
  1.1186 +  \fi
  1.1187 +  \def\pdfurl#1{%
  1.1188 +    \begingroup
  1.1189 +      \normalturnoffactive\def\@{@}%
  1.1190 +      \let\value=\expandablevalue
  1.1191 +      \leavevmode\Red
  1.1192 +      \startlink attr{/Border [0 0 0]}%
  1.1193 +        user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
  1.1194 +        % #1
  1.1195 +    \endgroup}
  1.1196 +  \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
  1.1197 +  \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
  1.1198 +  \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
  1.1199 +  \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
  1.1200 +  \def\maketoks{%
  1.1201 +    \expandafter\poptoks\the\toksA|ENDTOKS|
  1.1202 +    \ifx\first0\adn0
  1.1203 +    \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
  1.1204 +    \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
  1.1205 +    \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
  1.1206 +    \else
  1.1207 +      \ifnum0=\countA\else\makelink\fi
  1.1208 +      \ifx\first.\let\next=\done\else
  1.1209 +        \let\next=\maketoks
  1.1210 +        \addtokens{\toksB}{\the\toksD}
  1.1211 +        \ifx\first,\addtokens{\toksB}{\space}\fi
  1.1212 +      \fi
  1.1213 +    \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
  1.1214 +    \next}
  1.1215 +  \def\makelink{\addtokens{\toksB}%
  1.1216 +    {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
  1.1217 +  \def\pdflink#1{%
  1.1218 +    \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
  1.1219 +    \linkcolor #1\endlink}
  1.1220 +  \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
  1.1221 +\fi % \ifx\pdfoutput
  1.1222 +
  1.1223 +
  1.1224 +\message{fonts,}
  1.1225 +% Font-change commands.
  1.1226 +
  1.1227 +% Texinfo sort of supports the sans serif font style, which plain TeX does not.
  1.1228 +% So we set up a \sf analogous to plain's \rm, etc.
  1.1229 +\newfam\sffam
  1.1230 +\def\sf{\fam=\sffam \tensf}
  1.1231 +\let\li = \sf % Sometimes we call it \li, not \sf.
  1.1232 +
  1.1233 +% We don't need math for this one.
  1.1234 +\def\ttsl{\tenttsl}
  1.1235 +
  1.1236 +% Default leading.
  1.1237 +\newdimen\textleading  \textleading = 13.2pt
  1.1238 +
  1.1239 +% Set the baselineskip to #1, and the lineskip and strut size
  1.1240 +% correspondingly.  There is no deep meaning behind these magic numbers
  1.1241 +% used as factors; they just match (closely enough) what Knuth defined.
  1.1242 +%
  1.1243 +\def\lineskipfactor{.08333}
  1.1244 +\def\strutheightpercent{.70833}
  1.1245 +\def\strutdepthpercent {.29167}
  1.1246 +%
  1.1247 +\def\setleading#1{%
  1.1248 +  \normalbaselineskip = #1\relax
  1.1249 +  \normallineskip = \lineskipfactor\normalbaselineskip
  1.1250 +  \normalbaselines
  1.1251 +  \setbox\strutbox =\hbox{%
  1.1252 +    \vrule width0pt height\strutheightpercent\baselineskip
  1.1253 +                    depth \strutdepthpercent \baselineskip
  1.1254 +  }%
  1.1255 +}
  1.1256 +
  1.1257 +% Set the font macro #1 to the font named #2, adding on the
  1.1258 +% specified font prefix (normally `cm').
  1.1259 +% #3 is the font's design size, #4 is a scale factor
  1.1260 +\def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4}
  1.1261 +
  1.1262 +% Use cm as the default font prefix.
  1.1263 +% To specify the font prefix, you must define \fontprefix
  1.1264 +% before you read in texinfo.tex.
  1.1265 +\ifx\fontprefix\undefined
  1.1266 +\def\fontprefix{cm}
  1.1267 +\fi
  1.1268 +% Support font families that don't use the same naming scheme as CM.
  1.1269 +\def\rmshape{r}
  1.1270 +\def\rmbshape{bx}               %where the normal face is bold
  1.1271 +\def\bfshape{b}
  1.1272 +\def\bxshape{bx}
  1.1273 +\def\ttshape{tt}
  1.1274 +\def\ttbshape{tt}
  1.1275 +\def\ttslshape{sltt}
  1.1276 +\def\itshape{ti}
  1.1277 +\def\itbshape{bxti}
  1.1278 +\def\slshape{sl}
  1.1279 +\def\slbshape{bxsl}
  1.1280 +\def\sfshape{ss}
  1.1281 +\def\sfbshape{ss}
  1.1282 +\def\scshape{csc}
  1.1283 +\def\scbshape{csc}
  1.1284 +
  1.1285 +\newcount\mainmagstep
  1.1286 +\ifx\bigger\relax
  1.1287 +  % not really supported.
  1.1288 +  \mainmagstep=\magstep1
  1.1289 +  \setfont\textrm\rmshape{12}{1000}
  1.1290 +  \setfont\texttt\ttshape{12}{1000}
  1.1291 +\else
  1.1292 +  \mainmagstep=\magstephalf
  1.1293 +  \setfont\textrm\rmshape{10}{\mainmagstep}
  1.1294 +  \setfont\texttt\ttshape{10}{\mainmagstep}
  1.1295 +\fi
  1.1296 +% Instead of cmb10, you may want to use cmbx10.
  1.1297 +% cmbx10 is a prettier font on its own, but cmb10
  1.1298 +% looks better when embedded in a line with cmr10
  1.1299 +% (in Bob's opinion).
  1.1300 +\setfont\textbf\bfshape{10}{\mainmagstep}
  1.1301 +\setfont\textit\itshape{10}{\mainmagstep}
  1.1302 +\setfont\textsl\slshape{10}{\mainmagstep}
  1.1303 +\setfont\textsf\sfshape{10}{\mainmagstep}
  1.1304 +\setfont\textsc\scshape{10}{\mainmagstep}
  1.1305 +\setfont\textttsl\ttslshape{10}{\mainmagstep}
  1.1306 +\font\texti=cmmi10 scaled \mainmagstep
  1.1307 +\font\textsy=cmsy10 scaled \mainmagstep
  1.1308 +
  1.1309 +% A few fonts for @defun, etc.
  1.1310 +\setfont\defbf\bxshape{10}{\magstep1} %was 1314
  1.1311 +\setfont\deftt\ttshape{10}{\magstep1}
  1.1312 +\def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf}
  1.1313 +
  1.1314 +% Fonts for indices, footnotes, small examples (9pt).
  1.1315 +\setfont\smallrm\rmshape{9}{1000}
  1.1316 +\setfont\smalltt\ttshape{9}{1000}
  1.1317 +\setfont\smallbf\bfshape{10}{900}
  1.1318 +\setfont\smallit\itshape{9}{1000}
  1.1319 +\setfont\smallsl\slshape{9}{1000}
  1.1320 +\setfont\smallsf\sfshape{9}{1000}
  1.1321 +\setfont\smallsc\scshape{10}{900}
  1.1322 +\setfont\smallttsl\ttslshape{10}{900}
  1.1323 +\font\smalli=cmmi9
  1.1324 +\font\smallsy=cmsy9
  1.1325 +
  1.1326 +% Fonts for small examples (8pt).
  1.1327 +\setfont\smallerrm\rmshape{8}{1000}
  1.1328 +\setfont\smallertt\ttshape{8}{1000}
  1.1329 +\setfont\smallerbf\bfshape{10}{800}
  1.1330 +\setfont\smallerit\itshape{8}{1000}
  1.1331 +\setfont\smallersl\slshape{8}{1000}
  1.1332 +\setfont\smallersf\sfshape{8}{1000}
  1.1333 +\setfont\smallersc\scshape{10}{800}
  1.1334 +\setfont\smallerttsl\ttslshape{10}{800}
  1.1335 +\font\smalleri=cmmi8
  1.1336 +\font\smallersy=cmsy8
  1.1337 +
  1.1338 +% Fonts for title page:
  1.1339 +\setfont\titlerm\rmbshape{12}{\magstep3}
  1.1340 +\setfont\titleit\itbshape{10}{\magstep4}
  1.1341 +\setfont\titlesl\slbshape{10}{\magstep4}
  1.1342 +\setfont\titlett\ttbshape{12}{\magstep3}
  1.1343 +\setfont\titlettsl\ttslshape{10}{\magstep4}
  1.1344 +\setfont\titlesf\sfbshape{17}{\magstep1}
  1.1345 +\let\titlebf=\titlerm
  1.1346 +\setfont\titlesc\scbshape{10}{\magstep4}
  1.1347 +\font\titlei=cmmi12 scaled \magstep3
  1.1348 +\font\titlesy=cmsy10 scaled \magstep4
  1.1349 +\def\authorrm{\secrm}
  1.1350 +\def\authortt{\sectt}
  1.1351 +
  1.1352 +% Chapter (and unnumbered) fonts (17.28pt).
  1.1353 +\setfont\chaprm\rmbshape{12}{\magstep2}
  1.1354 +\setfont\chapit\itbshape{10}{\magstep3}
  1.1355 +\setfont\chapsl\slbshape{10}{\magstep3}
  1.1356 +\setfont\chaptt\ttbshape{12}{\magstep2}
  1.1357 +\setfont\chapttsl\ttslshape{10}{\magstep3}
  1.1358 +\setfont\chapsf\sfbshape{17}{1000}
  1.1359 +\let\chapbf=\chaprm
  1.1360 +\setfont\chapsc\scbshape{10}{\magstep3}
  1.1361 +\font\chapi=cmmi12 scaled \magstep2
  1.1362 +\font\chapsy=cmsy10 scaled \magstep3
  1.1363 +
  1.1364 +% Section fonts (14.4pt).
  1.1365 +\setfont\secrm\rmbshape{12}{\magstep1}
  1.1366 +\setfont\secit\itbshape{10}{\magstep2}
  1.1367 +\setfont\secsl\slbshape{10}{\magstep2}
  1.1368 +\setfont\sectt\ttbshape{12}{\magstep1}
  1.1369 +\setfont\secttsl\ttslshape{10}{\magstep2}
  1.1370 +\setfont\secsf\sfbshape{12}{\magstep1}
  1.1371 +\let\secbf\secrm
  1.1372 +\setfont\secsc\scbshape{10}{\magstep2}
  1.1373 +\font\seci=cmmi12 scaled \magstep1
  1.1374 +\font\secsy=cmsy10 scaled \magstep2
  1.1375 +
  1.1376 +% Subsection fonts (13.15pt).
  1.1377 +\setfont\ssecrm\rmbshape{12}{\magstephalf}
  1.1378 +\setfont\ssecit\itbshape{10}{1315}
  1.1379 +\setfont\ssecsl\slbshape{10}{1315}
  1.1380 +\setfont\ssectt\ttbshape{12}{\magstephalf}
  1.1381 +\setfont\ssecttsl\ttslshape{10}{1315}
  1.1382 +\setfont\ssecsf\sfbshape{12}{\magstephalf}
  1.1383 +\let\ssecbf\ssecrm
  1.1384 +\setfont\ssecsc\scbshape{10}{\magstep1}
  1.1385 +\font\sseci=cmmi12 scaled \magstephalf
  1.1386 +\font\ssecsy=cmsy10 scaled 1315
  1.1387 +% The smallcaps and symbol fonts should actually be scaled \magstep1.5,
  1.1388 +% but that is not a standard magnification.
  1.1389 +
  1.1390 +% In order for the font changes to affect most math symbols and letters,
  1.1391 +% we have to define the \textfont of the standard families.  Since
  1.1392 +% texinfo doesn't allow for producing subscripts and superscripts except
  1.1393 +% in the main text, we don't bother to reset \scriptfont and
  1.1394 +% \scriptscriptfont (which would also require loading a lot more fonts).
  1.1395 +%
  1.1396 +\def\resetmathfonts{%
  1.1397 +  \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy
  1.1398 +  \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf
  1.1399 +  \textfont\ttfam=\tentt \textfont\sffam=\tensf
  1.1400 +}
  1.1401 +
  1.1402 +% The font-changing commands redefine the meanings of \tenSTYLE, instead
  1.1403 +% of just \STYLE.  We do this so that font changes will continue to work
  1.1404 +% in math mode, where it is the current \fam that is relevant in most
  1.1405 +% cases, not the current font.  Plain TeX does \def\bf{\fam=\bffam
  1.1406 +% \tenbf}, for example.  By redefining \tenbf, we obviate the need to
  1.1407 +% redefine \bf itself.
  1.1408 +\def\textfonts{%
  1.1409 +  \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
  1.1410 +  \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
  1.1411 +  \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl
  1.1412 +  \resetmathfonts \setleading{\textleading}}
  1.1413 +\def\titlefonts{%
  1.1414 +  \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl
  1.1415 +  \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc
  1.1416 +  \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
  1.1417 +  \let\tenttsl=\titlettsl
  1.1418 +  \resetmathfonts \setleading{25pt}}
  1.1419 +\def\titlefont#1{{\titlefonts\rm #1}}
  1.1420 +\def\chapfonts{%
  1.1421 +  \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
  1.1422 +  \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
  1.1423 +  \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl
  1.1424 +  \resetmathfonts \setleading{19pt}}
  1.1425 +\def\secfonts{%
  1.1426 +  \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
  1.1427 +  \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
  1.1428 +  \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl
  1.1429 +  \resetmathfonts \setleading{16pt}}
  1.1430 +\def\subsecfonts{%
  1.1431 +  \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
  1.1432 +  \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
  1.1433 +  \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl
  1.1434 +  \resetmathfonts \setleading{15pt}}
  1.1435 +\let\subsubsecfonts = \subsecfonts % Maybe make sssec fonts scaled magstephalf?
  1.1436 +\def\smallfonts{%
  1.1437 +  \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl
  1.1438 +  \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc
  1.1439 +  \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy
  1.1440 +  \let\tenttsl=\smallttsl
  1.1441 +  \resetmathfonts \setleading{10.5pt}}
  1.1442 +\def\smallerfonts{%
  1.1443 +  \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl
  1.1444 +  \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc
  1.1445 +  \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy
  1.1446 +  \let\tenttsl=\smallerttsl
  1.1447 +  \resetmathfonts \setleading{9.5pt}}
  1.1448 +
  1.1449 +% Set the fonts to use with the @small... environments.
  1.1450 +\let\smallexamplefonts = \smallfonts
  1.1451 +
  1.1452 +% About \smallexamplefonts.  If we use \smallfonts (9pt), @smallexample
  1.1453 +% can fit this many characters:
  1.1454 +%   8.5x11=86   smallbook=72  a4=90  a5=69
  1.1455 +% If we use \smallerfonts (8pt), then we can fit this many characters:
  1.1456 +%   8.5x11=90+  smallbook=80  a4=90+  a5=77
  1.1457 +% For me, subjectively, the few extra characters that fit aren't worth
  1.1458 +% the additional smallness of 8pt.  So I'm making the default 9pt.
  1.1459 +%
  1.1460 +% By the way, for comparison, here's what fits with @example (10pt):
  1.1461 +%   8.5x11=71  smallbook=60  a4=75  a5=58
  1.1462 +%
  1.1463 +% I wish we used A4 paper on this side of the Atlantic.
  1.1464 +%
  1.1465 +% --karl, 24jan03.
  1.1466 +
  1.1467 +
  1.1468 +% Set up the default fonts, so we can use them for creating boxes.
  1.1469 +%
  1.1470 +\textfonts
  1.1471 +
  1.1472 +% Define these so they can be easily changed for other fonts.
  1.1473 +\def\angleleft{$\langle$}
  1.1474 +\def\angleright{$\rangle$}
  1.1475 +
  1.1476 +% Count depth in font-changes, for error checks
  1.1477 +\newcount\fontdepth \fontdepth=0
  1.1478 +
  1.1479 +% Fonts for short table of contents.
  1.1480 +\setfont\shortcontrm\rmshape{12}{1000}
  1.1481 +\setfont\shortcontbf\bxshape{12}{1000}
  1.1482 +\setfont\shortcontsl\slshape{12}{1000}
  1.1483 +\setfont\shortconttt\ttshape{12}{1000}
  1.1484 +
  1.1485 +%% Add scribe-like font environments, plus @l for inline lisp (usually sans
  1.1486 +%% serif) and @ii for TeX italic
  1.1487 +
  1.1488 +% \smartitalic{ARG} outputs arg in italics, followed by an italic correction
  1.1489 +% unless the following character is such as not to need one.
  1.1490 +\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else
  1.1491 +                    \ptexslash\fi\fi\fi}
  1.1492 +\def\smartslanted#1{{\ifusingtt\ttsl\sl #1}\futurelet\next\smartitalicx}
  1.1493 +\def\smartitalic#1{{\ifusingtt\ttsl\it #1}\futurelet\next\smartitalicx}
  1.1494 +
  1.1495 +\let\i=\smartitalic
  1.1496 +\let\var=\smartslanted
  1.1497 +\let\dfn=\smartslanted
  1.1498 +\let\emph=\smartitalic
  1.1499 +\let\cite=\smartslanted
  1.1500 +
  1.1501 +\def\b#1{{\bf #1}}
  1.1502 +\let\strong=\b
  1.1503 +
  1.1504 +% We can't just use \exhyphenpenalty, because that only has effect at
  1.1505 +% the end of a paragraph.  Restore normal hyphenation at the end of the
  1.1506 +% group within which \nohyphenation is presumably called.
  1.1507 +%
  1.1508 +\def\nohyphenation{\hyphenchar\font = -1  \aftergroup\restorehyphenation}
  1.1509 +\def\restorehyphenation{\hyphenchar\font = `- }
  1.1510 +
  1.1511 +% Set sfcode to normal for the chars that usually have another value.
  1.1512 +% Can't use plain's \frenchspacing because it uses the `\x notation, and
  1.1513 +% sometimes \x has an active definition that messes things up.
  1.1514 +%
  1.1515 +\catcode`@=11
  1.1516 +  \def\frenchspacing{%
  1.1517 +    \sfcode\dotChar  =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m
  1.1518 +    \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m
  1.1519 +  }
  1.1520 +\catcode`@=\other
  1.1521 +
  1.1522 +\def\t#1{%
  1.1523 +  {\tt \rawbackslash \frenchspacing #1}%
  1.1524 +  \null
  1.1525 +}
  1.1526 +\let\ttfont=\t
  1.1527 +\def\samp#1{`\tclose{#1}'\null}
  1.1528 +\setfont\keyrm\rmshape{8}{1000}
  1.1529 +\font\keysy=cmsy9
  1.1530 +\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
  1.1531 +  \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
  1.1532 +    \vbox{\hrule\kern-0.4pt
  1.1533 +     \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
  1.1534 +    \kern-0.4pt\hrule}%
  1.1535 +  \kern-.06em\raise0.4pt\hbox{\angleright}}}}
  1.1536 +% The old definition, with no lozenge:
  1.1537 +%\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null}
  1.1538 +\def\ctrl #1{{\tt \rawbackslash \hat}#1}
  1.1539 +
  1.1540 +% @file, @option are the same as @samp.
  1.1541 +\let\file=\samp
  1.1542 +\let\option=\samp
  1.1543 +
  1.1544 +% @code is a modification of @t,
  1.1545 +% which makes spaces the same size as normal in the surrounding text.
  1.1546 +\def\tclose#1{%
  1.1547 +  {%
  1.1548 +    % Change normal interword space to be same as for the current font.
  1.1549 +    \spaceskip = \fontdimen2\font
  1.1550 +    %
  1.1551 +    % Switch to typewriter.
  1.1552 +    \tt
  1.1553 +    %
  1.1554 +    % But `\ ' produces the large typewriter interword space.
  1.1555 +    \def\ {{\spaceskip = 0pt{} }}%
  1.1556 +    %
  1.1557 +    % Turn off hyphenation.
  1.1558 +    \nohyphenation
  1.1559 +    %
  1.1560 +    \rawbackslash
  1.1561 +    \frenchspacing
  1.1562 +    #1%
  1.1563 +  }%
  1.1564 +  \null
  1.1565 +}
  1.1566 +
  1.1567 +% We *must* turn on hyphenation at `-' and `_' in \code.
  1.1568 +% Otherwise, it is too hard to avoid overfull hboxes
  1.1569 +% in the Emacs manual, the Library manual, etc.
  1.1570 +
  1.1571 +% Unfortunately, TeX uses one parameter (\hyphenchar) to control
  1.1572 +% both hyphenation at - and hyphenation within words.
  1.1573 +% We must therefore turn them both off (\tclose does that)
  1.1574 +% and arrange explicitly to hyphenate at a dash.
  1.1575 +%  -- rms.
  1.1576 +{
  1.1577 +  \catcode`\-=\active
  1.1578 +  \catcode`\_=\active
  1.1579 +  %
  1.1580 +  \global\def\code{\begingroup
  1.1581 +    \catcode`\-=\active \let-\codedash
  1.1582 +    \catcode`\_=\active \let_\codeunder
  1.1583 +    \codex
  1.1584 +  }
  1.1585 +  %
  1.1586 +  % If we end up with any active - characters when handling the index,
  1.1587 +  % just treat them as a normal -.
  1.1588 +  \global\def\indexbreaks{\catcode`\-=\active \let-\realdash}
  1.1589 +}
  1.1590 +
  1.1591 +\def\realdash{-}
  1.1592 +\def\codedash{-\discretionary{}{}{}}
  1.1593 +\def\codeunder{%
  1.1594 +  % this is all so @math{@code{var_name}+1} can work.  In math mode, _
  1.1595 +  % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
  1.1596 +  % will therefore expand the active definition of _, which is us
  1.1597 +  % (inside @code that is), therefore an endless loop.
  1.1598 +  \ifusingtt{\ifmmode
  1.1599 +               \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_.
  1.1600 +             \else\normalunderscore \fi
  1.1601 +             \discretionary{}{}{}}%
  1.1602 +            {\_}%
  1.1603 +}
  1.1604 +\def\codex #1{\tclose{#1}\endgroup}
  1.1605 +
  1.1606 +% @kbd is like @code, except that if the argument is just one @key command,
  1.1607 +% then @kbd has no effect.
  1.1608 +
  1.1609 +% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
  1.1610 +%   `example' (@kbd uses ttsl only inside of @example and friends),
  1.1611 +%   or `code' (@kbd uses normal tty font always).
  1.1612 +\def\kbdinputstyle{\parsearg\kbdinputstylexxx}
  1.1613 +\def\kbdinputstylexxx#1{%
  1.1614 +  \def\arg{#1}%
  1.1615 +  \ifx\arg\worddistinct
  1.1616 +    \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
  1.1617 +  \else\ifx\arg\wordexample
  1.1618 +    \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
  1.1619 +  \else\ifx\arg\wordcode
  1.1620 +    \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
  1.1621 +  \else
  1.1622 +    \errhelp = \EMsimple
  1.1623 +    \errmessage{Unknown @kbdinputstyle option `\arg'}%
  1.1624 +  \fi\fi\fi
  1.1625 +}
  1.1626 +\def\worddistinct{distinct}
  1.1627 +\def\wordexample{example}
  1.1628 +\def\wordcode{code}
  1.1629 +
  1.1630 +% Default is `distinct.'
  1.1631 +\kbdinputstyle distinct
  1.1632 +
  1.1633 +\def\xkey{\key}
  1.1634 +\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
  1.1635 +\ifx\one\xkey\ifx\threex\three \key{#2}%
  1.1636 +\else{\tclose{\kbdfont\look}}\fi
  1.1637 +\else{\tclose{\kbdfont\look}}\fi}
  1.1638 +
  1.1639 +% For @url, @env, @command quotes seem unnecessary, so use \code.
  1.1640 +\let\url=\code
  1.1641 +\let\env=\code
  1.1642 +\let\command=\code
  1.1643 +
  1.1644 +% @uref (abbreviation for `urlref') takes an optional (comma-separated)
  1.1645 +% second argument specifying the text to display and an optional third
  1.1646 +% arg as text to display instead of (rather than in addition to) the url
  1.1647 +% itself.  First (mandatory) arg is the url.  Perhaps eventually put in
  1.1648 +% a hypertex \special here.
  1.1649 +%
  1.1650 +\def\uref#1{\douref #1,,,\finish}
  1.1651 +\def\douref#1,#2,#3,#4\finish{\begingroup
  1.1652 +  \unsepspaces
  1.1653 +  \pdfurl{#1}%
  1.1654 +  \setbox0 = \hbox{\ignorespaces #3}%
  1.1655 +  \ifdim\wd0 > 0pt
  1.1656 +    \unhbox0 % third arg given, show only that
  1.1657 +  \else
  1.1658 +    \setbox0 = \hbox{\ignorespaces #2}%
  1.1659 +    \ifdim\wd0 > 0pt
  1.1660 +      \ifpdf
  1.1661 +        \unhbox0             % PDF: 2nd arg given, show only it
  1.1662 +      \else
  1.1663 +        \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url
  1.1664 +      \fi
  1.1665 +    \else
  1.1666 +      \code{#1}% only url given, so show it
  1.1667 +    \fi
  1.1668 +  \fi
  1.1669 +  \endlink
  1.1670 +\endgroup}
  1.1671 +
  1.1672 +% rms does not like angle brackets --karl, 17may97.
  1.1673 +% So now @email is just like @uref, unless we are pdf.
  1.1674 +%
  1.1675 +%\def\email#1{\angleleft{\tt #1}\angleright}
  1.1676 +\ifpdf
  1.1677 +  \def\email#1{\doemail#1,,\finish}
  1.1678 +  \def\doemail#1,#2,#3\finish{\begingroup
  1.1679 +    \unsepspaces
  1.1680 +    \pdfurl{mailto:#1}%
  1.1681 +    \setbox0 = \hbox{\ignorespaces #2}%
  1.1682 +    \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
  1.1683 +    \endlink
  1.1684 +  \endgroup}
  1.1685 +\else
  1.1686 +  \let\email=\uref
  1.1687 +\fi
  1.1688 +
  1.1689 +% Check if we are currently using a typewriter font.  Since all the
  1.1690 +% Computer Modern typewriter fonts have zero interword stretch (and
  1.1691 +% shrink), and it is reasonable to expect all typewriter fonts to have
  1.1692 +% this property, we can check that font parameter.
  1.1693 +%
  1.1694 +\def\ifmonospace{\ifdim\fontdimen3\font=0pt }
  1.1695 +
  1.1696 +% Typeset a dimension, e.g., `in' or `pt'.  The only reason for the
  1.1697 +% argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
  1.1698 +%
  1.1699 +\def\dmn#1{\thinspace #1}
  1.1700 +
  1.1701 +\def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par}
  1.1702 +
  1.1703 +% @l was never documented to mean ``switch to the Lisp font'',
  1.1704 +% and it is not used as such in any manual I can find.  We need it for
  1.1705 +% Polish suppressed-l.  --karl, 22sep96.
  1.1706 +%\def\l#1{{\li #1}\null}
  1.1707 +
  1.1708 +% Explicit font changes: @r, @sc, undocumented @ii.
  1.1709 +\def\r#1{{\rm #1}}              % roman font
  1.1710 +\def\sc#1{{\smallcaps#1}}       % smallcaps font
  1.1711 +\def\ii#1{{\it #1}}             % italic font
  1.1712 +
  1.1713 +% @acronym downcases the argument and prints in smallcaps.
  1.1714 +\def\acronym#1{{\smallcaps \lowercase{#1}}}
  1.1715 +
  1.1716 +% @pounds{} is a sterling sign.
  1.1717 +\def\pounds{{\it\$}}
  1.1718 +
  1.1719 +% @registeredsymbol - R in a circle.  For now, only works in text size;
  1.1720 +% we'd have to redo the font mechanism to change the \scriptstyle and
  1.1721 +% \scriptscriptstyle font sizes to make it look right in headings.
  1.1722 +% Adapted from the plain.tex definition of \copyright.
  1.1723 +%
  1.1724 +\def\registeredsymbol{%
  1.1725 +  $^{{\ooalign{\hfil\raise.07ex\hbox{$\scriptstyle\rm R$}\hfil\crcr\Orb}}%
  1.1726 +    }$%
  1.1727 +}
  1.1728 +
  1.1729 +
  1.1730 +\message{page headings,}
  1.1731 +
  1.1732 +\newskip\titlepagetopglue \titlepagetopglue = 1.5in
  1.1733 +\newskip\titlepagebottomglue \titlepagebottomglue = 2pc
  1.1734 +
  1.1735 +% First the title page.  Must do @settitle before @titlepage.
  1.1736 +\newif\ifseenauthor
  1.1737 +\newif\iffinishedtitlepage
  1.1738 +
  1.1739 +% Do an implicit @contents or @shortcontents after @end titlepage if the
  1.1740 +% user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage.
  1.1741 +%
  1.1742 +\newif\ifsetcontentsaftertitlepage
  1.1743 + \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue
  1.1744 +\newif\ifsetshortcontentsaftertitlepage
  1.1745 + \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue
  1.1746 +
  1.1747 +\def\shorttitlepage{\parsearg\shorttitlepagezzz}
  1.1748 +\def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}%
  1.1749 +        \endgroup\page\hbox{}\page}
  1.1750 +
  1.1751 +\def\titlepage{\begingroup \parindent=0pt \textfonts
  1.1752 +   \let\subtitlerm=\tenrm
  1.1753 +   \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
  1.1754 +   %
  1.1755 +   \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines
  1.1756 +                   \let\tt=\authortt}%
  1.1757 +   %
  1.1758 +   % Leave some space at the very top of the page.
  1.1759 +   \vglue\titlepagetopglue
  1.1760 +   %
  1.1761 +   % Now you can print the title using @title.
  1.1762 +   \def\title{\parsearg\titlezzz}%
  1.1763 +   \def\titlezzz##1{\leftline{\titlefonts\rm ##1}
  1.1764 +                    % print a rule at the page bottom also.
  1.1765 +                    \finishedtitlepagefalse
  1.1766 +                    \vskip4pt \hrule height 4pt width \hsize \vskip4pt}%
  1.1767 +   % No rule at page bottom unless we print one at the top with @title.
  1.1768 +   \finishedtitlepagetrue
  1.1769 +   %
  1.1770 +   % Now you can put text using @subtitle.
  1.1771 +   \def\subtitle{\parsearg\subtitlezzz}%
  1.1772 +   \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}%
  1.1773 +   %
  1.1774 +   % @author should come last, but may come many times.
  1.1775 +   \def\author{\parsearg\authorzzz}%
  1.1776 +   \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
  1.1777 +      {\authorfont \leftline{##1}}}%
  1.1778 +   %
  1.1779 +   % Most title ``pages'' are actually two pages long, with space
  1.1780 +   % at the top of the second.  We don't want the ragged left on the second.
  1.1781 +   \let\oldpage = \page
  1.1782 +   \def\page{%
  1.1783 +      \iffinishedtitlepage\else
  1.1784 +         \finishtitlepage
  1.1785 +      \fi
  1.1786 +      \oldpage
  1.1787 +      \let\page = \oldpage
  1.1788 +      \hbox{}}%
  1.1789 +%   \def\page{\oldpage \hbox{}}
  1.1790 +}
  1.1791 +
  1.1792 +\def\Etitlepage{%
  1.1793 +   \iffinishedtitlepage\else
  1.1794 +      \finishtitlepage
  1.1795 +   \fi
  1.1796 +   % It is important to do the page break before ending the group,
  1.1797 +   % because the headline and footline are only empty inside the group.
  1.1798 +   % If we use the new definition of \page, we always get a blank page
  1.1799 +   % after the title page, which we certainly don't want.
  1.1800 +   \oldpage
  1.1801 +   \endgroup
  1.1802 +   %
  1.1803 +   % Need this before the \...aftertitlepage checks so that if they are
  1.1804 +   % in effect the toc pages will come out with page numbers.
  1.1805 +   \HEADINGSon
  1.1806 +   %
  1.1807 +   % If they want short, they certainly want long too.
  1.1808 +   \ifsetshortcontentsaftertitlepage
  1.1809 +     \shortcontents
  1.1810 +     \contents
  1.1811 +     \global\let\shortcontents = \relax
  1.1812 +     \global\let\contents = \relax
  1.1813 +   \fi
  1.1814 +   %
  1.1815 +   \ifsetcontentsaftertitlepage
  1.1816 +     \contents
  1.1817 +     \global\let\contents = \relax
  1.1818 +     \global\let\shortcontents = \relax
  1.1819 +   \fi
  1.1820 +}
  1.1821 +
  1.1822 +\def\finishtitlepage{%
  1.1823 +   \vskip4pt \hrule height 2pt width \hsize
  1.1824 +   \vskip\titlepagebottomglue
  1.1825 +   \finishedtitlepagetrue
  1.1826 +}
  1.1827 +
  1.1828 +%%% Set up page headings and footings.
  1.1829 +
  1.1830 +\let\thispage=\folio
  1.1831 +
  1.1832 +\newtoks\evenheadline    % headline on even pages
  1.1833 +\newtoks\oddheadline     % headline on odd pages
  1.1834 +\newtoks\evenfootline    % footline on even pages
  1.1835 +\newtoks\oddfootline     % footline on odd pages
  1.1836 +
  1.1837 +% Now make Tex use those variables
  1.1838 +\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
  1.1839 +                            \else \the\evenheadline \fi}}
  1.1840 +\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
  1.1841 +                            \else \the\evenfootline \fi}\HEADINGShook}
  1.1842 +\let\HEADINGShook=\relax
  1.1843 +
  1.1844 +% Commands to set those variables.
  1.1845 +% For example, this is what  @headings on  does
  1.1846 +% @evenheading @thistitle|@thispage|@thischapter
  1.1847 +% @oddheading @thischapter|@thispage|@thistitle
  1.1848 +% @evenfooting @thisfile||
  1.1849 +% @oddfooting ||@thisfile
  1.1850 +
  1.1851 +\def\evenheading{\parsearg\evenheadingxxx}
  1.1852 +\def\oddheading{\parsearg\oddheadingxxx}
  1.1853 +\def\everyheading{\parsearg\everyheadingxxx}
  1.1854 +
  1.1855 +\def\evenfooting{\parsearg\evenfootingxxx}
  1.1856 +\def\oddfooting{\parsearg\oddfootingxxx}
  1.1857 +\def\everyfooting{\parsearg\everyfootingxxx}
  1.1858 +
  1.1859 +{\catcode`\@=0 %
  1.1860 +
  1.1861 +\gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
  1.1862 +\gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
  1.1863 +\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  1.1864 +
  1.1865 +\gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
  1.1866 +\gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
  1.1867 +\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  1.1868 +
  1.1869 +\gdef\everyheadingxxx#1{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
  1.1870 +
  1.1871 +\gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
  1.1872 +\gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
  1.1873 +\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  1.1874 +
  1.1875 +\gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
  1.1876 +\gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
  1.1877 +  \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
  1.1878 +  %
  1.1879 +  % Leave some space for the footline.  Hopefully ok to assume
  1.1880 +  % @evenfooting will not be used by itself.
  1.1881 +  \global\advance\pageheight by -\baselineskip
  1.1882 +  \global\advance\vsize by -\baselineskip
  1.1883 +}
  1.1884 +
  1.1885 +\gdef\everyfootingxxx#1{\oddfootingxxx{#1}\evenfootingxxx{#1}}
  1.1886 +%
  1.1887 +}% unbind the catcode of @.
  1.1888 +
  1.1889 +% @headings double      turns headings on for double-sided printing.
  1.1890 +% @headings single      turns headings on for single-sided printing.
  1.1891 +% @headings off         turns them off.
  1.1892 +% @headings on          same as @headings double, retained for compatibility.
  1.1893 +% @headings after       turns on double-sided headings after this page.
  1.1894 +% @headings doubleafter turns on double-sided headings after this page.
  1.1895 +% @headings singleafter turns on single-sided headings after this page.
  1.1896 +% By default, they are off at the start of a document,
  1.1897 +% and turned `on' after @end titlepage.
  1.1898 +
  1.1899 +\def\headings #1 {\csname HEADINGS#1\endcsname}
  1.1900 +
  1.1901 +\def\HEADINGSoff{
  1.1902 +\global\evenheadline={\hfil} \global\evenfootline={\hfil}
  1.1903 +\global\oddheadline={\hfil} \global\oddfootline={\hfil}}
  1.1904 +\HEADINGSoff
  1.1905 +% When we turn headings on, set the page number to 1.
  1.1906 +% For double-sided printing, put current file name in lower left corner,
  1.1907 +% chapter name on inside top of right hand pages, document
  1.1908 +% title on inside top of left hand pages, and page numbers on outside top
  1.1909 +% edge of all pages.
  1.1910 +\def\HEADINGSdouble{
  1.1911 +\global\pageno=1
  1.1912 +\global\evenfootline={\hfil}
  1.1913 +\global\oddfootline={\hfil}
  1.1914 +\global\evenheadline={\line{\folio\hfil\thistitle}}
  1.1915 +\global\oddheadline={\line{\thischapter\hfil\folio}}
  1.1916 +\global\let\contentsalignmacro = \chapoddpage
  1.1917 +}
  1.1918 +\let\contentsalignmacro = \chappager
  1.1919 +
  1.1920 +% For single-sided printing, chapter title goes across top left of page,
  1.1921 +% page number on top right.
  1.1922 +\def\HEADINGSsingle{
  1.1923 +\global\pageno=1
  1.1924 +\global\evenfootline={\hfil}
  1.1925 +\global\oddfootline={\hfil}
  1.1926 +\global\evenheadline={\line{\thischapter\hfil\folio}}
  1.1927 +\global\oddheadline={\line{\thischapter\hfil\folio}}
  1.1928 +\global\let\contentsalignmacro = \chappager
  1.1929 +}
  1.1930 +\def\HEADINGSon{\HEADINGSdouble}
  1.1931 +
  1.1932 +\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
  1.1933 +\let\HEADINGSdoubleafter=\HEADINGSafter
  1.1934 +\def\HEADINGSdoublex{%
  1.1935 +\global\evenfootline={\hfil}
  1.1936 +\global\oddfootline={\hfil}
  1.1937 +\global\evenheadline={\line{\folio\hfil\thistitle}}
  1.1938 +\global\oddheadline={\line{\thischapter\hfil\folio}}
  1.1939 +\global\let\contentsalignmacro = \chapoddpage
  1.1940 +}
  1.1941 +
  1.1942 +\def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
  1.1943 +\def\HEADINGSsinglex{%
  1.1944 +\global\evenfootline={\hfil}
  1.1945 +\global\oddfootline={\hfil}
  1.1946 +\global\evenheadline={\line{\thischapter\hfil\folio}}
  1.1947 +\global\oddheadline={\line{\thischapter\hfil\folio}}
  1.1948 +\global\let\contentsalignmacro = \chappager
  1.1949 +}
  1.1950 +
  1.1951 +% Subroutines used in generating headings
  1.1952 +% This produces Day Month Year style of output.
  1.1953 +% Only define if not already defined, in case a txi-??.tex file has set
  1.1954 +% up a different format (e.g., txi-cs.tex does this).
  1.1955 +\ifx\today\undefined
  1.1956 +\def\today{%
  1.1957 +  \number\day\space
  1.1958 +  \ifcase\month
  1.1959 +  \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
  1.1960 +  \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
  1.1961 +  \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
  1.1962 +  \fi
  1.1963 +  \space\number\year}
  1.1964 +\fi
  1.1965 +
  1.1966 +% @settitle line...  specifies the title of the document, for headings.
  1.1967 +% It generates no output of its own.
  1.1968 +\def\thistitle{\putwordNoTitle}
  1.1969 +\def\settitle{\parsearg\settitlezzz}
  1.1970 +\def\settitlezzz #1{\gdef\thistitle{#1}}
  1.1971 +
  1.1972 +
  1.1973 +\message{tables,}
  1.1974 +% Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x).
  1.1975 +
  1.1976 +% default indentation of table text
  1.1977 +\newdimen\tableindent \tableindent=.8in
  1.1978 +% default indentation of @itemize and @enumerate text
  1.1979 +\newdimen\itemindent  \itemindent=.3in
  1.1980 +% margin between end of table item and start of table text.
  1.1981 +\newdimen\itemmargin  \itemmargin=.1in
  1.1982 +
  1.1983 +% used internally for \itemindent minus \itemmargin
  1.1984 +\newdimen\itemmax
  1.1985 +
  1.1986 +% Note @table, @vtable, and @vtable define @item, @itemx, etc., with
  1.1987 +% these defs.
  1.1988 +% They also define \itemindex
  1.1989 +% to index the item name in whatever manner is desired (perhaps none).
  1.1990 +
  1.1991 +\newif\ifitemxneedsnegativevskip
  1.1992 +
  1.1993 +\def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
  1.1994 +
  1.1995 +\def\internalBitem{\smallbreak \parsearg\itemzzz}
  1.1996 +\def\internalBitemx{\itemxpar \parsearg\itemzzz}
  1.1997 +
  1.1998 +\def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
  1.1999 +\def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \itemxpar \parsearg\xitemzzz}
  1.2000 +
  1.2001 +\def\internalBkitem{\smallbreak \parsearg\kitemzzz}
  1.2002 +\def\internalBkitemx{\itemxpar \parsearg\kitemzzz}
  1.2003 +
  1.2004 +\def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}%
  1.2005 +                 \itemzzz {#1}}
  1.2006 +
  1.2007 +\def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}%
  1.2008 +                 \itemzzz {#1}}
  1.2009 +
  1.2010 +\def\itemzzz #1{\begingroup %
  1.2011 +  \advance\hsize by -\rightskip
  1.2012 +  \advance\hsize by -\tableindent
  1.2013 +  \setbox0=\hbox{\itemfont{#1}}%
  1.2014 +  \itemindex{#1}%
  1.2015 +  \nobreak % This prevents a break before @itemx.
  1.2016 +  %
  1.2017 +  % If the item text does not fit in the space we have, put it on a line
  1.2018 +  % by itself, and do not allow a page break either before or after that
  1.2019 +  % line.  We do not start a paragraph here because then if the next
  1.2020 +  % command is, e.g., @kindex, the whatsit would get put into the
  1.2021 +  % horizontal list on a line by itself, resulting in extra blank space.
  1.2022 +  \ifdim \wd0>\itemmax
  1.2023 +    %
  1.2024 +    % Make this a paragraph so we get the \parskip glue and wrapping,
  1.2025 +    % but leave it ragged-right.
  1.2026 +    \begingroup
  1.2027 +      \advance\leftskip by-\tableindent
  1.2028 +      \advance\hsize by\tableindent
  1.2029 +      \advance\rightskip by0pt plus1fil
  1.2030 +      \leavevmode\unhbox0\par
  1.2031 +    \endgroup
  1.2032 +    %
  1.2033 +    % We're going to be starting a paragraph, but we don't want the
  1.2034 +    % \parskip glue -- logically it's part of the @item we just started.
  1.2035 +    \nobreak \vskip-\parskip
  1.2036 +    %
  1.2037 +    % Stop a page break at the \parskip glue coming up.  (Unfortunately
  1.2038 +    % we can't prevent a possible page break at the following
  1.2039 +    % \baselineskip glue.)  However, if what follows is an environment
  1.2040 +    % such as @example, there will be no \parskip glue; then
  1.2041 +    % the negative vskip we just would cause the example and the item to
  1.2042 +    % crash together.  So we use this bizarre value of 10001 as a signal
  1.2043 +    % to \aboveenvbreak to insert \parskip glue after all.
  1.2044 +    % (Possibly there are other commands that could be followed by
  1.2045 +    % @example which need the same treatment, but not section titles; or
  1.2046 +    % maybe section titles are the only special case and they should be
  1.2047 +    % penalty 10001...)
  1.2048 +    \penalty 10001
  1.2049 +    \endgroup
  1.2050 +    \itemxneedsnegativevskipfalse
  1.2051 +  \else
  1.2052 +    % The item text fits into the space.  Start a paragraph, so that the
  1.2053 +    % following text (if any) will end up on the same line.
  1.2054 +    \noindent
  1.2055 +    % Do this with kerns and \unhbox so that if there is a footnote in
  1.2056 +    % the item text, it can migrate to the main vertical list and
  1.2057 +    % eventually be printed.
  1.2058 +    \nobreak\kern-\tableindent
  1.2059 +    \dimen0 = \itemmax  \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
  1.2060 +    \unhbox0
  1.2061 +    \nobreak\kern\dimen0
  1.2062 +    \endgroup
  1.2063 +    \itemxneedsnegativevskiptrue
  1.2064 +  \fi
  1.2065 +}
  1.2066 +
  1.2067 +\def\item{\errmessage{@item while not in a table}}
  1.2068 +\def\itemx{\errmessage{@itemx while not in a table}}
  1.2069 +\def\kitem{\errmessage{@kitem while not in a table}}
  1.2070 +\def\kitemx{\errmessage{@kitemx while not in a table}}
  1.2071 +\def\xitem{\errmessage{@xitem while not in a table}}
  1.2072 +\def\xitemx{\errmessage{@xitemx while not in a table}}
  1.2073 +
  1.2074 +% Contains a kludge to get @end[description] to work.
  1.2075 +\def\description{\tablez{\dontindex}{1}{}{}{}{}}
  1.2076 +
  1.2077 +% @table, @ftable, @vtable.
  1.2078 +\def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
  1.2079 +{\obeylines\obeyspaces%
  1.2080 +\gdef\tablex #1^^M{%
  1.2081 +\tabley\dontindex#1        \endtabley}}
  1.2082 +
  1.2083 +\def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
  1.2084 +{\obeylines\obeyspaces%
  1.2085 +\gdef\ftablex #1^^M{%
  1.2086 +\tabley\fnitemindex#1        \endtabley
  1.2087 +\def\Eftable{\endgraf\afterenvbreak\endgroup}%
  1.2088 +\let\Etable=\relax}}
  1.2089 +
  1.2090 +\def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex}
  1.2091 +{\obeylines\obeyspaces%
  1.2092 +\gdef\vtablex #1^^M{%
  1.2093 +\tabley\vritemindex#1        \endtabley
  1.2094 +\def\Evtable{\endgraf\afterenvbreak\endgroup}%
  1.2095 +\let\Etable=\relax}}
  1.2096 +
  1.2097 +\def\dontindex #1{}
  1.2098 +\def\fnitemindex #1{\doind {fn}{\code{#1}}}%
  1.2099 +\def\vritemindex #1{\doind {vr}{\code{#1}}}%
  1.2100 +
  1.2101 +{\obeyspaces %
  1.2102 +\gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
  1.2103 +\tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
  1.2104 +
  1.2105 +\def\tablez #1#2#3#4#5#6{%
  1.2106 +\aboveenvbreak %
  1.2107 +\begingroup %
  1.2108 +\def\Edescription{\Etable}% Necessary kludge.
  1.2109 +\let\itemindex=#1%
  1.2110 +\ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
  1.2111 +\ifnum 0#4>0 \tableindent=#4\mil \fi %
  1.2112 +\ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
  1.2113 +\def\itemfont{#2}%
  1.2114 +\itemmax=\tableindent %
  1.2115 +\advance \itemmax by -\itemmargin %
  1.2116 +\advance \leftskip by \tableindent %
  1.2117 +\exdentamount=\tableindent
  1.2118 +\parindent = 0pt
  1.2119 +\parskip = \smallskipamount
  1.2120 +\ifdim \parskip=0pt \parskip=2pt \fi%
  1.2121 +\def\Etable{\endgraf\afterenvbreak\endgroup}%
  1.2122 +\let\item = \internalBitem %
  1.2123 +\let\itemx = \internalBitemx %
  1.2124 +\let\kitem = \internalBkitem %
  1.2125 +\let\kitemx = \internalBkitemx %
  1.2126 +\let\xitem = \internalBxitem %
  1.2127 +\let\xitemx = \internalBxitemx %
  1.2128 +}
  1.2129 +
  1.2130 +% This is the counter used by @enumerate, which is really @itemize
  1.2131 +
  1.2132 +\newcount \itemno
  1.2133 +
  1.2134 +\def\itemize{\parsearg\itemizezzz}
  1.2135 +
  1.2136 +\def\itemizezzz #1{%
  1.2137 +  \begingroup % ended by the @end itemize
  1.2138 +  \itemizey {#1}{\Eitemize}
  1.2139 +}
  1.2140 +
  1.2141 +\def\itemizey#1#2{%
  1.2142 +  \aboveenvbreak
  1.2143 +  \itemmax=\itemindent
  1.2144 +  \advance\itemmax by -\itemmargin
  1.2145 +  \advance\leftskip by \itemindent
  1.2146 +  \exdentamount=\itemindent
  1.2147 +  \parindent=0pt
  1.2148 +  \parskip=\smallskipamount
  1.2149 +  \ifdim\parskip=0pt \parskip=2pt \fi
  1.2150 +  \def#2{\endgraf\afterenvbreak\endgroup}%
  1.2151 +  \def\itemcontents{#1}%
  1.2152 +  % @itemize with no arg is equivalent to @itemize @bullet.
  1.2153 +  \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
  1.2154 +  \let\item=\itemizeitem
  1.2155 +}
  1.2156 +
  1.2157 +% \splitoff TOKENS\endmark defines \first to be the first token in
  1.2158 +% TOKENS, and \rest to be the remainder.
  1.2159 +%
  1.2160 +\def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
  1.2161 +
  1.2162 +% Allow an optional argument of an uppercase letter, lowercase letter,
  1.2163 +% or number, to specify the first label in the enumerated list.  No
  1.2164 +% argument is the same as `1'.
  1.2165 +%
  1.2166 +\def\enumerate{\parsearg\enumeratezzz}
  1.2167 +\def\enumeratezzz #1{\enumeratey #1  \endenumeratey}
  1.2168 +\def\enumeratey #1 #2\endenumeratey{%
  1.2169 +  \begingroup % ended by the @end enumerate
  1.2170 +  %
  1.2171 +  % If we were given no argument, pretend we were given `1'.
  1.2172 +  \def\thearg{#1}%
  1.2173 +  \ifx\thearg\empty \def\thearg{1}\fi
  1.2174 +  %
  1.2175 +  % Detect if the argument is a single token.  If so, it might be a
  1.2176 +  % letter.  Otherwise, the only valid thing it can be is a number.
  1.2177 +  % (We will always have one token, because of the test we just made.
  1.2178 +  % This is a good thing, since \splitoff doesn't work given nothing at
  1.2179 +  % all -- the first parameter is undelimited.)
  1.2180 +  \expandafter\splitoff\thearg\endmark
  1.2181 +  \ifx\rest\empty
  1.2182 +    % Only one token in the argument.  It could still be anything.
  1.2183 +    % A ``lowercase letter'' is one whose \lccode is nonzero.
  1.2184 +    % An ``uppercase letter'' is one whose \lccode is both nonzero, and
  1.2185 +    %   not equal to itself.
  1.2186 +    % Otherwise, we assume it's a number.
  1.2187 +    %
  1.2188 +    % We need the \relax at the end of the \ifnum lines to stop TeX from
  1.2189 +    % continuing to look for a <number>.
  1.2190 +    %
  1.2191 +    \ifnum\lccode\expandafter`\thearg=0\relax
  1.2192 +      \numericenumerate % a number (we hope)
  1.2193 +    \else
  1.2194 +      % It's a letter.
  1.2195 +      \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
  1.2196 +        \lowercaseenumerate % lowercase letter
  1.2197 +      \else
  1.2198 +        \uppercaseenumerate % uppercase letter
  1.2199 +      \fi
  1.2200 +    \fi
  1.2201 +  \else
  1.2202 +    % Multiple tokens in the argument.  We hope it's a number.
  1.2203 +    \numericenumerate
  1.2204 +  \fi
  1.2205 +}
  1.2206 +
  1.2207 +% An @enumerate whose labels are integers.  The starting integer is
  1.2208 +% given in \thearg.
  1.2209 +%
  1.2210 +\def\numericenumerate{%
  1.2211 +  \itemno = \thearg
  1.2212 +  \startenumeration{\the\itemno}%
  1.2213 +}
  1.2214 +
  1.2215 +% The starting (lowercase) letter is in \thearg.
  1.2216 +\def\lowercaseenumerate{%
  1.2217 +  \itemno = \expandafter`\thearg
  1.2218 +  \startenumeration{%
  1.2219 +    % Be sure we're not beyond the end of the alphabet.
  1.2220 +    \ifnum\itemno=0
  1.2221 +      \errmessage{No more lowercase letters in @enumerate; get a bigger
  1.2222 +                  alphabet}%
  1.2223 +    \fi
  1.2224 +    \char\lccode\itemno
  1.2225 +  }%
  1.2226 +}
  1.2227 +
  1.2228 +% The starting (uppercase) letter is in \thearg.
  1.2229 +\def\uppercaseenumerate{%
  1.2230 +  \itemno = \expandafter`\thearg
  1.2231 +  \startenumeration{%
  1.2232 +    % Be sure we're not beyond the end of the alphabet.
  1.2233 +    \ifnum\itemno=0
  1.2234 +      \errmessage{No more uppercase letters in @enumerate; get a bigger
  1.2235 +                  alphabet}
  1.2236 +    \fi
  1.2237 +    \char\uccode\itemno
  1.2238 +  }%
  1.2239 +}
  1.2240 +
  1.2241 +% Call itemizey, adding a period to the first argument and supplying the
  1.2242 +% common last two arguments.  Also subtract one from the initial value in
  1.2243 +% \itemno, since @item increments \itemno.
  1.2244 +%
  1.2245 +\def\startenumeration#1{%
  1.2246 +  \advance\itemno by -1
  1.2247 +  \itemizey{#1.}\Eenumerate\flushcr
  1.2248 +}
  1.2249 +
  1.2250 +% @alphaenumerate and @capsenumerate are abbreviations for giving an arg
  1.2251 +% to @enumerate.
  1.2252 +%
  1.2253 +\def\alphaenumerate{\enumerate{a}}
  1.2254 +\def\capsenumerate{\enumerate{A}}
  1.2255 +\def\Ealphaenumerate{\Eenumerate}
  1.2256 +\def\Ecapsenumerate{\Eenumerate}
  1.2257 +
  1.2258 +% Definition of @item while inside @itemize.
  1.2259 +
  1.2260 +\def\itemizeitem{%
  1.2261 +\advance\itemno by 1
  1.2262 +{\let\par=\endgraf \smallbreak}%
  1.2263 +\ifhmode \errmessage{In hmode at itemizeitem}\fi
  1.2264 +{\parskip=0in \hskip 0pt
  1.2265 +\hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
  1.2266 +\vadjust{\penalty 1200}}%
  1.2267 +\flushcr}
  1.2268 +
  1.2269 +% @multitable macros
  1.2270 +% Amy Hendrickson, 8/18/94, 3/6/96
  1.2271 +%
  1.2272 +% @multitable ... @end multitable will make as many columns as desired.
  1.2273 +% Contents of each column will wrap at width given in preamble.  Width
  1.2274 +% can be specified either with sample text given in a template line,
  1.2275 +% or in percent of \hsize, the current width of text on page.
  1.2276 +
  1.2277 +% Table can continue over pages but will only break between lines.
  1.2278 +
  1.2279 +% To make preamble:
  1.2280 +%
  1.2281 +% Either define widths of columns in terms of percent of \hsize:
  1.2282 +%   @multitable @columnfractions .25 .3 .45
  1.2283 +%   @item ...
  1.2284 +%
  1.2285 +%   Numbers following @columnfractions are the percent of the total
  1.2286 +%   current hsize to be used for each column. You may use as many
  1.2287 +%   columns as desired.
  1.2288 +
  1.2289 +
  1.2290 +% Or use a template:
  1.2291 +%   @multitable {Column 1 template} {Column 2 template} {Column 3 template}
  1.2292 +%   @item ...
  1.2293 +%   using the widest term desired in each column.
  1.2294 +%
  1.2295 +% For those who want to use more than one line's worth of words in
  1.2296 +% the preamble, break the line within one argument and it
  1.2297 +% will parse correctly, i.e.,
  1.2298 +%
  1.2299 +%     @multitable {Column 1 template} {Column 2 template} {Column 3
  1.2300 +%      template}
  1.2301 +% Not:
  1.2302 +%     @multitable {Column 1 template} {Column 2 template}
  1.2303 +%      {Column 3 template}
  1.2304 +
  1.2305 +% Each new table line starts with @item, each subsequent new column
  1.2306 +% starts with @tab. Empty columns may be produced by supplying @tab's
  1.2307 +% with nothing between them for as many times as empty columns are needed,
  1.2308 +% ie, @tab@tab@tab will produce two empty columns.
  1.2309 +
  1.2310 +% @item, @tab, @multitable or @end multitable do not need to be on their
  1.2311 +% own lines, but it will not hurt if they are.
  1.2312 +
  1.2313 +% Sample multitable:
  1.2314 +
  1.2315 +%   @multitable {Column 1 template} {Column 2 template} {Column 3 template}
  1.2316 +%   @item first col stuff @tab second col stuff @tab third col
  1.2317 +%   @item
  1.2318 +%   first col stuff
  1.2319 +%   @tab
  1.2320 +%   second col stuff
  1.2321 +%   @tab
  1.2322 +%   third col
  1.2323 +%   @item first col stuff @tab second col stuff
  1.2324 +%   @tab Many paragraphs of text may be used in any column.
  1.2325 +%
  1.2326 +%         They will wrap at the width determined by the template.
  1.2327 +%   @item@tab@tab This will be in third column.
  1.2328 +%   @end multitable
  1.2329 +
  1.2330 +% Default dimensions may be reset by user.
  1.2331 +% @multitableparskip is vertical space between paragraphs in table.
  1.2332 +% @multitableparindent is paragraph indent in table.
  1.2333 +% @multitablecolmargin is horizontal space to be left between columns.
  1.2334 +% @multitablelinespace is space to leave between table items, baseline
  1.2335 +%                                                            to baseline.
  1.2336 +%   0pt means it depends on current normal line spacing.
  1.2337 +%
  1.2338 +\newskip\multitableparskip
  1.2339 +\newskip\multitableparindent
  1.2340 +\newdimen\multitablecolspace
  1.2341 +\newskip\multitablelinespace
  1.2342 +\multitableparskip=0pt
  1.2343 +\multitableparindent=6pt
  1.2344 +\multitablecolspace=12pt
  1.2345 +\multitablelinespace=0pt
  1.2346 +
  1.2347 +% Macros used to set up halign preamble:
  1.2348 +%
  1.2349 +\let\endsetuptable\relax
  1.2350 +\def\xendsetuptable{\endsetuptable}
  1.2351 +\let\columnfractions\relax
  1.2352 +\def\xcolumnfractions{\columnfractions}
  1.2353 +\newif\ifsetpercent
  1.2354 +
  1.2355 +% #1 is the part of the @columnfraction before the decimal point, which
  1.2356 +% is presumably either 0 or the empty string (but we don't check, we
  1.2357 +% just throw it away).  #2 is the decimal part, which we use as the
  1.2358 +% percent of \hsize for this column.
  1.2359 +\def\pickupwholefraction#1.#2 {%
  1.2360 +  \global\advance\colcount by 1
  1.2361 +  \expandafter\xdef\csname col\the\colcount\endcsname{.#2\hsize}%
  1.2362 +  \setuptable
  1.2363 +}
  1.2364 +
  1.2365 +\newcount\colcount
  1.2366 +\def\setuptable#1{%
  1.2367 +  \def\firstarg{#1}%
  1.2368 +  \ifx\firstarg\xendsetuptable
  1.2369 +    \let\go = \relax
  1.2370 +  \else
  1.2371 +    \ifx\firstarg\xcolumnfractions
  1.2372 +      \global\setpercenttrue
  1.2373 +    \else
  1.2374 +      \ifsetpercent
  1.2375 +         \let\go\pickupwholefraction
  1.2376 +      \else
  1.2377 +         \global\advance\colcount by 1
  1.2378 +         \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a
  1.2379 +                   % separator; typically that is always in the input, anyway.
  1.2380 +         \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
  1.2381 +      \fi
  1.2382 +    \fi
  1.2383 +    \ifx\go\pickupwholefraction
  1.2384 +      % Put the argument back for the \pickupwholefraction call, so
  1.2385 +      % we'll always have a period there to be parsed.
  1.2386 +      \def\go{\pickupwholefraction#1}%
  1.2387 +    \else
  1.2388 +      \let\go = \setuptable
  1.2389 +    \fi%
  1.2390 +  \fi
  1.2391 +  \go
  1.2392 +}
  1.2393 +
  1.2394 +% @multitable ... @end multitable definitions:
  1.2395 +%
  1.2396 +\def\multitable{\parsearg\dotable}
  1.2397 +\def\dotable#1{\bgroup
  1.2398 +  \vskip\parskip
  1.2399 +  \let\item=\crcrwithfootnotes
  1.2400 +  % A \tab used to include \hskip1sp.  But then the space in a template
  1.2401 +  % line is not enough.  That is bad.  So let's go back to just & until
  1.2402 +  % we encounter the problem it was intended to solve again.  --karl,
  1.2403 +  % nathan@acm.org, 20apr99.
  1.2404 +  \let\tab=&%
  1.2405 +  \let\startfootins=\startsavedfootnote
  1.2406 +  \tolerance=9500
  1.2407 +  \hbadness=9500
  1.2408 +  \setmultitablespacing
  1.2409 +  \parskip=\multitableparskip
  1.2410 +  \parindent=\multitableparindent
  1.2411 +  \overfullrule=0pt
  1.2412 +  \global\colcount=0
  1.2413 +  \def\Emultitable{%
  1.2414 +    \global\setpercentfalse
  1.2415 +    \crcrwithfootnotes\crcr
  1.2416 +    \egroup\egroup
  1.2417 +  }%
  1.2418 +  %
  1.2419 +  % To parse everything between @multitable and @item:
  1.2420 +  \setuptable#1 \endsetuptable
  1.2421 +  %
  1.2422 +  % \everycr will reset column counter, \colcount, at the end of
  1.2423 +  % each line. Every column entry will cause \colcount to advance by one.
  1.2424 +  % The table preamble
  1.2425 +  % looks at the current \colcount to find the correct column width.
  1.2426 +  \everycr{\noalign{%
  1.2427 +  %
  1.2428 +  % \filbreak%% keeps underfull box messages off when table breaks over pages.
  1.2429 +  % Maybe so, but it also creates really weird page breaks when the table
  1.2430 +  % breaks over pages. Wouldn't \vfil be better?  Wait until the problem
  1.2431 +  % manifests itself, so it can be fixed for real --karl.
  1.2432 +    \global\colcount=0\relax}}%
  1.2433 +  %
  1.2434 +  % This preamble sets up a generic column definition, which will
  1.2435 +  % be used as many times as user calls for columns.
  1.2436 +  % \vtop will set a single line and will also let text wrap and
  1.2437 +  % continue for many paragraphs if desired.
  1.2438 +  \halign\bgroup&\global\advance\colcount by 1\relax
  1.2439 +    \multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname
  1.2440 +  %
  1.2441 +  % In order to keep entries from bumping into each other
  1.2442 +  % we will add a \leftskip of \multitablecolspace to all columns after
  1.2443 +  % the first one.
  1.2444 +  %
  1.2445 +  % If a template has been used, we will add \multitablecolspace
  1.2446 +  % to the width of each template entry.
  1.2447 +  %
  1.2448 +  % If the user has set preamble in terms of percent of \hsize we will
  1.2449 +  % use that dimension as the width of the column, and the \leftskip
  1.2450 +  % will keep entries from bumping into each other.  Table will start at
  1.2451 +  % left margin and final column will justify at right margin.
  1.2452 +  %
  1.2453 +  % Make sure we don't inherit \rightskip from the outer environment.
  1.2454 +  \rightskip=0pt
  1.2455 +  \ifnum\colcount=1
  1.2456 +    % The first column will be indented with the surrounding text.
  1.2457 +    \advance\hsize by\leftskip
  1.2458 +  \else
  1.2459 +    \ifsetpercent \else
  1.2460 +      % If user has not set preamble in terms of percent of \hsize
  1.2461 +      % we will advance \hsize by \multitablecolspace.
  1.2462 +      \advance\hsize by \multitablecolspace
  1.2463 +    \fi
  1.2464 +   % In either case we will make \leftskip=\multitablecolspace:
  1.2465 +  \leftskip=\multitablecolspace
  1.2466 +  \fi
  1.2467 +  % Ignoring space at the beginning and end avoids an occasional spurious
  1.2468 +  % blank line, when TeX decides to break the line at the space before the
  1.2469 +  % box from the multistrut, so the strut ends up on a line by itself.
  1.2470 +  % For example:
  1.2471 +  % @multitable @columnfractions .11 .89
  1.2472 +  % @item @code{#}
  1.2473 +  % @tab Legal holiday which is valid in major parts of the whole country.
  1.2474 +  % Is automatically provided with highlighting sequences respectively marking
  1.2475 +  % characters.
  1.2476 +  \noindent\ignorespaces##\unskip\multistrut}\cr
  1.2477 +}
  1.2478 +
  1.2479 +\def\setmultitablespacing{% test to see if user has set \multitablelinespace.
  1.2480 +% If so, do nothing. If not, give it an appropriate dimension based on
  1.2481 +% current baselineskip.
  1.2482 +\ifdim\multitablelinespace=0pt
  1.2483 +\setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
  1.2484 +\global\advance\multitablelinespace by-\ht0
  1.2485 +%% strut to put in table in case some entry doesn't have descenders,
  1.2486 +%% to keep lines equally spaced
  1.2487 +\let\multistrut = \strut
  1.2488 +\else
  1.2489 +%% FIXME: what is \box0 supposed to be?
  1.2490 +\gdef\multistrut{\vrule height\multitablelinespace depth\dp0
  1.2491 +width0pt\relax} \fi
  1.2492 +%% Test to see if parskip is larger than space between lines of
  1.2493 +%% table. If not, do nothing.
  1.2494 +%%        If so, set to same dimension as multitablelinespace.
  1.2495 +\ifdim\multitableparskip>\multitablelinespace
  1.2496 +\global\multitableparskip=\multitablelinespace
  1.2497 +\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
  1.2498 +                                      %% than skip between lines in the table.
  1.2499 +\fi%
  1.2500 +\ifdim\multitableparskip=0pt
  1.2501 +\global\multitableparskip=\multitablelinespace
  1.2502 +\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
  1.2503 +                                      %% than skip between lines in the table.
  1.2504 +\fi}
  1.2505 +
  1.2506 +% In case a @footnote appears inside an alignment, save the footnote
  1.2507 +% text to a box and make the \insert when a row of the table is
  1.2508 +% finished.  Otherwise, the insertion is lost, it never migrates to the
  1.2509 +% main vertical list.  --kasal, 22jan03.
  1.2510 +%
  1.2511 +\newbox\savedfootnotes
  1.2512 +%
  1.2513 +% \dotable \let's \startfootins to this, so that \dofootnote will call
  1.2514 +% it instead of starting the insertion right away.
  1.2515 +\def\startsavedfootnote{%
  1.2516 +  \global\setbox\savedfootnotes = \vbox\bgroup
  1.2517 +    \unvbox\savedfootnotes
  1.2518 +}
  1.2519 +\def\crcrwithfootnotes{%
  1.2520 +  \crcr
  1.2521 +  \ifvoid\savedfootnotes \else
  1.2522 +    \noalign{\insert\footins{\box\savedfootnotes}}%
  1.2523 +  \fi
  1.2524 +}
  1.2525 +
  1.2526 +\message{conditionals,}
  1.2527 +% Prevent errors for section commands.
  1.2528 +% Used in @ignore and in failing conditionals.
  1.2529 +\def\ignoresections{%
  1.2530 +  \let\appendix=\relax
  1.2531 +  \let\appendixsec=\relax
  1.2532 +  \let\appendixsection=\relax
  1.2533 +  \let\appendixsubsec=\relax
  1.2534 +  \let\appendixsubsection=\relax
  1.2535 +  \let\appendixsubsubsec=\relax
  1.2536 +  \let\appendixsubsubsection=\relax
  1.2537 +  %\let\begin=\relax
  1.2538 +  %\let\bye=\relax
  1.2539 +  \let\centerchap=\relax
  1.2540 +  \let\chapter=\relax
  1.2541 +  \let\contents=\relax
  1.2542 +  \let\section=\relax
  1.2543 +  \let\smallbook=\relax
  1.2544 +  \let\subsec=\relax
  1.2545 +  \let\subsection=\relax
  1.2546 +  \let\subsubsec=\relax
  1.2547 +  \let\subsubsection=\relax
  1.2548 +  \let\titlepage=\relax
  1.2549 +  \let\top=\relax
  1.2550 +  \let\unnumbered=\relax
  1.2551 +  \let\unnumberedsec=\relax
  1.2552 +  \let\unnumberedsection=\relax
  1.2553 +  \let\unnumberedsubsec=\relax
  1.2554 +  \let\unnumberedsubsection=\relax
  1.2555 +  \let\unnumberedsubsubsec=\relax
  1.2556 +  \let\unnumberedsubsubsection=\relax
  1.2557 +}
  1.2558 +
  1.2559 +% Ignore @ignore, @ifhtml, @ifinfo, and the like.
  1.2560 +%
  1.2561 +\def\direntry{\doignore{direntry}}
  1.2562 +\def\documentdescriptionword{documentdescription}
  1.2563 +\def\documentdescription{\doignore{documentdescription}}
  1.2564 +\def\html{\doignore{html}}
  1.2565 +\def\ifhtml{\doignore{ifhtml}}
  1.2566 +\def\ifinfo{\doignore{ifinfo}}
  1.2567 +\def\ifnottex{\doignore{ifnottex}}
  1.2568 +\def\ifplaintext{\doignore{ifplaintext}}
  1.2569 +\def\ifxml{\doignore{ifxml}}
  1.2570 +\def\ignore{\doignore{ignore}}
  1.2571 +\def\menu{\doignore{menu}}
  1.2572 +\def\xml{\doignore{xml}}
  1.2573 +
  1.2574 +% @dircategory CATEGORY  -- specify a category of the dir file
  1.2575 +% which this file should belong to.  Ignore this in TeX.
  1.2576 +\let\dircategory = \comment
  1.2577 +
  1.2578 +% Ignore text until a line `@end #1', keeping track of nested conditionals.
  1.2579 +%
  1.2580 +% A count to remember the depth of nesting.
  1.2581 +\newcount\doignorecount  \doignorecount = 0
  1.2582 +
  1.2583 +\def\doignore#1{\begingroup
  1.2584 +  % Don't complain about control sequences we have declared \outer.
  1.2585 +  \ignoresections
  1.2586 +  %
  1.2587 +  % Make sure that spaces turn into tokens that match what \doignoretext wants.
  1.2588 +  \catcode\spaceChar = 10
  1.2589 +  %
  1.2590 +  % Ignore braces, so mismatched braces don't cause trouble.
  1.2591 +  \catcode`\{ = 9
  1.2592 +  \catcode`\} = 9
  1.2593 +  %
  1.2594 +  % Count number of #1's that we've seen.
  1.2595 +  \doignorecount = 0
  1.2596 +  %
  1.2597 +  % Swallow text until we reach the matching `@end #1'.
  1.2598 +  \expandafter \dodoignore \csname#1\endcsname {#1}%
  1.2599 +}
  1.2600 +
  1.2601 +{ \catcode`@=11 % We want to use \ST@P which cannot appear in texinfo source.
  1.2602 +  \obeylines %
  1.2603 +  %
  1.2604 +  \gdef\dodoignore#1#2{%
  1.2605 +    % #1 contains, e.g., \ifinfo, a.k.a. @ifinfo.
  1.2606 +    % #2 contains the string `ifinfo'.
  1.2607 +    %
  1.2608 +    % Define a command to find the next `@end #2', which must be on a line
  1.2609 +    % by itself.
  1.2610 +    \long\def\doignoretext##1^^M\end #2{\doignoretextyyy##1^^M#1\ST@P}%
  1.2611 +    % And this command to find another #1 command, at the beginning of a
  1.2612 +    % line.  (Otherwise, we would consider a line `@c @ifset', for
  1.2613 +    % example, to count as an @ifset for nesting.)
  1.2614 +    \long\def\doignoretextyyy##1^^M#1##2\ST@P{\doignoreyyy{##2}\ST@P}%
  1.2615 +    %
  1.2616 +    % And now expand that command.
  1.2617 +    \obeylines %
  1.2618 +    \doignoretext ^^M%
  1.2619 +  }%
  1.2620 +}
  1.2621 +
  1.2622 +\def\doignoreyyy#1{%
  1.2623 +  \def\temp{#1}%
  1.2624 +  \ifx\temp\empty			% Nothing found.
  1.2625 +    \let\next\doignoretextzzz
  1.2626 +  \else					% Found a nested condition, ...
  1.2627 +    \advance\doignorecount by 1
  1.2628 +    \let\next\doignoretextyyy		% ..., look for another.
  1.2629 +    % If we're here, #1 ends with \ifinfo (for example).
  1.2630 +  \fi
  1.2631 +  \next #1% the token \ST@P is present just after this macro.
  1.2632 +}
  1.2633 +
  1.2634 +% We have to swallow the remaining "\ST@P".
  1.2635 +% 
  1.2636 +\def\doignoretextzzz#1{%
  1.2637 +  \ifnum\doignorecount = 0	% We have just found the outermost @end.
  1.2638 +    \let\next\enddoignore
  1.2639 +  \else				% Still inside a nested condition.
  1.2640 +    \advance\doignorecount by -1
  1.2641 +    \let\next\doignoretext      % Look for the next @end.
  1.2642 +  \fi
  1.2643 +  \next
  1.2644 +}
  1.2645 +
  1.2646 +% Finish off ignored text.
  1.2647 +\def\enddoignore{\endgroup\ignorespaces}
  1.2648 +
  1.2649 +
  1.2650 +% @set VAR sets the variable VAR to an empty value.
  1.2651 +% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
  1.2652 +%
  1.2653 +% Since we want to separate VAR from REST-OF-LINE (which might be
  1.2654 +% empty), we can't just use \parsearg; we have to insert a space of our
  1.2655 +% own to delimit the rest of the line, and then take it out again if we
  1.2656 +% didn't need it.  Make sure the catcode of space is correct to avoid
  1.2657 +% losing inside @example, for instance.
  1.2658 +%
  1.2659 +\def\set{\begingroup\catcode` =10
  1.2660 +  \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR.
  1.2661 +  \parsearg\setxxx}
  1.2662 +\def\setxxx#1{\setyyy#1 \endsetyyy}
  1.2663 +\def\setyyy#1 #2\endsetyyy{%
  1.2664 +  \def\temp{#2}%
  1.2665 +  \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty
  1.2666 +  \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted.
  1.2667 +  \fi
  1.2668 +  \endgroup
  1.2669 +}
  1.2670 +% Can't use \xdef to pre-expand #2 and save some time, since \temp or
  1.2671 +% \next or other control sequences that we've defined might get us into
  1.2672 +% an infinite loop. Consider `@set foo @cite{bar}'.
  1.2673 +\def\setzzz#1#2 \endsetzzz{\expandafter\gdef\csname SET#1\endcsname{#2}}
  1.2674 +
  1.2675 +% @clear VAR clears (i.e., unsets) the variable VAR.
  1.2676 +%
  1.2677 +\def\clear{\parsearg\clearxxx}
  1.2678 +\def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax}
  1.2679 +
  1.2680 +% @value{foo} gets the text saved in variable foo.
  1.2681 +{
  1.2682 +  \catcode`\_ = \active
  1.2683 +  %
  1.2684 +  % We might end up with active _ or - characters in the argument if
  1.2685 +  % we're called from @code, as @code{@value{foo-bar_}}.  So \let any
  1.2686 +  % such active characters to their normal equivalents.
  1.2687 +  \gdef\value{\begingroup
  1.2688 +    \catcode`\-=\other \catcode`\_=\other
  1.2689 +    \indexbreaks \let_\normalunderscore
  1.2690 +    \valuexxx}
  1.2691 +}
  1.2692 +\def\valuexxx#1{\expandablevalue{#1}\endgroup}
  1.2693 +
  1.2694 +% We have this subroutine so that we can handle at least some @value's
  1.2695 +% properly in indexes (we \let\value to this in \indexdummies).  Ones
  1.2696 +% whose names contain - or _ still won't work, but we can't do anything
  1.2697 +% about that.  The command has to be fully expandable (if the variable
  1.2698 +% is set), since the result winds up in the index file.  This means that
  1.2699 +% if the variable's value contains other Texinfo commands, it's almost
  1.2700 +% certain it will fail (although perhaps we could fix that with
  1.2701 +% sufficient work to do a one-level expansion on the result, instead of
  1.2702 +% complete).
  1.2703 +%
  1.2704 +\def\expandablevalue#1{%
  1.2705 +  \expandafter\ifx\csname SET#1\endcsname\relax
  1.2706 +    {[No value for ``#1'']}%
  1.2707 +    \message{Variable `#1', used in @value, is not set.}%
  1.2708 +  \else
  1.2709 +    \csname SET#1\endcsname
  1.2710 +  \fi
  1.2711 +}
  1.2712 +
  1.2713 +% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
  1.2714 +% with @set.
  1.2715 +%
  1.2716 +\def\ifset{\parsearg\doifset}
  1.2717 +\def\doifset#1{%
  1.2718 +  \expandafter\ifx\csname SET#1\endcsname\relax
  1.2719 +    \let\next=\ifsetfail
  1.2720 +  \else
  1.2721 +    \let\next=\ifsetsucceed
  1.2722 +  \fi
  1.2723 +  \next
  1.2724 +}
  1.2725 +\def\ifsetsucceed{\conditionalsucceed{ifset}}
  1.2726 +\def\ifsetfail{\doignore{ifset}}
  1.2727 +\defineunmatchedend{ifset}
  1.2728 +
  1.2729 +% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
  1.2730 +% defined with @set, or has been undefined with @clear.
  1.2731 +%
  1.2732 +\def\ifclear{\parsearg\doifclear}
  1.2733 +\def\doifclear#1{%
  1.2734 +  \expandafter\ifx\csname SET#1\endcsname\relax
  1.2735 +    \let\next=\ifclearsucceed
  1.2736 +  \else
  1.2737 +    \let\next=\ifclearfail
  1.2738 +  \fi
  1.2739 +  \next
  1.2740 +}
  1.2741 +\def\ifclearsucceed{\conditionalsucceed{ifclear}}
  1.2742 +\def\ifclearfail{\doignore{ifclear}}
  1.2743 +\defineunmatchedend{ifclear}
  1.2744 +
  1.2745 +% @iftex, @ifnothtml, @ifnotinfo, @ifnotplaintext always succeed; we
  1.2746 +% read the text following, through the first @end iftex (etc.).  Make
  1.2747 +% `@end iftex' (etc.) valid only after an @iftex.
  1.2748 +%
  1.2749 +\def\iftex{\conditionalsucceed{iftex}}
  1.2750 +\def\ifnothtml{\conditionalsucceed{ifnothtml}}
  1.2751 +\def\ifnotinfo{\conditionalsucceed{ifnotinfo}}
  1.2752 +\def\ifnotplaintext{\conditionalsucceed{ifnotplaintext}}
  1.2753 +\defineunmatchedend{iftex}
  1.2754 +\defineunmatchedend{ifnothtml}
  1.2755 +\defineunmatchedend{ifnotinfo}
  1.2756 +\defineunmatchedend{ifnotplaintext}
  1.2757 +
  1.2758 +% True conditional.  Since \set globally defines its variables, we can
  1.2759 +% just start and end a group (to keep the @end definition undefined at
  1.2760 +% the outer level).
  1.2761 +%
  1.2762 +\def\conditionalsucceed#1{\begingroup
  1.2763 +  \expandafter\def\csname E#1\endcsname{\endgroup}%
  1.2764 +}
  1.2765 +
  1.2766 +% @defininfoenclose.
  1.2767 +\let\definfoenclose=\comment
  1.2768 +
  1.2769 +
  1.2770 +\message{indexing,}
  1.2771 +% Index generation facilities
  1.2772 +
  1.2773 +% Define \newwrite to be identical to plain tex's \newwrite
  1.2774 +% except not \outer, so it can be used within \newindex.
  1.2775 +{\catcode`\@=11
  1.2776 +\gdef\newwrite{\alloc@7\write\chardef\sixt@@n}}
  1.2777 +
  1.2778 +% \newindex {foo} defines an index named foo.
  1.2779 +% It automatically defines \fooindex such that
  1.2780 +% \fooindex ...rest of line... puts an entry in the index foo.
  1.2781 +% It also defines \fooindfile to be the number of the output channel for
  1.2782 +% the file that accumulates this index.  The file's extension is foo.
  1.2783 +% The name of an index should be no more than 2 characters long
  1.2784 +% for the sake of vms.
  1.2785 +%
  1.2786 +\def\newindex#1{%
  1.2787 +  \iflinks
  1.2788 +    \expandafter\newwrite \csname#1indfile\endcsname
  1.2789 +    \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
  1.2790 +  \fi
  1.2791 +  \expandafter\xdef\csname#1index\endcsname{%     % Define @#1index
  1.2792 +    \noexpand\doindex{#1}}
  1.2793 +}
  1.2794 +
  1.2795 +% @defindex foo  ==  \newindex{foo}
  1.2796 +%
  1.2797 +\def\defindex{\parsearg\newindex}
  1.2798 +
  1.2799 +% Define @defcodeindex, like @defindex except put all entries in @code.
  1.2800 +%
  1.2801 +\def\defcodeindex{\parsearg\newcodeindex}
  1.2802 +%
  1.2803 +\def\newcodeindex#1{%
  1.2804 +  \iflinks
  1.2805 +    \expandafter\newwrite \csname#1indfile\endcsname
  1.2806 +    \openout \csname#1indfile\endcsname \jobname.#1
  1.2807 +  \fi
  1.2808 +  \expandafter\xdef\csname#1index\endcsname{%
  1.2809 +    \noexpand\docodeindex{#1}}%
  1.2810 +}
  1.2811 +
  1.2812 +
  1.2813 +% @synindex foo bar    makes index foo feed into index bar.
  1.2814 +% Do this instead of @defindex foo if you don't want it as a separate index.
  1.2815 +%
  1.2816 +% @syncodeindex foo bar   similar, but put all entries made for index foo
  1.2817 +% inside @code.
  1.2818 +%
  1.2819 +\def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
  1.2820 +\def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}
  1.2821 +
  1.2822 +% #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
  1.2823 +% #3 the target index (bar).
  1.2824 +\def\dosynindex#1#2#3{%
  1.2825 +  % Only do \closeout if we haven't already done it, else we'll end up
  1.2826 +  % closing the target index.
  1.2827 +  \expandafter \ifx\csname donesynindex#2\endcsname \undefined
  1.2828 +    % The \closeout helps reduce unnecessary open files; the limit on the
  1.2829 +    % Acorn RISC OS is a mere 16 files.
  1.2830 +    \expandafter\closeout\csname#2indfile\endcsname
  1.2831 +    \expandafter\let\csname\donesynindex#2\endcsname = 1
  1.2832 +  \fi
  1.2833 +  % redefine \fooindfile:
  1.2834 +  \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
  1.2835 +  \expandafter\let\csname#2indfile\endcsname=\temp
  1.2836 +  % redefine \fooindex:
  1.2837 +  \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
  1.2838 +}
  1.2839 +
  1.2840 +% Define \doindex, the driver for all \fooindex macros.
  1.2841 +% Argument #1 is generated by the calling \fooindex macro,
  1.2842 +%  and it is "foo", the name of the index.
  1.2843 +
  1.2844 +% \doindex just uses \parsearg; it calls \doind for the actual work.
  1.2845 +% This is because \doind is more useful to call from other macros.
  1.2846 +
  1.2847 +% There is also \dosubind {index}{topic}{subtopic}
  1.2848 +% which makes an entry in a two-level index such as the operation index.
  1.2849 +
  1.2850 +\def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
  1.2851 +\def\singleindexer #1{\doind{\indexname}{#1}}
  1.2852 +
  1.2853 +% like the previous two, but they put @code around the argument.
  1.2854 +\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
  1.2855 +\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
  1.2856 +
  1.2857 +% Take care of Texinfo commands that can appear in an index entry.
  1.2858 +% Since there are some commands we want to expand, and others we don't,
  1.2859 +% we have to laboriously prevent expansion for those that we don't.
  1.2860 +%
  1.2861 +\def\indexdummies{%
  1.2862 +  \def\@{@}% change to @@ when we switch to @ as escape char in index files.
  1.2863 +  \def\ {\realbackslash\space }%
  1.2864 +  % Need these in case \tex is in effect and \{ is a \delimiter again.
  1.2865 +  % But can't use \lbracecmd and \rbracecmd because texindex assumes
  1.2866 +  % braces and backslashes are used only as delimiters.
  1.2867 +  \let\{ = \mylbrace
  1.2868 +  \let\} = \myrbrace
  1.2869 +  %
  1.2870 +  % \definedummyword defines \#1 as \realbackslash #1\space, thus
  1.2871 +  % effectively preventing its expansion.  This is used only for control
  1.2872 +  % words, not control letters, because the \space would be incorrect
  1.2873 +  % for control characters, but is needed to separate the control word
  1.2874 +  % from whatever follows.
  1.2875 +  %
  1.2876 +  % For control letters, we have \definedummyletter, which omits the
  1.2877 +  % space.
  1.2878 +  %
  1.2879 +  % These can be used both for control words that take an argument and
  1.2880 +  % those that do not.  If it is followed by {arg} in the input, then
  1.2881 +  % that will dutifully get written to the index (or wherever).
  1.2882 +  %
  1.2883 +  \def\definedummyword##1{%
  1.2884 +    \expandafter\def\csname ##1\endcsname{\realbackslash ##1\space}%
  1.2885 +  }%
  1.2886 +  \def\definedummyletter##1{%
  1.2887 +    \expandafter\def\csname ##1\endcsname{\realbackslash ##1}%
  1.2888 +  }%
  1.2889 +  %
  1.2890 +  % Do the redefinitions.
  1.2891 +  \commondummies
  1.2892 +}
  1.2893 +
  1.2894 +% For the aux file, @ is the escape character.  So we want to redefine
  1.2895 +% everything using @ instead of \realbackslash.  When everything uses
  1.2896 +% @, this will be simpler.
  1.2897 +%
  1.2898 +\def\atdummies{%
  1.2899 +  \def\@{@@}%
  1.2900 +  \def\ {@ }%
  1.2901 +  \let\{ = \lbraceatcmd
  1.2902 +  \let\} = \rbraceatcmd
  1.2903 +  %
  1.2904 +  % (See comments in \indexdummies.)
  1.2905 +  \def\definedummyword##1{%
  1.2906 +    \expandafter\def\csname ##1\endcsname{@##1\space}%
  1.2907 +  }%
  1.2908 +  \def\definedummyletter##1{%
  1.2909 +    \expandafter\def\csname ##1\endcsname{@##1}%
  1.2910 +  }%
  1.2911 +  %
  1.2912 +  % Do the redefinitions.
  1.2913 +  \commondummies
  1.2914 +}
  1.2915 +
  1.2916 +% Called from \indexdummies and \atdummies.  \definedummyword and
  1.2917 +% \definedummyletter must be defined first.
  1.2918 +%
  1.2919 +\def\commondummies{%
  1.2920 +  %
  1.2921 +  \normalturnoffactive
  1.2922 +  %
  1.2923 +  % Control letters and accents.
  1.2924 +  \definedummyletter{_}%
  1.2925 +  \definedummyletter{,}%
  1.2926 +  \definedummyletter{"}%
  1.2927 +  \definedummyletter{`}%
  1.2928 +  \definedummyletter{'}%
  1.2929 +  \definedummyletter{^}%
  1.2930 +  \definedummyletter{~}%
  1.2931 +  \definedummyletter{=}%
  1.2932 +  \definedummyword{u}%
  1.2933 +  \definedummyword{v}%
  1.2934 +  \definedummyword{H}%
  1.2935 +  \definedummyword{dotaccent}%
  1.2936 +  \definedummyword{ringaccent}%
  1.2937 +  \definedummyword{tieaccent}%
  1.2938 +  \definedummyword{ubaraccent}%
  1.2939 +  \definedummyword{udotaccent}%
  1.2940 +  \definedummyword{dotless}%
  1.2941 +  %
  1.2942 +  % Other non-English letters.
  1.2943 +  \definedummyword{AA}%
  1.2944 +  \definedummyword{AE}%
  1.2945 +  \definedummyword{L}%
  1.2946 +  \definedummyword{OE}%
  1.2947 +  \definedummyword{O}%
  1.2948 +  \definedummyword{aa}%
  1.2949 +  \definedummyword{ae}%
  1.2950 +  \definedummyword{l}%
  1.2951 +  \definedummyword{oe}%
  1.2952 +  \definedummyword{o}%
  1.2953 +  \definedummyword{ss}%
  1.2954 +  %
  1.2955 +  % Although these internal commands shouldn't show up, sometimes they do.
  1.2956 +  \definedummyword{bf}%
  1.2957 +  \definedummyword{gtr}%
  1.2958 +  \definedummyword{hat}%
  1.2959 +  \definedummyword{less}%
  1.2960 +  \definedummyword{sf}%
  1.2961 +  \definedummyword{sl}%
  1.2962 +  \definedummyword{tclose}%
  1.2963 +  \definedummyword{tt}%
  1.2964 +  %
  1.2965 +  % Texinfo font commands.
  1.2966 +  \definedummyword{b}%
  1.2967 +  \definedummyword{i}%
  1.2968 +  \definedummyword{r}%
  1.2969 +  \definedummyword{sc}%
  1.2970 +  \definedummyword{t}%
  1.2971 +  %
  1.2972 +  \definedummyword{TeX}%
  1.2973 +  \definedummyword{acronym}%
  1.2974 +  \definedummyword{cite}%
  1.2975 +  \definedummyword{code}%
  1.2976 +  \definedummyword{command}%
  1.2977 +  \definedummyword{dfn}%
  1.2978 +  \definedummyword{dots}%
  1.2979 +  \definedummyword{emph}%
  1.2980 +  \definedummyword{env}%
  1.2981 +  \definedummyword{file}%
  1.2982 +  \definedummyword{kbd}%
  1.2983 +  \definedummyword{key}%
  1.2984 +  \definedummyword{math}%
  1.2985 +  \definedummyword{option}%
  1.2986 +  \definedummyword{samp}%
  1.2987 +  \definedummyword{strong}%
  1.2988 +  \definedummyword{uref}%
  1.2989 +  \definedummyword{url}%
  1.2990 +  \definedummyword{var}%
  1.2991 +  \definedummyword{w}%
  1.2992 +  %
  1.2993 +  % Assorted special characters.
  1.2994 +  \definedummyword{bullet}%
  1.2995 +  \definedummyword{copyright}%
  1.2996 +  \definedummyword{dots}%
  1.2997 +  \definedummyword{enddots}%
  1.2998 +  \definedummyword{equiv}%
  1.2999 +  \definedummyword{error}%
  1.3000 +  \definedummyword{expansion}%
  1.3001 +  \definedummyword{minus}%
  1.3002 +  \definedummyword{pounds}%
  1.3003 +  \definedummyword{point}%
  1.3004 +  \definedummyword{print}%
  1.3005 +  \definedummyword{result}%
  1.3006 +  %
  1.3007 +  % Handle some cases of @value -- where the variable name does not
  1.3008 +  % contain - or _, and the value does not contain any
  1.3009 +  % (non-fully-expandable) commands.
  1.3010 +  \let\value = \expandablevalue
  1.3011 +  %
  1.3012 +  % Normal spaces, not active ones.
  1.3013 +  \unsepspaces
  1.3014 +  %
  1.3015 +  % No macro expansion.
  1.3016 +  \turnoffmacros
  1.3017 +}
  1.3018 +
  1.3019 +% If an index command is used in an @example environment, any spaces
  1.3020 +% therein should become regular spaces in the raw index file, not the
  1.3021 +% expansion of \tie (\leavevmode \penalty \@M \ ).
  1.3022 +{\obeyspaces
  1.3023 + \gdef\unsepspaces{\obeyspaces\let =\space}}
  1.3024 +
  1.3025 +
  1.3026 +% \indexnofonts is used when outputting the strings to sort the index
  1.3027 +% by, and when constructing control sequence names.  It eliminates all
  1.3028 +% control sequences and just writes whatever the best ASCII sort string
  1.3029 +% would be for a given command (usually its argument).
  1.3030 +%
  1.3031 +\def\indexdummytex{TeX}
  1.3032 +\def\indexdummydots{...}
  1.3033 +%
  1.3034 +\def\indexnofonts{%
  1.3035 +  \def\ { }%
  1.3036 +  \def\@{@}%
  1.3037 +  % how to handle braces?
  1.3038 +  \def\_{\normalunderscore}%
  1.3039 +  %
  1.3040 +  \let\,=\asis
  1.3041 +  \let\"=\asis
  1.3042 +  \let\`=\asis
  1.3043 +  \let\'=\asis
  1.3044 +  \let\^=\asis
  1.3045 +  \let\~=\asis
  1.3046 +  \let\==\asis
  1.3047 +  \let\u=\asis
  1.3048 +  \let\v=\asis
  1.3049 +  \let\H=\asis
  1.3050 +  \let\dotaccent=\asis
  1.3051 +  \let\ringaccent=\asis
  1.3052 +  \let\tieaccent=\asis
  1.3053 +  \let\ubaraccent=\asis
  1.3054 +  \let\udotaccent=\asis
  1.3055 +  \let\dotless=\asis
  1.3056 +  %
  1.3057 +  % Other non-English letters.
  1.3058 +  \def\AA{AA}%
  1.3059 +  \def\AE{AE}%
  1.3060 +  \def\L{L}%
  1.3061 +  \def\OE{OE}%
  1.3062 +  \def\O{O}%
  1.3063 +  \def\aa{aa}%
  1.3064 +  \def\ae{ae}%
  1.3065 +  \def\l{l}%
  1.3066 +  \def\oe{oe}%
  1.3067 +  \def\o{o}%
  1.3068 +  \def\ss{ss}%
  1.3069 +  \def\exclamdown{!}%
  1.3070 +  \def\questiondown{?}%
  1.3071 +  %
  1.3072 +  % Don't no-op \tt, since it isn't a user-level command
  1.3073 +  % and is used in the definitions of the active chars like <, >, |, etc.
  1.3074 +  % Likewise with the other plain tex font commands.
  1.3075 +  %\let\tt=\asis
  1.3076 +  %
  1.3077 +  % Texinfo font commands.
  1.3078 +  \let\b=\asis
  1.3079 +  \let\i=\asis
  1.3080 +  \let\r=\asis
  1.3081 +  \let\sc=\asis
  1.3082 +  \let\t=\asis
  1.3083 +  %
  1.3084 +  \let\TeX=\indexdummytex
  1.3085 +  \let\acronym=\asis
  1.3086 +  \let\cite=\asis
  1.3087 +  \let\code=\asis
  1.3088 +  \let\command=\asis
  1.3089 +  \let\dfn=\asis
  1.3090 +  \let\dots=\indexdummydots
  1.3091 +  \let\emph=\asis
  1.3092 +  \let\env=\asis
  1.3093 +  \let\file=\asis
  1.3094 +  \let\kbd=\asis
  1.3095 +  \let\key=\asis
  1.3096 +  \let\math=\asis
  1.3097 +  \let\option=\asis
  1.3098 +  \let\samp=\asis
  1.3099 +  \let\strong=\asis
  1.3100 +  \let\uref=\asis
  1.3101 +  \let\url=\asis
  1.3102 +  \let\var=\asis
  1.3103 +  \let\w=\asis
  1.3104 +}
  1.3105 +
  1.3106 +\let\indexbackslash=0  %overridden during \printindex.
  1.3107 +\let\SETmarginindex=\relax % put index entries in margin (undocumented)?
  1.3108 +
  1.3109 +% For \ifx comparisons.
  1.3110 +\def\emptymacro{\empty}
  1.3111 +
  1.3112 +% Most index entries go through here, but \dosubind is the general case.
  1.3113 +%
  1.3114 +\def\doind#1#2{\dosubind{#1}{#2}\empty}
  1.3115 +
  1.3116 +% Workhorse for all \fooindexes.
  1.3117 +% #1 is name of index, #2 is stuff to put there, #3 is subentry --
  1.3118 +% \empty if called from \doind, as we usually are.  The main exception
  1.3119 +% is with defuns, which call us directly.
  1.3120 +%
  1.3121 +\def\dosubind#1#2#3{%
  1.3122 +  % Put the index entry in the margin if desired.
  1.3123 +  \ifx\SETmarginindex\relax\else
  1.3124 +    \insert\margin{\hbox{\vrule height8pt depth3pt width0pt #2}}%
  1.3125 +  \fi
  1.3126 +  {%
  1.3127 +    \count255=\lastpenalty
  1.3128 +    {%
  1.3129 +      \indexdummies % Must do this here, since \bf, etc expand at this stage
  1.3130 +      \escapechar=`\\
  1.3131 +      {%
  1.3132 +        \let\folio = 0% We will expand all macros now EXCEPT \folio.
  1.3133 +        \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
  1.3134 +        % so it will be output as is; and it will print as backslash.
  1.3135 +        %
  1.3136 +        % The main index entry text.
  1.3137 +        \toks0 = {#2}%
  1.3138 +        %
  1.3139 +        % If third arg is present, precede it with space in sort key.
  1.3140 +        \def\thirdarg{#3}%
  1.3141 +        \ifx\thirdarg\emptymacro \else
  1.3142 +           % If the third (subentry) arg is present, add it to the index
  1.3143 +           % line to write.
  1.3144 +          \toks0 = \expandafter{\the\toks0 \space #3}%
  1.3145 +        \fi
  1.3146 +        %
  1.3147 +        % Process the index entry with all font commands turned off, to
  1.3148 +        % get the string to sort by.
  1.3149 +        {\indexnofonts
  1.3150 +         \edef\temp{\the\toks0}% need full expansion
  1.3151 +         \xdef\indexsorttmp{\temp}%
  1.3152 +        }%
  1.3153 +        %
  1.3154 +        % Set up the complete index entry, with both the sort key and
  1.3155 +        % the original text, including any font commands.  We write
  1.3156 +        % three arguments to \entry to the .?? file (four in the
  1.3157 +        % subentry case), texindex reduces to two when writing the .??s
  1.3158 +        % sorted result.
  1.3159 +        \edef\temp{%
  1.3160 +          \write\csname#1indfile\endcsname{%
  1.3161 +            \realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}%
  1.3162 +        }%
  1.3163 +        %
  1.3164 +        % If a skip is the last thing on the list now, preserve it
  1.3165 +        % by backing up by \lastskip, doing the \write, then inserting
  1.3166 +        % the skip again.  Otherwise, the whatsit generated by the
  1.3167 +        % \write will make \lastskip zero.  The result is that sequences
  1.3168 +        % like this:
  1.3169 +        % @end defun
  1.3170 +        % @tindex whatever
  1.3171 +        % @defun ...
  1.3172 +        % will have extra space inserted, because the \medbreak in the
  1.3173 +        % start of the @defun won't see the skip inserted by the @end of
  1.3174 +        % the previous defun.
  1.3175 +        %
  1.3176 +        % But don't do any of this if we're not in vertical mode.  We
  1.3177 +        % don't want to do a \vskip and prematurely end a paragraph.
  1.3178 +        %
  1.3179 +        % Avoid page breaks due to these extra skips, too.
  1.3180 +        %
  1.3181 +        \iflinks
  1.3182 +          \ifvmode
  1.3183 +            \skip0 = \lastskip
  1.3184 +            \ifdim\lastskip = 0pt \else \nobreak\vskip-\skip0 \fi
  1.3185 +          \fi
  1.3186 +          %
  1.3187 +          \temp % do the write
  1.3188 +          %
  1.3189 +          \ifvmode \ifdim\skip0 = 0pt \else \nobreak\vskip\skip0 \fi \fi
  1.3190 +        \fi
  1.3191 +      }%
  1.3192 +    }%
  1.3193 +    \penalty\count255
  1.3194 +  }%
  1.3195 +}
  1.3196 +
  1.3197 +% The index entry written in the file actually looks like
  1.3198 +%  \entry {sortstring}{page}{topic}
  1.3199 +% or
  1.3200 +%  \entry {sortstring}{page}{topic}{subtopic}
  1.3201 +% The texindex program reads in these files and writes files
  1.3202 +% containing these kinds of lines:
  1.3203 +%  \initial {c}
  1.3204 +%     before the first topic whose initial is c
  1.3205 +%  \entry {topic}{pagelist}
  1.3206 +%     for a topic that is used without subtopics
  1.3207 +%  \primary {topic}
  1.3208 +%     for the beginning of a topic that is used with subtopics
  1.3209 +%  \secondary {subtopic}{pagelist}
  1.3210 +%     for each subtopic.
  1.3211 +
  1.3212 +% Define the user-accessible indexing commands
  1.3213 +% @findex, @vindex, @kindex, @cindex.
  1.3214 +
  1.3215 +\def\findex {\fnindex}
  1.3216 +\def\kindex {\kyindex}
  1.3217 +\def\cindex {\cpindex}
  1.3218 +\def\vindex {\vrindex}
  1.3219 +\def\tindex {\tpindex}
  1.3220 +\def\pindex {\pgindex}
  1.3221 +
  1.3222 +\def\cindexsub {\begingroup\obeylines\cindexsub}
  1.3223 +{\obeylines %
  1.3224 +\gdef\cindexsub "#1" #2^^M{\endgroup %
  1.3225 +\dosubind{cp}{#2}{#1}}}
  1.3226 +
  1.3227 +% Define the macros used in formatting output of the sorted index material.
  1.3228 +
  1.3229 +% @printindex causes a particular index (the ??s file) to get printed.
  1.3230 +% It does not print any chapter heading (usually an @unnumbered).
  1.3231 +%
  1.3232 +\def\printindex{\parsearg\doprintindex}
  1.3233 +\def\doprintindex#1{\begingroup
  1.3234 +  \dobreak \chapheadingskip{10000}%
  1.3235 +  %
  1.3236 +  \smallfonts \rm
  1.3237 +  \tolerance = 9500
  1.3238 +  \everypar = {}% don't want the \kern\-parindent from indentation suppression.
  1.3239 +  \indexbreaks
  1.3240 +  %
  1.3241 +  % See if the index file exists and is nonempty.
  1.3242 +  % Change catcode of @ here so that if the index file contains
  1.3243 +  % \initial {@}
  1.3244 +  % as its first line, TeX doesn't complain about mismatched braces
  1.3245 +  % (because it thinks @} is a control sequence).
  1.3246 +  \catcode`\@ = 11
  1.3247 +  \openin 1 \jobname.#1s
  1.3248 +  \ifeof 1
  1.3249 +    % \enddoublecolumns gets confused if there is no text in the index,
  1.3250 +    % and it loses the chapter title and the aux file entries for the
  1.3251 +    % index.  The easiest way to prevent this problem is to make sure
  1.3252 +    % there is some text.
  1.3253 +    \putwordIndexNonexistent
  1.3254 +  \else
  1.3255 +    %
  1.3256 +    % If the index file exists but is empty, then \openin leaves \ifeof
  1.3257 +    % false.  We have to make TeX try to read something from the file, so
  1.3258 +    % it can discover if there is anything in it.
  1.3259 +    \read 1 to \temp
  1.3260 +    \ifeof 1
  1.3261 +      \putwordIndexIsEmpty
  1.3262 +    \else
  1.3263 +      % Index files are almost Texinfo source, but we use \ as the escape
  1.3264 +      % character.  It would be better to use @, but that's too big a change
  1.3265 +      % to make right now.
  1.3266 +      \def\indexbackslash{\rawbackslashxx}%
  1.3267 +      \catcode`\\ = 0
  1.3268 +      \escapechar = `\\
  1.3269 +      \begindoublecolumns
  1.3270 +      \input \jobname.#1s
  1.3271 +      \enddoublecolumns
  1.3272 +    \fi
  1.3273 +  \fi
  1.3274 +  \closein 1
  1.3275 +\endgroup}
  1.3276 +
  1.3277 +% These macros are used by the sorted index file itself.
  1.3278 +% Change them to control the appearance of the index.
  1.3279 +
  1.3280 +\def\initial#1{{%
  1.3281 +  % Some minor font changes for the special characters.
  1.3282 +  \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
  1.3283 +  %
  1.3284 +  % Remove any glue we may have, we'll be inserting our own.
  1.3285 +  \removelastskip
  1.3286 +  %
  1.3287 +  % We like breaks before the index initials, so insert a bonus.
  1.3288 +  \penalty -300
  1.3289 +  %
  1.3290 +  % Typeset the initial.  Making this add up to a whole number of
  1.3291 +  % baselineskips increases the chance of the dots lining up from column
  1.3292 +  % to column.  It still won't often be perfect, because of the stretch
  1.3293 +  % we need before each entry, but it's better.
  1.3294 +  %
  1.3295 +  % No shrink because it confuses \balancecolumns.
  1.3296 +  \vskip 1.67\baselineskip plus .5\baselineskip
  1.3297 +  \leftline{\secbf #1}%
  1.3298 +  \vskip .33\baselineskip plus .1\baselineskip
  1.3299 +  %
  1.3300 +  % Do our best not to break after the initial.
  1.3301 +  \nobreak
  1.3302 +}}
  1.3303 +
  1.3304 +% This typesets a paragraph consisting of #1, dot leaders, and then #2
  1.3305 +% flush to the right margin.  It is used for index and table of contents
  1.3306 +% entries.  The paragraph is indented by \leftskip.
  1.3307 +%
  1.3308 +\def\entry#1#2{\begingroup
  1.3309 +  %
  1.3310 +  % Start a new paragraph if necessary, so our assignments below can't
  1.3311 +  % affect previous text.
  1.3312 +  \par
  1.3313 +  %
  1.3314 +  % Do not fill out the last line with white space.
  1.3315 +  \parfillskip = 0in
  1.3316 +  %
  1.3317 +  % No extra space above this paragraph.
  1.3318 +  \parskip = 0in
  1.3319 +  %
  1.3320 +  % Do not prefer a separate line ending with a hyphen to fewer lines.
  1.3321 +  \finalhyphendemerits = 0
  1.3322 +  %
  1.3323 +  % \hangindent is only relevant when the entry text and page number
  1.3324 +  % don't both fit on one line.  In that case, bob suggests starting the
  1.3325 +  % dots pretty far over on the line.  Unfortunately, a large
  1.3326 +  % indentation looks wrong when the entry text itself is broken across
  1.3327 +  % lines.  So we use a small indentation and put up with long leaders.
  1.3328 +  %
  1.3329 +  % \hangafter is reset to 1 (which is the value we want) at the start
  1.3330 +  % of each paragraph, so we need not do anything with that.
  1.3331 +  \hangindent = 2em
  1.3332 +  %
  1.3333 +  % When the entry text needs to be broken, just fill out the first line
  1.3334 +  % with blank space.
  1.3335 +  \rightskip = 0pt plus1fil
  1.3336 +  %
  1.3337 +  % A bit of stretch before each entry for the benefit of balancing columns.
  1.3338 +  \vskip 0pt plus1pt
  1.3339 +  %
  1.3340 +  % Start a ``paragraph'' for the index entry so the line breaking
  1.3341 +  % parameters we've set above will have an effect.
  1.3342 +  \noindent
  1.3343 +  %
  1.3344 +  % Insert the text of the index entry.  TeX will do line-breaking on it.
  1.3345 +  #1%
  1.3346 +  % The following is kludged to not output a line of dots in the index if
  1.3347 +  % there are no page numbers.  The next person who breaks this will be
  1.3348 +  % cursed by a Unix daemon.
  1.3349 +  \def\tempa{{\rm }}%
  1.3350 +  \def\tempb{#2}%
  1.3351 +  \edef\tempc{\tempa}%
  1.3352 +  \edef\tempd{\tempb}%
  1.3353 +  \ifx\tempc\tempd\ \else%
  1.3354 +    %
  1.3355 +    % If we must, put the page number on a line of its own, and fill out
  1.3356 +    % this line with blank space.  (The \hfil is overwhelmed with the
  1.3357 +    % fill leaders glue in \indexdotfill if the page number does fit.)
  1.3358 +    \hfil\penalty50
  1.3359 +    \null\nobreak\indexdotfill % Have leaders before the page number.
  1.3360 +    %
  1.3361 +    % The `\ ' here is removed by the implicit \unskip that TeX does as
  1.3362 +    % part of (the primitive) \par.  Without it, a spurious underfull
  1.3363 +    % \hbox ensues.
  1.3364 +    \ifpdf
  1.3365 +      \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
  1.3366 +    \else
  1.3367 +      \ #2% The page number ends the paragraph.
  1.3368 +    \fi
  1.3369 +  \fi%
  1.3370 +  \par
  1.3371 +\endgroup}
  1.3372 +
  1.3373 +% Like \dotfill except takes at least 1 em.
  1.3374 +\def\indexdotfill{\cleaders
  1.3375 +  \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill}
  1.3376 +
  1.3377 +\def\primary #1{\line{#1\hfil}}
  1.3378 +
  1.3379 +\newskip\secondaryindent \secondaryindent=0.5cm
  1.3380 +\def\secondary#1#2{{%
  1.3381 +  \parfillskip=0in
  1.3382 +  \parskip=0in
  1.3383 +  \hangindent=1in
  1.3384 +  \hangafter=1
  1.3385 +  \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill
  1.3386 +  \ifpdf
  1.3387 +    \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
  1.3388 +  \else
  1.3389 +    #2
  1.3390 +  \fi
  1.3391 +  \par
  1.3392 +}}
  1.3393 +
  1.3394 +% Define two-column mode, which we use to typeset indexes.
  1.3395 +% Adapted from the TeXbook, page 416, which is to say,
  1.3396 +% the manmac.tex format used to print the TeXbook itself.
  1.3397 +\catcode`\@=11
  1.3398 +
  1.3399 +\newbox\partialpage
  1.3400 +\newdimen\doublecolumnhsize
  1.3401 +
  1.3402 +\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
  1.3403 +  % Grab any single-column material above us.
  1.3404 +  \output = {%
  1.3405 +    %
  1.3406 +    % Here is a possibility not foreseen in manmac: if we accumulate a
  1.3407 +    % whole lot of material, we might end up calling this \output
  1.3408 +    % routine twice in a row (see the doublecol-lose test, which is
  1.3409 +    % essentially a couple of indexes with @setchapternewpage off).  In
  1.3410 +    % that case we just ship out what is in \partialpage with the normal
  1.3411 +    % output routine.  Generally, \partialpage will be empty when this
  1.3412 +    % runs and this will be a no-op.  See the indexspread.tex test case.
  1.3413 +    \ifvoid\partialpage \else
  1.3414 +      \onepageout{\pagecontents\partialpage}%
  1.3415 +    \fi
  1.3416 +    %
  1.3417 +    \global\setbox\partialpage = \vbox{%
  1.3418 +      % Unvbox the main output page.
  1.3419 +      \unvbox\PAGE
  1.3420 +      \kern-\topskip \kern\baselineskip
  1.3421 +    }%
  1.3422 +  }%
  1.3423 +  \eject % run that output routine to set \partialpage
  1.3424 +  %
  1.3425 +  % Use the double-column output routine for subsequent pages.
  1.3426 +  \output = {\doublecolumnout}%
  1.3427 +  %
  1.3428 +  % Change the page size parameters.  We could do this once outside this
  1.3429 +  % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
  1.3430 +  % format, but then we repeat the same computation.  Repeating a couple
  1.3431 +  % of assignments once per index is clearly meaningless for the
  1.3432 +  % execution time, so we may as well do it in one place.
  1.3433 +  %
  1.3434 +  % First we halve the line length, less a little for the gutter between
  1.3435 +  % the columns.  We compute the gutter based on the line length, so it
  1.3436 +  % changes automatically with the paper format.  The magic constant
  1.3437 +  % below is chosen so that the gutter has the same value (well, +-<1pt)
  1.3438 +  % as it did when we hard-coded it.
  1.3439 +  %
  1.3440 +  % We put the result in a separate register, \doublecolumhsize, so we
  1.3441 +  % can restore it in \pagesofar, after \hsize itself has (potentially)
  1.3442 +  % been clobbered.
  1.3443 +  %
  1.3444 +  \doublecolumnhsize = \hsize
  1.3445 +    \advance\doublecolumnhsize by -.04154\hsize
  1.3446 +    \divide\doublecolumnhsize by 2
  1.3447 +  \hsize = \doublecolumnhsize
  1.3448 +  %
  1.3449 +  % Double the \vsize as well.  (We don't need a separate register here,
  1.3450 +  % since nobody clobbers \vsize.)
  1.3451 +  \vsize = 2\vsize
  1.3452 +}
  1.3453 +
  1.3454 +% The double-column output routine for all double-column pages except
  1.3455 +% the last.
  1.3456 +%
  1.3457 +\def\doublecolumnout{%
  1.3458 +  \splittopskip=\topskip \splitmaxdepth=\maxdepth
  1.3459 +  % Get the available space for the double columns -- the normal
  1.3460 +  % (undoubled) page height minus any material left over from the
  1.3461 +  % previous page.
  1.3462 +  \dimen@ = \vsize
  1.3463 +  \divide\dimen@ by 2
  1.3464 +  \advance\dimen@ by -\ht\partialpage
  1.3465 +  %
  1.3466 +  % box0 will be the left-hand column, box2 the right.
  1.3467 +  \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
  1.3468 +  \onepageout\pagesofar
  1.3469 +  \unvbox255
  1.3470 +  \penalty\outputpenalty
  1.3471 +}
  1.3472 +%
  1.3473 +% Re-output the contents of the output page -- any previous material,
  1.3474 +% followed by the two boxes we just split, in box0 and box2.
  1.3475 +\def\pagesofar{%
  1.3476 +  \unvbox\partialpage
  1.3477 +  %
  1.3478 +  \hsize = \doublecolumnhsize
  1.3479 +  \wd0=\hsize \wd2=\hsize
  1.3480 +  \hbox to\pagewidth{\box0\hfil\box2}%
  1.3481 +}
  1.3482 +%
  1.3483 +% All done with double columns.
  1.3484 +\def\enddoublecolumns{%
  1.3485 +  \output = {%
  1.3486 +    % Split the last of the double-column material.  Leave it on the
  1.3487 +    % current page, no automatic page break.
  1.3488 +    \balancecolumns
  1.3489 +    %
  1.3490 +    % If we end up splitting too much material for the current page,
  1.3491 +    % though, there will be another page break right after this \output
  1.3492 +    % invocation ends.  Having called \balancecolumns once, we do not
  1.3493 +    % want to call it again.  Therefore, reset \output to its normal
  1.3494 +    % definition right away.  (We hope \balancecolumns will never be
  1.3495 +    % called on to balance too much material, but if it is, this makes
  1.3496 +    % the output somewhat more palatable.)
  1.3497 +    \global\output = {\onepageout{\pagecontents\PAGE}}%
  1.3498 +  }%
  1.3499 +  \eject
  1.3500 +  \endgroup % started in \begindoublecolumns
  1.3501 +  %
  1.3502 +  % \pagegoal was set to the doubled \vsize above, since we restarted
  1.3503 +  % the current page.  We're now back to normal single-column
  1.3504 +  % typesetting, so reset \pagegoal to the normal \vsize (after the
  1.3505 +  % \endgroup where \vsize got restored).
  1.3506 +  \pagegoal = \vsize
  1.3507 +}
  1.3508 +%
  1.3509 +% Called at the end of the double column material.
  1.3510 +\def\balancecolumns{%
  1.3511 +  \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120.
  1.3512 +  \dimen@ = \ht0
  1.3513 +  \advance\dimen@ by \topskip
  1.3514 +  \advance\dimen@ by-\baselineskip
  1.3515 +  \divide\dimen@ by 2 % target to split to
  1.3516 +  %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}%
  1.3517 +  \splittopskip = \topskip
  1.3518 +  % Loop until we get a decent breakpoint.
  1.3519 +  {%
  1.3520 +    \vbadness = 10000
  1.3521 +    \loop
  1.3522 +      \global\setbox3 = \copy0
  1.3523 +      \global\setbox1 = \vsplit3 to \dimen@
  1.3524 +    \ifdim\ht3>\dimen@
  1.3525 +      \global\advance\dimen@ by 1pt
  1.3526 +    \repeat
  1.3527 +  }%
  1.3528 +  %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}%
  1.3529 +  \setbox0=\vbox to\dimen@{\unvbox1}%
  1.3530 +  \setbox2=\vbox to\dimen@{\unvbox3}%
  1.3531 +  %
  1.3532 +  \pagesofar
  1.3533 +}
  1.3534 +\catcode`\@ = \other
  1.3535 +
  1.3536 +
  1.3537 +\message{sectioning,}
  1.3538 +% Chapters, sections, etc.
  1.3539 +
  1.3540 +\newcount\chapno
  1.3541 +\newcount\secno        \secno=0
  1.3542 +\newcount\subsecno     \subsecno=0
  1.3543 +\newcount\subsubsecno  \subsubsecno=0
  1.3544 +
  1.3545 +% This counter is funny since it counts through charcodes of letters A, B, ...
  1.3546 +\newcount\appendixno  \appendixno = `\@
  1.3547 +% \def\appendixletter{\char\the\appendixno}
  1.3548 +% We do the following for the sake of pdftex, which needs the actual
  1.3549 +% letter in the expansion, not just typeset.
  1.3550 +\def\appendixletter{%
  1.3551 +  \ifnum\appendixno=`A A%
  1.3552 +  \else\ifnum\appendixno=`B B%
  1.3553 +  \else\ifnum\appendixno=`C C%
  1.3554 +  \else\ifnum\appendixno=`D D%
  1.3555 +  \else\ifnum\appendixno=`E E%
  1.3556 +  \else\ifnum\appendixno=`F F%
  1.3557 +  \else\ifnum\appendixno=`G G%
  1.3558 +  \else\ifnum\appendixno=`H H%
  1.3559 +  \else\ifnum\appendixno=`I I%
  1.3560 +  \else\ifnum\appendixno=`J J%
  1.3561 +  \else\ifnum\appendixno=`K K%
  1.3562 +  \else\ifnum\appendixno=`L L%
  1.3563 +  \else\ifnum\appendixno=`M M%
  1.3564 +  \else\ifnum\appendixno=`N N%
  1.3565 +  \else\ifnum\appendixno=`O O%
  1.3566 +  \else\ifnum\appendixno=`P P%
  1.3567 +  \else\ifnum\appendixno=`Q Q%
  1.3568 +  \else\ifnum\appendixno=`R R%
  1.3569 +  \else\ifnum\appendixno=`S S%
  1.3570 +  \else\ifnum\appendixno=`T T%
  1.3571 +  \else\ifnum\appendixno=`U U%
  1.3572 +  \else\ifnum\appendixno=`V V%
  1.3573 +  \else\ifnum\appendixno=`W W%
  1.3574 +  \else\ifnum\appendixno=`X X%
  1.3575 +  \else\ifnum\appendixno=`Y Y%
  1.3576 +  \else\ifnum\appendixno=`Z Z%
  1.3577 +  % The \the is necessary, despite appearances, because \appendixletter is
  1.3578 +  % expanded while writing the .toc file.  \char\appendixno is not
  1.3579 +  % expandable, thus it is written literally, thus all appendixes come out
  1.3580 +  % with the same letter (or @) in the toc without it.
  1.3581 +  \else\char\the\appendixno
  1.3582 +  \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
  1.3583 +  \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
  1.3584 +
  1.3585 +% Each @chapter defines this as the name of the chapter.
  1.3586 +% page headings and footings can use it.  @section does likewise.
  1.3587 +\def\thischapter{}
  1.3588 +\def\thissection{}
  1.3589 +
  1.3590 +\newcount\absseclevel % used to calculate proper heading level
  1.3591 +\newcount\secbase\secbase=0 % @raise/lowersections modify this count
  1.3592 +
  1.3593 +% @raisesections: treat @section as chapter, @subsection as section, etc.
  1.3594 +\def\raisesections{\global\advance\secbase by -1}
  1.3595 +\let\up=\raisesections % original BFox name
  1.3596 +
  1.3597 +% @lowersections: treat @chapter as section, @section as subsection, etc.
  1.3598 +\def\lowersections{\global\advance\secbase by 1}
  1.3599 +\let\down=\lowersections % original BFox name
  1.3600 +
  1.3601 +% Choose a numbered-heading macro
  1.3602 +% #1 is heading level if unmodified by @raisesections or @lowersections
  1.3603 +% #2 is text for heading
  1.3604 +\def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
  1.3605 +\ifcase\absseclevel
  1.3606 +  \chapterzzz{#2}
  1.3607 +\or
  1.3608 +  \seczzz{#2}
  1.3609 +\or
  1.3610 +  \numberedsubseczzz{#2}
  1.3611 +\or
  1.3612 +  \numberedsubsubseczzz{#2}
  1.3613 +\else
  1.3614 +  \ifnum \absseclevel<0
  1.3615 +    \chapterzzz{#2}
  1.3616 +  \else
  1.3617 +    \numberedsubsubseczzz{#2}
  1.3618 +  \fi
  1.3619 +\fi
  1.3620 +\suppressfirstparagraphindent
  1.3621 +}
  1.3622 +
  1.3623 +% like \numhead, but chooses appendix heading levels
  1.3624 +\def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
  1.3625 +\ifcase\absseclevel
  1.3626 +  \appendixzzz{#2}
  1.3627 +\or
  1.3628 +  \appendixsectionzzz{#2}
  1.3629 +\or
  1.3630 +  \appendixsubseczzz{#2}
  1.3631 +\or
  1.3632 +  \appendixsubsubseczzz{#2}
  1.3633 +\else
  1.3634 +  \ifnum \absseclevel<0
  1.3635 +    \appendixzzz{#2}
  1.3636 +  \else
  1.3637 +    \appendixsubsubseczzz{#2}
  1.3638 +  \fi
  1.3639 +\fi
  1.3640 +\suppressfirstparagraphindent
  1.3641 +}
  1.3642 +
  1.3643 +% like \numhead, but chooses numberless heading levels
  1.3644 +\def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
  1.3645 +\ifcase\absseclevel
  1.3646 +  \unnumberedzzz{#2}
  1.3647 +\or
  1.3648 +  \unnumberedseczzz{#2}
  1.3649 +\or
  1.3650 +  \unnumberedsubseczzz{#2}
  1.3651 +\or
  1.3652 +  \unnumberedsubsubseczzz{#2}
  1.3653 +\else
  1.3654 +  \ifnum \absseclevel<0
  1.3655 +    \unnumberedzzz{#2}
  1.3656 +  \else
  1.3657 +    \unnumberedsubsubseczzz{#2}
  1.3658 +  \fi
  1.3659 +\fi
  1.3660 +\suppressfirstparagraphindent
  1.3661 +}
  1.3662 +
  1.3663 +% @chapter, @appendix, @unnumbered.
  1.3664 +\def\thischaptername{No Chapter Title}
  1.3665 +\outer\def\chapter{\parsearg\chapteryyy}
  1.3666 +\def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz
  1.3667 +\def\chapterzzz #1{%
  1.3668 +  \secno=0 \subsecno=0 \subsubsecno=0
  1.3669 +  \global\advance \chapno by 1 \message{\putwordChapter\space \the\chapno}%
  1.3670 +  \chapmacro {#1}{\the\chapno}%
  1.3671 +  \gdef\thissection{#1}%
  1.3672 +  \gdef\thischaptername{#1}%
  1.3673 +  % We don't substitute the actual chapter name into \thischapter
  1.3674 +  % because we don't want its macros evaluated now.
  1.3675 +  \xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}%
  1.3676 +  \writetocentry{chap}{#1}{{\the\chapno}}
  1.3677 +  \donoderef
  1.3678 +  \global\let\section = \numberedsec
  1.3679 +  \global\let\subsection = \numberedsubsec
  1.3680 +  \global\let\subsubsection = \numberedsubsubsec
  1.3681 +}
  1.3682 +
  1.3683 +% we use \chapno to avoid indenting back
  1.3684 +\def\appendixbox#1{%
  1.3685 +  \setbox0 = \hbox{\putwordAppendix{} \the\chapno}%
  1.3686 +  \hbox to \wd0{#1\hss}}
  1.3687 +
  1.3688 +\outer\def\appendix{\parsearg\appendixyyy}
  1.3689 +\def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz
  1.3690 +\def\appendixzzz #1{%
  1.3691 +  \secno=0 \subsecno=0 \subsubsecno=0
  1.3692 +  \global\advance \appendixno by 1
  1.3693 +  \message{\putwordAppendix\space \appendixletter}%
  1.3694 +  \chapmacro {#1}{\appendixbox{\putwordAppendix{} \appendixletter}}%
  1.3695 +  \gdef\thissection{#1}%
  1.3696 +  \gdef\thischaptername{#1}%
  1.3697 +  \xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}%
  1.3698 +  \writetocentry{appendix}{#1}{{\appendixletter}}
  1.3699 +  \appendixnoderef
  1.3700 +  \global\let\section = \appendixsec
  1.3701 +  \global\let\subsection = \appendixsubsec
  1.3702 +  \global\let\subsubsection = \appendixsubsubsec
  1.3703 +}
  1.3704 +
  1.3705 +% @centerchap is like @unnumbered, but the heading is centered.
  1.3706 +\outer\def\centerchap{\parsearg\centerchapyyy}
  1.3707 +\def\centerchapyyy #1{{\let\unnumbchapmacro=\centerchapmacro \unnumberedyyy{#1}}}
  1.3708 +
  1.3709 +% @top is like @unnumbered.
  1.3710 +\outer\def\top{\parsearg\unnumberedyyy}
  1.3711 +
  1.3712 +\outer\def\unnumbered{\parsearg\unnumberedyyy}
  1.3713 +\def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz
  1.3714 +\def\unnumberedzzz #1{%
  1.3715 +  \secno=0 \subsecno=0 \subsubsecno=0
  1.3716 +  %
  1.3717 +  % This used to be simply \message{#1}, but TeX fully expands the
  1.3718 +  % argument to \message.  Therefore, if #1 contained @-commands, TeX
  1.3719 +  % expanded them.  For example, in `@unnumbered The @cite{Book}', TeX
  1.3720 +  % expanded @cite (which turns out to cause errors because \cite is meant
  1.3721 +  % to be executed, not expanded).
  1.3722 +  %
  1.3723 +  % Anyway, we don't want the fully-expanded definition of @cite to appear
  1.3724 +  % as a result of the \message, we just want `@cite' itself.  We use
  1.3725 +  % \the<toks register> to achieve this: TeX expands \the<toks> only once,
  1.3726 +  % simply yielding the contents of <toks register>.  (We also do this for
  1.3727 +  % the toc entries.)
  1.3728 +  \toks0 = {#1}\message{(\the\toks0)}%
  1.3729 +  %
  1.3730 +  \unnumbchapmacro {#1}%
  1.3731 +  \gdef\thischapter{#1}\gdef\thissection{#1}%
  1.3732 +  \writetocentry{unnumbchap}{#1}{{\the\chapno}}
  1.3733 +  \unnumbnoderef
  1.3734 +  \global\let\section = \unnumberedsec
  1.3735 +  \global\let\subsection = \unnumberedsubsec
  1.3736 +  \global\let\subsubsection = \unnumberedsubsubsec
  1.3737 +}
  1.3738 +
  1.3739 +% Sections.
  1.3740 +\outer\def\numberedsec{\parsearg\secyyy}
  1.3741 +\def\secyyy #1{\numhead1{#1}} % normally calls seczzz
  1.3742 +\def\seczzz #1{%
  1.3743 +  \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
  1.3744 +  \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
  1.3745 +  \writetocentry{sec}{#1}{{\the\chapno}{\the\secno}}
  1.3746 +  \donoderef
  1.3747 +  \nobreak
  1.3748 +}
  1.3749 +
  1.3750 +\outer\def\appendixsection{\parsearg\appendixsecyyy}
  1.3751 +\outer\def\appendixsec{\parsearg\appendixsecyyy}
  1.3752 +\def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz
  1.3753 +\def\appendixsectionzzz #1{%
  1.3754 +  \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
  1.3755 +  \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
  1.3756 +  \writetocentry{sec}{#1}{{\appendixletter}{\the\secno}}
  1.3757 +  \appendixnoderef
  1.3758 +  \nobreak
  1.3759 +}
  1.3760 +
  1.3761 +\outer\def\unnumberedsec{\parsearg\unnumberedsecyyy}
  1.3762 +\def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz
  1.3763 +\def\unnumberedseczzz #1{%
  1.3764 +  \plainsecheading {#1}\gdef\thissection{#1}%
  1.3765 +  \writetocentry{unnumbsec}{#1}{{\the\chapno}{\the\secno}}
  1.3766 +  \unnumbnoderef
  1.3767 +  \nobreak
  1.3768 +}
  1.3769 +
  1.3770 +% Subsections.
  1.3771 +\outer\def\numberedsubsec{\parsearg\numberedsubsecyyy}
  1.3772 +\def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz
  1.3773 +\def\numberedsubseczzz #1{%
  1.3774 +  \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
  1.3775 +  \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
  1.3776 +  \writetocentry{subsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}}
  1.3777 +  \donoderef
  1.3778 +  \nobreak
  1.3779 +}
  1.3780 +
  1.3781 +\outer\def\appendixsubsec{\parsearg\appendixsubsecyyy}
  1.3782 +\def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz
  1.3783 +\def\appendixsubseczzz #1{%
  1.3784 +  \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
  1.3785 +  \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
  1.3786 +  \writetocentry{subsec}{#1}{{\appendixletter}{\the\secno}{\the\subsecno}}
  1.3787 +  \appendixnoderef
  1.3788 +  \nobreak
  1.3789 +}
  1.3790 +
  1.3791 +\outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy}
  1.3792 +\def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz
  1.3793 +\def\unnumberedsubseczzz #1{%
  1.3794 +  \plainsubsecheading {#1}\gdef\thissection{#1}%
  1.3795 +  \writetocentry{unnumbsubsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}}
  1.3796 +  \unnumbnoderef
  1.3797 +  \nobreak
  1.3798 +}
  1.3799 +
  1.3800 +% Subsubsections.
  1.3801 +\outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy}
  1.3802 +\def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz
  1.3803 +\def\numberedsubsubseczzz #1{%
  1.3804 +  \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
  1.3805 +  \subsubsecheading {#1}
  1.3806 +    {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
  1.3807 +  \writetocentry{subsubsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}}
  1.3808 +  \donoderef
  1.3809 +  \nobreak
  1.3810 +}
  1.3811 +
  1.3812 +\outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy}
  1.3813 +\def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz
  1.3814 +\def\appendixsubsubseczzz #1{%
  1.3815 +  \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
  1.3816 +  \subsubsecheading {#1}
  1.3817 +    {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
  1.3818 +  \writetocentry{subsubsec}{#1}{{\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}}
  1.3819 +  \appendixnoderef
  1.3820 +  \nobreak
  1.3821 +}
  1.3822 +
  1.3823 +\outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy}
  1.3824 +\def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz
  1.3825 +\def\unnumberedsubsubseczzz #1{%
  1.3826 +  \plainsubsubsecheading {#1}\gdef\thissection{#1}%
  1.3827 +  \writetocentry{unnumbsubsubsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}}
  1.3828 +  \unnumbnoderef
  1.3829 +  \nobreak
  1.3830 +}
  1.3831 +
  1.3832 +% These are variants which are not "outer", so they can appear in @ifinfo.
  1.3833 +% Actually, they should now be obsolete; ordinary section commands should work.
  1.3834 +\def\infotop{\parsearg\unnumberedzzz}
  1.3835 +\def\infounnumbered{\parsearg\unnumberedzzz}
  1.3836 +\def\infounnumberedsec{\parsearg\unnumberedseczzz}
  1.3837 +\def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz}
  1.3838 +\def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
  1.3839 +
  1.3840 +\def\infoappendix{\parsearg\appendixzzz}
  1.3841 +\def\infoappendixsec{\parsearg\appendixseczzz}
  1.3842 +\def\infoappendixsubsec{\parsearg\appendixsubseczzz}
  1.3843 +\def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz}
  1.3844 +
  1.3845 +\def\infochapter{\parsearg\chapterzzz}
  1.3846 +\def\infosection{\parsearg\sectionzzz}
  1.3847 +\def\infosubsection{\parsearg\subsectionzzz}
  1.3848 +\def\infosubsubsection{\parsearg\subsubsectionzzz}
  1.3849 +
  1.3850 +% These macros control what the section commands do, according
  1.3851 +% to what kind of chapter we are in (ordinary, appendix, or unnumbered).
  1.3852 +% Define them by default for a numbered chapter.
  1.3853 +\global\let\section = \numberedsec
  1.3854 +\global\let\subsection = \numberedsubsec
  1.3855 +\global\let\subsubsection = \numberedsubsubsec
  1.3856 +
  1.3857 +% Define @majorheading, @heading and @subheading
  1.3858 +
  1.3859 +% NOTE on use of \vbox for chapter headings, section headings, and such:
  1.3860 +%       1) We use \vbox rather than the earlier \line to permit
  1.3861 +%          overlong headings to fold.
  1.3862 +%       2) \hyphenpenalty is set to 10000 because hyphenation in a
  1.3863 +%          heading is obnoxious; this forbids it.
  1.3864 +%       3) Likewise, headings look best if no \parindent is used, and
  1.3865 +%          if justification is not attempted.  Hence \raggedright.
  1.3866 +
  1.3867 +
  1.3868 +\def\majorheading{%
  1.3869 +  {\advance\chapheadingskip by 10pt \chapbreak }%
  1.3870 +  \parsearg\chapheadingzzz
  1.3871 +}
  1.3872 +
  1.3873 +\def\chapheading{\chapbreak \parsearg\chapheadingzzz}
  1.3874 +\def\chapheadingzzz #1{%
  1.3875 +  {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  1.3876 +                    \parindent=0pt\raggedright
  1.3877 +                    \rm #1\hfill}}%
  1.3878 +  \bigskip \par\penalty 200\relax
  1.3879 +  \suppressfirstparagraphindent
  1.3880 +}
  1.3881 +
  1.3882 +% @heading, @subheading, @subsubheading.
  1.3883 +\def\heading{\parsearg\doheading}
  1.3884 +\def\subheading{\parsearg\dosubheading}
  1.3885 +\def\subsubheading{\parsearg\dosubsubheading}
  1.3886 +\def\doheading#1{\plainsecheading{#1}\suppressfirstparagraphindent}
  1.3887 +\def\dosubheading#1{\plainsubsecheading{#1}\suppressfirstparagraphindent}
  1.3888 +\def\dosubsubheading#1{\plainsubsubsecheading{#1}\suppressfirstparagraphindent}
  1.3889 +
  1.3890 +% These macros generate a chapter, section, etc. heading only
  1.3891 +% (including whitespace, linebreaking, etc. around it),
  1.3892 +% given all the information in convenient, parsed form.
  1.3893 +
  1.3894 +%%% Args are the skip and penalty (usually negative)
  1.3895 +\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
  1.3896 +
  1.3897 +\def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
  1.3898 +
  1.3899 +%%% Define plain chapter starts, and page on/off switching for it
  1.3900 +% Parameter controlling skip before chapter headings (if needed)
  1.3901 +
  1.3902 +\newskip\chapheadingskip
  1.3903 +
  1.3904 +\def\chapbreak{\dobreak \chapheadingskip {-4000}}
  1.3905 +\def\chappager{\par\vfill\supereject}
  1.3906 +\def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
  1.3907 +
  1.3908 +\def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
  1.3909 +
  1.3910 +\def\CHAPPAGoff{%
  1.3911 +\global\let\contentsalignmacro = \chappager
  1.3912 +\global\let\pchapsepmacro=\chapbreak
  1.3913 +\global\let\pagealignmacro=\chappager}
  1.3914 +
  1.3915 +\def\CHAPPAGon{%
  1.3916 +\global\let\contentsalignmacro = \chappager
  1.3917 +\global\let\pchapsepmacro=\chappager
  1.3918 +\global\let\pagealignmacro=\chappager
  1.3919 +\global\def\HEADINGSon{\HEADINGSsingle}}
  1.3920 +
  1.3921 +\def\CHAPPAGodd{
  1.3922 +\global\let\contentsalignmacro = \chapoddpage
  1.3923 +\global\let\pchapsepmacro=\chapoddpage
  1.3924 +\global\let\pagealignmacro=\chapoddpage
  1.3925 +\global\def\HEADINGSon{\HEADINGSdouble}}
  1.3926 +
  1.3927 +\CHAPPAGon
  1.3928 +
  1.3929 +\def\CHAPFplain{
  1.3930 +\global\let\chapmacro=\chfplain
  1.3931 +\global\let\unnumbchapmacro=\unnchfplain
  1.3932 +\global\let\centerchapmacro=\centerchfplain}
  1.3933 +
  1.3934 +% Plain chapter opening.
  1.3935 +% #1 is the text, #2 the chapter number or empty if unnumbered.
  1.3936 +\def\chfplain#1#2{%
  1.3937 +  \pchapsepmacro
  1.3938 +  {%
  1.3939 +    \chapfonts \rm
  1.3940 +    \def\chapnum{#2}%
  1.3941 +    \setbox0 = \hbox{#2\ifx\chapnum\empty\else\enspace\fi}%
  1.3942 +    \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
  1.3943 +          \hangindent = \wd0 \centerparametersmaybe
  1.3944 +          \unhbox0 #1\par}%
  1.3945 +  }%
  1.3946 +  \nobreak\bigskip % no page break after a chapter title
  1.3947 +  \nobreak
  1.3948 +}
  1.3949 +
  1.3950 +% Plain opening for unnumbered.
  1.3951 +\def\unnchfplain#1{\chfplain{#1}{}}
  1.3952 +
  1.3953 +% @centerchap -- centered and unnumbered.
  1.3954 +\let\centerparametersmaybe = \relax
  1.3955 +\def\centerchfplain#1{{%
  1.3956 +  \def\centerparametersmaybe{%
  1.3957 +    \advance\rightskip by 3\rightskip
  1.3958 +    \leftskip = \rightskip
  1.3959 +    \parfillskip = 0pt
  1.3960 +  }%
  1.3961 +  \chfplain{#1}{}%
  1.3962 +}}
  1.3963 +
  1.3964 +\CHAPFplain % The default
  1.3965 +
  1.3966 +\def\unnchfopen #1{%
  1.3967 +\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  1.3968 +                       \parindent=0pt\raggedright
  1.3969 +                       \rm #1\hfill}}\bigskip \par\nobreak
  1.3970 +}
  1.3971 +
  1.3972 +\def\chfopen #1#2{\chapoddpage {\chapfonts
  1.3973 +\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
  1.3974 +\par\penalty 5000 %
  1.3975 +}
  1.3976 +
  1.3977 +\def\centerchfopen #1{%
  1.3978 +\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  1.3979 +                       \parindent=0pt
  1.3980 +                       \hfill {\rm #1}\hfill}}\bigskip \par\nobreak
  1.3981 +}
  1.3982 +
  1.3983 +\def\CHAPFopen{
  1.3984 +\global\let\chapmacro=\chfopen
  1.3985 +\global\let\unnumbchapmacro=\unnchfopen
  1.3986 +\global\let\centerchapmacro=\centerchfopen}
  1.3987 +
  1.3988 +
  1.3989 +% Section titles.
  1.3990 +\newskip\secheadingskip
  1.3991 +\def\secheadingbreak{\dobreak \secheadingskip {-1000}}
  1.3992 +\def\secheading#1#2#3{\sectionheading{sec}{#2.#3}{#1}}
  1.3993 +\def\plainsecheading#1{\sectionheading{sec}{}{#1}}
  1.3994 +
  1.3995 +% Subsection titles.
  1.3996 +\newskip \subsecheadingskip
  1.3997 +\def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
  1.3998 +\def\subsecheading#1#2#3#4{\sectionheading{subsec}{#2.#3.#4}{#1}}
  1.3999 +\def\plainsubsecheading#1{\sectionheading{subsec}{}{#1}}
  1.4000 +
  1.4001 +% Subsubsection titles.
  1.4002 +\let\subsubsecheadingskip = \subsecheadingskip
  1.4003 +\let\subsubsecheadingbreak = \subsecheadingbreak
  1.4004 +\def\subsubsecheading#1#2#3#4#5{\sectionheading{subsubsec}{#2.#3.#4.#5}{#1}}
  1.4005 +\def\plainsubsubsecheading#1{\sectionheading{subsubsec}{}{#1}}
  1.4006 +
  1.4007 +
  1.4008 +% Print any size section title.
  1.4009 +%
  1.4010 +% #1 is the section type (sec/subsec/subsubsec), #2 is the section
  1.4011 +% number (maybe empty), #3 the text.
  1.4012 +\def\sectionheading#1#2#3{%
  1.4013 +  {%
  1.4014 +    \expandafter\advance\csname #1headingskip\endcsname by \parskip
  1.4015 +    \csname #1headingbreak\endcsname
  1.4016 +  }%
  1.4017 +  {%
  1.4018 +    % Switch to the right set of fonts.
  1.4019 +    \csname #1fonts\endcsname \rm
  1.4020 +    %
  1.4021 +    % Only insert the separating space if we have a section number.
  1.4022 +    \def\secnum{#2}%
  1.4023 +    \setbox0 = \hbox{#2\ifx\secnum\empty\else\enspace\fi}%
  1.4024 +    %
  1.4025 +    \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
  1.4026 +          \hangindent = \wd0 % zero if no section number
  1.4027 +          \unhbox0 #3}%
  1.4028 +  }%
  1.4029 +  % Add extra space after the heading -- either a line space or a
  1.4030 +  % paragraph space, whichever is more.  (Some people like to set
  1.4031 +  % \parskip to large values for some reason.)  Don't allow stretch, though.
  1.4032 +  \nobreak
  1.4033 +  \ifdim\parskip>\normalbaselineskip
  1.4034 +    \kern\parskip
  1.4035 +  \else
  1.4036 +    \kern\normalbaselineskip
  1.4037 +  \fi
  1.4038 +  \nobreak
  1.4039 +}
  1.4040 +
  1.4041 +
  1.4042 +\message{toc,}
  1.4043 +% Table of contents.
  1.4044 +\newwrite\tocfile
  1.4045 +
  1.4046 +% Write an entry to the toc file, opening it if necessary.
  1.4047 +% Called from @chapter, etc.  We supply {\folio} at the end of the
  1.4048 +% argument, which will end up as the last argument to the \...entry macro.
  1.4049 +%
  1.4050 +% Usage: \writetocentry{chap}{The Name of The Game}{{\the\chapno}}
  1.4051 +% We open the .toc file for writing here instead of at @setfilename (or
  1.4052 +% any other fixed time) so that @contents can be anywhere in the document.
  1.4053 +%
  1.4054 +\newif\iftocfileopened
  1.4055 +\def\writetocentry#1#2#3{%
  1.4056 +  \iftocfileopened\else
  1.4057 +    \immediate\openout\tocfile = \jobname.toc
  1.4058 +    \global\tocfileopenedtrue
  1.4059 +  \fi
  1.4060 +  %
  1.4061 +  \iflinks
  1.4062 +    \toks0 = {#2}%
  1.4063 +    \edef\temp{\write\tocfile{\realbackslash #1entry{\the\toks0}#3{\folio}}}%
  1.4064 +    \temp
  1.4065 +  \fi
  1.4066 +  %
  1.4067 +  % Tell \shipout to create a page destination if we're doing pdf, which
  1.4068 +  % will be the target of the links in the table of contents.  We can't
  1.4069 +  % just do it on every page because the title pages are numbered 1 and
  1.4070 +  % 2 (the page numbers aren't printed), and so are the first two pages
  1.4071 +  % of the document.  Thus, we'd have two destinations named `1', and
  1.4072 +  % two named `2'.
  1.4073 +  \ifpdf \pdfmakepagedesttrue \fi
  1.4074 +}
  1.4075 +
  1.4076 +\newskip\contentsrightmargin \contentsrightmargin=1in
  1.4077 +\newcount\savepageno
  1.4078 +\newcount\lastnegativepageno \lastnegativepageno = -1
  1.4079 +
  1.4080 +% Finish up the main text and prepare to read what we've written
  1.4081 +% to \tocfile.
  1.4082 +%
  1.4083 +\def\startcontents#1{%
  1.4084 +   % If @setchapternewpage on, and @headings double, the contents should
  1.4085 +   % start on an odd page, unlike chapters.  Thus, we maintain
  1.4086 +   % \contentsalignmacro in parallel with \pagealignmacro.
  1.4087 +   % From: Torbjorn Granlund <tege@matematik.su.se>
  1.4088 +   \contentsalignmacro
  1.4089 +   \immediate\closeout\tocfile
  1.4090 +   %
  1.4091 +   % Don't need to put `Contents' or `Short Contents' in the headline.
  1.4092 +   % It is abundantly clear what they are.
  1.4093 +   \unnumbchapmacro{#1}\def\thischapter{}%
  1.4094 +   \savepageno = \pageno
  1.4095 +   \begingroup                  % Set up to handle contents files properly.
  1.4096 +      \catcode`\\=0  \catcode`\{=1  \catcode`\}=2  \catcode`\@=11
  1.4097 +      % We can't do this, because then an actual ^ in a section
  1.4098 +      % title fails, e.g., @chapter ^ -- exponentiation.  --karl, 9jul97.
  1.4099 +      %\catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi
  1.4100 +      \raggedbottom             % Worry more about breakpoints than the bottom.
  1.4101 +      \advance\hsize by -\contentsrightmargin % Don't use the full line length.
  1.4102 +      %
  1.4103 +      % Roman numerals for page numbers.
  1.4104 +      \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
  1.4105 +}
  1.4106 +
  1.4107 +
  1.4108 +% Normal (long) toc.
  1.4109 +\def\contents{%
  1.4110 +   \startcontents{\putwordTOC}%
  1.4111 +     \openin 1 \jobname.toc
  1.4112 +     \ifeof 1 \else
  1.4113 +       \closein 1
  1.4114 +       \input \jobname.toc
  1.4115 +     \fi
  1.4116 +     \vfill \eject
  1.4117 +     \contentsalignmacro % in case @setchapternewpage odd is in effect
  1.4118 +     \pdfmakeoutlines
  1.4119 +   \endgroup
  1.4120 +   \lastnegativepageno = \pageno
  1.4121 +   \global\pageno = \savepageno
  1.4122 +}
  1.4123 +
  1.4124 +% And just the chapters.
  1.4125 +\def\summarycontents{%
  1.4126 +   \startcontents{\putwordShortTOC}%
  1.4127 +      %
  1.4128 +      \let\chapentry = \shortchapentry
  1.4129 +      \let\appendixentry = \shortappendixentry
  1.4130 +      \let\unnumbchapentry = \shortunnumberedentry
  1.4131 +      % We want a true roman here for the page numbers.
  1.4132 +      \secfonts
  1.4133 +      \let\rm=\shortcontrm \let\bf=\shortcontbf
  1.4134 +      \let\sl=\shortcontsl \let\tt=\shortconttt
  1.4135 +      \rm
  1.4136 +      \hyphenpenalty = 10000
  1.4137 +      \advance\baselineskip by 1pt % Open it up a little.
  1.4138 +      \def\secentry ##1##2##3##4{}
  1.4139 +      \def\subsecentry ##1##2##3##4##5{}
  1.4140 +      \def\subsubsecentry ##1##2##3##4##5##6{}
  1.4141 +      \let\unnumbsecentry = \secentry
  1.4142 +      \let\unnumbsubsecentry = \subsecentry
  1.4143 +      \let\unnumbsubsubsecentry = \subsubsecentry
  1.4144 +      \openin 1 \jobname.toc
  1.4145 +      \ifeof 1 \else
  1.4146 +        \closein 1
  1.4147 +        \input \jobname.toc
  1.4148 +      \fi
  1.4149 +     \vfill \eject
  1.4150 +     \contentsalignmacro % in case @setchapternewpage odd is in effect
  1.4151 +   \endgroup
  1.4152 +   \lastnegativepageno = \pageno
  1.4153 +   \global\pageno = \savepageno
  1.4154 +}
  1.4155 +\let\shortcontents = \summarycontents
  1.4156 +
  1.4157 +\ifpdf
  1.4158 +  \pdfcatalog{/PageMode /UseOutlines}%
  1.4159 +\fi
  1.4160 +
  1.4161 +% These macros generate individual entries in the table of contents.
  1.4162 +% The first argument is the chapter or section name.
  1.4163 +% The last argument is the page number.
  1.4164 +% The arguments in between are the chapter number, section number, ...
  1.4165 +
  1.4166 +% Chapters, in the main contents.
  1.4167 +\def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}}
  1.4168 +%
  1.4169 +% Chapters, in the short toc.
  1.4170 +% See comments in \dochapentry re vbox and related settings.
  1.4171 +\def\shortchapentry#1#2#3{%
  1.4172 +  \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#3\egroup}%
  1.4173 +}
  1.4174 +
  1.4175 +% Appendices, in the main contents.
  1.4176 +\def\appendixentry#1#2#3{%
  1.4177 +  \dochapentry{\appendixbox{\putwordAppendix{} #2}\labelspace#1}{#3}}
  1.4178 +%
  1.4179 +% Appendices, in the short toc.
  1.4180 +\let\shortappendixentry = \shortchapentry
  1.4181 +
  1.4182 +% Typeset the label for a chapter or appendix for the short contents.
  1.4183 +% The arg is, e.g., `Appendix A' for an appendix, or `3' for a chapter.
  1.4184 +% We could simplify the code here by writing out an \appendixentry
  1.4185 +% command in the toc file for appendices, instead of using \chapentry
  1.4186 +% for both, but it doesn't seem worth it.
  1.4187 +%
  1.4188 +\newdimen\shortappendixwidth
  1.4189 +%
  1.4190 +\def\shortchaplabel#1{%
  1.4191 +  % This space should be enough, since a single number is .5em, and the
  1.4192 +  % widest letter (M) is 1em, at least in the Computer Modern fonts.
  1.4193 +  % But use \hss just in case.
  1.4194 +  % (This space doesn't include the extra space that gets added after
  1.4195 +  % the label; that gets put in by \shortchapentry above.)
  1.4196 +  \dimen0 = 1em
  1.4197 +  \hbox to \dimen0{#1\hss}%
  1.4198 +}
  1.4199 +
  1.4200 +% Unnumbered chapters.
  1.4201 +\def\unnumbchapentry#1#2#3{\dochapentry{#1}{#3}}
  1.4202 +\def\shortunnumberedentry#1#2#3{\tocentry{#1}{\doshortpageno\bgroup#3\egroup}}
  1.4203 +
  1.4204 +% Sections.
  1.4205 +\def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}}
  1.4206 +\def\unnumbsecentry#1#2#3#4{\dosecentry{#1}{#4}}
  1.4207 +
  1.4208 +% Subsections.
  1.4209 +\def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}}
  1.4210 +\def\unnumbsubsecentry#1#2#3#4#5{\dosubsecentry{#1}{#5}}
  1.4211 +
  1.4212 +% And subsubsections.
  1.4213 +\def\subsubsecentry#1#2#3#4#5#6{%
  1.4214 +  \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}}
  1.4215 +\def\unnumbsubsubsecentry#1#2#3#4#5#6{\dosubsubsecentry{#1}{#6}}
  1.4216 +
  1.4217 +% This parameter controls the indentation of the various levels.
  1.4218 +\newdimen\tocindent \tocindent = 3pc
  1.4219 +
  1.4220 +% Now for the actual typesetting. In all these, #1 is the text and #2 is the
  1.4221 +% page number.
  1.4222 +%
  1.4223 +% If the toc has to be broken over pages, we want it to be at chapters
  1.4224 +% if at all possible; hence the \penalty.
  1.4225 +\def\dochapentry#1#2{%
  1.4226 +   \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
  1.4227 +   \begingroup
  1.4228 +     \chapentryfonts
  1.4229 +     \tocentry{#1}{\dopageno\bgroup#2\egroup}%
  1.4230 +   \endgroup
  1.4231 +   \nobreak\vskip .25\baselineskip plus.1\baselineskip
  1.4232 +}
  1.4233 +
  1.4234 +\def\dosecentry#1#2{\begingroup
  1.4235 +  \secentryfonts \leftskip=\tocindent
  1.4236 +  \tocentry{#1}{\dopageno\bgroup#2\egroup}%
  1.4237 +\endgroup}
  1.4238 +
  1.4239 +\def\dosubsecentry#1#2{\begingroup
  1.4240 +  \subsecentryfonts \leftskip=2\tocindent
  1.4241 +  \tocentry{#1}{\dopageno\bgroup#2\egroup}%
  1.4242 +\endgroup}
  1.4243 +
  1.4244 +\def\dosubsubsecentry#1#2{\begingroup
  1.4245 +  \subsubsecentryfonts \leftskip=3\tocindent
  1.4246 +  \tocentry{#1}{\dopageno\bgroup#2\egroup}%
  1.4247 +\endgroup}
  1.4248 +
  1.4249 +% Final typesetting of a toc entry; we use the same \entry macro as for
  1.4250 +% the index entries, but we want to suppress hyphenation here.  (We
  1.4251 +% can't do that in the \entry macro, since index entries might consist
  1.4252 +% of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.)
  1.4253 +\def\tocentry#1#2{\begingroup
  1.4254 +  \vskip 0pt plus1pt % allow a little stretch for the sake of nice page breaks
  1.4255 +  % Do not use \turnoffactive in these arguments.  Since the toc is
  1.4256 +  % typeset in cmr, characters such as _ would come out wrong; we
  1.4257 +  % have to do the usual translation tricks.
  1.4258 +  \entry{#1}{#2}%
  1.4259 +\endgroup}
  1.4260 +
  1.4261 +% Space between chapter (or whatever) number and the title.
  1.4262 +\def\labelspace{\hskip1em \relax}
  1.4263 +
  1.4264 +\def\dopageno#1{{\rm #1}}
  1.4265 +\def\doshortpageno#1{{\rm #1}}
  1.4266 +
  1.4267 +\def\chapentryfonts{\secfonts \rm}
  1.4268 +\def\secentryfonts{\textfonts}
  1.4269 +\let\subsecentryfonts = \textfonts
  1.4270 +\let\subsubsecentryfonts = \textfonts
  1.4271 +
  1.4272 +
  1.4273 +\message{environments,}
  1.4274 +% @foo ... @end foo.
  1.4275 +
  1.4276 +% @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
  1.4277 +%
  1.4278 +% Since these characters are used in examples, it should be an even number of
  1.4279 +% \tt widths. Each \tt character is 1en, so two makes it 1em.
  1.4280 +%
  1.4281 +\def\point{$\star$}
  1.4282 +\def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
  1.4283 +\def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}}
  1.4284 +\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
  1.4285 +\def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}}
  1.4286 +
  1.4287 +% The @error{} command.
  1.4288 +% Adapted from the TeXbook's \boxit.
  1.4289 +%
  1.4290 +\newbox\errorbox
  1.4291 +%
  1.4292 +{\tentt \global\dimen0 = 3em}% Width of the box.
  1.4293 +\dimen2 = .55pt % Thickness of rules
  1.4294 +% The text. (`r' is open on the right, `e' somewhat less so on the left.)
  1.4295 +\setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
  1.4296 +%
  1.4297 +\global\setbox\errorbox=\hbox to \dimen0{\hfil
  1.4298 +   \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
  1.4299 +   \advance\hsize by -2\dimen2 % Rules.
  1.4300 +   \vbox{
  1.4301 +      \hrule height\dimen2
  1.4302 +      \hbox{\vrule width\dimen2 \kern3pt          % Space to left of text.
  1.4303 +         \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
  1.4304 +         \kern3pt\vrule width\dimen2}% Space to right.
  1.4305 +      \hrule height\dimen2}
  1.4306 +    \hfil}
  1.4307 +%
  1.4308 +\def\error{\leavevmode\lower.7ex\copy\errorbox}
  1.4309 +
  1.4310 +% @tex ... @end tex    escapes into raw Tex temporarily.
  1.4311 +% One exception: @ is still an escape character, so that @end tex works.
  1.4312 +% But \@ or @@ will get a plain tex @ character.
  1.4313 +
  1.4314 +\def\tex{\begingroup
  1.4315 +  \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
  1.4316 +  \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
  1.4317 +  \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
  1.4318 +  \catcode `\%=14
  1.4319 +  \catcode `\+=\other
  1.4320 +  \catcode `\"=\other
  1.4321 +  \catcode `\==\other
  1.4322 +  \catcode `\|=\other
  1.4323 +  \catcode `\<=\other
  1.4324 +  \catcode `\>=\other
  1.4325 +  \escapechar=`\\
  1.4326 +  %
  1.4327 +  \let\b=\ptexb
  1.4328 +  \let\bullet=\ptexbullet
  1.4329 +  \let\c=\ptexc
  1.4330 +  \let\,=\ptexcomma
  1.4331 +  \let\.=\ptexdot
  1.4332 +  \let\dots=\ptexdots
  1.4333 +  \let\equiv=\ptexequiv
  1.4334 +  \let\!=\ptexexclam
  1.4335 +  \let\i=\ptexi
  1.4336 +  \let\indent=\ptexindent
  1.4337 +  \let\{=\ptexlbrace
  1.4338 +  \let\+=\tabalign
  1.4339 +  \let\}=\ptexrbrace
  1.4340 +  \let\/=\ptexslash
  1.4341 +  \let\*=\ptexstar
  1.4342 +  \let\t=\ptext
  1.4343 +  %
  1.4344 +  \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
  1.4345 +  \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
  1.4346 +  \def\@{@}%
  1.4347 +\let\Etex=\endgroup}
  1.4348 +
  1.4349 +% Define @lisp ... @end lisp.
  1.4350 +% @lisp does a \begingroup so it can rebind things,
  1.4351 +% including the definition of @end lisp (which normally is erroneous).
  1.4352 +
  1.4353 +% Amount to narrow the margins by for @lisp.
  1.4354 +\newskip\lispnarrowing \lispnarrowing=0.4in
  1.4355 +
  1.4356 +% This is the definition that ^^M gets inside @lisp, @example, and other
  1.4357 +% such environments.  \null is better than a space, since it doesn't
  1.4358 +% have any width.
  1.4359 +\def\lisppar{\null\endgraf}
  1.4360 +
  1.4361 +% Make each space character in the input produce a normal interword
  1.4362 +% space in the output.  Don't allow a line break at this space, as this
  1.4363 +% is used only in environments like @example, where each line of input
  1.4364 +% should produce a line of output anyway.
  1.4365 +%
  1.4366 +{\obeyspaces %
  1.4367 +\gdef\sepspaces{\obeyspaces\let =\tie}}
  1.4368 +
  1.4369 +% Define \obeyedspace to be our active space, whatever it is.  This is
  1.4370 +% for use in \parsearg.
  1.4371 +{\sepspaces%
  1.4372 +\global\let\obeyedspace= }
  1.4373 +
  1.4374 +% This space is always present above and below environments.
  1.4375 +\newskip\envskipamount \envskipamount = 0pt
  1.4376 +
  1.4377 +% Make spacing and below environment symmetrical.  We use \parskip here
  1.4378 +% to help in doing that, since in @example-like environments \parskip
  1.4379 +% is reset to zero; thus the \afterenvbreak inserts no space -- but the
  1.4380 +% start of the next paragraph will insert \parskip.
  1.4381 +%
  1.4382 +\def\aboveenvbreak{{%
  1.4383 +  % =10000 instead of <10000 because of a special case in \itemzzz, q.v.
  1.4384 +  \ifnum \lastpenalty=10000 \else
  1.4385 +    \advance\envskipamount by \parskip
  1.4386 +    \endgraf
  1.4387 +    \ifdim\lastskip<\envskipamount
  1.4388 +      \removelastskip
  1.4389 +      % it's not a good place to break if the last penalty was \nobreak
  1.4390 +      % or better ...
  1.4391 +      \ifnum\lastpenalty>10000 \else \penalty-50 \fi
  1.4392 +      \vskip\envskipamount
  1.4393 +    \fi
  1.4394 +  \fi
  1.4395 +}}
  1.4396 +
  1.4397 +\let\afterenvbreak = \aboveenvbreak
  1.4398 +
  1.4399 +% \nonarrowing is a flag.  If "set", @lisp etc don't narrow margins.
  1.4400 +\let\nonarrowing=\relax
  1.4401 +
  1.4402 +% @cartouche ... @end cartouche: draw rectangle w/rounded corners around
  1.4403 +% environment contents.
  1.4404 +\font\circle=lcircle10
  1.4405 +\newdimen\circthick
  1.4406 +\newdimen\cartouter\newdimen\cartinner
  1.4407 +\newskip\normbskip\newskip\normpskip\newskip\normlskip
  1.4408 +\circthick=\fontdimen8\circle
  1.4409 +%
  1.4410 +\def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
  1.4411 +\def\ctr{{\hskip 6pt\circle\char'010}}
  1.4412 +\def\cbl{{\circle\char'012\hskip -6pt}}
  1.4413 +\def\cbr{{\hskip 6pt\circle\char'011}}
  1.4414 +\def\carttop{\hbox to \cartouter{\hskip\lskip
  1.4415 +        \ctl\leaders\hrule height\circthick\hfil\ctr
  1.4416 +        \hskip\rskip}}
  1.4417 +\def\cartbot{\hbox to \cartouter{\hskip\lskip
  1.4418 +        \cbl\leaders\hrule height\circthick\hfil\cbr
  1.4419 +        \hskip\rskip}}
  1.4420 +%
  1.4421 +\newskip\lskip\newskip\rskip
  1.4422 +
  1.4423 +\def\cartouche{%
  1.4424 +\par  % can't be in the midst of a paragraph.
  1.4425 +\begingroup
  1.4426 +        \lskip=\leftskip \rskip=\rightskip
  1.4427 +        \leftskip=0pt\rightskip=0pt %we want these *outside*.
  1.4428 +        \cartinner=\hsize \advance\cartinner by-\lskip
  1.4429 +                          \advance\cartinner by-\rskip
  1.4430 +        \cartouter=\hsize
  1.4431 +        \advance\cartouter by 18.4pt % allow for 3pt kerns on either
  1.4432 +%                                    side, and for 6pt waste from
  1.4433 +%                                    each corner char, and rule thickness
  1.4434 +        \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
  1.4435 +        % Flag to tell @lisp, etc., not to narrow margin.
  1.4436 +        \let\nonarrowing=\comment
  1.4437 +        \vbox\bgroup
  1.4438 +                \baselineskip=0pt\parskip=0pt\lineskip=0pt
  1.4439 +                \carttop
  1.4440 +                \hbox\bgroup
  1.4441 +                        \hskip\lskip
  1.4442 +                        \vrule\kern3pt
  1.4443 +                        \vbox\bgroup
  1.4444 +                                \hsize=\cartinner
  1.4445 +                                \kern3pt
  1.4446 +                                \begingroup
  1.4447 +                                        \baselineskip=\normbskip
  1.4448 +                                        \lineskip=\normlskip
  1.4449 +                                        \parskip=\normpskip
  1.4450 +                                        \vskip -\parskip
  1.4451 +\def\Ecartouche{%
  1.4452 +                                \endgroup
  1.4453 +                                \kern3pt
  1.4454 +                        \egroup
  1.4455 +                        \kern3pt\vrule
  1.4456 +                        \hskip\rskip
  1.4457 +                \egroup
  1.4458 +                \cartbot
  1.4459 +        \egroup
  1.4460 +\endgroup
  1.4461 +}}
  1.4462 +
  1.4463 +
  1.4464 +% This macro is called at the beginning of all the @example variants,
  1.4465 +% inside a group.
  1.4466 +\def\nonfillstart{%
  1.4467 +  \aboveenvbreak
  1.4468 +  \inENV % This group ends at the end of the body
  1.4469 +  \hfuzz = 12pt % Don't be fussy
  1.4470 +  \sepspaces % Make spaces be word-separators rather than space tokens.
  1.4471 +  \let\par = \lisppar % don't ignore blank lines
  1.4472 +  \obeylines % each line of input is a line of output
  1.4473 +  \parskip = 0pt
  1.4474 +  \parindent = 0pt
  1.4475 +  \emergencystretch = 0pt % don't try to avoid overfull boxes
  1.4476 +  % @cartouche defines \nonarrowing to inhibit narrowing
  1.4477 +  % at next level down.
  1.4478 +  \ifx\nonarrowing\relax
  1.4479 +    \advance \leftskip by \lispnarrowing
  1.4480 +    \exdentamount=\lispnarrowing
  1.4481 +    \let\exdent=\nofillexdent
  1.4482 +    \let\nonarrowing=\relax
  1.4483 +  \fi
  1.4484 +}
  1.4485 +
  1.4486 +% Define the \E... control sequence only if we are inside the particular
  1.4487 +% environment, so the error checking in \end will work.
  1.4488 +%
  1.4489 +% To end an @example-like environment, we first end the paragraph (via
  1.4490 +% \afterenvbreak's vertical glue), and then the group.  That way we keep
  1.4491 +% the zero \parskip that the environments set -- \parskip glue will be
  1.4492 +% inserted at the beginning of the next paragraph in the document, after
  1.4493 +% the environment.
  1.4494 +%
  1.4495 +\def\nonfillfinish{\afterenvbreak\endgroup}
  1.4496 +
  1.4497 +% @lisp: indented, narrowed, typewriter font.
  1.4498 +\def\lisp{\begingroup
  1.4499 +  \nonfillstart
  1.4500 +  \let\Elisp = \nonfillfinish
  1.4501 +  \tt
  1.4502 +  \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
  1.4503 +  \gobble       % eat return
  1.4504 +}
  1.4505 +
  1.4506 +% @example: Same as @lisp.
  1.4507 +\def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp}
  1.4508 +
  1.4509 +% @smallexample and @smalllisp: use smaller fonts.
  1.4510 +% Originally contributed by Pavel@xerox.
  1.4511 +\def\smalllisp{\begingroup
  1.4512 +  \def\Esmalllisp{\nonfillfinish\endgroup}%
  1.4513 +  \def\Esmallexample{\nonfillfinish\endgroup}%
  1.4514 +  \smallexamplefonts
  1.4515 +  \lisp
  1.4516 +}
  1.4517 +\let\smallexample = \smalllisp
  1.4518 +
  1.4519 +
  1.4520 +% @display: same as @lisp except keep current font.
  1.4521 +%
  1.4522 +\def\display{\begingroup
  1.4523 +  \nonfillstart
  1.4524 +  \let\Edisplay = \nonfillfinish
  1.4525 +  \gobble
  1.4526 +}
  1.4527 +%
  1.4528 +% @smalldisplay: @display plus smaller fonts.
  1.4529 +%
  1.4530 +\def\smalldisplay{\begingroup
  1.4531 +  \def\Esmalldisplay{\nonfillfinish\endgroup}%
  1.4532 +  \smallexamplefonts \rm
  1.4533 +  \display
  1.4534 +}
  1.4535 +
  1.4536 +% @format: same as @display except don't narrow margins.
  1.4537 +%
  1.4538 +\def\format{\begingroup
  1.4539 +  \let\nonarrowing = t
  1.4540 +  \nonfillstart
  1.4541 +  \let\Eformat = \nonfillfinish
  1.4542 +  \gobble
  1.4543 +}
  1.4544 +%
  1.4545 +% @smallformat: @format plus smaller fonts.
  1.4546 +%
  1.4547 +\def\smallformat{\begingroup
  1.4548 +  \def\Esmallformat{\nonfillfinish\endgroup}%
  1.4549 +  \smallexamplefonts \rm
  1.4550 +  \format
  1.4551 +}
  1.4552 +
  1.4553 +% @flushleft (same as @format).
  1.4554 +%
  1.4555 +\def\flushleft{\begingroup \def\Eflushleft{\nonfillfinish\endgroup}\format}
  1.4556 +
  1.4557 +% @flushright.
  1.4558 +%
  1.4559 +\def\flushright{\begingroup
  1.4560 +  \let\nonarrowing = t
  1.4561 +  \nonfillstart
  1.4562 +  \let\Eflushright = \nonfillfinish
  1.4563 +  \advance\leftskip by 0pt plus 1fill
  1.4564 +  \gobble
  1.4565 +}
  1.4566 +
  1.4567 +
  1.4568 +% @quotation does normal linebreaking (hence we can't use \nonfillstart)
  1.4569 +% and narrows the margins.
  1.4570 +%
  1.4571 +\def\quotation{%
  1.4572 +  \begingroup\inENV %This group ends at the end of the @quotation body
  1.4573 +  {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
  1.4574 +  \parindent=0pt
  1.4575 +  % We have retained a nonzero parskip for the environment, since we're
  1.4576 +  % doing normal filling. So to avoid extra space below the environment...
  1.4577 +  \def\Equotation{\parskip = 0pt \nonfillfinish}%
  1.4578 +  %
  1.4579 +  % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
  1.4580 +  \ifx\nonarrowing\relax
  1.4581 +    \advance\leftskip by \lispnarrowing
  1.4582 +    \advance\rightskip by \lispnarrowing
  1.4583 +    \exdentamount = \lispnarrowing
  1.4584 +    \let\nonarrowing = \relax
  1.4585 +  \fi
  1.4586 +}
  1.4587 +
  1.4588 +
  1.4589 +% LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
  1.4590 +% If we want to allow any <char> as delimiter,
  1.4591 +% we need the curly braces so that makeinfo sees the @verb command, eg:
  1.4592 +% `@verbx...x' would look like the '@verbx' command.  --janneke@gnu.org
  1.4593 +%
  1.4594 +% [Knuth]: Donald Ervin Knuth, 1996.  The TeXbook.
  1.4595 +%
  1.4596 +% [Knuth] p.344; only we need to do the other characters Texinfo sets
  1.4597 +% active too.  Otherwise, they get lost as the first character on a
  1.4598 +% verbatim line.
  1.4599 +\def\dospecials{%
  1.4600 +  \do\ \do\\\do\{\do\}\do\$\do\&%
  1.4601 +  \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~%
  1.4602 +  \do\<\do\>\do\|\do\@\do+\do\"%
  1.4603 +}
  1.4604 +%
  1.4605 +% [Knuth] p. 380
  1.4606 +\def\uncatcodespecials{%
  1.4607 +  \def\do##1{\catcode`##1=12}\dospecials}
  1.4608 +%
  1.4609 +% [Knuth] pp. 380,381,391
  1.4610 +% Disable Spanish ligatures ?` and !` of \tt font
  1.4611 +\begingroup
  1.4612 +  \catcode`\`=\active\gdef`{\relax\lq}
  1.4613 +\endgroup
  1.4614 +%
  1.4615 +% Setup for the @verb command.
  1.4616 +%
  1.4617 +% Eight spaces for a tab
  1.4618 +\begingroup
  1.4619 +  \catcode`\^^I=\active
  1.4620 +  \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
  1.4621 +\endgroup
  1.4622 +%
  1.4623 +\def\setupverb{%
  1.4624 +  \tt  % easiest (and conventionally used) font for verbatim
  1.4625 +  \def\par{\leavevmode\endgraf}%
  1.4626 +  \catcode`\`=\active
  1.4627 +  \tabeightspaces
  1.4628 +  % Respect line breaks,
  1.4629 +  % print special symbols as themselves, and
  1.4630 +  % make each space count
  1.4631 +  % must do in this order:
  1.4632 +  \obeylines \uncatcodespecials \sepspaces
  1.4633 +}
  1.4634 +
  1.4635 +% Setup for the @verbatim environment
  1.4636 +%
  1.4637 +% Real tab expansion
  1.4638 +\newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
  1.4639 +%
  1.4640 +\def\starttabbox{\setbox0=\hbox\bgroup}
  1.4641 +\begingroup
  1.4642 +  \catcode`\^^I=\active
  1.4643 +  \gdef\tabexpand{%
  1.4644 +    \catcode`\^^I=\active
  1.4645 +    \def^^I{\leavevmode\egroup
  1.4646 +      \dimen0=\wd0 % the width so far, or since the previous tab
  1.4647 +      \divide\dimen0 by\tabw
  1.4648 +      \multiply\dimen0 by\tabw % compute previous multiple of \tabw
  1.4649 +      \advance\dimen0 by\tabw  % advance to next multiple of \tabw
  1.4650 +      \wd0=\dimen0 \box0 \starttabbox
  1.4651 +    }%
  1.4652 +  }
  1.4653 +\endgroup
  1.4654 +\def\setupverbatim{%
  1.4655 +  % Easiest (and conventionally used) font for verbatim
  1.4656 +  \tt
  1.4657 +  \def\par{\leavevmode\egroup\box0\endgraf}%
  1.4658 +  \catcode`\`=\active
  1.4659 +  \tabexpand
  1.4660 +  % Respect line breaks,
  1.4661 +  % print special symbols as themselves, and
  1.4662 +  % make each space count
  1.4663 +  % must do in this order:
  1.4664 +  \obeylines \uncatcodespecials \sepspaces
  1.4665 +  \everypar{\starttabbox}%
  1.4666 +}
  1.4667 +
  1.4668 +% Do the @verb magic: verbatim text is quoted by unique
  1.4669 +% delimiter characters.  Before first delimiter expect a
  1.4670 +% right brace, after last delimiter expect closing brace:
  1.4671 +%
  1.4672 +%    \def\doverb'{'<char>#1<char>'}'{#1}
  1.4673 +%
  1.4674 +% [Knuth] p. 382; only eat outer {}
  1.4675 +\begingroup
  1.4676 +  \catcode`[=1\catcode`]=2\catcode`\{=12\catcode`\}=12
  1.4677 +  \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
  1.4678 +\endgroup
  1.4679 +%
  1.4680 +\def\verb{\begingroup\setupverb\doverb}
  1.4681 +%
  1.4682 +%
  1.4683 +% Do the @verbatim magic: define the macro \doverbatim so that
  1.4684 +% the (first) argument ends when '@end verbatim' is reached, ie:
  1.4685 +%
  1.4686 +%     \def\doverbatim#1@end verbatim{#1}
  1.4687 +%
  1.4688 +% For Texinfo it's a lot easier than for LaTeX,
  1.4689 +% because texinfo's \verbatim doesn't stop at '\end{verbatim}':
  1.4690 +% we need not redefine '\', '{' and '}'.
  1.4691 +%
  1.4692 +% Inspired by LaTeX's verbatim command set [latex.ltx]
  1.4693 +%% Include LaTeX hack for completeness -- never know
  1.4694 +%% \begingroup
  1.4695 +%% \catcode`|=0 \catcode`[=1
  1.4696 +%% \catcode`]=2\catcode`\{=12\catcode`\}=12\catcode`\ =\active
  1.4697 +%% \catcode`\\=12|gdef|doverbatim#1@end verbatim[
  1.4698 +%% #1|endgroup|def|Everbatim[]|end[verbatim]]
  1.4699 +%% |endgroup
  1.4700 +%
  1.4701 +\begingroup
  1.4702 +  \catcode`\ =\active
  1.4703 +  \obeylines %
  1.4704 +  % ignore everything up to the first ^^M, that's the newline at the end
  1.4705 +  % of the @verbatim input line itself.  Otherwise we get an extra blank
  1.4706 +  % line in the output.
  1.4707 +  \gdef\doverbatim#1^^M#2@end verbatim{#2\end{verbatim}}%
  1.4708 +\endgroup
  1.4709 +%
  1.4710 +\def\verbatim{%
  1.4711 +  \def\Everbatim{\nonfillfinish\endgroup}%
  1.4712 +  \begingroup
  1.4713 +    \nonfillstart
  1.4714 +    \advance\leftskip by -\defbodyindent
  1.4715 +    \begingroup\setupverbatim\doverbatim
  1.4716 +}
  1.4717 +
  1.4718 +% @verbatiminclude FILE - insert text of file in verbatim environment.
  1.4719 +%
  1.4720 +% Allow normal characters that we make active in the argument (a file name).
  1.4721 +\def\verbatiminclude{%
  1.4722 +  \begingroup
  1.4723 +    \catcode`\\=\other
  1.4724 +    \catcode`~=\other
  1.4725 +    \catcode`^=\other
  1.4726 +    \catcode`_=\other
  1.4727 +    \catcode`|=\other
  1.4728 +    \catcode`<=\other
  1.4729 +    \catcode`>=\other
  1.4730 +    \catcode`+=\other
  1.4731 +    \parsearg\doverbatiminclude
  1.4732 +}
  1.4733 +\def\setupverbatiminclude{%
  1.4734 +  \begingroup
  1.4735 +    \nonfillstart
  1.4736 +    \advance\leftskip by -\defbodyindent
  1.4737 +    \begingroup\setupverbatim
  1.4738 +}
  1.4739 +%
  1.4740 +\def\doverbatiminclude#1{%
  1.4741 +     % Restore active chars for included file.
  1.4742 +  \endgroup
  1.4743 +  \begingroup
  1.4744 +    \let\value=\expandablevalue
  1.4745 +    \def\thisfile{#1}%
  1.4746 +    \expandafter\expandafter\setupverbatiminclude\input\thisfile
  1.4747 +  \endgroup
  1.4748 +  \nonfillfinish
  1.4749 +  \endgroup
  1.4750 +}
  1.4751 +
  1.4752 +% @copying ... @end copying.
  1.4753 +% Save the text away for @insertcopying later.  Many commands won't be
  1.4754 +% allowed in this context, but that's ok.
  1.4755 +%
  1.4756 +% We save the uninterpreted tokens, rather than creating a box.
  1.4757 +% Saving the text in a box would be much easier, but then all the
  1.4758 +% typesetting commands (@smallbook, font changes, etc.) have to be done
  1.4759 +% beforehand -- and a) we want @copying to be done first in the source
  1.4760 +% file; b) letting users define the frontmatter in as flexible order as
  1.4761 +% possible is very desirable.
  1.4762 +%
  1.4763 +\def\copying{\begingroup
  1.4764 +  % Define a command to swallow text until we reach `@end copying'.
  1.4765 +  % \ is the escape char in this texinfo.tex file, so it is the
  1.4766 +  % delimiter for the command; @ will be the escape char when we read
  1.4767 +  % it, but that doesn't matter.
  1.4768 +  \long\def\docopying##1\end copying{\gdef\copyingtext{##1}\enddocopying}%
  1.4769 +  %
  1.4770 +  % We must preserve ^^M's in the input file; see \insertcopying below.
  1.4771 +  \catcode`\^^M = \active
  1.4772 +  \docopying
  1.4773 +}
  1.4774 +
  1.4775 +% What we do to finish off the copying text.
  1.4776 +%
  1.4777 +\def\enddocopying{\endgroup\ignorespaces}
  1.4778 +
  1.4779 +% @insertcopying.  Here we must play games with ^^M's.  On the one hand,
  1.4780 +% we need them to delimit commands such as `@end quotation', so they
  1.4781 +% must be active.  On the other hand, we certainly don't want every
  1.4782 +% end-of-line to be a \par, as would happen with the normal active
  1.4783 +% definition of ^^M.  On the third hand, two ^^M's in a row should still
  1.4784 +% generate a \par.
  1.4785 +%
  1.4786 +% Our approach is to make ^^M insert a space and a penalty1 normally;
  1.4787 +% then it can also check if \lastpenalty=1.  If it does, then manually
  1.4788 +% do \par.
  1.4789 +%
  1.4790 +% This messes up the normal definitions of @c[omment], so we redefine
  1.4791 +% it.  Similarly for @ignore.  (These commands are used in the gcc
  1.4792 +% manual for man page generation.)
  1.4793 +%
  1.4794 +% Seems pretty fragile, most line-oriented commands will presumably
  1.4795 +% fail, but for the limited use of getting the copying text (which
  1.4796 +% should be quite simple) inserted, we can hope it's ok.
  1.4797 +%
  1.4798 +{\catcode`\^^M=\active %
  1.4799 +\gdef\insertcopying{\begingroup %
  1.4800 +  \parindent = 0pt  % looks wrong on title page
  1.4801 +  \def^^M{%
  1.4802 +    \ifnum \lastpenalty=1 %
  1.4803 +      \par %
  1.4804 +    \else %
  1.4805 +      \space \penalty 1 %
  1.4806 +    \fi %
  1.4807 +  }%
  1.4808 +  %
  1.4809 +  % Fix @c[omment] for catcode 13 ^^M's.
  1.4810 +  \def\c##1^^M{\ignorespaces}%
  1.4811 +  \let\comment = \c %
  1.4812 +  %
  1.4813 +  % Don't bother jumping through all the hoops that \doignore does, it
  1.4814 +  % would be very hard since the catcodes are already set.
  1.4815 +  \long\def\ignore##1\end ignore{\ignorespaces}%
  1.4816 +  %
  1.4817 +  \copyingtext %
  1.4818 +\endgroup}%
  1.4819 +}
  1.4820 +
  1.4821 +\message{defuns,}
  1.4822 +% @defun etc.
  1.4823 +
  1.4824 +% Allow user to change definition object font (\df) internally
  1.4825 +\def\setdeffont#1 {\csname DEF#1\endcsname}
  1.4826 +
  1.4827 +\newskip\defbodyindent \defbodyindent=.4in
  1.4828 +\newskip\defargsindent \defargsindent=50pt
  1.4829 +\newskip\deflastargmargin \deflastargmargin=18pt
  1.4830 +
  1.4831 +\newcount\parencount
  1.4832 +
  1.4833 +% We want ()&[] to print specially on the defun line.
  1.4834 +%
  1.4835 +\def\activeparens{%
  1.4836 +  \catcode`\(=\active \catcode`\)=\active
  1.4837 +  \catcode`\&=\active
  1.4838 +  \catcode`\[=\active \catcode`\]=\active
  1.4839 +}
  1.4840 +
  1.4841 +% Make control sequences which act like normal parenthesis chars.
  1.4842 +\let\lparen = ( \let\rparen = )
  1.4843 +
  1.4844 +{\activeparens % Now, smart parens don't turn on until &foo (see \amprm)
  1.4845 +
  1.4846 +% Be sure that we always have a definition for `(', etc.  For example,
  1.4847 +% if the fn name has parens in it, \boldbrax will not be in effect yet,
  1.4848 +% so TeX would otherwise complain about undefined control sequence.
  1.4849 +\global\let(=\lparen \global\let)=\rparen
  1.4850 +\global\let[=\lbrack \global\let]=\rbrack
  1.4851 +
  1.4852 +\gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 }
  1.4853 +\gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
  1.4854 +% This is used to turn on special parens
  1.4855 +% but make & act ordinary (given that it's active).
  1.4856 +\gdef\boldbraxnoamp{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb\let&=\ampnr}
  1.4857 +
  1.4858 +% Definitions of (, ) and & used in args for functions.
  1.4859 +% This is the definition of ( outside of all parentheses.
  1.4860 +\gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested
  1.4861 +  \global\advance\parencount by 1
  1.4862 +}
  1.4863 +%
  1.4864 +% This is the definition of ( when already inside a level of parens.
  1.4865 +\gdef\opnested{\char`\(\global\advance\parencount by 1 }
  1.4866 +%
  1.4867 +\gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0.
  1.4868 +  % also in that case restore the outer-level definition of (.
  1.4869 +  \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
  1.4870 +  \global\advance \parencount by -1 }
  1.4871 +% If we encounter &foo, then turn on ()-hacking afterwards
  1.4872 +\gdef\amprm#1 {{\rm\&#1}\let(=\oprm \let)=\clrm\ }
  1.4873 +%
  1.4874 +\gdef\normalparens{\boldbrax\let&=\ampnr}
  1.4875 +} % End of definition inside \activeparens
  1.4876 +%% These parens (in \boldbrax) actually are a little bolder than the
  1.4877 +%% contained text.  This is especially needed for [ and ]
  1.4878 +\def\opnr{{\sf\char`\(}\global\advance\parencount by 1 }
  1.4879 +\def\clnr{{\sf\char`\)}\global\advance\parencount by -1 }
  1.4880 +\let\ampnr = \&
  1.4881 +\def\lbrb{{\bf\char`\[}}
  1.4882 +\def\rbrb{{\bf\char`\]}}
  1.4883 +
  1.4884 +% Active &'s sneak into the index arguments, so make sure it's defined.
  1.4885 +{
  1.4886 +  \catcode`& = \active
  1.4887 +  \global\let& = \ampnr
  1.4888 +}
  1.4889 +
  1.4890 +% \defname, which formats the name of the @def (not the args).
  1.4891 +% #1 is the function name.
  1.4892 +% #2 is the type of definition, such as "Function".
  1.4893 +%
  1.4894 +\def\defname#1#2{%
  1.4895 +  % How we'll output the type name.  Putting it in brackets helps
  1.4896 +  % distinguish it from the body text that may end up on the next line
  1.4897 +  % just below it.
  1.4898 +  \ifempty{#2}%
  1.4899 +    \def\defnametype{}%
  1.4900 +  \else
  1.4901 +    \def\defnametype{[\rm #2]}%
  1.4902 +  \fi
  1.4903 +  %
  1.4904 +  % Get the values of \leftskip and \rightskip as they were outside the @def...
  1.4905 +  \dimen2=\leftskip
  1.4906 +  \advance\dimen2 by -\defbodyindent
  1.4907 +  %
  1.4908 +  % Figure out values for the paragraph shape.
  1.4909 +  \setbox0=\hbox{\hskip \deflastargmargin{\defnametype}}%
  1.4910 +  \dimen0=\hsize \advance \dimen0 by -\wd0  % compute size for first line
  1.4911 +  \dimen1=\hsize \advance \dimen1 by -\defargsindent  % size for continuations
  1.4912 +  \parshape 2 0in \dimen0 \defargsindent \dimen1
  1.4913 +  %
  1.4914 +  % Output arg 2 ("Function" or some such) but stuck inside a box of
  1.4915 +  % width 0 so it does not interfere with linebreaking.
  1.4916 +  \noindent
  1.4917 +  %
  1.4918 +  {% Adjust \hsize to exclude the ambient margins,
  1.4919 +   % so that \rightline will obey them.
  1.4920 +   \advance \hsize by -\dimen2
  1.4921 +   \dimen3 = 0pt  % was -1.25pc
  1.4922 +   \rlap{\rightline{\defnametype\kern\dimen3}}%
  1.4923 +  }%
  1.4924 +  %
  1.4925 +  % Allow all lines to be underfull without complaint:
  1.4926 +  \tolerance=10000 \hbadness=10000
  1.4927 +  \advance\leftskip by -\defbodyindent
  1.4928 +  \exdentamount=\defbodyindent
  1.4929 +  {\df #1}\enskip        % output function name
  1.4930 +  % \defunargs will be called next to output the arguments, if any.
  1.4931 +}
  1.4932 +
  1.4933 +% Common pieces to start any @def...
  1.4934 +% #1 is the \E... control sequence to end the definition (which we define).
  1.4935 +% #2 is the \...x control sequence (which our caller defines).
  1.4936 +% #3 is the control sequence to process the header, such as \defunheader.
  1.4937 +%
  1.4938 +\def\parsebodycommon#1#2#3{%
  1.4939 +  \begingroup\inENV
  1.4940 +  % If there are two @def commands in a row, we'll have a \nobreak,
  1.4941 +  % which is there to keep the function description together with its
  1.4942 +  % header.  But if there's nothing but headers, we want to allow a
  1.4943 +  % break after all.  Check for penalty 10002 (inserted by
  1.4944 +  % \defargscommonending) instead of 10000, since the sectioning
  1.4945 +  % commands insert a \penalty10000, and we don't want to allow a break
  1.4946 +  % between a section heading and a defun.
  1.4947 +  \ifnum\lastpenalty=10002 \penalty0 \fi
  1.4948 +  \medbreak
  1.4949 +  %
  1.4950 +  % Define the \E... end token that this defining construct specifies
  1.4951 +  % so that it will exit this group.
  1.4952 +  \def#1{\endgraf\endgroup\medbreak}%
  1.4953 +  %
  1.4954 +  \parindent=0in
  1.4955 +  \advance\leftskip by \defbodyindent
  1.4956 +  \exdentamount=\defbodyindent
  1.4957 +}
  1.4958 +
  1.4959 +% Common part of the \...x definitions.
  1.4960 +%
  1.4961 +\def\defxbodycommon{%
  1.4962 +  % As with \parsebodycommon above, allow line break if we have multiple
  1.4963 +  % x headers in a row.  It's not a great place, though.
  1.4964 +  \ifnum\lastpenalty=10000 \penalty1000 \fi
  1.4965 +  %
  1.4966 +  \begingroup\obeylines
  1.4967 +}
  1.4968 +
  1.4969 +% Process body of @defun, @deffn, @defmac, etc.
  1.4970 +%
  1.4971 +\def\defparsebody#1#2#3{%
  1.4972 +  \parsebodycommon{#1}{#2}{#3}%
  1.4973 +  \def#2{\defxbodycommon \activeparens \spacesplit#3}%
  1.4974 +  \catcode\equalChar=\active
  1.4975 +  \begingroup\obeylines\activeparens
  1.4976 +  \spacesplit#3%
  1.4977 +}
  1.4978 +
  1.4979 +% #1, #2, #3 are the common arguments (see \parsebodycommon above).
  1.4980 +% #4, delimited by the space, is the class name.
  1.4981 +%
  1.4982 +\def\defmethparsebody#1#2#3#4 {%
  1.4983 +  \parsebodycommon{#1}{#2}{#3}%
  1.4984 +  \def#2##1 {\defxbodycommon \activeparens \spacesplit{#3{##1}}}%
  1.4985 +  \begingroup\obeylines\activeparens
  1.4986 +  % The \empty here prevents misinterpretation of a construct such as
  1.4987 +  %   @deffn {whatever} {Enharmonic comma}
  1.4988 +  % See comments at \deftpparsebody, although in our case we don't have
  1.4989 +  % to remove the \empty afterwards, since it is empty.
  1.4990 +  \spacesplit{#3{#4}}\empty
  1.4991 +}
  1.4992 +
  1.4993 +% Used for @deftypemethod and @deftypeivar.
  1.4994 +% #1, #2, #3 are the common arguments (see \defparsebody).
  1.4995 +% #4, delimited by a space, is the class name.
  1.4996 +% #5 is the method's return type.
  1.4997 +%
  1.4998 +\def\deftypemethparsebody#1#2#3#4 #5 {%
  1.4999 +  \parsebodycommon{#1}{#2}{#3}%
  1.5000 +  \def#2##1 ##2 {\defxbodycommon \activeparens \spacesplit{#3{##1}{##2}}}%
  1.5001 +  \begingroup\obeylines\activeparens
  1.5002 +  \spacesplit{#3{#4}{#5}}%
  1.5003 +}
  1.5004 +
  1.5005 +% Used for @deftypeop.  The change from \deftypemethparsebody is an
  1.5006 +% extra argument at the beginning which is the `category', instead of it
  1.5007 +% being the hardwired string `Method' or `Instance Variable'.  We have
  1.5008 +% to account for this both in the \...x definition and in parsing the
  1.5009 +% input at hand.  Thus also need a control sequence (passed as #5) for
  1.5010 +% the \E... definition to assign the category name to.
  1.5011 +%
  1.5012 +\def\deftypeopparsebody#1#2#3#4#5 #6 {%
  1.5013 +  \parsebodycommon{#1}{#2}{#3}%
  1.5014 +  \def#2##1 ##2 ##3 {\def#4{##1}%
  1.5015 +    \defxbodycommon \activeparens \spacesplit{#3{##2}{##3}}}%
  1.5016 +  \begingroup\obeylines\activeparens
  1.5017 +  \spacesplit{#3{#5}{#6}}%
  1.5018 +}
  1.5019 +
  1.5020 +% For @defop.
  1.5021 +\def\defopparsebody #1#2#3#4#5 {%
  1.5022 +  \parsebodycommon{#1}{#2}{#3}%
  1.5023 +  \def#2##1 ##2 {\def#4{##1}%
  1.5024 +    \defxbodycommon \activeparens \spacesplit{#3{##2}}}%
  1.5025 +  \begingroup\obeylines\activeparens
  1.5026 +  \spacesplit{#3{#5}}%
  1.5027 +}
  1.5028 +
  1.5029 +% These parsing functions are similar to the preceding ones
  1.5030 +% except that they do not make parens into active characters.
  1.5031 +% These are used for "variables" since they have no arguments.
  1.5032 +%
  1.5033 +\def\defvarparsebody #1#2#3{%
  1.5034 +  \parsebodycommon{#1}{#2}{#3}%
  1.5035 +  \def#2{\defxbodycommon \spacesplit#3}%
  1.5036 +  \catcode\equalChar=\active
  1.5037 +  \begingroup\obeylines
  1.5038 +  \spacesplit#3%
  1.5039 +}
  1.5040 +
  1.5041 +% @defopvar.
  1.5042 +\def\defopvarparsebody #1#2#3#4#5 {%
  1.5043 +  \parsebodycommon{#1}{#2}{#3}%
  1.5044 +  \def#2##1 ##2 {\def#4{##1}%
  1.5045 +    \defxbodycommon \spacesplit{#3{##2}}}%
  1.5046 +  \begingroup\obeylines
  1.5047 +  \spacesplit{#3{#5}}%
  1.5048 +}
  1.5049 +
  1.5050 +\def\defvrparsebody#1#2#3#4 {%
  1.5051 +  \parsebodycommon{#1}{#2}{#3}%
  1.5052 +  \def#2##1 {\defxbodycommon \spacesplit{#3{##1}}}%
  1.5053 +  \begingroup\obeylines
  1.5054 +  \spacesplit{#3{#4}}%
  1.5055 +}
  1.5056 +
  1.5057 +% This loses on `@deftp {Data Type} {struct termios}' -- it thinks the
  1.5058 +% type is just `struct', because we lose the braces in `{struct
  1.5059 +% termios}' when \spacesplit reads its undelimited argument.  Sigh.
  1.5060 +% \let\deftpparsebody=\defvrparsebody
  1.5061 +%
  1.5062 +% So, to get around this, we put \empty in with the type name.  That
  1.5063 +% way, TeX won't find exactly `{...}' as an undelimited argument, and
  1.5064 +% won't strip off the braces.
  1.5065 +%
  1.5066 +\def\deftpparsebody #1#2#3#4 {%
  1.5067 +  \parsebodycommon{#1}{#2}{#3}%
  1.5068 +  \def#2##1 {\defxbodycommon \spacesplit{#3{##1}}}%
  1.5069 +  \begingroup\obeylines
  1.5070 +  \spacesplit{\parsetpheaderline{#3{#4}}}\empty
  1.5071 +}
  1.5072 +
  1.5073 +% Fine, but then we have to eventually remove the \empty *and* the
  1.5074 +% braces (if any).  That's what this does.
  1.5075 +%
  1.5076 +\def\removeemptybraces\empty#1\relax{#1}
  1.5077 +
  1.5078 +% After \spacesplit has done its work, this is called -- #1 is the final
  1.5079 +% thing to call, #2 the type name (which starts with \empty), and #3
  1.5080 +% (which might be empty) the arguments.
  1.5081 +%
  1.5082 +\def\parsetpheaderline#1#2#3{%
  1.5083 +  #1{\removeemptybraces#2\relax}{#3}%
  1.5084 +}%
  1.5085 +
  1.5086 +% Split up #2 (the rest of the input line) at the first space token.
  1.5087 +% call #1 with two arguments:
  1.5088 +%  the first is all of #2 before the space token,
  1.5089 +%  the second is all of #2 after that space token.
  1.5090 +% If #2 contains no space token, all of it is passed as the first arg
  1.5091 +% and the second is passed as empty.
  1.5092 +%
  1.5093 +{\obeylines %
  1.5094 + \gdef\spacesplit#1#2^^M{\endgroup\spacesplitx{#1}#2 \relax\spacesplitx}%
  1.5095 + \long\gdef\spacesplitx#1#2 #3#4\spacesplitx{%
  1.5096 +   \ifx\relax #3%
  1.5097 +     #1{#2}{}%
  1.5098 +   \else %
  1.5099 +     #1{#2}{#3#4}%
  1.5100 +   \fi}%
  1.5101 +}
  1.5102 +
  1.5103 +% Define @defun.
  1.5104 +
  1.5105 +% This is called to end the arguments processing for all the @def... commands.
  1.5106 +%
  1.5107 +\def\defargscommonending{%
  1.5108 +  \interlinepenalty = 10000
  1.5109 +  \advance\rightskip by 0pt plus 1fil
  1.5110 +  \endgraf
  1.5111 +  \nobreak\vskip -\parskip
  1.5112 +  \penalty 10002  % signal to \parsebodycommon.
  1.5113 +}
  1.5114 +
  1.5115 +% This expands the args and terminates the paragraph they comprise.
  1.5116 +%
  1.5117 +\def\defunargs#1{\functionparens \sl
  1.5118 +% Expand, preventing hyphenation at `-' chars.
  1.5119 +% Note that groups don't affect changes in \hyphenchar.
  1.5120 +% Set the font temporarily and use \font in case \setfont made \tensl a macro.
  1.5121 +{\tensl\hyphenchar\font=0}%
  1.5122 +#1%
  1.5123 +{\tensl\hyphenchar\font=45}%
  1.5124 +\ifnum\parencount=0 \else \errmessage{Unbalanced parentheses in @def}\fi%
  1.5125 +  \defargscommonending
  1.5126 +}
  1.5127 +
  1.5128 +\def\deftypefunargs #1{%
  1.5129 +% Expand, preventing hyphenation at `-' chars.
  1.5130 +% Note that groups don't affect changes in \hyphenchar.
  1.5131 +% Use \boldbraxnoamp, not \functionparens, so that & is not special.
  1.5132 +\boldbraxnoamp
  1.5133 +\tclose{#1}% avoid \code because of side effects on active chars
  1.5134 +  \defargscommonending
  1.5135 +}
  1.5136 +
  1.5137 +% Do complete processing of one @defun or @defunx line already parsed.
  1.5138 +
  1.5139 +% @deffn Command forward-char nchars
  1.5140 +
  1.5141 +\def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader}
  1.5142 +
  1.5143 +\def\deffnheader #1#2#3{\doind {fn}{\code{#2}}%
  1.5144 +\begingroup\defname {#2}{#1}\defunargs{#3}\endgroup %
  1.5145 +\catcode\equalChar=\other % Turn off change made in \defparsebody
  1.5146 +}
  1.5147 +
  1.5148 +% @defun == @deffn Function
  1.5149 +
  1.5150 +\def\defun{\defparsebody\Edefun\defunx\defunheader}
  1.5151 +
  1.5152 +\def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
  1.5153 +\begingroup\defname {#1}{\putwordDeffunc}%
  1.5154 +\defunargs {#2}\endgroup %
  1.5155 +\catcode\equalChar=\other % Turn off change made in \defparsebody
  1.5156 +}
  1.5157 +
  1.5158 +% @deftypefun int foobar (int @var{foo}, float @var{bar})
  1.5159 +
  1.5160 +\def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader}
  1.5161 +
  1.5162 +% #1 is the data type.  #2 is the name and args.
  1.5163 +\def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax}
  1.5164 +% #1 is the data type, #2 the name, #3 the args.
  1.5165 +\def\deftypefunheaderx #1#2 #3\relax{%
  1.5166 +\doind {fn}{\code{#2}}% Make entry in function index
  1.5167 +\begingroup\defname {\defheaderxcond#1\relax$.$#2}{\putwordDeftypefun}%
  1.5168 +\deftypefunargs {#3}\endgroup %
  1.5169 +\catcode\equalChar=\other % Turn off change made in \defparsebody
  1.5170 +}
  1.5171 +
  1.5172 +% @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar})
  1.5173 +
  1.5174 +\def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader}
  1.5175 +
  1.5176 +% \defheaderxcond#1\relax$.$
  1.5177 +% puts #1 in @code, followed by a space, but does nothing if #1 is null.
  1.5178 +\def\defheaderxcond#1#2$.${\ifx#1\relax\else\code{#1#2} \fi}
  1.5179 +
  1.5180 +% #1 is the classification.  #2 is the data type.  #3 is the name and args.
  1.5181 +\def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax}
  1.5182 +% #1 is the classification, #2 the data type, #3 the name, #4 the args.
  1.5183 +\def\deftypefnheaderx #1#2#3 #4\relax{%
  1.5184 +\doind {fn}{\code{#3}}% Make entry in function index
  1.5185 +\begingroup
  1.5186 +\normalparens % notably, turn off `&' magic, which prevents
  1.5187 +%               at least some C++ text from working
  1.5188 +\defname {\defheaderxcond#2\relax$.$#3}{#1}%
  1.5189 +\deftypefunargs {#4}\endgroup %
  1.5190 +\catcode\equalChar=\other % Turn off change made in \defparsebody
  1.5191 +}
  1.5192 +
  1.5193 +% @defmac == @deffn Macro
  1.5194 +
  1.5195 +\def\defmac{\defparsebody\Edefmac\defmacx\defmacheader}
  1.5196 +
  1.5197 +\def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
  1.5198 +\begingroup\defname {#1}{\putwordDefmac}%
  1.5199 +\defunargs {#2}\endgroup %
  1.5200 +\catcode\equalChar=\other % Turn off change made in \defparsebody
  1.5201 +}
  1.5202 +
  1.5203 +% @defspec == @deffn Special Form
  1.5204 +
  1.5205 +\def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
  1.5206 +
  1.5207 +\def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
  1.5208 +\begingroup\defname {#1}{\putwordDefspec}%
  1.5209 +\defunargs {#2}\endgroup %
  1.5210 +\catcode\equalChar=\other % Turn off change made in \defparsebody
  1.5211 +}
  1.5212 +
  1.5213 +% @defop CATEGORY CLASS OPERATION ARG...
  1.5214 +%
  1.5215 +\def\defop #1 {\def\defoptype{#1}%
  1.5216 +\defopparsebody\Edefop\defopx\defopheader\defoptype}
  1.5217 +%
  1.5218 +\def\defopheader#1#2#3{%
  1.5219 +  \dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% function index entry
  1.5220 +  \begingroup
  1.5221 +    \defname{#2}{\defoptype\ \putwordon\ #1}%
  1.5222 +    \defunargs{#3}%
  1.5223 +  \endgroup
  1.5224 +}
  1.5225 +
  1.5226 +% @deftypeop CATEGORY CLASS TYPE OPERATION ARG...
  1.5227 +%
  1.5228 +\def\deftypeop #1 {\def\deftypeopcategory{#1}%
  1.5229 +  \deftypeopparsebody\Edeftypeop\deftypeopx\deftypeopheader
  1.5230 +                       \deftypeopcategory}
  1.5231 +%
  1.5232 +% #1 is the class name, #2 the data type, #3 the operation name, #4 the args.
  1.5233 +\def\deftypeopheader#1#2#3#4{%
  1.5234 +  \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index
  1.5235 +  \begingroup
  1.5236 +    \defname{\defheaderxcond#2\relax$.$#3}
  1.5237 +            {\deftypeopcategory\ \putwordon\ \code{#1}}%
  1.5238 +    \deftypefunargs{#4}%
  1.5239 +  \endgroup
  1.5240 +}
  1.5241 +
  1.5242 +% @deftypemethod CLASS TYPE METHOD ARG...
  1.5243 +%
  1.5244 +\def\deftypemethod{%
  1.5245 +  \deftypemethparsebody\Edeftypemethod\deftypemethodx\deftypemethodheader}
  1.5246 +%
  1.5247 +% #1 is the class name, #2 the data type, #3 the method name, #4 the args.
  1.5248 +\def\deftypemethodheader#1#2#3#4{%
  1.5249 +  \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index
  1.5250 +  \begingroup
  1.5251 +    \defname{\defheaderxcond#2\relax$.$#3}{\putwordMethodon\ \code{#1}}%
  1.5252 +    \deftypefunargs{#4}%
  1.5253 +  \endgroup
  1.5254 +}
  1.5255 +
  1.5256 +% @deftypeivar CLASS TYPE VARNAME
  1.5257 +%
  1.5258 +\def\deftypeivar{%
  1.5259 +  \deftypemethparsebody\Edeftypeivar\deftypeivarx\deftypeivarheader}
  1.5260 +%
  1.5261 +% #1 is the class name, #2 the data type, #3 the variable name.
  1.5262 +\def\deftypeivarheader#1#2#3{%
  1.5263 +  \dosubind{vr}{\code{#3}}{\putwordof\ \code{#1}}% entry in variable index
  1.5264 +  \begingroup
  1.5265 +    \defname{\defheaderxcond#2\relax$.$#3}
  1.5266 +            {\putwordInstanceVariableof\ \code{#1}}%
  1.5267 +    \defvarargs{#3}%
  1.5268 +  \endgroup
  1.5269 +}
  1.5270 +
  1.5271 +% @defmethod == @defop Method
  1.5272 +%
  1.5273 +\def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
  1.5274 +%
  1.5275 +% #1 is the class name, #2 the method name, #3 the args.
  1.5276 +\def\defmethodheader#1#2#3{%
  1.5277 +  \dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% entry in function index
  1.5278 +  \begingroup
  1.5279 +    \defname{#2}{\putwordMethodon\ \code{#1}}%
  1.5280 +    \defunargs{#3}%
  1.5281 +  \endgroup
  1.5282 +}
  1.5283 +
  1.5284 +% @defcv {Class Option} foo-class foo-flag
  1.5285 +
  1.5286 +\def\defcv #1 {\def\defcvtype{#1}%
  1.5287 +\defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}
  1.5288 +
  1.5289 +\def\defcvarheader #1#2#3{%
  1.5290 +  \dosubind{vr}{\code{#2}}{\putwordof\ \code{#1}}% variable index entry
  1.5291 +  \begingroup
  1.5292 +    \defname{#2}{\defcvtype\ \putwordof\ #1}%
  1.5293 +    \defvarargs{#3}%
  1.5294 +  \endgroup
  1.5295 +}
  1.5296 +
  1.5297 +% @defivar CLASS VARNAME == @defcv {Instance Variable} CLASS VARNAME
  1.5298 +%
  1.5299 +\def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader}
  1.5300 +%
  1.5301 +\def\defivarheader#1#2#3{%
  1.5302 +  \dosubind{vr}{\code{#2}}{\putwordof\ \code{#1}}% entry in var index
  1.5303 +  \begingroup
  1.5304 +    \defname{#2}{\putwordInstanceVariableof\ #1}%
  1.5305 +    \defvarargs{#3}%
  1.5306 +  \endgroup
  1.5307 +}
  1.5308 +
  1.5309 +% @defvar
  1.5310 +% First, define the processing that is wanted for arguments of @defvar.
  1.5311 +% This is actually simple: just print them in roman.
  1.5312 +% This must expand the args and terminate the paragraph they make up
  1.5313 +\def\defvarargs #1{\normalparens #1%
  1.5314 +  \defargscommonending
  1.5315 +}
  1.5316 +
  1.5317 +% @defvr Counter foo-count
  1.5318 +
  1.5319 +\def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader}
  1.5320 +
  1.5321 +\def\defvrheader #1#2#3{\doind {vr}{\code{#2}}%
  1.5322 +\begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup}
  1.5323 +
  1.5324 +% @defvar == @defvr Variable
  1.5325 +
  1.5326 +\def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader}
  1.5327 +
  1.5328 +\def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
  1.5329 +\begingroup\defname {#1}{\putwordDefvar}%
  1.5330 +\defvarargs {#2}\endgroup %
  1.5331 +}
  1.5332 +
  1.5333 +% @defopt == @defvr {User Option}
  1.5334 +
  1.5335 +\def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader}
  1.5336 +
  1.5337 +\def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
  1.5338 +\begingroup\defname {#1}{\putwordDefopt}%
  1.5339 +\defvarargs {#2}\endgroup %
  1.5340 +}
  1.5341 +
  1.5342 +% @deftypevar int foobar
  1.5343 +
  1.5344 +\def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader}
  1.5345 +
  1.5346 +% #1 is the data type.  #2 is the name, perhaps followed by text that
  1.5347 +% is actually part of the data type, which should not be put into the index.
  1.5348 +\def\deftypevarheader #1#2{%
  1.5349 +\dovarind#2 \relax% Make entry in variables index
  1.5350 +\begingroup\defname {\defheaderxcond#1\relax$.$#2}{\putwordDeftypevar}%
  1.5351 +  \defargscommonending
  1.5352 +\endgroup}
  1.5353 +\def\dovarind#1 #2\relax{\doind{vr}{\code{#1}}}
  1.5354 +
  1.5355 +% @deftypevr {Global Flag} int enable
  1.5356 +
  1.5357 +\def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader}
  1.5358 +
  1.5359 +\def\deftypevrheader #1#2#3{\dovarind#3 \relax%
  1.5360 +\begingroup\defname {\defheaderxcond#2\relax$.$#3}{#1}
  1.5361 +  \defargscommonending
  1.5362 +\endgroup}
  1.5363 +
  1.5364 +% Now define @deftp
  1.5365 +% Args are printed in bold, a slight difference from @defvar.
  1.5366 +
  1.5367 +\def\deftpargs #1{\bf \defvarargs{#1}}
  1.5368 +
  1.5369 +% @deftp Class window height width ...
  1.5370 +
  1.5371 +\def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader}
  1.5372 +
  1.5373 +\def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
  1.5374 +\begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
  1.5375 +
  1.5376 +% These definitions are used if you use @defunx (etc.)
  1.5377 +% anywhere other than immediately after a @defun or @defunx.
  1.5378 +%
  1.5379 +\def\defcvx#1 {\errmessage{@defcvx in invalid context}}
  1.5380 +\def\deffnx#1 {\errmessage{@deffnx in invalid context}}
  1.5381 +\def\defivarx#1 {\errmessage{@defivarx in invalid context}}
  1.5382 +\def\defmacx#1 {\errmessage{@defmacx in invalid context}}
  1.5383 +\def\defmethodx#1 {\errmessage{@defmethodx in invalid context}}
  1.5384 +\def\defoptx #1 {\errmessage{@defoptx in invalid context}}
  1.5385 +\def\defopx#1 {\errmessage{@defopx in invalid context}}
  1.5386 +\def\defspecx#1 {\errmessage{@defspecx in invalid context}}
  1.5387 +\def\deftpx#1 {\errmessage{@deftpx in invalid context}}
  1.5388 +\def\deftypefnx#1 {\errmessage{@deftypefnx in invalid context}}
  1.5389 +\def\deftypefunx#1 {\errmessage{@deftypefunx in invalid context}}
  1.5390 +\def\deftypeivarx#1 {\errmessage{@deftypeivarx in invalid context}}
  1.5391 +\def\deftypemethodx#1 {\errmessage{@deftypemethodx in invalid context}}
  1.5392 +\def\deftypeopx#1 {\errmessage{@deftypeopx in invalid context}}
  1.5393 +\def\deftypevarx#1 {\errmessage{@deftypevarx in invalid context}}
  1.5394 +\def\deftypevrx#1 {\errmessage{@deftypevrx in invalid context}}
  1.5395 +\def\defunx#1 {\errmessage{@defunx in invalid context}}
  1.5396 +\def\defvarx#1 {\errmessage{@defvarx in invalid context}}
  1.5397 +\def\defvrx#1 {\errmessage{@defvrx in invalid context}}
  1.5398 +
  1.5399 +
  1.5400 +\message{macros,}
  1.5401 +% @macro.
  1.5402 +
  1.5403 +% To do this right we need a feature of e-TeX, \scantokens,
  1.5404 +% which we arrange to emulate with a temporary file in ordinary TeX.
  1.5405 +\ifx\eTeXversion\undefined
  1.5406 + \newwrite\macscribble
  1.5407 + \def\scanmacro#1{%
  1.5408 +   \begingroup \newlinechar`\^^M
  1.5409 +   % Undo catcode changes of \startcontents and \doprintindex
  1.5410 +   \catcode`\@=0 \catcode`\\=\other \escapechar=`\@
  1.5411 +   % Append \endinput to make sure that TeX does not see the ending newline.
  1.5412 +   \toks0={#1\endinput}%
  1.5413 +   \immediate\openout\macscribble=\jobname.tmp
  1.5414 +   \immediate\write\macscribble{\the\toks0}%
  1.5415 +   \immediate\closeout\macscribble
  1.5416 +   \let\xeatspaces\eatspaces
  1.5417 +   \input \jobname.tmp
  1.5418 +   \endgroup
  1.5419 +}
  1.5420 +\else
  1.5421 +\def\scanmacro#1{%
  1.5422 +\begingroup \newlinechar`\^^M
  1.5423 +% Undo catcode changes of \startcontents and \doprintindex
  1.5424 +\catcode`\@=0 \catcode`\\=\other \escapechar=`\@
  1.5425 +\let\xeatspaces\eatspaces\scantokens{#1\endinput}\endgroup}
  1.5426 +\fi
  1.5427 +
  1.5428 +\newcount\paramno   % Count of parameters
  1.5429 +\newtoks\macname    % Macro name
  1.5430 +\newif\ifrecursive  % Is it recursive?
  1.5431 +\def\macrolist{}    % List of all defined macros in the form
  1.5432 +                    % \do\macro1\do\macro2...
  1.5433 +
  1.5434 +% Utility routines.
  1.5435 +% Thisdoes \let #1 = #2, except with \csnames.
  1.5436 +\def\cslet#1#2{%
  1.5437 +\expandafter\expandafter
  1.5438 +\expandafter\let
  1.5439 +\expandafter\expandafter
  1.5440 +\csname#1\endcsname
  1.5441 +\csname#2\endcsname}
  1.5442 +
  1.5443 +% Trim leading and trailing spaces off a string.
  1.5444 +% Concepts from aro-bend problem 15 (see CTAN).
  1.5445 +{\catcode`\@=11
  1.5446 +\gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
  1.5447 +\gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
  1.5448 +\gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
  1.5449 +\def\unbrace#1{#1}
  1.5450 +\unbrace{\gdef\trim@@@ #1 } #2@{#1}
  1.5451 +}
  1.5452 +
  1.5453 +% Trim a single trailing ^^M off a string.
  1.5454 +{\catcode`\^^M=\other \catcode`\Q=3%
  1.5455 +\gdef\eatcr #1{\eatcra #1Q^^MQ}%
  1.5456 +\gdef\eatcra#1^^MQ{\eatcrb#1Q}%
  1.5457 +\gdef\eatcrb#1Q#2Q{#1}%
  1.5458 +}
  1.5459 +
  1.5460 +% Macro bodies are absorbed as an argument in a context where
  1.5461 +% all characters are catcode 10, 11 or 12, except \ which is active
  1.5462 +% (as in normal texinfo). It is necessary to change the definition of \.
  1.5463 +
  1.5464 +% It's necessary to have hard CRs when the macro is executed. This is
  1.5465 +% done by  making ^^M (\endlinechar) catcode 12 when reading the macro
  1.5466 +% body, and then making it the \newlinechar in \scanmacro.
  1.5467 +
  1.5468 +\def\macrobodyctxt{%
  1.5469 +  \catcode`\~=\other
  1.5470 +  \catcode`\^=\other
  1.5471 +  \catcode`\_=\other
  1.5472 +  \catcode`\|=\other
  1.5473 +  \catcode`\<=\other
  1.5474 +  \catcode`\>=\other
  1.5475 +  \catcode`\+=\other
  1.5476 +  \catcode`\{=\other
  1.5477 +  \catcode`\}=\other
  1.5478 +  \catcode`\@=\other
  1.5479 +  \catcode`\^^M=\other
  1.5480 +  \usembodybackslash}
  1.5481 +
  1.5482 +\def\macroargctxt{%
  1.5483 +  \catcode`\~=\other
  1.5484 +  \catcode`\^=\other
  1.5485 +  \catcode`\_=\other
  1.5486 +  \catcode`\|=\other
  1.5487 +  \catcode`\<=\other
  1.5488 +  \catcode`\>=\other
  1.5489 +  \catcode`\+=\other
  1.5490 +  \catcode`\@=\other
  1.5491 +  \catcode`\\=\other}
  1.5492 +
  1.5493 +% \mbodybackslash is the definition of \ in @macro bodies.
  1.5494 +% It maps \foo\ => \csname macarg.foo\endcsname => #N
  1.5495 +% where N is the macro parameter number.
  1.5496 +% We define \csname macarg.\endcsname to be \realbackslash, so
  1.5497 +% \\ in macro replacement text gets you a backslash.
  1.5498 +
  1.5499 +{\catcode`@=0 @catcode`@\=@active
  1.5500 + @gdef@usembodybackslash{@let\=@mbodybackslash}
  1.5501 + @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
  1.5502 +}
  1.5503 +\expandafter\def\csname macarg.\endcsname{\realbackslash}
  1.5504 +
  1.5505 +\def\macro{\recursivefalse\parsearg\macroxxx}
  1.5506 +\def\rmacro{\recursivetrue\parsearg\macroxxx}
  1.5507 +
  1.5508 +\def\macroxxx#1{%
  1.5509 +  \getargs{#1}%           now \macname is the macname and \argl the arglist
  1.5510 +  \ifx\argl\empty       % no arguments
  1.5511 +     \paramno=0%
  1.5512 +  \else
  1.5513 +     \expandafter\parsemargdef \argl;%
  1.5514 +  \fi
  1.5515 +  \if1\csname ismacro.\the\macname\endcsname
  1.5516 +     \message{Warning: redefining \the\macname}%
  1.5517 +  \else
  1.5518 +     \expandafter\ifx\csname \the\macname\endcsname \relax
  1.5519 +     \else \errmessage{Macro name \the\macname\space already defined}\fi
  1.5520 +     \global\cslet{macsave.\the\macname}{\the\macname}%
  1.5521 +     \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
  1.5522 +     % Add the macroname to \macrolist
  1.5523 +     \toks0 = \expandafter{\macrolist\do}%
  1.5524 +     \xdef\macrolist{\the\toks0
  1.5525 +       \expandafter\noexpand\csname\the\macname\endcsname}%
  1.5526 +  \fi
  1.5527 +  \begingroup \macrobodyctxt
  1.5528 +  \ifrecursive \expandafter\parsermacbody
  1.5529 +  \else \expandafter\parsemacbody
  1.5530 +  \fi}
  1.5531 +
  1.5532 +\def\unmacro{\parsearg\dounmacro}
  1.5533 +\def\dounmacro#1{%
  1.5534 +  \if1\csname ismacro.#1\endcsname
  1.5535 +    \global\cslet{#1}{macsave.#1}%
  1.5536 +    \global\expandafter\let \csname ismacro.#1\endcsname=0%
  1.5537 +    % Remove the macro name from \macrolist:
  1.5538 +    \begingroup
  1.5539 +      \expandafter\let\csname#1\endcsname \relax
  1.5540 +      \let\do\unmacrodo
  1.5541 +      \xdef\macrolist{\macrolist}%
  1.5542 +    \endgroup
  1.5543 +  \else
  1.5544 +    \errmessage{Macro #1 not defined}%
  1.5545 +  \fi
  1.5546 +}
  1.5547 +
  1.5548 +% Called by \do from \dounmacro on each macro.  The idea is to omit any
  1.5549 +% macro definitions that have been changed to \relax.
  1.5550 +%
  1.5551 +\def\unmacrodo#1{%
  1.5552 +  \ifx#1\relax
  1.5553 +    % remove this
  1.5554 +  \else
  1.5555 +    \noexpand\do \noexpand #1%
  1.5556 +  \fi
  1.5557 +}
  1.5558 +
  1.5559 +% This makes use of the obscure feature that if the last token of a
  1.5560 +% <parameter list> is #, then the preceding argument is delimited by
  1.5561 +% an opening brace, and that opening brace is not consumed.
  1.5562 +\def\getargs#1{\getargsxxx#1{}}
  1.5563 +\def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
  1.5564 +\def\getmacname #1 #2\relax{\macname={#1}}
  1.5565 +\def\getmacargs#1{\def\argl{#1}}
  1.5566 +
  1.5567 +% Parse the optional {params} list.  Set up \paramno and \paramlist
  1.5568 +% so \defmacro knows what to do.  Define \macarg.blah for each blah
  1.5569 +% in the params list, to be ##N where N is the position in that list.
  1.5570 +% That gets used by \mbodybackslash (above).
  1.5571 +
  1.5572 +% We need to get `macro parameter char #' into several definitions.
  1.5573 +% The technique used is stolen from LaTeX:  let \hash be something
  1.5574 +% unexpandable, insert that wherever you need a #, and then redefine
  1.5575 +% it to # just before using the token list produced.
  1.5576 +%
  1.5577 +% The same technique is used to protect \eatspaces till just before
  1.5578 +% the macro is used.
  1.5579 +
  1.5580 +\def\parsemargdef#1;{\paramno=0\def\paramlist{}%
  1.5581 +        \let\hash\relax\let\xeatspaces\relax\parsemargdefxxx#1,;,}
  1.5582 +\def\parsemargdefxxx#1,{%
  1.5583 +  \if#1;\let\next=\relax
  1.5584 +  \else \let\next=\parsemargdefxxx
  1.5585 +    \advance\paramno by 1%
  1.5586 +    \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
  1.5587 +        {\xeatspaces{\hash\the\paramno}}%
  1.5588 +    \edef\paramlist{\paramlist\hash\the\paramno,}%
  1.5589 +  \fi\next}
  1.5590 +
  1.5591 +% These two commands read recursive and nonrecursive macro bodies.
  1.5592 +% (They're different since rec and nonrec macros end differently.)
  1.5593 +
  1.5594 +\long\def\parsemacbody#1@end macro%
  1.5595 +{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
  1.5596 +\long\def\parsermacbody#1@end rmacro%
  1.5597 +{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
  1.5598 +
  1.5599 +% This defines the macro itself. There are six cases: recursive and
  1.5600 +% nonrecursive macros of zero, one, and many arguments.
  1.5601 +% Much magic with \expandafter here.
  1.5602 +% \xdef is used so that macro definitions will survive the file
  1.5603 +% they're defined in; @include reads the file inside a group.
  1.5604 +\def\defmacro{%
  1.5605 +  \let\hash=##% convert placeholders to macro parameter chars
  1.5606 +  \ifrecursive
  1.5607 +    \ifcase\paramno
  1.5608 +    % 0
  1.5609 +      \expandafter\xdef\csname\the\macname\endcsname{%
  1.5610 +        \noexpand\scanmacro{\temp}}%
  1.5611 +    \or % 1
  1.5612 +      \expandafter\xdef\csname\the\macname\endcsname{%
  1.5613 +         \bgroup\noexpand\macroargctxt
  1.5614 +         \noexpand\braceorline
  1.5615 +         \expandafter\noexpand\csname\the\macname xxx\endcsname}%
  1.5616 +      \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
  1.5617 +         \egroup\noexpand\scanmacro{\temp}}%
  1.5618 +    \else % many
  1.5619 +      \expandafter\xdef\csname\the\macname\endcsname{%
  1.5620 +         \bgroup\noexpand\macroargctxt
  1.5621 +         \noexpand\csname\the\macname xx\endcsname}%
  1.5622 +      \expandafter\xdef\csname\the\macname xx\endcsname##1{%
  1.5623 +          \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
  1.5624 +      \expandafter\expandafter
  1.5625 +      \expandafter\xdef
  1.5626 +      \expandafter\expandafter
  1.5627 +        \csname\the\macname xxx\endcsname
  1.5628 +          \paramlist{\egroup\noexpand\scanmacro{\temp}}%
  1.5629 +    \fi
  1.5630 +  \else
  1.5631 +    \ifcase\paramno
  1.5632 +    % 0
  1.5633 +      \expandafter\xdef\csname\the\macname\endcsname{%
  1.5634 +        \noexpand\norecurse{\the\macname}%
  1.5635 +        \noexpand\scanmacro{\temp}\egroup}%
  1.5636 +    \or % 1
  1.5637 +      \expandafter\xdef\csname\the\macname\endcsname{%
  1.5638 +         \bgroup\noexpand\macroargctxt
  1.5639 +         \noexpand\braceorline
  1.5640 +         \expandafter\noexpand\csname\the\macname xxx\endcsname}%
  1.5641 +      \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
  1.5642 +        \egroup
  1.5643 +        \noexpand\norecurse{\the\macname}%
  1.5644 +        \noexpand\scanmacro{\temp}\egroup}%
  1.5645 +    \else % many
  1.5646 +      \expandafter\xdef\csname\the\macname\endcsname{%
  1.5647 +         \bgroup\noexpand\macroargctxt
  1.5648 +         \expandafter\noexpand\csname\the\macname xx\endcsname}%
  1.5649 +      \expandafter\xdef\csname\the\macname xx\endcsname##1{%
  1.5650 +          \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
  1.5651 +      \expandafter\expandafter
  1.5652 +      \expandafter\xdef
  1.5653 +      \expandafter\expandafter
  1.5654 +      \csname\the\macname xxx\endcsname
  1.5655 +      \paramlist{%
  1.5656 +          \egroup
  1.5657 +          \noexpand\norecurse{\the\macname}%
  1.5658 +          \noexpand\scanmacro{\temp}\egroup}%
  1.5659 +    \fi
  1.5660 +  \fi}
  1.5661 +
  1.5662 +\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
  1.5663 +
  1.5664 +% \braceorline decides whether the next nonwhitespace character is a
  1.5665 +% {.  If so it reads up to the closing }, if not, it reads the whole
  1.5666 +% line.  Whatever was read is then fed to the next control sequence
  1.5667 +% as an argument (by \parsebrace or \parsearg)
  1.5668 +\def\braceorline#1{\let\next=#1\futurelet\nchar\braceorlinexxx}
  1.5669 +\def\braceorlinexxx{%
  1.5670 +  \ifx\nchar\bgroup\else
  1.5671 +    \expandafter\parsearg
  1.5672 +  \fi \next}
  1.5673 +
  1.5674 +% We mant to disable all macros during \shipout so that they are not
  1.5675 +% expanded by \write.
  1.5676 +\def\turnoffmacros{\begingroup \def\do##1{\let\noexpand##1=\relax}%
  1.5677 +  \edef\next{\macrolist}\expandafter\endgroup\next}
  1.5678 +
  1.5679 +
  1.5680 +% @alias.
  1.5681 +% We need some trickery to remove the optional spaces around the equal
  1.5682 +% sign.  Just make them active and then expand them all to nothing.
  1.5683 +\def\alias{\begingroup\obeyspaces\parsearg\aliasxxx}
  1.5684 +\def\aliasxxx #1{\aliasyyy#1\relax}
  1.5685 +\def\aliasyyy #1=#2\relax{\ignoreactivespaces
  1.5686 +\edef\next{\global\let\expandafter\noexpand\csname#1\endcsname=%
  1.5687 +           \expandafter\noexpand\csname#2\endcsname}%
  1.5688 +\expandafter\endgroup\next}
  1.5689 +
  1.5690 +
  1.5691 +\message{cross references,}
  1.5692 +% @xref etc.
  1.5693 +
  1.5694 +\newwrite\auxfile
  1.5695 +
  1.5696 +\newif\ifhavexrefs    % True if xref values are known.
  1.5697 +\newif\ifwarnedxrefs  % True if we warned once that they aren't known.
  1.5698 +
  1.5699 +% @inforef is relatively simple.
  1.5700 +\def\inforef #1{\inforefzzz #1,,,,**}
  1.5701 +\def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
  1.5702 +  node \samp{\ignorespaces#1{}}}
  1.5703 +
  1.5704 +% @node's job is to define \lastnode.
  1.5705 +\def\node{\ENVcheck\parsearg\nodezzz}
  1.5706 +\def\nodezzz#1{\nodexxx #1,\finishnodeparse}
  1.5707 +\def\nodexxx#1,#2\finishnodeparse{\gdef\lastnode{#1}}
  1.5708 +\let\nwnode=\node
  1.5709 +\let\lastnode=\relax
  1.5710 +
  1.5711 +% The sectioning commands (@chapter, etc.) call these.
  1.5712 +\def\donoderef{%
  1.5713 +  \ifx\lastnode\relax\else
  1.5714 +    \expandafter\expandafter\expandafter\setref{\lastnode}%
  1.5715 +      {Ysectionnumberandtype}%
  1.5716 +    \global\let\lastnode=\relax
  1.5717 +  \fi
  1.5718 +}
  1.5719 +\def\unnumbnoderef{%
  1.5720 +  \ifx\lastnode\relax\else
  1.5721 +    \expandafter\expandafter\expandafter\setref{\lastnode}{Ynothing}%
  1.5722 +    \global\let\lastnode=\relax
  1.5723 +  \fi
  1.5724 +}
  1.5725 +\def\appendixnoderef{%
  1.5726 +  \ifx\lastnode\relax\else
  1.5727 +    \expandafter\expandafter\expandafter\setref{\lastnode}%
  1.5728 +      {Yappendixletterandtype}%
  1.5729 +    \global\let\lastnode=\relax
  1.5730 +  \fi
  1.5731 +}
  1.5732 +
  1.5733 +
  1.5734 +% @anchor{NAME} -- define xref target at arbitrary point.
  1.5735 +%
  1.5736 +\newcount\savesfregister
  1.5737 +\gdef\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
  1.5738 +\gdef\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
  1.5739 +\gdef\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
  1.5740 +
  1.5741 +% \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
  1.5742 +% anchor), namely NAME-title (the corresponding @chapter/etc. name),
  1.5743 +% NAME-pg (the page number), and NAME-snt (section number and type).
  1.5744 +% Called from \foonoderef.
  1.5745 +%
  1.5746 +% We have to set \indexdummies so commands such as @code in a section
  1.5747 +% title aren't expanded.  It would be nicer not to expand the titles in
  1.5748 +% the first place, but there's so many layers that that is hard to do.
  1.5749 +%
  1.5750 +% Likewise, use \turnoffactive so that punctuation chars such as underscore
  1.5751 +% and backslash work in node names.
  1.5752 +%
  1.5753 +\def\setref#1#2{{%
  1.5754 +  \atdummies
  1.5755 +  \pdfmkdest{#1}%
  1.5756 +  %
  1.5757 +  \turnoffactive
  1.5758 +  \dosetq{#1-title}{Ytitle}%
  1.5759 +  \dosetq{#1-pg}{Ypagenumber}%
  1.5760 +  \dosetq{#1-snt}{#2}%
  1.5761 +}}
  1.5762 +
  1.5763 +% @xref, @pxref, and @ref generate cross-references.  For \xrefX, #1 is
  1.5764 +% the node name, #2 the name of the Info cross-reference, #3 the printed
  1.5765 +% node name, #4 the name of the Info file, #5 the name of the printed
  1.5766 +% manual.  All but the node name can be omitted.
  1.5767 +%
  1.5768 +\def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]}
  1.5769 +\def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]}
  1.5770 +\def\ref#1{\xrefX[#1,,,,,,,]}
  1.5771 +\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
  1.5772 +  \unsepspaces
  1.5773 +  \def\printedmanual{\ignorespaces #5}%
  1.5774 +  \def\printednodename{\ignorespaces #3}%
  1.5775 +  \setbox1=\hbox{\printedmanual}%
  1.5776 +  \setbox0=\hbox{\printednodename}%
  1.5777 +  \ifdim \wd0 = 0pt
  1.5778 +    % No printed node name was explicitly given.
  1.5779 +    \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax
  1.5780 +      % Use the node name inside the square brackets.
  1.5781 +      \def\printednodename{\ignorespaces #1}%
  1.5782 +    \else
  1.5783 +      % Use the actual chapter/section title appear inside
  1.5784 +      % the square brackets.  Use the real section title if we have it.
  1.5785 +      \ifdim \wd1 > 0pt
  1.5786 +        % It is in another manual, so we don't have it.
  1.5787 +        \def\printednodename{\ignorespaces #1}%
  1.5788 +      \else
  1.5789 +        \ifhavexrefs
  1.5790 +          % We know the real title if we have the xref values.
  1.5791 +          \def\printednodename{\refx{#1-title}{}}%
  1.5792 +        \else
  1.5793 +          % Otherwise just copy the Info node name.
  1.5794 +          \def\printednodename{\ignorespaces #1}%
  1.5795 +        \fi%
  1.5796 +      \fi
  1.5797 +    \fi
  1.5798 +  \fi
  1.5799 +  %
  1.5800 +  % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not
  1.5801 +  % insert empty discretionaries after hyphens, which means that it will
  1.5802 +  % not find a line break at a hyphen in a node names.  Since some manuals
  1.5803 +  % are best written with fairly long node names, containing hyphens, this
  1.5804 +  % is a loss.  Therefore, we give the text of the node name again, so it
  1.5805 +  % is as if TeX is seeing it for the first time.
  1.5806 +  \ifpdf
  1.5807 +    \leavevmode
  1.5808 +    \getfilename{#4}%
  1.5809 +    {\turnoffactive \otherbackslash
  1.5810 +     \ifnum\filenamelength>0
  1.5811 +       \startlink attr{/Border [0 0 0]}%
  1.5812 +         goto file{\the\filename.pdf} name{#1}%
  1.5813 +     \else
  1.5814 +       \startlink attr{/Border [0 0 0]}%
  1.5815 +         goto name{#1}%
  1.5816 +     \fi
  1.5817 +    }%
  1.5818 +    \linkcolor
  1.5819 +  \fi
  1.5820 +  %
  1.5821 +  \ifdim \wd1 > 0pt
  1.5822 +    \putwordsection{} ``\printednodename'' \putwordin{} \cite{\printedmanual}%
  1.5823 +  \else
  1.5824 +    % _ (for example) has to be the character _ for the purposes of the
  1.5825 +    % control sequence corresponding to the node, but it has to expand
  1.5826 +    % into the usual \leavevmode...\vrule stuff for purposes of
  1.5827 +    % printing. So we \turnoffactive for the \refx-snt, back on for the
  1.5828 +    % printing, back off for the \refx-pg.
  1.5829 +    {\turnoffactive \otherbackslash
  1.5830 +     % Only output a following space if the -snt ref is nonempty; for
  1.5831 +     % @unnumbered and @anchor, it won't be.
  1.5832 +     \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
  1.5833 +     \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
  1.5834 +    }%
  1.5835 +    % output the `[mynode]' via a macro.
  1.5836 +    \xrefprintnodename\printednodename
  1.5837 +    %
  1.5838 +    % But we always want a comma and a space:
  1.5839 +    ,\space
  1.5840 +    %
  1.5841 +    % output the `page 3'.
  1.5842 +    \turnoffactive \otherbackslash \putwordpage\tie\refx{#1-pg}{}%
  1.5843 +  \fi
  1.5844 +  \endlink
  1.5845 +\endgroup}
  1.5846 +
  1.5847 +% This macro is called from \xrefX for the `[nodename]' part of xref
  1.5848 +% output.  It's a separate macro only so it can be changed more easily,
  1.5849 +% since not square brackets don't work in some documents.  Particularly
  1.5850 +% one that Bob is working on :).
  1.5851 +%
  1.5852 +\def\xrefprintnodename#1{[#1]}
  1.5853 +
  1.5854 +% \dosetq is called from \setref to do the actual \write (\iflinks).
  1.5855 +%
  1.5856 +\def\dosetq#1#2{%
  1.5857 +  {\let\folio=0%
  1.5858 +   \edef\next{\write\auxfile{\internalsetq{#1}{#2}}}%
  1.5859 +   \iflinks \next \fi
  1.5860 +  }%
  1.5861 +}
  1.5862 +
  1.5863 +% \internalsetq{foo}{page} expands into
  1.5864 +%   CHARACTERS @xrdef{foo}{...expansion of \page...}
  1.5865 +\def\internalsetq#1#2{@xrdef{#1}{\csname #2\endcsname}}
  1.5866 +
  1.5867 +% Things to be expanded by \internalsetq.
  1.5868 +%
  1.5869 +\def\Ypagenumber{\folio}
  1.5870 +\def\Ytitle{\thissection}
  1.5871 +\def\Ynothing{}
  1.5872 +\def\Ysectionnumberandtype{%
  1.5873 +  \ifnum\secno=0
  1.5874 +    \putwordChapter@tie \the\chapno
  1.5875 +  \else \ifnum\subsecno=0
  1.5876 +    \putwordSection@tie \the\chapno.\the\secno
  1.5877 +  \else \ifnum\subsubsecno=0
  1.5878 +    \putwordSection@tie \the\chapno.\the\secno.\the\subsecno
  1.5879 +  \else
  1.5880 +    \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno
  1.5881 +  \fi\fi\fi
  1.5882 +}
  1.5883 +
  1.5884 +\def\Yappendixletterandtype{%
  1.5885 +  \ifnum\secno=0
  1.5886 +     \putwordAppendix@tie @char\the\appendixno{}%
  1.5887 +  \else \ifnum\subsecno=0
  1.5888 +     \putwordSection@tie @char\the\appendixno.\the\secno
  1.5889 +  \else \ifnum\subsubsecno=0
  1.5890 +    \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno
  1.5891 +  \else
  1.5892 +    \putwordSection@tie
  1.5893 +      @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno
  1.5894 +  \fi\fi\fi
  1.5895 +}
  1.5896 +
  1.5897 +% Use TeX 3.0's \inputlineno to get the line number, for better error
  1.5898 +% messages, but if we're using an old version of TeX, don't do anything.
  1.5899 +%
  1.5900 +\ifx\inputlineno\thisisundefined
  1.5901 +  \let\linenumber = \empty % Pre-3.0.
  1.5902 +\else
  1.5903 +  \def\linenumber{\the\inputlineno:\space}
  1.5904 +\fi
  1.5905 +
  1.5906 +% Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
  1.5907 +% If its value is nonempty, SUFFIX is output afterward.
  1.5908 +%
  1.5909 +\def\refx#1#2{%
  1.5910 +  {%
  1.5911 +    \indexnofonts
  1.5912 +    \otherbackslash
  1.5913 +    \expandafter\global\expandafter\let\expandafter\thisrefX
  1.5914 +      \csname X#1\endcsname
  1.5915 +  }%
  1.5916 +  \ifx\thisrefX\relax
  1.5917 +    % If not defined, say something at least.
  1.5918 +    \angleleft un\-de\-fined\angleright
  1.5919 +    \iflinks
  1.5920 +      \ifhavexrefs
  1.5921 +        \message{\linenumber Undefined cross reference `#1'.}%
  1.5922 +      \else
  1.5923 +        \ifwarnedxrefs\else
  1.5924 +          \global\warnedxrefstrue
  1.5925 +          \message{Cross reference values unknown; you must run TeX again.}%
  1.5926 +        \fi
  1.5927 +      \fi
  1.5928 +    \fi
  1.5929 +  \else
  1.5930 +    % It's defined, so just use it.
  1.5931 +    \thisrefX
  1.5932 +  \fi
  1.5933 +  #2% Output the suffix in any case.
  1.5934 +}
  1.5935 +
  1.5936 +% This is the macro invoked by entries in the aux file.
  1.5937 +%
  1.5938 +\def\xrdef#1{\expandafter\gdef\csname X#1\endcsname}
  1.5939 +
  1.5940 +% Read the last existing aux file, if any.  No error if none exists.
  1.5941 +\def\readauxfile{\begingroup
  1.5942 +  \catcode`\^^@=\other
  1.5943 +  \catcode`\^^A=\other
  1.5944 +  \catcode`\^^B=\other
  1.5945 +  \catcode`\^^C=\other
  1.5946 +  \catcode`\^^D=\other
  1.5947 +  \catcode`\^^E=\other
  1.5948 +  \catcode`\^^F=\other
  1.5949 +  \catcode`\^^G=\other
  1.5950 +  \catcode`\^^H=\other
  1.5951 +  \catcode`\^^K=\other
  1.5952 +  \catcode`\^^L=\other
  1.5953 +  \catcode`\^^N=\other
  1.5954 +  \catcode`\^^P=\other
  1.5955 +  \catcode`\^^Q=\other
  1.5956 +  \catcode`\^^R=\other
  1.5957 +  \catcode`\^^S=\other
  1.5958 +  \catcode`\^^T=\other
  1.5959 +  \catcode`\^^U=\other
  1.5960 +  \catcode`\^^V=\other
  1.5961 +  \catcode`\^^W=\other
  1.5962 +  \catcode`\^^X=\other
  1.5963 +  \catcode`\^^Z=\other
  1.5964 +  \catcode`\^^[=\other
  1.5965 +  \catcode`\^^\=\other
  1.5966 +  \catcode`\^^]=\other
  1.5967 +  \catcode`\^^^=\other
  1.5968 +  \catcode`\^^_=\other
  1.5969 +  % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc.
  1.5970 +  % in xref tags, i.e., node names.  But since ^^e4 notation isn't
  1.5971 +  % supported in the main text, it doesn't seem desirable.  Furthermore,
  1.5972 +  % that is not enough: for node names that actually contain a ^
  1.5973 +  % character, we would end up writing a line like this: 'xrdef {'hat
  1.5974 +  % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
  1.5975 +  % argument, and \hat is not an expandable control sequence.  It could
  1.5976 +  % all be worked out, but why?  Either we support ^^ or we don't.
  1.5977 +  %
  1.5978 +  % The other change necessary for this was to define \auxhat:
  1.5979 +  % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
  1.5980 +  % and then to call \auxhat in \setq.
  1.5981 +  %
  1.5982 +  \catcode`\^=\other
  1.5983 +  %
  1.5984 +  % Special characters.  Should be turned off anyway, but...
  1.5985 +  \catcode`\~=\other
  1.5986 +  \catcode`\[=\other
  1.5987 +  \catcode`\]=\other
  1.5988 +  \catcode`\"=\other
  1.5989 +  \catcode`\_=\other
  1.5990 +  \catcode`\|=\other
  1.5991 +  \catcode`\<=\other
  1.5992 +  \catcode`\>=\other
  1.5993 +  \catcode`\$=\other
  1.5994 +  \catcode`\#=\other
  1.5995 +  \catcode`\&=\other
  1.5996 +  \catcode`\%=\other
  1.5997 +  \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
  1.5998 +  %
  1.5999 +  % Make the characters 128-255 be printing characters
  1.6000 +  {%
  1.6001 +    \count 1=128
  1.6002 +    \def\loop{%
  1.6003 +      \catcode\count 1=\other
  1.6004 +      \advance\count 1 by 1
  1.6005 +      \ifnum \count 1<256 \loop \fi
  1.6006 +    }%
  1.6007 +  }%
  1.6008 +  %
  1.6009 +  % Turn off \ as an escape so we do not lose on
  1.6010 +  % entries which were dumped with control sequences in their names.
  1.6011 +  % For example, @xrdef{$\leq $-fun}{page ...} made by @defun ^^
  1.6012 +  % Reference to such entries still does not work the way one would wish,
  1.6013 +  % but at least they do not bomb out when the aux file is read in.
  1.6014 +  \catcode`\\=\other
  1.6015 +  %
  1.6016 +  % @ is our escape character in .aux files.
  1.6017 +  \catcode`\{=1
  1.6018 +  \catcode`\}=2
  1.6019 +  \catcode`\@=0
  1.6020 +  %
  1.6021 +  \openin 1 \jobname.aux
  1.6022 +  \ifeof 1 \else
  1.6023 +    \closein 1
  1.6024 +    \input \jobname.aux
  1.6025 +    \global\havexrefstrue
  1.6026 +  \fi
  1.6027 +  % Open the new aux file.  TeX will close it automatically at exit.
  1.6028 +  \openout\auxfile=\jobname.aux
  1.6029 +\endgroup}
  1.6030 +
  1.6031 +
  1.6032 +% Footnotes.
  1.6033 +
  1.6034 +\newcount \footnoteno
  1.6035 +
  1.6036 +% The trailing space in the following definition for supereject is
  1.6037 +% vital for proper filling; pages come out unaligned when you do a
  1.6038 +% pagealignmacro call if that space before the closing brace is
  1.6039 +% removed. (Generally, numeric constants should always be followed by a
  1.6040 +% space to prevent strange expansion errors.)
  1.6041 +\def\supereject{\par\penalty -20000\footnoteno =0 }
  1.6042 +
  1.6043 +% @footnotestyle is meaningful for info output only.
  1.6044 +\let\footnotestyle=\comment
  1.6045 +
  1.6046 +\let\ptexfootnote=\footnote
  1.6047 +
  1.6048 +{\catcode `\@=11
  1.6049 +%
  1.6050 +% Auto-number footnotes.  Otherwise like plain.
  1.6051 +\gdef\footnote{%
  1.6052 +  \let\indent=\ptexindent
  1.6053 +  \global\advance\footnoteno by \@ne
  1.6054 +  \edef\thisfootno{$^{\the\footnoteno}$}%
  1.6055 +  %
  1.6056 +  % In case the footnote comes at the end of a sentence, preserve the
  1.6057 +  % extra spacing after we do the footnote number.
  1.6058 +  \let\@sf\empty
  1.6059 +  \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi
  1.6060 +  %
  1.6061 +  % Remove inadvertent blank space before typesetting the footnote number.
  1.6062 +  \unskip
  1.6063 +  \thisfootno\@sf
  1.6064 +  \dofootnote
  1.6065 +}%
  1.6066 +
  1.6067 +% Don't bother with the trickery in plain.tex to not require the
  1.6068 +% footnote text as a parameter.  Our footnotes don't need to be so general.
  1.6069 +%
  1.6070 +% Oh yes, they do; otherwise, @ifset and anything else that uses
  1.6071 +% \parseargline fail inside footnotes because the tokens are fixed when
  1.6072 +% the footnote is read.  --karl, 16nov96.
  1.6073 +%
  1.6074 +% The start of the footnote looks usually like this:
  1.6075 +\gdef\startfootins{\insert\footins\bgroup}
  1.6076 +%
  1.6077 +% ... but this macro is redefined inside @multitable.
  1.6078 +%
  1.6079 +\gdef\dofootnote{%
  1.6080 +  \startfootins
  1.6081 +  % We want to typeset this text as a normal paragraph, even if the
  1.6082 +  % footnote reference occurs in (for example) a display environment.
  1.6083 +  % So reset some parameters.
  1.6084 +  \hsize=\pagewidth
  1.6085 +  \interlinepenalty\interfootnotelinepenalty
  1.6086 +  \splittopskip\ht\strutbox % top baseline for broken footnotes
  1.6087 +  \splitmaxdepth\dp\strutbox
  1.6088 +  \floatingpenalty\@MM
  1.6089 +  \leftskip\z@skip
  1.6090 +  \rightskip\z@skip
  1.6091 +  \spaceskip\z@skip
  1.6092 +  \xspaceskip\z@skip
  1.6093 +  \parindent\defaultparindent
  1.6094 +  %
  1.6095 +  \smallfonts \rm
  1.6096 +  %
  1.6097 +  % Because we use hanging indentation in footnotes, a @noindent appears
  1.6098 +  % to exdent this text, so make it be a no-op.  makeinfo does not use
  1.6099 +  % hanging indentation so @noindent can still be needed within footnote
  1.6100 +  % text after an @example or the like (not that this is good style).
  1.6101 +  \let\noindent = \relax
  1.6102 +  %
  1.6103 +  % Hang the footnote text off the number.  Use \everypar in case the
  1.6104 +  % footnote extends for more than one paragraph.
  1.6105 +  \everypar = {\hang}%
  1.6106 +  \textindent{\thisfootno}%
  1.6107 +  %
  1.6108 +  % Don't crash into the line above the footnote text.  Since this
  1.6109 +  % expands into a box, it must come within the paragraph, lest it
  1.6110 +  % provide a place where TeX can split the footnote.
  1.6111 +  \footstrut
  1.6112 +  \futurelet\next\fo@t
  1.6113 +}
  1.6114 +}%end \catcode `\@=11
  1.6115 +
  1.6116 +% @| inserts a changebar to the left of the current line.  It should
  1.6117 +% surround any changed text.  This approach does *not* work if the
  1.6118 +% change spans more than two lines of output.  To handle that, we would
  1.6119 +% have adopt a much more difficult approach (putting marks into the main
  1.6120 +% vertical list for the beginning and end of each change).
  1.6121 +%
  1.6122 +\def\|{%
  1.6123 +  % \vadjust can only be used in horizontal mode.
  1.6124 +  \leavevmode
  1.6125 +  %
  1.6126 +  % Append this vertical mode material after the current line in the output.
  1.6127 +  \vadjust{%
  1.6128 +    % We want to insert a rule with the height and depth of the current
  1.6129 +    % leading; that is exactly what \strutbox is supposed to record.
  1.6130 +    \vskip-\baselineskip
  1.6131 +    %
  1.6132 +    % \vadjust-items are inserted at the left edge of the type.  So
  1.6133 +    % the \llap here moves out into the left-hand margin.
  1.6134 +    \llap{%
  1.6135 +      %
  1.6136 +      % For a thicker or thinner bar, change the `1pt'.
  1.6137 +      \vrule height\baselineskip width1pt
  1.6138 +      %
  1.6139 +      % This is the space between the bar and the text.
  1.6140 +      \hskip 12pt
  1.6141 +    }%
  1.6142 +  }%
  1.6143 +}
  1.6144 +
  1.6145 +% For a final copy, take out the rectangles
  1.6146 +% that mark overfull boxes (in case you have decided
  1.6147 +% that the text looks ok even though it passes the margin).
  1.6148 +%
  1.6149 +\def\finalout{\overfullrule=0pt}
  1.6150 +
  1.6151 +% @image.  We use the macros from epsf.tex to support this.
  1.6152 +% If epsf.tex is not installed and @image is used, we complain.
  1.6153 +%
  1.6154 +% Check for and read epsf.tex up front.  If we read it only at @image
  1.6155 +% time, we might be inside a group, and then its definitions would get
  1.6156 +% undone and the next image would fail.
  1.6157 +\openin 1 = epsf.tex
  1.6158 +\ifeof 1 \else
  1.6159 +  \closein 1
  1.6160 +  % Do not bother showing banner with epsf.tex v2.7k (available in
  1.6161 +  % doc/epsf.tex and on ctan).
  1.6162 +  \def\epsfannounce{\toks0 = }%
  1.6163 +  \input epsf.tex
  1.6164 +\fi
  1.6165 +%
  1.6166 +% We will only complain once about lack of epsf.tex.
  1.6167 +\newif\ifwarnednoepsf
  1.6168 +\newhelp\noepsfhelp{epsf.tex must be installed for images to
  1.6169 +  work.  It is also included in the Texinfo distribution, or you can get
  1.6170 +  it from ftp://tug.org/tex/epsf.tex.}
  1.6171 +%
  1.6172 +\def\image#1{%
  1.6173 +  \ifx\epsfbox\undefined
  1.6174 +    \ifwarnednoepsf \else
  1.6175 +      \errhelp = \noepsfhelp
  1.6176 +      \errmessage{epsf.tex not found, images will be ignored}%
  1.6177 +      \global\warnednoepsftrue
  1.6178 +    \fi
  1.6179 +  \else
  1.6180 +    \imagexxx #1,,,,,\finish
  1.6181 +  \fi
  1.6182 +}
  1.6183 +%
  1.6184 +% Arguments to @image:
  1.6185 +% #1 is (mandatory) image filename; we tack on .eps extension.
  1.6186 +% #2 is (optional) width, #3 is (optional) height.
  1.6187 +% #4 is (ignored optional) html alt text.
  1.6188 +% #5 is (ignored optional) extension.
  1.6189 +% #6 is just the usual extra ignored arg for parsing this stuff.
  1.6190 +\newif\ifimagevmode
  1.6191 +\def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
  1.6192 +  \catcode`\^^M = 5     % in case we're inside an example
  1.6193 +  \normalturnoffactive  % allow _ et al. in names
  1.6194 +  % If the image is by itself, center it.
  1.6195 +  \ifvmode
  1.6196 +    \imagevmodetrue
  1.6197 +    \nobreak\bigskip
  1.6198 +    % Usually we'll have text after the image which will insert
  1.6199 +    % \parskip glue, so insert it here too to equalize the space
  1.6200 +    % above and below.
  1.6201 +    \nobreak\vskip\parskip
  1.6202 +    \nobreak
  1.6203 +    \line\bgroup\hss
  1.6204 +  \fi
  1.6205 +  %
  1.6206 +  % Output the image.
  1.6207 +  \ifpdf
  1.6208 +    \dopdfimage{#1}{#2}{#3}%
  1.6209 +  \else
  1.6210 +    % \epsfbox itself resets \epsf?size at each figure.
  1.6211 +    \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
  1.6212 +    \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
  1.6213 +    \epsfbox{#1.eps}%
  1.6214 +  \fi
  1.6215 +  %
  1.6216 +  \ifimagevmode \hss \egroup \bigbreak \fi  % space after the image
  1.6217 +\endgroup}
  1.6218 +
  1.6219 +
  1.6220 +\message{localization,}
  1.6221 +% and i18n.
  1.6222 +
  1.6223 +% @documentlanguage is usually given very early, just after
  1.6224 +% @setfilename.  If done too late, it may not override everything
  1.6225 +% properly.  Single argument is the language abbreviation.
  1.6226 +% It would be nice if we could set up a hyphenation file here.
  1.6227 +%
  1.6228 +\def\documentlanguage{\parsearg\dodocumentlanguage}
  1.6229 +\def\dodocumentlanguage#1{%
  1.6230 +  \tex % read txi-??.tex file in plain TeX.
  1.6231 +  % Read the file if it exists.
  1.6232 +  \openin 1 txi-#1.tex
  1.6233 +  \ifeof1
  1.6234 +    \errhelp = \nolanghelp
  1.6235 +    \errmessage{Cannot read language file txi-#1.tex}%
  1.6236 +    \let\temp = \relax
  1.6237 +  \else
  1.6238 +    \def\temp{\input txi-#1.tex }%
  1.6239 +  \fi
  1.6240 +  \temp
  1.6241 +  \endgroup
  1.6242 +}
  1.6243 +\newhelp\nolanghelp{The given language definition file cannot be found or
  1.6244 +is empty.  Maybe you need to install it?  In the current directory
  1.6245 +should work if nowhere else does.}
  1.6246 +
  1.6247 +
  1.6248 +% @documentencoding should change something in TeX eventually, most
  1.6249 +% likely, but for now just recognize it.
  1.6250 +\let\documentencoding = \comment
  1.6251 +
  1.6252 +
  1.6253 +% Page size parameters.
  1.6254 +%
  1.6255 +\newdimen\defaultparindent \defaultparindent = 15pt
  1.6256 +
  1.6257 +\chapheadingskip = 15pt plus 4pt minus 2pt
  1.6258 +\secheadingskip = 12pt plus 3pt minus 2pt
  1.6259 +\subsecheadingskip = 9pt plus 2pt minus 2pt
  1.6260 +
  1.6261 +% Prevent underfull vbox error messages.
  1.6262 +\vbadness = 10000
  1.6263 +
  1.6264 +% Don't be so finicky about underfull hboxes, either.
  1.6265 +\hbadness = 2000
  1.6266 +
  1.6267 +% Following George Bush, just get rid of widows and orphans.
  1.6268 +\widowpenalty=10000
  1.6269 +\clubpenalty=10000
  1.6270 +
  1.6271 +% Use TeX 3.0's \emergencystretch to help line breaking, but if we're
  1.6272 +% using an old version of TeX, don't do anything.  We want the amount of
  1.6273 +% stretch added to depend on the line length, hence the dependence on
  1.6274 +% \hsize.  We call this whenever the paper size is set.
  1.6275 +%
  1.6276 +\def\setemergencystretch{%
  1.6277 +  \ifx\emergencystretch\thisisundefined
  1.6278 +    % Allow us to assign to \emergencystretch anyway.
  1.6279 +    \def\emergencystretch{\dimen0}%
  1.6280 +  \else
  1.6281 +    \emergencystretch = .15\hsize
  1.6282 +  \fi
  1.6283 +}
  1.6284 +
  1.6285 +% Parameters in order: 1) textheight; 2) textwidth; 3) voffset;
  1.6286 +% 4) hoffset; 5) binding offset; 6) topskip; 7) physical page height; 8)
  1.6287 +% physical page width.
  1.6288 +%
  1.6289 +% We also call \setleading{\textleading}, so the caller should define
  1.6290 +% \textleading.  The caller should also set \parskip.
  1.6291 +%
  1.6292 +\def\internalpagesizes#1#2#3#4#5#6#7#8{%
  1.6293 +  \voffset = #3\relax
  1.6294 +  \topskip = #6\relax
  1.6295 +  \splittopskip = \topskip
  1.6296 +  %
  1.6297 +  \vsize = #1\relax
  1.6298 +  \advance\vsize by \topskip
  1.6299 +  \outervsize = \vsize
  1.6300 +  \advance\outervsize by 2\topandbottommargin
  1.6301 +  \pageheight = \vsize
  1.6302 +  %
  1.6303 +  \hsize = #2\relax
  1.6304 +  \outerhsize = \hsize
  1.6305 +  \advance\outerhsize by 0.5in
  1.6306 +  \pagewidth = \hsize
  1.6307 +  %
  1.6308 +  \normaloffset = #4\relax
  1.6309 +  \bindingoffset = #5\relax
  1.6310 +  %
  1.6311 +  \ifpdf
  1.6312 +    \pdfpageheight #7\relax
  1.6313 +    \pdfpagewidth #8\relax
  1.6314 +  \fi
  1.6315 +  %
  1.6316 +  \setleading{\textleading}
  1.6317 +  %
  1.6318 +  \parindent = \defaultparindent
  1.6319 +  \setemergencystretch
  1.6320 +}
  1.6321 +
  1.6322 +% @letterpaper (the default).
  1.6323 +\def\letterpaper{{\globaldefs = 1
  1.6324 +  \parskip = 3pt plus 2pt minus 1pt
  1.6325 +  \textleading = 13.2pt
  1.6326 +  %
  1.6327 +  % If page is nothing but text, make it come out even.
  1.6328 +  \internalpagesizes{46\baselineskip}{6in}%
  1.6329 +                    {\voffset}{.25in}%
  1.6330 +                    {\bindingoffset}{36pt}%
  1.6331 +                    {11in}{8.5in}%
  1.6332 +}}
  1.6333 +
  1.6334 +% Use @smallbook to reset parameters for 7x9.5 (or so) format.
  1.6335 +\def\smallbook{{\globaldefs = 1
  1.6336 +  \parskip = 2pt plus 1pt
  1.6337 +  \textleading = 12pt
  1.6338 +  %
  1.6339 +  \internalpagesizes{7.5in}{5in}%
  1.6340 +                    {\voffset}{.25in}%
  1.6341 +                    {\bindingoffset}{16pt}%
  1.6342 +                    {9.25in}{7in}%
  1.6343 +  %
  1.6344 +  \lispnarrowing = 0.3in
  1.6345 +  \tolerance = 700
  1.6346 +  \hfuzz = 1pt
  1.6347 +  \contentsrightmargin = 0pt
  1.6348 +  \defbodyindent = .5cm
  1.6349 +}}
  1.6350 +
  1.6351 +% Use @afourpaper to print on European A4 paper.
  1.6352 +\def\afourpaper{{\globaldefs = 1
  1.6353 +  \parskip = 3pt plus 2pt minus 1pt
  1.6354 +  \textleading = 13.2pt
  1.6355 +  %
  1.6356 +  % Double-side printing via postscript on Laserjet 4050
  1.6357 +  % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm.
  1.6358 +  % To change the settings for a different printer or situation, adjust
  1.6359 +  % \normaloffset until the front-side and back-side texts align.  Then
  1.6360 +  % do the same for \bindingoffset.  You can set these for testing in
  1.6361 +  % your texinfo source file like this:
  1.6362 +  % @tex
  1.6363 +  % \global\normaloffset = -6mm
  1.6364 +  % \global\bindingoffset = 10mm
  1.6365 +  % @end tex
  1.6366 +  \internalpagesizes{51\baselineskip}{160mm}
  1.6367 +                    {\voffset}{\hoffset}%
  1.6368 +                    {\bindingoffset}{44pt}%
  1.6369 +                    {297mm}{210mm}%
  1.6370 +  %
  1.6371 +  \tolerance = 700
  1.6372 +  \hfuzz = 1pt
  1.6373 +  \contentsrightmargin = 0pt
  1.6374 +  \defbodyindent = 5mm
  1.6375 +}}
  1.6376 +
  1.6377 +% Use @afivepaper to print on European A5 paper.
  1.6378 +% From romildo@urano.iceb.ufop.br, 2 July 2000.
  1.6379 +% He also recommends making @example and @lisp be small.
  1.6380 +\def\afivepaper{{\globaldefs = 1
  1.6381 +  \parskip = 2pt plus 1pt minus 0.1pt
  1.6382 +  \textleading = 12.5pt
  1.6383 +  %
  1.6384 +  \internalpagesizes{160mm}{120mm}%
  1.6385 +                    {\voffset}{\hoffset}%
  1.6386 +                    {\bindingoffset}{8pt}%
  1.6387 +                    {210mm}{148mm}%
  1.6388 +  %
  1.6389 +  \lispnarrowing = 0.2in
  1.6390 +  \tolerance = 800
  1.6391 +  \hfuzz = 1.2pt
  1.6392 +  \contentsrightmargin = 0pt
  1.6393 +  \defbodyindent = 2mm
  1.6394 +  \tableindent = 12mm
  1.6395 +}}
  1.6396 +
  1.6397 +% A specific text layout, 24x15cm overall, intended for A4 paper.
  1.6398 +\def\afourlatex{{\globaldefs = 1
  1.6399 +  \afourpaper
  1.6400 +  \internalpagesizes{237mm}{150mm}%
  1.6401 +                    {\voffset}{4.6mm}%
  1.6402 +                    {\bindingoffset}{7mm}%
  1.6403 +                    {297mm}{210mm}%
  1.6404 +  %
  1.6405 +  % Must explicitly reset to 0 because we call \afourpaper.
  1.6406 +  \globaldefs = 0
  1.6407 +}}
  1.6408 +
  1.6409 +% Use @afourwide to print on A4 paper in landscape format.
  1.6410 +\def\afourwide{{\globaldefs = 1
  1.6411 +  \afourpaper
  1.6412 +  \internalpagesizes{241mm}{165mm}%
  1.6413 +                    {\voffset}{-2.95mm}%
  1.6414 +                    {\bindingoffset}{7mm}%
  1.6415 +                    {297mm}{210mm}%
  1.6416 +  \globaldefs = 0
  1.6417 +}}
  1.6418 +
  1.6419 +% @pagesizes TEXTHEIGHT[,TEXTWIDTH]
  1.6420 +% Perhaps we should allow setting the margins, \topskip, \parskip,
  1.6421 +% and/or leading, also. Or perhaps we should compute them somehow.
  1.6422 +%
  1.6423 +\def\pagesizes{\parsearg\pagesizesxxx}
  1.6424 +\def\pagesizesxxx#1{\pagesizesyyy #1,,\finish}
  1.6425 +\def\pagesizesyyy#1,#2,#3\finish{{%
  1.6426 +  \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
  1.6427 +  \globaldefs = 1
  1.6428 +  %
  1.6429 +  \parskip = 3pt plus 2pt minus 1pt
  1.6430 +  \setleading{\textleading}%
  1.6431 +  %
  1.6432 +  \dimen0 = #1
  1.6433 +  \advance\dimen0 by \voffset
  1.6434 +  %
  1.6435 +  \dimen2 = \hsize
  1.6436 +  \advance\dimen2 by \normaloffset
  1.6437 +  %
  1.6438 +  \internalpagesizes{#1}{\hsize}%
  1.6439 +                    {\voffset}{\normaloffset}%
  1.6440 +                    {\bindingoffset}{44pt}%
  1.6441 +                    {\dimen0}{\dimen2}%
  1.6442 +}}
  1.6443 +
  1.6444 +% Set default to letter.
  1.6445 +%
  1.6446 +\letterpaper
  1.6447 +
  1.6448 +
  1.6449 +\message{and turning on texinfo input format.}
  1.6450 +
  1.6451 +% Define macros to output various characters with catcode for normal text.
  1.6452 +\catcode`\"=\other
  1.6453 +\catcode`\~=\other
  1.6454 +\catcode`\^=\other
  1.6455 +\catcode`\_=\other
  1.6456 +\catcode`\|=\other
  1.6457 +\catcode`\<=\other
  1.6458 +\catcode`\>=\other
  1.6459 +\catcode`\+=\other
  1.6460 +\catcode`\$=\other
  1.6461 +\def\normaldoublequote{"}
  1.6462 +\def\normaltilde{~}
  1.6463 +\def\normalcaret{^}
  1.6464 +\def\normalunderscore{_}
  1.6465 +\def\normalverticalbar{|}
  1.6466 +\def\normalless{<}
  1.6467 +\def\normalgreater{>}
  1.6468 +\def\normalplus{+}
  1.6469 +\def\normaldollar{$}%$ font-lock fix
  1.6470 +
  1.6471 +% This macro is used to make a character print one way in ttfont
  1.6472 +% where it can probably just be output, and another way in other fonts,
  1.6473 +% where something hairier probably needs to be done.
  1.6474 +%
  1.6475 +% #1 is what to print if we are indeed using \tt; #2 is what to print
  1.6476 +% otherwise.  Since all the Computer Modern typewriter fonts have zero
  1.6477 +% interword stretch (and shrink), and it is reasonable to expect all
  1.6478 +% typewriter fonts to have this, we can check that font parameter.
  1.6479 +%
  1.6480 +\def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
  1.6481 +
  1.6482 +% Same as above, but check for italic font.  Actually this also catches
  1.6483 +% non-italic slanted fonts since it is impossible to distinguish them from
  1.6484 +% italic fonts.  But since this is only used by $ and it uses \sl anyway
  1.6485 +% this is not a problem.
  1.6486 +\def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
  1.6487 +
  1.6488 +% Turn off all special characters except @
  1.6489 +% (and those which the user can use as if they were ordinary).
  1.6490 +% Most of these we simply print from the \tt font, but for some, we can
  1.6491 +% use math or other variants that look better in normal text.
  1.6492 +
  1.6493 +\catcode`\"=\active
  1.6494 +\def\activedoublequote{{\tt\char34}}
  1.6495 +\let"=\activedoublequote
  1.6496 +\catcode`\~=\active
  1.6497 +\def~{{\tt\char126}}
  1.6498 +\chardef\hat=`\^
  1.6499 +\catcode`\^=\active
  1.6500 +\def^{{\tt \hat}}
  1.6501 +
  1.6502 +\catcode`\_=\active
  1.6503 +\def_{\ifusingtt\normalunderscore\_}
  1.6504 +% Subroutine for the previous macro.
  1.6505 +\def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }
  1.6506 +
  1.6507 +\catcode`\|=\active
  1.6508 +\def|{{\tt\char124}}
  1.6509 +\chardef \less=`\<
  1.6510 +\catcode`\<=\active
  1.6511 +\def<{{\tt \less}}
  1.6512 +\chardef \gtr=`\>
  1.6513 +\catcode`\>=\active
  1.6514 +\def>{{\tt \gtr}}
  1.6515 +\catcode`\+=\active
  1.6516 +\def+{{\tt \char 43}}
  1.6517 +\catcode`\$=\active
  1.6518 +\def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
  1.6519 +
  1.6520 +% Set up an active definition for =, but don't enable it most of the time.
  1.6521 +{\catcode`\==\active
  1.6522 +\global\def={{\tt \char 61}}}
  1.6523 +
  1.6524 +\catcode`+=\active
  1.6525 +\catcode`\_=\active
  1.6526 +
  1.6527 +% If a .fmt file is being used, characters that might appear in a file
  1.6528 +% name cannot be active until we have parsed the command line.
  1.6529 +% So turn them off again, and have \everyjob (or @setfilename) turn them on.
  1.6530 +% \otherifyactive is called near the end of this file.
  1.6531 +\def\otherifyactive{\catcode`+=\other \catcode`\_=\other}
  1.6532 +
  1.6533 +\catcode`\@=0
  1.6534 +
  1.6535 +% \rawbackslashxx outputs one backslash character in current font,
  1.6536 +% as in \char`\\.
  1.6537 +\global\chardef\rawbackslashxx=`\\
  1.6538 +
  1.6539 +% \rawbackslash defines an active \ to do \rawbackslashxx.
  1.6540 +% \otherbackslash defines an active \ to be a literal `\' character with
  1.6541 +% catcode other.
  1.6542 +{\catcode`\\=\active
  1.6543 + @gdef@rawbackslash{@let\=@rawbackslashxx}
  1.6544 + @gdef@otherbackslash{@let\=@realbackslash}
  1.6545 +}
  1.6546 +
  1.6547 +% \realbackslash is an actual character `\' with catcode other.
  1.6548 +{\catcode`\\=\other @gdef@realbackslash{\}}
  1.6549 +
  1.6550 +% \normalbackslash outputs one backslash in fixed width font.
  1.6551 +\def\normalbackslash{{\tt\rawbackslashxx}}
  1.6552 +
  1.6553 +\catcode`\\=\active
  1.6554 +
  1.6555 +% Used sometimes to turn off (effectively) the active characters
  1.6556 +% even after parsing them.
  1.6557 +@def@turnoffactive{%
  1.6558 +  @let"=@normaldoublequote
  1.6559 +  @let\=@realbackslash
  1.6560 +  @let~=@normaltilde
  1.6561 +  @let^=@normalcaret
  1.6562 +  @let_=@normalunderscore
  1.6563 +  @let|=@normalverticalbar
  1.6564 +  @let<=@normalless
  1.6565 +  @let>=@normalgreater
  1.6566 +  @let+=@normalplus
  1.6567 +  @let$=@normaldollar %$ font-lock fix
  1.6568 +}
  1.6569 +
  1.6570 +% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
  1.6571 +% the literal character `\'.  (Thus, \ is not expandable when this is in
  1.6572 +% effect.)
  1.6573 +%
  1.6574 +@def@normalturnoffactive{@turnoffactive @let\=@normalbackslash}
  1.6575 +
  1.6576 +% Make _ and + \other characters, temporarily.
  1.6577 +% This is canceled by @fixbackslash.
  1.6578 +@otherifyactive
  1.6579 +
  1.6580 +% If a .fmt file is being used, we don't want the `\input texinfo' to show up.
  1.6581 +% That is what \eatinput is for; after that, the `\' should revert to printing
  1.6582 +% a backslash.
  1.6583 +%
  1.6584 +@gdef@eatinput input texinfo{@fixbackslash}
  1.6585 +@global@let\ = @eatinput
  1.6586 +
  1.6587 +% On the other hand, perhaps the file did not have a `\input texinfo'. Then
  1.6588 +% the first `\{ in the file would cause an error. This macro tries to fix
  1.6589 +% that, assuming it is called before the first `\' could plausibly occur.
  1.6590 +% Also back turn on active characters that might appear in the input
  1.6591 +% file name, in case not using a pre-dumped format.
  1.6592 +%
  1.6593 +@gdef@fixbackslash{%
  1.6594 +  @ifx\@eatinput @let\ = @normalbackslash @fi
  1.6595 +  @catcode`+=@active
  1.6596 +  @catcode`@_=@active
  1.6597 +}
  1.6598 +
  1.6599 +% Say @foo, not \foo, in error messages.
  1.6600 +@escapechar = `@@
  1.6601 +
  1.6602 +% These look ok in all fonts, so just make them not special.
  1.6603 +@catcode`@& = @other
  1.6604 +@catcode`@# = @other
  1.6605 +@catcode`@% = @other
  1.6606 +
  1.6607 +@c Set initial fonts.
  1.6608 +@textfonts
  1.6609 +@rm
  1.6610 +
  1.6611 +
  1.6612 +@c Local variables:
  1.6613 +@c eval: (add-hook 'write-file-hooks 'time-stamp)
  1.6614 +@c page-delimiter: "^\\\\message"
  1.6615 +@c time-stamp-start: "def\\\\texinfoversion{"
  1.6616 +@c time-stamp-format: "%:y-%02m-%02d.%02H"
  1.6617 +@c time-stamp-end: "}"
  1.6618 +@c End: