dotemacs

My Emacs configuration
git clone git://git.entf.net/dotemacs
Log | Files | Refs | LICENSE

texinfo.tex (325847B)


      1 % texinfo.tex -- TeX macros to handle Texinfo files.
      2 %
      3 % Load plain if necessary, i.e., if running under initex.
      4 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
      5 %
      6 \def\texinfoversion{2013-09-11.11}
      7 %
      8 % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
      9 % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
     10 % 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
     11 %
     12 % This texinfo.tex file is free software: you can redistribute it and/or
     13 % modify it under the terms of the GNU General Public License as
     14 % published by the Free Software Foundation, either version 3 of the
     15 % License, or (at your option) any later version.
     16 %
     17 % This texinfo.tex file is distributed in the hope that it will be
     18 % useful, but WITHOUT ANY WARRANTY; without even the implied warranty
     19 % of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     20 % General Public License for more details.
     21 %
     22 % You should have received a copy of the GNU General Public License
     23 % along with this program.  If not, see <https://www.gnu.org/licenses/>.
     24 %
     25 % As a special exception, when this file is read by TeX when processing
     26 % a Texinfo source document, you may use the result without
     27 % restriction. This Exception is an additional permission under section 7
     28 % of the GNU General Public License, version 3 ("GPLv3").
     29 %
     30 % Please try the latest version of texinfo.tex before submitting bug
     31 % reports; you can get the latest version from:
     32 %   https://ftp.gnu.org/gnu/texinfo/ (the Texinfo release area), or
     33 %   https://ftpmirror.gnu.org/texinfo/ (same, via a mirror), or
     34 %   https://www.gnu.org/software/texinfo/ (the Texinfo home page)
     35 % The texinfo.tex in any given distribution could well be out
     36 % of date, so if that's what you're using, please check.
     37 %
     38 % Send bug reports to bug-texinfo@gnu.org.  Please include including a
     39 % complete document in each bug report with which we can reproduce the
     40 % problem.  Patches are, of course, greatly appreciated.
     41 %
     42 % To process a Texinfo manual with TeX, it's most reliable to use the
     43 % texi2dvi shell script that comes with the distribution.  For a simple
     44 % manual foo.texi, however, you can get away with this:
     45 %   tex foo.texi
     46 %   texindex foo.??
     47 %   tex foo.texi
     48 %   tex foo.texi
     49 %   dvips foo.dvi -o  # or whatever; this makes foo.ps.
     50 % The extra TeX runs get the cross-reference information correct.
     51 % Sometimes one run after texindex suffices, and sometimes you need more
     52 % than two; texi2dvi does it as many times as necessary.
     53 %
     54 % It is possible to adapt texinfo.tex for other languages, to some
     55 % extent.  You can get the existing language-specific files from the
     56 % full Texinfo distribution.
     57 %
     58 % The GNU Texinfo home page is https://www.gnu.org/software/texinfo.
     59 
     60 
     61 \message{Loading texinfo [version \texinfoversion]:}
     62 
     63 % If in a .fmt file, print the version number
     64 % and turn on active characters that we couldn't do earlier because
     65 % they might have appeared in the input file name.
     66 \everyjob{\message{[Texinfo version \texinfoversion]}%
     67   \catcode`+=\active \catcode`\_=\active}
     68 
     69 \chardef\other=12
     70 
     71 % We never want plain's \outer definition of \+ in Texinfo.
     72 % For @tex, we can use \tabalign.
     73 \let\+ = \relax
     74 
     75 % Save some plain tex macros whose names we will redefine.
     76 \let\ptexb=\b
     77 \let\ptexbullet=\bullet
     78 \let\ptexc=\c
     79 \let\ptexcomma=\,
     80 \let\ptexdot=\.
     81 \let\ptexdots=\dots
     82 \let\ptexend=\end
     83 \let\ptexequiv=\equiv
     84 \let\ptexexclam=\!
     85 \let\ptexfootnote=\footnote
     86 \let\ptexgtr=>
     87 \let\ptexhat=^
     88 \let\ptexi=\i
     89 \let\ptexindent=\indent
     90 \let\ptexinsert=\insert
     91 \let\ptexlbrace=\{
     92 \let\ptexless=<
     93 \let\ptexnewwrite\newwrite
     94 \let\ptexnoindent=\noindent
     95 \let\ptexplus=+
     96 \let\ptexraggedright=\raggedright
     97 \let\ptexrbrace=\}
     98 \let\ptexslash=\/
     99 \let\ptexstar=\*
    100 \let\ptext=\t
    101 \let\ptextop=\top
    102 {\catcode`\'=\active \global\let\ptexquoteright'}% active in plain's math mode
    103 
    104 % If this character appears in an error message or help string, it
    105 % starts a new line in the output.
    106 \newlinechar = `^^J
    107 
    108 % Use TeX 3.0's \inputlineno to get the line number, for better error
    109 % messages, but if we're using an old version of TeX, don't do anything.
    110 %
    111 \ifx\inputlineno\thisisundefined
    112   \let\linenumber = \empty % Pre-3.0.
    113 \else
    114   \def\linenumber{l.\the\inputlineno:\space}
    115 \fi
    116 
    117 % Set up fixed words for English if not already set.
    118 \ifx\putwordAppendix\undefined  \gdef\putwordAppendix{Appendix}\fi
    119 \ifx\putwordChapter\undefined   \gdef\putwordChapter{Chapter}\fi
    120 \ifx\putworderror\undefined     \gdef\putworderror{error}\fi
    121 \ifx\putwordfile\undefined      \gdef\putwordfile{file}\fi
    122 \ifx\putwordin\undefined        \gdef\putwordin{in}\fi
    123 \ifx\putwordIndexIsEmpty\undefined       \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
    124 \ifx\putwordIndexNonexistent\undefined   \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
    125 \ifx\putwordInfo\undefined      \gdef\putwordInfo{Info}\fi
    126 \ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
    127 \ifx\putwordMethodon\undefined  \gdef\putwordMethodon{Method on}\fi
    128 \ifx\putwordNoTitle\undefined   \gdef\putwordNoTitle{No Title}\fi
    129 \ifx\putwordof\undefined        \gdef\putwordof{of}\fi
    130 \ifx\putwordon\undefined        \gdef\putwordon{on}\fi
    131 \ifx\putwordpage\undefined      \gdef\putwordpage{page}\fi
    132 \ifx\putwordsection\undefined   \gdef\putwordsection{section}\fi
    133 \ifx\putwordSection\undefined   \gdef\putwordSection{Section}\fi
    134 \ifx\putwordsee\undefined       \gdef\putwordsee{see}\fi
    135 \ifx\putwordSee\undefined       \gdef\putwordSee{See}\fi
    136 \ifx\putwordShortTOC\undefined  \gdef\putwordShortTOC{Short Contents}\fi
    137 \ifx\putwordTOC\undefined       \gdef\putwordTOC{Table of Contents}\fi
    138 %
    139 \ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
    140 \ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
    141 \ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
    142 \ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
    143 \ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
    144 \ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
    145 \ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
    146 \ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
    147 \ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
    148 \ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
    149 \ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
    150 \ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
    151 %
    152 \ifx\putwordDefmac\undefined    \gdef\putwordDefmac{Macro}\fi
    153 \ifx\putwordDefspec\undefined   \gdef\putwordDefspec{Special Form}\fi
    154 \ifx\putwordDefvar\undefined    \gdef\putwordDefvar{Variable}\fi
    155 \ifx\putwordDefopt\undefined    \gdef\putwordDefopt{User Option}\fi
    156 \ifx\putwordDeffunc\undefined   \gdef\putwordDeffunc{Function}\fi
    157 
    158 % Since the category of space is not known, we have to be careful.
    159 \chardef\spacecat = 10
    160 \def\spaceisspace{\catcode`\ =\spacecat}
    161 
    162 % sometimes characters are active, so we need control sequences.
    163 \chardef\ampChar   = `\&
    164 \chardef\colonChar = `\:
    165 \chardef\commaChar = `\,
    166 \chardef\dashChar  = `\-
    167 \chardef\dotChar   = `\.
    168 \chardef\exclamChar= `\!
    169 \chardef\hashChar  = `\#
    170 \chardef\lquoteChar= `\`
    171 \chardef\questChar = `\?
    172 \chardef\rquoteChar= `\'
    173 \chardef\semiChar  = `\;
    174 \chardef\slashChar = `\/
    175 \chardef\underChar = `\_
    176 
    177 % Ignore a token.
    178 %
    179 \def\gobble#1{}
    180 
    181 % The following is used inside several \edef's.
    182 \def\makecsname#1{\expandafter\noexpand\csname#1\endcsname}
    183 
    184 % Hyphenation fixes.
    185 \hyphenation{
    186   Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script
    187   ap-pen-dix bit-map bit-maps
    188   data-base data-bases eshell fall-ing half-way long-est man-u-script
    189   man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm
    190   par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces
    191   spell-ing spell-ings
    192   stand-alone strong-est time-stamp time-stamps which-ever white-space
    193   wide-spread wrap-around
    194 }
    195 
    196 % Margin to add to right of even pages, to left of odd pages.
    197 \newdimen\bindingoffset
    198 \newdimen\normaloffset
    199 \newdimen\pagewidth \newdimen\pageheight
    200 
    201 % For a final copy, take out the rectangles
    202 % that mark overfull boxes (in case you have decided
    203 % that the text looks ok even though it passes the margin).
    204 %
    205 \def\finalout{\overfullrule=0pt }
    206 
    207 % Sometimes it is convenient to have everything in the transcript file
    208 % and nothing on the terminal.  We don't just call \tracingall here,
    209 % since that produces some useless output on the terminal.  We also make
    210 % some effort to order the tracing commands to reduce output in the log
    211 % file; cf. trace.sty in LaTeX.
    212 %
    213 \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
    214 \def\loggingall{%
    215   \tracingstats2
    216   \tracingpages1
    217   \tracinglostchars2  % 2 gives us more in etex
    218   \tracingparagraphs1
    219   \tracingoutput1
    220   \tracingmacros2
    221   \tracingrestores1
    222   \showboxbreadth\maxdimen \showboxdepth\maxdimen
    223   \ifx\eTeXversion\thisisundefined\else % etex gives us more logging
    224     \tracingscantokens1
    225     \tracingifs1
    226     \tracinggroups1
    227     \tracingnesting2
    228     \tracingassigns1
    229   \fi
    230   \tracingcommands3  % 3 gives us more in etex
    231   \errorcontextlines16
    232 }%
    233 
    234 % @errormsg{MSG}.  Do the index-like expansions on MSG, but if things
    235 % aren't perfect, it's not the end of the world, being an error message,
    236 % after all.
    237 %
    238 \def\errormsg{\begingroup \indexnofonts \doerrormsg}
    239 \def\doerrormsg#1{\errmessage{#1}}
    240 
    241 % add check for \lastpenalty to plain's definitions.  If the last thing
    242 % we did was a \nobreak, we don't want to insert more space.
    243 %
    244 \def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount
    245   \removelastskip\penalty-50\smallskip\fi\fi}
    246 \def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount
    247   \removelastskip\penalty-100\medskip\fi\fi}
    248 \def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
    249   \removelastskip\penalty-200\bigskip\fi\fi}
    250 
    251 % Do @cropmarks to get crop marks.
    252 %
    253 \newif\ifcropmarks
    254 \let\cropmarks = \cropmarkstrue
    255 %
    256 % Dimensions to add cropmarks at corners.
    257 % Added by P. A. MacKay, 12 Nov. 1986
    258 %
    259 \newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
    260 \newdimen\cornerlong  \cornerlong=1pc
    261 \newdimen\cornerthick \cornerthick=.3pt
    262 \newdimen\topandbottommargin \topandbottommargin=.75in
    263 
    264 % Output a mark which sets \thischapter, \thissection and \thiscolor.
    265 % We dump everything together because we only have one kind of mark.
    266 % This works because we only use \botmark / \topmark, not \firstmark.
    267 %
    268 % A mark contains a subexpression of the \ifcase ... \fi construct.
    269 % \get*marks macros below extract the needed part using \ifcase.
    270 %
    271 % Another complication is to let the user choose whether \thischapter
    272 % (\thissection) refers to the chapter (section) in effect at the top
    273 % of a page, or that at the bottom of a page.  The solution is
    274 % described on page 260 of The TeXbook.  It involves outputting two
    275 % marks for the sectioning macros, one before the section break, and
    276 % one after.  I won't pretend I can describe this better than DEK...
    277 \def\domark{%
    278   \toks0=\expandafter{\lastchapterdefs}%
    279   \toks2=\expandafter{\lastsectiondefs}%
    280   \toks4=\expandafter{\prevchapterdefs}%
    281   \toks6=\expandafter{\prevsectiondefs}%
    282   \toks8=\expandafter{\lastcolordefs}%
    283   \mark{%
    284                    \the\toks0 \the\toks2  % 0: top marks (\last...)
    285       \noexpand\or \the\toks4 \the\toks6  % 1: bottom marks (default, \prev...)
    286     \noexpand\else \the\toks8             % 2: color marks
    287   }%
    288 }
    289 % \topmark doesn't work for the very first chapter (after the title
    290 % page or the contents), so we use \firstmark there -- this gets us
    291 % the mark with the chapter defs, unless the user sneaks in, e.g.,
    292 % @setcolor (or @url, or @link, etc.) between @contents and the very
    293 % first @chapter.
    294 \def\gettopheadingmarks{%
    295   \ifcase0\topmark\fi
    296   \ifx\thischapter\empty \ifcase0\firstmark\fi \fi
    297 }
    298 \def\getbottomheadingmarks{\ifcase1\botmark\fi}
    299 \def\getcolormarks{\ifcase2\topmark\fi}
    300 
    301 % Avoid "undefined control sequence" errors.
    302 \def\lastchapterdefs{}
    303 \def\lastsectiondefs{}
    304 \def\prevchapterdefs{}
    305 \def\prevsectiondefs{}
    306 \def\lastcolordefs{}
    307 
    308 % Main output routine.
    309 \chardef\PAGE = 255
    310 \output = {\onepageout{\pagecontents\PAGE}}
    311 
    312 \newbox\headlinebox
    313 \newbox\footlinebox
    314 
    315 % \onepageout takes a vbox as an argument.  Note that \pagecontents
    316 % does insertions, but you have to call it yourself.
    317 \def\onepageout#1{%
    318   \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
    319   %
    320   \ifodd\pageno  \advance\hoffset by \bindingoffset
    321   \else \advance\hoffset by -\bindingoffset\fi
    322   %
    323   % Do this outside of the \shipout so @code etc. will be expanded in
    324   % the headline as they should be, not taken literally (outputting ''code).
    325   \def\commmonheadfootline{\let\hsize=\pagewidth \texinfochars}
    326   %
    327   \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
    328   \global\setbox\headlinebox = \vbox{\commmonheadfootline \makeheadline}%
    329   %
    330   \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi
    331   \global\setbox\footlinebox = \vbox{\commmonheadfootline \makefootline}%
    332   %
    333   {%
    334     % Have to do this stuff outside the \shipout because we want it to
    335     % take effect in \write's, yet the group defined by the \vbox ends
    336     % before the \shipout runs.
    337     %
    338     \indexdummies         % don't expand commands in the output.
    339     \normalturnoffactive  % \ in index entries must not stay \, e.g., if
    340                % the page break happens to be in the middle of an example.
    341                % We don't want .vr (or whatever) entries like this:
    342                % \entry{{\tt \indexbackslash }acronym}{32}{\code {\acronym}}
    343                % "\acronym" won't work when it's read back in;
    344                % it needs to be
    345                % {\code {{\tt \backslashcurfont }acronym}
    346     \shipout\vbox{%
    347       % Do this early so pdf references go to the beginning of the page.
    348       \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi
    349       %
    350       \ifcropmarks \vbox to \outervsize\bgroup
    351         \hsize = \outerhsize
    352         \vskip-\topandbottommargin
    353         \vtop to0pt{%
    354           \line{\ewtop\hfil\ewtop}%
    355           \nointerlineskip
    356           \line{%
    357             \vbox{\moveleft\cornerthick\nstop}%
    358             \hfill
    359             \vbox{\moveright\cornerthick\nstop}%
    360           }%
    361           \vss}%
    362         \vskip\topandbottommargin
    363         \line\bgroup
    364           \hfil % center the page within the outer (page) hsize.
    365           \ifodd\pageno\hskip\bindingoffset\fi
    366           \vbox\bgroup
    367       \fi
    368       %
    369       \unvbox\headlinebox
    370       \pagebody{#1}%
    371       \ifdim\ht\footlinebox > 0pt
    372         % Only leave this space if the footline is nonempty.
    373         % (We lessened \vsize for it in \oddfootingyyy.)
    374         % The \baselineskip=24pt in plain's \makefootline has no effect.
    375         \vskip 24pt
    376         \unvbox\footlinebox
    377       \fi
    378       %
    379       \ifcropmarks
    380           \egroup % end of \vbox\bgroup
    381         \hfil\egroup % end of (centering) \line\bgroup
    382         \vskip\topandbottommargin plus1fill minus1fill
    383         \boxmaxdepth = \cornerthick
    384         \vbox to0pt{\vss
    385           \line{%
    386             \vbox{\moveleft\cornerthick\nsbot}%
    387             \hfill
    388             \vbox{\moveright\cornerthick\nsbot}%
    389           }%
    390           \nointerlineskip
    391           \line{\ewbot\hfil\ewbot}%
    392         }%
    393       \egroup % \vbox from first cropmarks clause
    394       \fi
    395     }% end of \shipout\vbox
    396   }% end of group with \indexdummies
    397   \advancepageno
    398   \ifnum\outputpenalty>-20000 \else\dosupereject\fi
    399 }
    400 
    401 \newinsert\margin \dimen\margin=\maxdimen
    402 
    403 \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
    404 {\catcode`\@ =11
    405 \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
    406 % marginal hacks, juha@viisa.uucp (Juha Takala)
    407 \ifvoid\margin\else % marginal info is present
    408   \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
    409 \dimen@=\dp#1\relax \unvbox#1\relax
    410 \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
    411 \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
    412 }
    413 
    414 % Here are the rules for the cropmarks.  Note that they are
    415 % offset so that the space between them is truly \outerhsize or \outervsize
    416 % (P. A. MacKay, 12 November, 1986)
    417 %
    418 \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
    419 \def\nstop{\vbox
    420   {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
    421 \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
    422 \def\nsbot{\vbox
    423   {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
    424 
    425 % Parse an argument, then pass it to #1.  The argument is the rest of
    426 % the input line (except we remove a trailing comment).  #1 should be a
    427 % macro which expects an ordinary undelimited TeX argument.
    428 %
    429 \def\parsearg{\parseargusing{}}
    430 \def\parseargusing#1#2{%
    431   \def\argtorun{#2}%
    432   \begingroup
    433     \obeylines
    434     \spaceisspace
    435     #1%
    436     \parseargline\empty% Insert the \empty token, see \finishparsearg below.
    437 }
    438 
    439 {\obeylines %
    440   \gdef\parseargline#1^^M{%
    441     \endgroup % End of the group started in \parsearg.
    442     \argremovecomment #1\comment\ArgTerm%
    443   }%
    444 }
    445 
    446 % First remove any @comment, then any @c comment.
    447 \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
    448 \def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
    449 
    450 % Each occurrence of `\^^M' or `<space>\^^M' is replaced by a single space.
    451 %
    452 % \argremovec might leave us with trailing space, e.g.,
    453 %    @end itemize  @c foo
    454 % This space token undergoes the same procedure and is eventually removed
    455 % by \finishparsearg.
    456 %
    457 \def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M}
    458 \def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M}
    459 \def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{%
    460   \def\temp{#3}%
    461   \ifx\temp\empty
    462     % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp:
    463     \let\temp\finishparsearg
    464   \else
    465     \let\temp\argcheckspaces
    466   \fi
    467   % Put the space token in:
    468   \temp#1 #3\ArgTerm
    469 }
    470 
    471 % If a _delimited_ argument is enclosed in braces, they get stripped; so
    472 % to get _exactly_ the rest of the line, we had to prevent such situation.
    473 % We prepended an \empty token at the very beginning and we expand it now,
    474 % just before passing the control to \argtorun.
    475 % (Similarly, we have to think about #3 of \argcheckspacesY above: it is
    476 % either the null string, or it ends with \^^M---thus there is no danger
    477 % that a pair of braces would be stripped.
    478 %
    479 % But first, we have to remove the trailing space token.
    480 %
    481 \def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}}
    482 
    483 % \parseargdef\foo{...}
    484 %	is roughly equivalent to
    485 % \def\foo{\parsearg\Xfoo}
    486 % \def\Xfoo#1{...}
    487 %
    488 % Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my
    489 % favourite TeX trick.  --kasal, 16nov03
    490 
    491 \def\parseargdef#1{%
    492   \expandafter \doparseargdef \csname\string#1\endcsname #1%
    493 }
    494 \def\doparseargdef#1#2{%
    495   \def#2{\parsearg#1}%
    496   \def#1##1%
    497 }
    498 
    499 % Several utility definitions with active space:
    500 {
    501   \obeyspaces
    502   \gdef\obeyedspace{ }
    503 
    504   % Make each space character in the input produce a normal interword
    505   % space in the output.  Don't allow a line break at this space, as this
    506   % is used only in environments like @example, where each line of input
    507   % should produce a line of output anyway.
    508   %
    509   \gdef\sepspaces{\obeyspaces\let =\tie}
    510 
    511   % If an index command is used in an @example environment, any spaces
    512   % therein should become regular spaces in the raw index file, not the
    513   % expansion of \tie (\leavevmode \penalty \@M \ ).
    514   \gdef\unsepspaces{\let =\space}
    515 }
    516 
    517 
    518 \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
    519 
    520 % Define the framework for environments in texinfo.tex.  It's used like this:
    521 %
    522 %   \envdef\foo{...}
    523 %   \def\Efoo{...}
    524 %
    525 % It's the responsibility of \envdef to insert \begingroup before the
    526 % actual body; @end closes the group after calling \Efoo.  \envdef also
    527 % defines \thisenv, so the current environment is known; @end checks
    528 % whether the environment name matches.  The \checkenv macro can also be
    529 % used to check whether the current environment is the one expected.
    530 %
    531 % Non-false conditionals (@iftex, @ifset) don't fit into this, so they
    532 % are not treated as environments; they don't open a group.  (The
    533 % implementation of @end takes care not to call \endgroup in this
    534 % special case.)
    535 
    536 
    537 % At run-time, environments start with this:
    538 \def\startenvironment#1{\begingroup\def\thisenv{#1}}
    539 % initialize
    540 \let\thisenv\empty
    541 
    542 % ... but they get defined via ``\envdef\foo{...}'':
    543 \long\def\envdef#1#2{\def#1{\startenvironment#1#2}}
    544 \def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}}
    545 
    546 % Check whether we're in the right environment:
    547 \def\checkenv#1{%
    548   \def\temp{#1}%
    549   \ifx\thisenv\temp
    550   \else
    551     \badenverr
    552   \fi
    553 }
    554 
    555 % Environment mismatch, #1 expected:
    556 \def\badenverr{%
    557   \errhelp = \EMsimple
    558   \errmessage{This command can appear only \inenvironment\temp,
    559     not \inenvironment\thisenv}%
    560 }
    561 \def\inenvironment#1{%
    562   \ifx#1\empty
    563     outside of any environment%
    564   \else
    565     in environment \expandafter\string#1%
    566   \fi
    567 }
    568 
    569 % @end foo executes the definition of \Efoo.
    570 % But first, it executes a specialized version of \checkenv
    571 %
    572 \parseargdef\end{%
    573   \if 1\csname iscond.#1\endcsname
    574   \else
    575     % The general wording of \badenverr may not be ideal.
    576     \expandafter\checkenv\csname#1\endcsname
    577     \csname E#1\endcsname
    578     \endgroup
    579   \fi
    580 }
    581 
    582 \newhelp\EMsimple{Press RETURN to continue.}
    583 
    584 
    585 % Be sure we're in horizontal mode when doing a tie, since we make space
    586 % equivalent to this in @example-like environments. Otherwise, a space
    587 % at the beginning of a line will start with \penalty -- and
    588 % since \penalty is valid in vertical mode, we'd end up putting the
    589 % penalty on the vertical list instead of in the new paragraph.
    590 {\catcode`@ = 11
    591  % Avoid using \@M directly, because that causes trouble
    592  % if the definition is written into an index file.
    593  \global\let\tiepenalty = \@M
    594  \gdef\tie{\leavevmode\penalty\tiepenalty\ }
    595 }
    596 
    597 % @: forces normal size whitespace following.
    598 \def\:{\spacefactor=1000 }
    599 
    600 % @* forces a line break.
    601 \def\*{\unskip\hfil\break\hbox{}\ignorespaces}
    602 
    603 % @/ allows a line break.
    604 \let\/=\allowbreak
    605 
    606 % @. is an end-of-sentence period.
    607 \def\.{.\spacefactor=\endofsentencespacefactor\space}
    608 
    609 % @! is an end-of-sentence bang.
    610 \def\!{!\spacefactor=\endofsentencespacefactor\space}
    611 
    612 % @? is an end-of-sentence query.
    613 \def\?{?\spacefactor=\endofsentencespacefactor\space}
    614 
    615 % @frenchspacing on|off  says whether to put extra space after punctuation.
    616 %
    617 \def\onword{on}
    618 \def\offword{off}
    619 %
    620 \parseargdef\frenchspacing{%
    621   \def\temp{#1}%
    622   \ifx\temp\onword \plainfrenchspacing
    623   \else\ifx\temp\offword \plainnonfrenchspacing
    624   \else
    625     \errhelp = \EMsimple
    626     \errmessage{Unknown @frenchspacing option `\temp', must be on|off}%
    627   \fi\fi
    628 }
    629 
    630 % @w prevents a word break.  Without the \leavevmode, @w at the
    631 % beginning of a paragraph, when TeX is still in vertical mode, would
    632 % produce a whole line of output instead of starting the paragraph.
    633 \def\w#1{\leavevmode\hbox{#1}}
    634 
    635 % @group ... @end group forces ... to be all on one page, by enclosing
    636 % it in a TeX vbox.  We use \vtop instead of \vbox to construct the box
    637 % to keep its height that of a normal line.  According to the rules for
    638 % \topskip (p.114 of the TeXbook), the glue inserted is
    639 % max (\topskip - \ht (first item), 0).  If that height is large,
    640 % therefore, no glue is inserted, and the space between the headline and
    641 % the text is small, which looks bad.
    642 %
    643 % Another complication is that the group might be very large.  This can
    644 % cause the glue on the previous page to be unduly stretched, because it
    645 % does not have much material.  In this case, it's better to add an
    646 % explicit \vfill so that the extra space is at the bottom.  The
    647 % threshold for doing this is if the group is more than \vfilllimit
    648 % percent of a page (\vfilllimit can be changed inside of @tex).
    649 %
    650 \newbox\groupbox
    651 \def\vfilllimit{0.7}
    652 %
    653 \envdef\group{%
    654   \ifnum\catcode`\^^M=\active \else
    655     \errhelp = \groupinvalidhelp
    656     \errmessage{@group invalid in context where filling is enabled}%
    657   \fi
    658   \startsavinginserts
    659   %
    660   \setbox\groupbox = \vtop\bgroup
    661     % Do @comment since we are called inside an environment such as
    662     % @example, where each end-of-line in the input causes an
    663     % end-of-line in the output.  We don't want the end-of-line after
    664     % the `@group' to put extra space in the output.  Since @group
    665     % should appear on a line by itself (according to the Texinfo
    666     % manual), we don't worry about eating any user text.
    667     \comment
    668 }
    669 %
    670 % The \vtop produces a box with normal height and large depth; thus, TeX puts
    671 % \baselineskip glue before it, and (when the next line of text is done)
    672 % \lineskip glue after it.  Thus, space below is not quite equal to space
    673 % above.  But it's pretty close.
    674 \def\Egroup{%
    675     % To get correct interline space between the last line of the group
    676     % and the first line afterwards, we have to propagate \prevdepth.
    677     \endgraf % Not \par, as it may have been set to \lisppar.
    678     \global\dimen1 = \prevdepth
    679   \egroup           % End the \vtop.
    680   % \dimen0 is the vertical size of the group's box.
    681   \dimen0 = \ht\groupbox  \advance\dimen0 by \dp\groupbox
    682   % \dimen2 is how much space is left on the page (more or less).
    683   \dimen2 = \pageheight   \advance\dimen2 by -\pagetotal
    684   % if the group doesn't fit on the current page, and it's a big big
    685   % group, force a page break.
    686   \ifdim \dimen0 > \dimen2
    687     \ifdim \pagetotal < \vfilllimit\pageheight
    688       \page
    689     \fi
    690   \fi
    691   \box\groupbox
    692   \prevdepth = \dimen1
    693   \checkinserts
    694 }
    695 %
    696 % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
    697 % message, so this ends up printing `@group can only ...'.
    698 %
    699 \newhelp\groupinvalidhelp{%
    700 group can only be used in environments such as @example,^^J%
    701 where each line of input produces a line of output.}
    702 
    703 % @need space-in-mils
    704 % forces a page break if there is not space-in-mils remaining.
    705 
    706 \newdimen\mil  \mil=0.001in
    707 
    708 \parseargdef\need{%
    709   % Ensure vertical mode, so we don't make a big box in the middle of a
    710   % paragraph.
    711   \par
    712   %
    713   % If the @need value is less than one line space, it's useless.
    714   \dimen0 = #1\mil
    715   \dimen2 = \ht\strutbox
    716   \advance\dimen2 by \dp\strutbox
    717   \ifdim\dimen0 > \dimen2
    718     %
    719     % Do a \strut just to make the height of this box be normal, so the
    720     % normal leading is inserted relative to the preceding line.
    721     % And a page break here is fine.
    722     \vtop to #1\mil{\strut\vfil}%
    723     %
    724     % TeX does not even consider page breaks if a penalty added to the
    725     % main vertical list is 10000 or more.  But in order to see if the
    726     % empty box we just added fits on the page, we must make it consider
    727     % page breaks.  On the other hand, we don't want to actually break the
    728     % page after the empty box.  So we use a penalty of 9999.
    729     %
    730     % There is an extremely small chance that TeX will actually break the
    731     % page at this \penalty, if there are no other feasible breakpoints in
    732     % sight.  (If the user is using lots of big @group commands, which
    733     % almost-but-not-quite fill up a page, TeX will have a hard time doing
    734     % good page breaking, for example.)  However, I could not construct an
    735     % example where a page broke at this \penalty; if it happens in a real
    736     % document, then we can reconsider our strategy.
    737     \penalty9999
    738     %
    739     % Back up by the size of the box, whether we did a page break or not.
    740     \kern -#1\mil
    741     %
    742     % Do not allow a page break right after this kern.
    743     \nobreak
    744   \fi
    745 }
    746 
    747 % @br   forces paragraph break (and is undocumented).
    748 
    749 \let\br = \par
    750 
    751 % @page forces the start of a new page.
    752 %
    753 \def\page{\par\vfill\supereject}
    754 
    755 % @exdent text....
    756 % outputs text on separate line in roman font, starting at standard page margin
    757 
    758 % This records the amount of indent in the innermost environment.
    759 % That's how much \exdent should take out.
    760 \newskip\exdentamount
    761 
    762 % This defn is used inside fill environments such as @defun.
    763 \parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}
    764 
    765 % This defn is used inside nofill environments such as @example.
    766 \parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount
    767   \leftline{\hskip\leftskip{\rm#1}}}}
    768 
    769 % @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
    770 % paragraph.  For more general purposes, use the \margin insertion
    771 % class.  WHICH is `l' or `r'.  Not documented, written for gawk manual.
    772 %
    773 \newskip\inmarginspacing \inmarginspacing=1cm
    774 \def\strutdepth{\dp\strutbox}
    775 %
    776 \def\doinmargin#1#2{\strut\vadjust{%
    777   \nobreak
    778   \kern-\strutdepth
    779   \vtop to \strutdepth{%
    780     \baselineskip=\strutdepth
    781     \vss
    782     % if you have multiple lines of stuff to put here, you'll need to
    783     % make the vbox yourself of the appropriate size.
    784     \ifx#1l%
    785       \llap{\ignorespaces #2\hskip\inmarginspacing}%
    786     \else
    787       \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
    788     \fi
    789     \null
    790   }%
    791 }}
    792 \def\inleftmargin{\doinmargin l}
    793 \def\inrightmargin{\doinmargin r}
    794 %
    795 % @inmargin{TEXT [, RIGHT-TEXT]}
    796 % (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
    797 % else use TEXT for both).
    798 %
    799 \def\inmargin#1{\parseinmargin #1,,\finish}
    800 \def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
    801   \setbox0 = \hbox{\ignorespaces #2}%
    802   \ifdim\wd0 > 0pt
    803     \def\lefttext{#1}%  have both texts
    804     \def\righttext{#2}%
    805   \else
    806     \def\lefttext{#1}%  have only one text
    807     \def\righttext{#1}%
    808   \fi
    809   %
    810   \ifodd\pageno
    811     \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
    812   \else
    813     \def\temp{\inleftmargin\lefttext}%
    814   \fi
    815   \temp
    816 }
    817 
    818 % @| inserts a changebar to the left of the current line.  It should
    819 % surround any changed text.  This approach does *not* work if the
    820 % change spans more than two lines of output.  To handle that, we would
    821 % have adopt a much more difficult approach (putting marks into the main
    822 % vertical list for the beginning and end of each change).  This command
    823 % is not documented, not supported, and doesn't work.
    824 %
    825 \def\|{%
    826   % \vadjust can only be used in horizontal mode.
    827   \leavevmode
    828   %
    829   % Append this vertical mode material after the current line in the output.
    830   \vadjust{%
    831     % We want to insert a rule with the height and depth of the current
    832     % leading; that is exactly what \strutbox is supposed to record.
    833     \vskip-\baselineskip
    834     %
    835     % \vadjust-items are inserted at the left edge of the type.  So
    836     % the \llap here moves out into the left-hand margin.
    837     \llap{%
    838       %
    839       % For a thicker or thinner bar, change the `1pt'.
    840       \vrule height\baselineskip width1pt
    841       %
    842       % This is the space between the bar and the text.
    843       \hskip 12pt
    844     }%
    845   }%
    846 }
    847 
    848 % @include FILE -- \input text of FILE.
    849 %
    850 \def\include{\parseargusing\filenamecatcodes\includezzz}
    851 \def\includezzz#1{%
    852   \pushthisfilestack
    853   \def\thisfile{#1}%
    854   {%
    855     \makevalueexpandable  % we want to expand any @value in FILE.
    856     \turnoffactive        % and allow special characters in the expansion
    857     \indexnofonts         % Allow `@@' and other weird things in file names.
    858     \wlog{texinfo.tex: doing @include of #1^^J}%
    859     \edef\temp{\noexpand\input #1 }%
    860     %
    861     % This trickery is to read FILE outside of a group, in case it makes
    862     % definitions, etc.
    863     \expandafter
    864   }\temp
    865   \popthisfilestack
    866 }
    867 \def\filenamecatcodes{%
    868   \catcode`\\=\other
    869   \catcode`~=\other
    870   \catcode`^=\other
    871   \catcode`_=\other
    872   \catcode`|=\other
    873   \catcode`<=\other
    874   \catcode`>=\other
    875   \catcode`+=\other
    876   \catcode`-=\other
    877   \catcode`\`=\other
    878   \catcode`\'=\other
    879 }
    880 
    881 \def\pushthisfilestack{%
    882   \expandafter\pushthisfilestackX\popthisfilestack\StackTerm
    883 }
    884 \def\pushthisfilestackX{%
    885   \expandafter\pushthisfilestackY\thisfile\StackTerm
    886 }
    887 \def\pushthisfilestackY #1\StackTerm #2\StackTerm {%
    888   \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}%
    889 }
    890 
    891 \def\popthisfilestack{\errthisfilestackempty}
    892 \def\errthisfilestackempty{\errmessage{Internal error:
    893   the stack of filenames is empty.}}
    894 %
    895 \def\thisfile{}
    896 
    897 % @center line
    898 % outputs that line, centered.
    899 %
    900 \parseargdef\center{%
    901   \ifhmode
    902     \let\centersub\centerH
    903   \else
    904     \let\centersub\centerV
    905   \fi
    906   \centersub{\hfil \ignorespaces#1\unskip \hfil}%
    907   \let\centersub\relax % don't let the definition persist, just in case
    908 }
    909 \def\centerH#1{{%
    910   \hfil\break
    911   \advance\hsize by -\leftskip
    912   \advance\hsize by -\rightskip
    913   \line{#1}%
    914   \break
    915 }}
    916 %
    917 \newcount\centerpenalty
    918 \def\centerV#1{%
    919   % The idea here is the same as in \startdefun, \cartouche, etc.: if
    920   % @center is the first thing after a section heading, we need to wipe
    921   % out the negative parskip inserted by \sectionheading, but still
    922   % prevent a page break here.
    923   \centerpenalty = \lastpenalty
    924   \ifnum\centerpenalty>10000 \vskip\parskip \fi
    925   \ifnum\centerpenalty>9999 \penalty\centerpenalty \fi
    926   \line{\kern\leftskip #1\kern\rightskip}%
    927 }
    928 
    929 % @sp n   outputs n lines of vertical space
    930 %
    931 \parseargdef\sp{\vskip #1\baselineskip}
    932 
    933 % @comment ...line which is ignored...
    934 % @c is the same as @comment
    935 % @ignore ... @end ignore  is another way to write a comment
    936 %
    937 \def\comment{\begingroup \catcode`\^^M=\other%
    938 \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
    939 \commentxxx}
    940 {\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}}
    941 %
    942 \let\c=\comment
    943 
    944 % @paragraphindent NCHARS
    945 % We'll use ems for NCHARS, close enough.
    946 % NCHARS can also be the word `asis' or `none'.
    947 % We cannot feasibly implement @paragraphindent asis, though.
    948 %
    949 \def\asisword{asis} % no translation, these are keywords
    950 \def\noneword{none}
    951 %
    952 \parseargdef\paragraphindent{%
    953   \def\temp{#1}%
    954   \ifx\temp\asisword
    955   \else
    956     \ifx\temp\noneword
    957       \defaultparindent = 0pt
    958     \else
    959       \defaultparindent = #1em
    960     \fi
    961   \fi
    962   \parindent = \defaultparindent
    963 }
    964 
    965 % @exampleindent NCHARS
    966 % We'll use ems for NCHARS like @paragraphindent.
    967 % It seems @exampleindent asis isn't necessary, but
    968 % I preserve it to make it similar to @paragraphindent.
    969 \parseargdef\exampleindent{%
    970   \def\temp{#1}%
    971   \ifx\temp\asisword
    972   \else
    973     \ifx\temp\noneword
    974       \lispnarrowing = 0pt
    975     \else
    976       \lispnarrowing = #1em
    977     \fi
    978   \fi
    979 }
    980 
    981 % @firstparagraphindent WORD
    982 % If WORD is `none', then suppress indentation of the first paragraph
    983 % after a section heading.  If WORD is `insert', then do indent at such
    984 % paragraphs.
    985 %
    986 % The paragraph indentation is suppressed or not by calling
    987 % \suppressfirstparagraphindent, which the sectioning commands do.
    988 % We switch the definition of this back and forth according to WORD.
    989 % By default, we suppress indentation.
    990 %
    991 \def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
    992 \def\insertword{insert}
    993 %
    994 \parseargdef\firstparagraphindent{%
    995   \def\temp{#1}%
    996   \ifx\temp\noneword
    997     \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
    998   \else\ifx\temp\insertword
    999     \let\suppressfirstparagraphindent = \relax
   1000   \else
   1001     \errhelp = \EMsimple
   1002     \errmessage{Unknown @firstparagraphindent option `\temp'}%
   1003   \fi\fi
   1004 }
   1005 
   1006 % Here is how we actually suppress indentation.  Redefine \everypar to
   1007 % \kern backwards by \parindent, and then reset itself to empty.
   1008 %
   1009 % We also make \indent itself not actually do anything until the next
   1010 % paragraph.
   1011 %
   1012 \gdef\dosuppressfirstparagraphindent{%
   1013   \gdef\indent{%
   1014     \restorefirstparagraphindent
   1015     \indent
   1016   }%
   1017   \gdef\noindent{%
   1018     \restorefirstparagraphindent
   1019     \noindent
   1020   }%
   1021   \global\everypar = {%
   1022     \kern -\parindent
   1023     \restorefirstparagraphindent
   1024   }%
   1025 }
   1026 
   1027 \gdef\restorefirstparagraphindent{%
   1028   \global \let \indent = \ptexindent
   1029   \global \let \noindent = \ptexnoindent
   1030   \global \everypar = {}%
   1031 }
   1032 
   1033 
   1034 % @refill is a no-op.
   1035 \let\refill=\relax
   1036 
   1037 % If working on a large document in chapters, it is convenient to
   1038 % be able to disable indexing, cross-referencing, and contents, for test runs.
   1039 % This is done with @novalidate (before @setfilename).
   1040 %
   1041 \newif\iflinks \linkstrue % by default we want the aux files.
   1042 \let\novalidate = \linksfalse
   1043 
   1044 % @setfilename is done at the beginning of every texinfo file.
   1045 % So open here the files we need to have open while reading the input.
   1046 % This makes it possible to make a .fmt file for texinfo.
   1047 \def\setfilename{%
   1048    \fixbackslash  % Turn off hack to swallow `\input texinfo'.
   1049    \iflinks
   1050      \tryauxfile
   1051      % Open the new aux file.  TeX will close it automatically at exit.
   1052      \immediate\openout\auxfile=\jobname.aux
   1053    \fi % \openindices needs to do some work in any case.
   1054    \openindices
   1055    \let\setfilename=\comment % Ignore extra @setfilename cmds.
   1056    %
   1057    % If texinfo.cnf is present on the system, read it.
   1058    % Useful for site-wide @afourpaper, etc.
   1059    \openin 1 texinfo.cnf
   1060    \ifeof 1 \else \input texinfo.cnf \fi
   1061    \closein 1
   1062    %
   1063    \comment % Ignore the actual filename.
   1064 }
   1065 
   1066 % Called from \setfilename.
   1067 %
   1068 \def\openindices{%
   1069   \newindex{cp}%
   1070   \newcodeindex{fn}%
   1071   \newcodeindex{vr}%
   1072   \newcodeindex{tp}%
   1073   \newcodeindex{ky}%
   1074   \newcodeindex{pg}%
   1075 }
   1076 
   1077 % @bye.
   1078 \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
   1079 
   1080 
   1081 \message{pdf,}
   1082 % adobe `portable' document format
   1083 \newcount\tempnum
   1084 \newcount\lnkcount
   1085 \newtoks\filename
   1086 \newcount\filenamelength
   1087 \newcount\pgn
   1088 \newtoks\toksA
   1089 \newtoks\toksB
   1090 \newtoks\toksC
   1091 \newtoks\toksD
   1092 \newbox\boxA
   1093 \newcount\countA
   1094 \newif\ifpdf
   1095 \newif\ifpdfmakepagedest
   1096 
   1097 % when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
   1098 % can be set).  So we test for \relax and 0 as well as being undefined.
   1099 \ifx\pdfoutput\thisisundefined
   1100 \else
   1101   \ifx\pdfoutput\relax
   1102   \else
   1103     \ifcase\pdfoutput
   1104     \else
   1105       \pdftrue
   1106     \fi
   1107   \fi
   1108 \fi
   1109 
   1110 % PDF uses PostScript string constants for the names of xref targets,
   1111 % for display in the outlines, and in other places.  Thus, we have to
   1112 % double any backslashes.  Otherwise, a name like "\node" will be
   1113 % interpreted as a newline (\n), followed by o, d, e.  Not good.
   1114 %
   1115 % See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and
   1116 % related messages.  The final outcome is that it is up to the TeX user
   1117 % to double the backslashes and otherwise make the string valid, so
   1118 % that's what we do.  pdftex 1.30.0 (ca.2005) introduced a primitive to
   1119 % do this reliably, so we use it.
   1120 
   1121 % #1 is a control sequence in which to do the replacements,
   1122 % which we \xdef.
   1123 \def\txiescapepdf#1{%
   1124   \ifx\pdfescapestring\thisisundefined
   1125     % No primitive available; should we give a warning or log?
   1126     % Many times it won't matter.
   1127   \else
   1128     % The expandable \pdfescapestring primitive escapes parentheses,
   1129     % backslashes, and other special chars.
   1130     \xdef#1{\pdfescapestring{#1}}%
   1131   \fi
   1132 }
   1133 
   1134 \newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images
   1135 with PDF output, and none of those formats could be found.  (.eps cannot
   1136 be supported due to the design of the PDF format; use regular TeX (DVI
   1137 output) for that.)}
   1138 
   1139 \ifpdf
   1140   %
   1141   % Color manipulation macros based on pdfcolor.tex,
   1142   % except using rgb instead of cmyk; the latter is said to render as a
   1143   % very dark gray on-screen and a very dark halftone in print, instead
   1144   % of actual black.
   1145   \def\rgbDarkRed{0.50 0.09 0.12}
   1146   \def\rgbBlack{0 0 0}
   1147   %
   1148   % k sets the color for filling (usual text, etc.);
   1149   % K sets the color for stroking (thin rules, e.g., normal _'s).
   1150   \def\pdfsetcolor#1{\pdfliteral{#1 rg  #1 RG}}
   1151   %
   1152   % Set color, and create a mark which defines \thiscolor accordingly,
   1153   % so that \makeheadline knows which color to restore.
   1154   \def\setcolor#1{%
   1155     \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}%
   1156     \domark
   1157     \pdfsetcolor{#1}%
   1158   }
   1159   %
   1160   \def\maincolor{\rgbBlack}
   1161   \pdfsetcolor{\maincolor}
   1162   \edef\thiscolor{\maincolor}
   1163   \def\lastcolordefs{}
   1164   %
   1165   \def\makefootline{%
   1166     \baselineskip24pt
   1167     \line{\pdfsetcolor{\maincolor}\the\footline}%
   1168   }
   1169   %
   1170   \def\makeheadline{%
   1171     \vbox to 0pt{%
   1172       \vskip-22.5pt
   1173       \line{%
   1174         \vbox to8.5pt{}%
   1175         % Extract \thiscolor definition from the marks.
   1176         \getcolormarks
   1177         % Typeset the headline with \maincolor, then restore the color.
   1178         \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
   1179       }%
   1180       \vss
   1181     }%
   1182     \nointerlineskip
   1183   }
   1184   %
   1185   %
   1186   \pdfcatalog{/PageMode /UseOutlines}
   1187   %
   1188   % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
   1189   \def\dopdfimage#1#2#3{%
   1190     \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
   1191     \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
   1192     %
   1193     % pdftex (and the PDF format) support .pdf, .png, .jpg (among
   1194     % others).  Let's try in that order, PDF first since if
   1195     % someone has a scalable image, presumably better to use that than a
   1196     % bitmap.
   1197     \let\pdfimgext=\empty
   1198     \begingroup
   1199       \openin 1 #1.pdf \ifeof 1
   1200         \openin 1 #1.PDF \ifeof 1
   1201           \openin 1 #1.png \ifeof 1
   1202             \openin 1 #1.jpg \ifeof 1
   1203               \openin 1 #1.jpeg \ifeof 1
   1204                 \openin 1 #1.JPG \ifeof 1
   1205                   \errhelp = \nopdfimagehelp
   1206                   \errmessage{Could not find image file #1 for pdf}%
   1207                 \else \gdef\pdfimgext{JPG}%
   1208                 \fi
   1209               \else \gdef\pdfimgext{jpeg}%
   1210               \fi
   1211             \else \gdef\pdfimgext{jpg}%
   1212             \fi
   1213           \else \gdef\pdfimgext{png}%
   1214           \fi
   1215         \else \gdef\pdfimgext{PDF}%
   1216         \fi
   1217       \else \gdef\pdfimgext{pdf}%
   1218       \fi
   1219       \closein 1
   1220     \endgroup
   1221     %
   1222     % without \immediate, ancient pdftex seg faults when the same image is
   1223     % included twice.  (Version 3.14159-pre-1.0-unofficial-20010704.)
   1224     \ifnum\pdftexversion < 14
   1225       \immediate\pdfimage
   1226     \else
   1227       \immediate\pdfximage
   1228     \fi
   1229       \ifdim \wd0 >0pt width \pdfimagewidth \fi
   1230       \ifdim \wd2 >0pt height \pdfimageheight \fi
   1231       \ifnum\pdftexversion<13
   1232          #1.\pdfimgext
   1233        \else
   1234          {#1.\pdfimgext}%
   1235        \fi
   1236     \ifnum\pdftexversion < 14 \else
   1237       \pdfrefximage \pdflastximage
   1238     \fi}
   1239   %
   1240   \def\pdfmkdest#1{{%
   1241     % We have to set dummies so commands such as @code, and characters
   1242     % such as \, aren't expanded when present in a section title.
   1243     \indexnofonts
   1244     \turnoffactive
   1245     \makevalueexpandable
   1246     \def\pdfdestname{#1}%
   1247     \txiescapepdf\pdfdestname
   1248     \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
   1249   }}
   1250   %
   1251   % used to mark target names; must be expandable.
   1252   \def\pdfmkpgn#1{#1}
   1253   %
   1254   % by default, use a color that is dark enough to print on paper as
   1255   % nearly black, but still distinguishable for online viewing.
   1256   \def\urlcolor{\rgbDarkRed}
   1257   \def\linkcolor{\rgbDarkRed}
   1258   \def\endlink{\setcolor{\maincolor}\pdfendlink}
   1259   %
   1260   % Adding outlines to PDF; macros for calculating structure of outlines
   1261   % come from Petr Olsak
   1262   \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
   1263     \else \csname#1\endcsname \fi}
   1264   \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
   1265     \advance\tempnum by 1
   1266     \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
   1267   %
   1268   % #1 is the section text, which is what will be displayed in the
   1269   % outline by the pdf viewer.  #2 is the pdf expression for the number
   1270   % of subentries (or empty, for subsubsections).  #3 is the node text,
   1271   % which might be empty if this toc entry had no corresponding node.
   1272   % #4 is the page number
   1273   %
   1274   \def\dopdfoutline#1#2#3#4{%
   1275     % Generate a link to the node text if that exists; else, use the
   1276     % page number.  We could generate a destination for the section
   1277     % text in the case where a section has no node, but it doesn't
   1278     % seem worth the trouble, since most documents are normally structured.
   1279     \edef\pdfoutlinedest{#3}%
   1280     \ifx\pdfoutlinedest\empty
   1281       \def\pdfoutlinedest{#4}%
   1282     \else
   1283       \txiescapepdf\pdfoutlinedest
   1284     \fi
   1285     %
   1286     % Also escape PDF chars in the display string.
   1287     \edef\pdfoutlinetext{#1}%
   1288     \txiescapepdf\pdfoutlinetext
   1289     %
   1290     \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}%
   1291   }
   1292   %
   1293   \def\pdfmakeoutlines{%
   1294     \begingroup
   1295       % Read toc silently, to get counts of subentries for \pdfoutline.
   1296       \def\partentry##1##2##3##4{}% ignore parts in the outlines
   1297       \def\numchapentry##1##2##3##4{%
   1298 	\def\thischapnum{##2}%
   1299 	\def\thissecnum{0}%
   1300 	\def\thissubsecnum{0}%
   1301       }%
   1302       \def\numsecentry##1##2##3##4{%
   1303 	\advancenumber{chap\thischapnum}%
   1304 	\def\thissecnum{##2}%
   1305 	\def\thissubsecnum{0}%
   1306       }%
   1307       \def\numsubsecentry##1##2##3##4{%
   1308 	\advancenumber{sec\thissecnum}%
   1309 	\def\thissubsecnum{##2}%
   1310       }%
   1311       \def\numsubsubsecentry##1##2##3##4{%
   1312 	\advancenumber{subsec\thissubsecnum}%
   1313       }%
   1314       \def\thischapnum{0}%
   1315       \def\thissecnum{0}%
   1316       \def\thissubsecnum{0}%
   1317       %
   1318       % use \def rather than \let here because we redefine \chapentry et
   1319       % al. a second time, below.
   1320       \def\appentry{\numchapentry}%
   1321       \def\appsecentry{\numsecentry}%
   1322       \def\appsubsecentry{\numsubsecentry}%
   1323       \def\appsubsubsecentry{\numsubsubsecentry}%
   1324       \def\unnchapentry{\numchapentry}%
   1325       \def\unnsecentry{\numsecentry}%
   1326       \def\unnsubsecentry{\numsubsecentry}%
   1327       \def\unnsubsubsecentry{\numsubsubsecentry}%
   1328       \readdatafile{toc}%
   1329       %
   1330       % Read toc second time, this time actually producing the outlines.
   1331       % The `-' means take the \expnumber as the absolute number of
   1332       % subentries, which we calculated on our first read of the .toc above.
   1333       %
   1334       % We use the node names as the destinations.
   1335       \def\numchapentry##1##2##3##4{%
   1336         \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}%
   1337       \def\numsecentry##1##2##3##4{%
   1338         \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}%
   1339       \def\numsubsecentry##1##2##3##4{%
   1340         \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}%
   1341       \def\numsubsubsecentry##1##2##3##4{% count is always zero
   1342         \dopdfoutline{##1}{}{##3}{##4}}%
   1343       %
   1344       % PDF outlines are displayed using system fonts, instead of
   1345       % document fonts.  Therefore we cannot use special characters,
   1346       % since the encoding is unknown.  For example, the eogonek from
   1347       % Latin 2 (0xea) gets translated to a | character.  Info from
   1348       % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
   1349       %
   1350       % TODO this right, we have to translate 8-bit characters to
   1351       % their "best" equivalent, based on the @documentencoding.  Too
   1352       % much work for too little return.  Just use the ASCII equivalents
   1353       % we use for the index sort strings.
   1354       %
   1355       \indexnofonts
   1356       \setupdatafile
   1357       % We can have normal brace characters in the PDF outlines, unlike
   1358       % Texinfo index files.  So set that up.
   1359       \def\{{\lbracecharliteral}%
   1360       \def\}{\rbracecharliteral}%
   1361       \catcode`\\=\active \otherbackslash
   1362       \input \tocreadfilename
   1363     \endgroup
   1364   }
   1365   {\catcode`[=1 \catcode`]=2
   1366    \catcode`{=\other \catcode`}=\other
   1367    \gdef\lbracecharliteral[{]%
   1368    \gdef\rbracecharliteral[}]%
   1369   ]
   1370   %
   1371   \def\skipspaces#1{\def\PP{#1}\def\D{|}%
   1372     \ifx\PP\D\let\nextsp\relax
   1373     \else\let\nextsp\skipspaces
   1374       \addtokens{\filename}{\PP}%
   1375       \advance\filenamelength by 1
   1376     \fi
   1377     \nextsp}
   1378   \def\getfilename#1{%
   1379     \filenamelength=0
   1380     % If we don't expand the argument now, \skipspaces will get
   1381     % snagged on things like "@value{foo}".
   1382     \edef\temp{#1}%
   1383     \expandafter\skipspaces\temp|\relax
   1384   }
   1385   \ifnum\pdftexversion < 14
   1386     \let \startlink \pdfannotlink
   1387   \else
   1388     \let \startlink \pdfstartlink
   1389   \fi
   1390   % make a live url in pdf output.
   1391   \def\pdfurl#1{%
   1392     \begingroup
   1393       % it seems we really need yet another set of dummies; have not
   1394       % tried to figure out what each command should do in the context
   1395       % of @url.  for now, just make @/ a no-op, that's the only one
   1396       % people have actually reported a problem with.
   1397       %
   1398       \normalturnoffactive
   1399       \def\@{@}%
   1400       \let\/=\empty
   1401       \makevalueexpandable
   1402       % do we want to go so far as to use \indexnofonts instead of just
   1403       % special-casing \var here?
   1404       \def\var##1{##1}%
   1405       %
   1406       \leavevmode\setcolor{\urlcolor}%
   1407       \startlink attr{/Border [0 0 0]}%
   1408         user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
   1409     \endgroup}
   1410   \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
   1411   \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
   1412   \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
   1413   \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
   1414   \def\maketoks{%
   1415     \expandafter\poptoks\the\toksA|ENDTOKS|\relax
   1416     \ifx\first0\adn0
   1417     \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
   1418     \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
   1419     \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
   1420     \else
   1421       \ifnum0=\countA\else\makelink\fi
   1422       \ifx\first.\let\next=\done\else
   1423         \let\next=\maketoks
   1424         \addtokens{\toksB}{\the\toksD}
   1425         \ifx\first,\addtokens{\toksB}{\space}\fi
   1426       \fi
   1427     \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
   1428     \next}
   1429   \def\makelink{\addtokens{\toksB}%
   1430     {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
   1431   \def\pdflink#1{%
   1432     \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
   1433     \setcolor{\linkcolor}#1\endlink}
   1434   \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
   1435 \else
   1436   % non-pdf mode
   1437   \let\pdfmkdest = \gobble
   1438   \let\pdfurl = \gobble
   1439   \let\endlink = \relax
   1440   \let\setcolor = \gobble
   1441   \let\pdfsetcolor = \gobble
   1442   \let\pdfmakeoutlines = \relax
   1443 \fi  % \ifx\pdfoutput
   1444 
   1445 
   1446 \message{fonts,}
   1447 
   1448 % Change the current font style to #1, remembering it in \curfontstyle.
   1449 % For now, we do not accumulate font styles: @b{@i{foo}} prints foo in
   1450 % italics, not bold italics.
   1451 %
   1452 \def\setfontstyle#1{%
   1453   \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd.
   1454   \csname ten#1\endcsname  % change the current font
   1455 }
   1456 
   1457 % Select #1 fonts with the current style.
   1458 %
   1459 \def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname}
   1460 
   1461 \def\rm{\fam=0 \setfontstyle{rm}}
   1462 \def\it{\fam=\itfam \setfontstyle{it}}
   1463 \def\sl{\fam=\slfam \setfontstyle{sl}}
   1464 \def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
   1465 \def\tt{\fam=\ttfam \setfontstyle{tt}}
   1466 
   1467 % Unfortunately, we have to override this for titles and the like, since
   1468 % in those cases "rm" is bold.  Sigh.
   1469 \def\rmisbold{\rm\def\curfontstyle{bf}}
   1470 
   1471 % Texinfo sort of supports the sans serif font style, which plain TeX does not.
   1472 % So we set up a \sf.
   1473 \newfam\sffam
   1474 \def\sf{\fam=\sffam \setfontstyle{sf}}
   1475 \let\li = \sf % Sometimes we call it \li, not \sf.
   1476 
   1477 % We don't need math for this font style.
   1478 \def\ttsl{\setfontstyle{ttsl}}
   1479 
   1480 
   1481 % Set the baselineskip to #1, and the lineskip and strut size
   1482 % correspondingly.  There is no deep meaning behind these magic numbers
   1483 % used as factors; they just match (closely enough) what Knuth defined.
   1484 %
   1485 \def\lineskipfactor{.08333}
   1486 \def\strutheightpercent{.70833}
   1487 \def\strutdepthpercent {.29167}
   1488 %
   1489 % can get a sort of poor man's double spacing by redefining this.
   1490 \def\baselinefactor{1}
   1491 %
   1492 \newdimen\textleading
   1493 \def\setleading#1{%
   1494   \dimen0 = #1\relax
   1495   \normalbaselineskip = \baselinefactor\dimen0
   1496   \normallineskip = \lineskipfactor\normalbaselineskip
   1497   \normalbaselines
   1498   \setbox\strutbox =\hbox{%
   1499     \vrule width0pt height\strutheightpercent\baselineskip
   1500                     depth \strutdepthpercent \baselineskip
   1501   }%
   1502 }
   1503 
   1504 % PDF CMaps.  See also LaTeX's t1.cmap.
   1505 %
   1506 % do nothing with this by default.
   1507 \expandafter\let\csname cmapOT1\endcsname\gobble
   1508 \expandafter\let\csname cmapOT1IT\endcsname\gobble
   1509 \expandafter\let\csname cmapOT1TT\endcsname\gobble
   1510 
   1511 % if we are producing pdf, and we have \pdffontattr, then define cmaps.
   1512 % (\pdffontattr was introduced many years ago, but people still run
   1513 % older pdftex's; it's easy to conditionalize, so we do.)
   1514 \ifpdf \ifx\pdffontattr\thisisundefined \else
   1515   \begingroup
   1516     \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
   1517     \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
   1518 %%DocumentNeededResources: ProcSet (CIDInit)
   1519 %%IncludeResource: ProcSet (CIDInit)
   1520 %%BeginResource: CMap (TeX-OT1-0)
   1521 %%Title: (TeX-OT1-0 TeX OT1 0)
   1522 %%Version: 1.000
   1523 %%EndComments
   1524 /CIDInit /ProcSet findresource begin
   1525 12 dict begin
   1526 begincmap
   1527 /CIDSystemInfo
   1528 << /Registry (TeX)
   1529 /Ordering (OT1)
   1530 /Supplement 0
   1531 >> def
   1532 /CMapName /TeX-OT1-0 def
   1533 /CMapType 2 def
   1534 1 begincodespacerange
   1535 <00> <7F>
   1536 endcodespacerange
   1537 8 beginbfrange
   1538 <00> <01> <0393>
   1539 <09> <0A> <03A8>
   1540 <23> <26> <0023>
   1541 <28> <3B> <0028>
   1542 <3F> <5B> <003F>
   1543 <5D> <5E> <005D>
   1544 <61> <7A> <0061>
   1545 <7B> <7C> <2013>
   1546 endbfrange
   1547 40 beginbfchar
   1548 <02> <0398>
   1549 <03> <039B>
   1550 <04> <039E>
   1551 <05> <03A0>
   1552 <06> <03A3>
   1553 <07> <03D2>
   1554 <08> <03A6>
   1555 <0B> <00660066>
   1556 <0C> <00660069>
   1557 <0D> <0066006C>
   1558 <0E> <006600660069>
   1559 <0F> <00660066006C>
   1560 <10> <0131>
   1561 <11> <0237>
   1562 <12> <0060>
   1563 <13> <00B4>
   1564 <14> <02C7>
   1565 <15> <02D8>
   1566 <16> <00AF>
   1567 <17> <02DA>
   1568 <18> <00B8>
   1569 <19> <00DF>
   1570 <1A> <00E6>
   1571 <1B> <0153>
   1572 <1C> <00F8>
   1573 <1D> <00C6>
   1574 <1E> <0152>
   1575 <1F> <00D8>
   1576 <21> <0021>
   1577 <22> <201D>
   1578 <27> <2019>
   1579 <3C> <00A1>
   1580 <3D> <003D>
   1581 <3E> <00BF>
   1582 <5C> <201C>
   1583 <5F> <02D9>
   1584 <60> <2018>
   1585 <7D> <02DD>
   1586 <7E> <007E>
   1587 <7F> <00A8>
   1588 endbfchar
   1589 endcmap
   1590 CMapName currentdict /CMap defineresource pop
   1591 end
   1592 end
   1593 %%EndResource
   1594 %%EOF
   1595     }\endgroup
   1596   \expandafter\edef\csname cmapOT1\endcsname#1{%
   1597     \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
   1598   }%
   1599 %
   1600 % \cmapOT1IT
   1601   \begingroup
   1602     \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
   1603     \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
   1604 %%DocumentNeededResources: ProcSet (CIDInit)
   1605 %%IncludeResource: ProcSet (CIDInit)
   1606 %%BeginResource: CMap (TeX-OT1IT-0)
   1607 %%Title: (TeX-OT1IT-0 TeX OT1IT 0)
   1608 %%Version: 1.000
   1609 %%EndComments
   1610 /CIDInit /ProcSet findresource begin
   1611 12 dict begin
   1612 begincmap
   1613 /CIDSystemInfo
   1614 << /Registry (TeX)
   1615 /Ordering (OT1IT)
   1616 /Supplement 0
   1617 >> def
   1618 /CMapName /TeX-OT1IT-0 def
   1619 /CMapType 2 def
   1620 1 begincodespacerange
   1621 <00> <7F>
   1622 endcodespacerange
   1623 8 beginbfrange
   1624 <00> <01> <0393>
   1625 <09> <0A> <03A8>
   1626 <25> <26> <0025>
   1627 <28> <3B> <0028>
   1628 <3F> <5B> <003F>
   1629 <5D> <5E> <005D>
   1630 <61> <7A> <0061>
   1631 <7B> <7C> <2013>
   1632 endbfrange
   1633 42 beginbfchar
   1634 <02> <0398>
   1635 <03> <039B>
   1636 <04> <039E>
   1637 <05> <03A0>
   1638 <06> <03A3>
   1639 <07> <03D2>
   1640 <08> <03A6>
   1641 <0B> <00660066>
   1642 <0C> <00660069>
   1643 <0D> <0066006C>
   1644 <0E> <006600660069>
   1645 <0F> <00660066006C>
   1646 <10> <0131>
   1647 <11> <0237>
   1648 <12> <0060>
   1649 <13> <00B4>
   1650 <14> <02C7>
   1651 <15> <02D8>
   1652 <16> <00AF>
   1653 <17> <02DA>
   1654 <18> <00B8>
   1655 <19> <00DF>
   1656 <1A> <00E6>
   1657 <1B> <0153>
   1658 <1C> <00F8>
   1659 <1D> <00C6>
   1660 <1E> <0152>
   1661 <1F> <00D8>
   1662 <21> <0021>
   1663 <22> <201D>
   1664 <23> <0023>
   1665 <24> <00A3>
   1666 <27> <2019>
   1667 <3C> <00A1>
   1668 <3D> <003D>
   1669 <3E> <00BF>
   1670 <5C> <201C>
   1671 <5F> <02D9>
   1672 <60> <2018>
   1673 <7D> <02DD>
   1674 <7E> <007E>
   1675 <7F> <00A8>
   1676 endbfchar
   1677 endcmap
   1678 CMapName currentdict /CMap defineresource pop
   1679 end
   1680 end
   1681 %%EndResource
   1682 %%EOF
   1683     }\endgroup
   1684   \expandafter\edef\csname cmapOT1IT\endcsname#1{%
   1685     \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
   1686   }%
   1687 %
   1688 % \cmapOT1TT
   1689   \begingroup
   1690     \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
   1691     \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
   1692 %%DocumentNeededResources: ProcSet (CIDInit)
   1693 %%IncludeResource: ProcSet (CIDInit)
   1694 %%BeginResource: CMap (TeX-OT1TT-0)
   1695 %%Title: (TeX-OT1TT-0 TeX OT1TT 0)
   1696 %%Version: 1.000
   1697 %%EndComments
   1698 /CIDInit /ProcSet findresource begin
   1699 12 dict begin
   1700 begincmap
   1701 /CIDSystemInfo
   1702 << /Registry (TeX)
   1703 /Ordering (OT1TT)
   1704 /Supplement 0
   1705 >> def
   1706 /CMapName /TeX-OT1TT-0 def
   1707 /CMapType 2 def
   1708 1 begincodespacerange
   1709 <00> <7F>
   1710 endcodespacerange
   1711 5 beginbfrange
   1712 <00> <01> <0393>
   1713 <09> <0A> <03A8>
   1714 <21> <26> <0021>
   1715 <28> <5F> <0028>
   1716 <61> <7E> <0061>
   1717 endbfrange
   1718 32 beginbfchar
   1719 <02> <0398>
   1720 <03> <039B>
   1721 <04> <039E>
   1722 <05> <03A0>
   1723 <06> <03A3>
   1724 <07> <03D2>
   1725 <08> <03A6>
   1726 <0B> <2191>
   1727 <0C> <2193>
   1728 <0D> <0027>
   1729 <0E> <00A1>
   1730 <0F> <00BF>
   1731 <10> <0131>
   1732 <11> <0237>
   1733 <12> <0060>
   1734 <13> <00B4>
   1735 <14> <02C7>
   1736 <15> <02D8>
   1737 <16> <00AF>
   1738 <17> <02DA>
   1739 <18> <00B8>
   1740 <19> <00DF>
   1741 <1A> <00E6>
   1742 <1B> <0153>
   1743 <1C> <00F8>
   1744 <1D> <00C6>
   1745 <1E> <0152>
   1746 <1F> <00D8>
   1747 <20> <2423>
   1748 <27> <2019>
   1749 <60> <2018>
   1750 <7F> <00A8>
   1751 endbfchar
   1752 endcmap
   1753 CMapName currentdict /CMap defineresource pop
   1754 end
   1755 end
   1756 %%EndResource
   1757 %%EOF
   1758     }\endgroup
   1759   \expandafter\edef\csname cmapOT1TT\endcsname#1{%
   1760     \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
   1761   }%
   1762 \fi\fi
   1763 
   1764 
   1765 % Set the font macro #1 to the font named \fontprefix#2.
   1766 % #3 is the font's design size, #4 is a scale factor, #5 is the CMap
   1767 % encoding (only OT1, OT1IT and OT1TT are allowed, or empty to omit).
   1768 % Example:
   1769 % #1 = \textrm
   1770 % #2 = \rmshape
   1771 % #3 = 10
   1772 % #4 = \mainmagstep
   1773 % #5 = OT1
   1774 %
   1775 \def\setfont#1#2#3#4#5{%
   1776   \font#1=\fontprefix#2#3 scaled #4
   1777   \csname cmap#5\endcsname#1%
   1778 }
   1779 % This is what gets called when #5 of \setfont is empty.
   1780 \let\cmap\gobble
   1781 %
   1782 % (end of cmaps)
   1783 
   1784 % Use cm as the default font prefix.
   1785 % To specify the font prefix, you must define \fontprefix
   1786 % before you read in texinfo.tex.
   1787 \ifx\fontprefix\thisisundefined
   1788 \def\fontprefix{cm}
   1789 \fi
   1790 % Support font families that don't use the same naming scheme as CM.
   1791 \def\rmshape{r}
   1792 \def\rmbshape{bx}               % where the normal face is bold
   1793 \def\bfshape{b}
   1794 \def\bxshape{bx}
   1795 \def\ttshape{tt}
   1796 \def\ttbshape{tt}
   1797 \def\ttslshape{sltt}
   1798 \def\itshape{ti}
   1799 \def\itbshape{bxti}
   1800 \def\slshape{sl}
   1801 \def\slbshape{bxsl}
   1802 \def\sfshape{ss}
   1803 \def\sfbshape{ss}
   1804 \def\scshape{csc}
   1805 \def\scbshape{csc}
   1806 
   1807 % Definitions for a main text size of 11pt.  (The default in Texinfo.)
   1808 %
   1809 \def\definetextfontsizexi{%
   1810 % Text fonts (11.2pt, magstep1).
   1811 \def\textnominalsize{11pt}
   1812 \edef\mainmagstep{\magstephalf}
   1813 \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
   1814 \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
   1815 \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
   1816 \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
   1817 \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
   1818 \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
   1819 \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
   1820 \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
   1821 \font\texti=cmmi10 scaled \mainmagstep
   1822 \font\textsy=cmsy10 scaled \mainmagstep
   1823 \def\textecsize{1095}
   1824 
   1825 % A few fonts for @defun names and args.
   1826 \setfont\defbf\bfshape{10}{\magstep1}{OT1}
   1827 \setfont\deftt\ttshape{10}{\magstep1}{OT1TT}
   1828 \setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT}
   1829 \def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf}
   1830 
   1831 % Fonts for indices, footnotes, small examples (9pt).
   1832 \def\smallnominalsize{9pt}
   1833 \setfont\smallrm\rmshape{9}{1000}{OT1}
   1834 \setfont\smalltt\ttshape{9}{1000}{OT1TT}
   1835 \setfont\smallbf\bfshape{10}{900}{OT1}
   1836 \setfont\smallit\itshape{9}{1000}{OT1IT}
   1837 \setfont\smallsl\slshape{9}{1000}{OT1}
   1838 \setfont\smallsf\sfshape{9}{1000}{OT1}
   1839 \setfont\smallsc\scshape{10}{900}{OT1}
   1840 \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
   1841 \font\smalli=cmmi9
   1842 \font\smallsy=cmsy9
   1843 \def\smallecsize{0900}
   1844 
   1845 % Fonts for small examples (8pt).
   1846 \def\smallernominalsize{8pt}
   1847 \setfont\smallerrm\rmshape{8}{1000}{OT1}
   1848 \setfont\smallertt\ttshape{8}{1000}{OT1TT}
   1849 \setfont\smallerbf\bfshape{10}{800}{OT1}
   1850 \setfont\smallerit\itshape{8}{1000}{OT1IT}
   1851 \setfont\smallersl\slshape{8}{1000}{OT1}
   1852 \setfont\smallersf\sfshape{8}{1000}{OT1}
   1853 \setfont\smallersc\scshape{10}{800}{OT1}
   1854 \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
   1855 \font\smalleri=cmmi8
   1856 \font\smallersy=cmsy8
   1857 \def\smallerecsize{0800}
   1858 
   1859 % Fonts for title page (20.4pt):
   1860 \def\titlenominalsize{20pt}
   1861 \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
   1862 \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
   1863 \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
   1864 \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
   1865 \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
   1866 \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
   1867 \let\titlebf=\titlerm
   1868 \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
   1869 \font\titlei=cmmi12 scaled \magstep3
   1870 \font\titlesy=cmsy10 scaled \magstep4
   1871 \def\titleecsize{2074}
   1872 
   1873 % Chapter (and unnumbered) fonts (17.28pt).
   1874 \def\chapnominalsize{17pt}
   1875 \setfont\chaprm\rmbshape{12}{\magstep2}{OT1}
   1876 \setfont\chapit\itbshape{10}{\magstep3}{OT1IT}
   1877 \setfont\chapsl\slbshape{10}{\magstep3}{OT1}
   1878 \setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT}
   1879 \setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT}
   1880 \setfont\chapsf\sfbshape{17}{1000}{OT1}
   1881 \let\chapbf=\chaprm
   1882 \setfont\chapsc\scbshape{10}{\magstep3}{OT1}
   1883 \font\chapi=cmmi12 scaled \magstep2
   1884 \font\chapsy=cmsy10 scaled \magstep3
   1885 \def\chapecsize{1728}
   1886 
   1887 % Section fonts (14.4pt).
   1888 \def\secnominalsize{14pt}
   1889 \setfont\secrm\rmbshape{12}{\magstep1}{OT1}
   1890 \setfont\secit\itbshape{10}{\magstep2}{OT1IT}
   1891 \setfont\secsl\slbshape{10}{\magstep2}{OT1}
   1892 \setfont\sectt\ttbshape{12}{\magstep1}{OT1TT}
   1893 \setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT}
   1894 \setfont\secsf\sfbshape{12}{\magstep1}{OT1}
   1895 \let\secbf\secrm
   1896 \setfont\secsc\scbshape{10}{\magstep2}{OT1}
   1897 \font\seci=cmmi12 scaled \magstep1
   1898 \font\secsy=cmsy10 scaled \magstep2
   1899 \def\sececsize{1440}
   1900 
   1901 % Subsection fonts (13.15pt).
   1902 \def\ssecnominalsize{13pt}
   1903 \setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1}
   1904 \setfont\ssecit\itbshape{10}{1315}{OT1IT}
   1905 \setfont\ssecsl\slbshape{10}{1315}{OT1}
   1906 \setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT}
   1907 \setfont\ssecttsl\ttslshape{10}{1315}{OT1TT}
   1908 \setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1}
   1909 \let\ssecbf\ssecrm
   1910 \setfont\ssecsc\scbshape{10}{1315}{OT1}
   1911 \font\sseci=cmmi12 scaled \magstephalf
   1912 \font\ssecsy=cmsy10 scaled 1315
   1913 \def\ssececsize{1200}
   1914 
   1915 % Reduced fonts for @acro in text (10pt).
   1916 \def\reducednominalsize{10pt}
   1917 \setfont\reducedrm\rmshape{10}{1000}{OT1}
   1918 \setfont\reducedtt\ttshape{10}{1000}{OT1TT}
   1919 \setfont\reducedbf\bfshape{10}{1000}{OT1}
   1920 \setfont\reducedit\itshape{10}{1000}{OT1IT}
   1921 \setfont\reducedsl\slshape{10}{1000}{OT1}
   1922 \setfont\reducedsf\sfshape{10}{1000}{OT1}
   1923 \setfont\reducedsc\scshape{10}{1000}{OT1}
   1924 \setfont\reducedttsl\ttslshape{10}{1000}{OT1TT}
   1925 \font\reducedi=cmmi10
   1926 \font\reducedsy=cmsy10
   1927 \def\reducedecsize{1000}
   1928 
   1929 \textleading = 13.2pt % line spacing for 11pt CM
   1930 \textfonts            % reset the current fonts
   1931 \rm
   1932 } % end of 11pt text font size definitions, \definetextfontsizexi
   1933 
   1934 
   1935 % Definitions to make the main text be 10pt Computer Modern, with
   1936 % section, chapter, etc., sizes following suit.  This is for the GNU
   1937 % Press printing of the Emacs 22 manual.  Maybe other manuals in the
   1938 % future.  Used with @smallbook, which sets the leading to 12pt.
   1939 %
   1940 \def\definetextfontsizex{%
   1941 % Text fonts (10pt).
   1942 \def\textnominalsize{10pt}
   1943 \edef\mainmagstep{1000}
   1944 \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
   1945 \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
   1946 \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
   1947 \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
   1948 \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
   1949 \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
   1950 \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
   1951 \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
   1952 \font\texti=cmmi10 scaled \mainmagstep
   1953 \font\textsy=cmsy10 scaled \mainmagstep
   1954 \def\textecsize{1000}
   1955 
   1956 % A few fonts for @defun names and args.
   1957 \setfont\defbf\bfshape{10}{\magstephalf}{OT1}
   1958 \setfont\deftt\ttshape{10}{\magstephalf}{OT1TT}
   1959 \setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT}
   1960 \def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf}
   1961 
   1962 % Fonts for indices, footnotes, small examples (9pt).
   1963 \def\smallnominalsize{9pt}
   1964 \setfont\smallrm\rmshape{9}{1000}{OT1}
   1965 \setfont\smalltt\ttshape{9}{1000}{OT1TT}
   1966 \setfont\smallbf\bfshape{10}{900}{OT1}
   1967 \setfont\smallit\itshape{9}{1000}{OT1IT}
   1968 \setfont\smallsl\slshape{9}{1000}{OT1}
   1969 \setfont\smallsf\sfshape{9}{1000}{OT1}
   1970 \setfont\smallsc\scshape{10}{900}{OT1}
   1971 \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
   1972 \font\smalli=cmmi9
   1973 \font\smallsy=cmsy9
   1974 \def\smallecsize{0900}
   1975 
   1976 % Fonts for small examples (8pt).
   1977 \def\smallernominalsize{8pt}
   1978 \setfont\smallerrm\rmshape{8}{1000}{OT1}
   1979 \setfont\smallertt\ttshape{8}{1000}{OT1TT}
   1980 \setfont\smallerbf\bfshape{10}{800}{OT1}
   1981 \setfont\smallerit\itshape{8}{1000}{OT1IT}
   1982 \setfont\smallersl\slshape{8}{1000}{OT1}
   1983 \setfont\smallersf\sfshape{8}{1000}{OT1}
   1984 \setfont\smallersc\scshape{10}{800}{OT1}
   1985 \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
   1986 \font\smalleri=cmmi8
   1987 \font\smallersy=cmsy8
   1988 \def\smallerecsize{0800}
   1989 
   1990 % Fonts for title page (20.4pt):
   1991 \def\titlenominalsize{20pt}
   1992 \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
   1993 \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
   1994 \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
   1995 \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
   1996 \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
   1997 \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
   1998 \let\titlebf=\titlerm
   1999 \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
   2000 \font\titlei=cmmi12 scaled \magstep3
   2001 \font\titlesy=cmsy10 scaled \magstep4
   2002 \def\titleecsize{2074}
   2003 
   2004 % Chapter fonts (14.4pt).
   2005 \def\chapnominalsize{14pt}
   2006 \setfont\chaprm\rmbshape{12}{\magstep1}{OT1}
   2007 \setfont\chapit\itbshape{10}{\magstep2}{OT1IT}
   2008 \setfont\chapsl\slbshape{10}{\magstep2}{OT1}
   2009 \setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT}
   2010 \setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT}
   2011 \setfont\chapsf\sfbshape{12}{\magstep1}{OT1}
   2012 \let\chapbf\chaprm
   2013 \setfont\chapsc\scbshape{10}{\magstep2}{OT1}
   2014 \font\chapi=cmmi12 scaled \magstep1
   2015 \font\chapsy=cmsy10 scaled \magstep2
   2016 \def\chapecsize{1440}
   2017 
   2018 % Section fonts (12pt).
   2019 \def\secnominalsize{12pt}
   2020 \setfont\secrm\rmbshape{12}{1000}{OT1}
   2021 \setfont\secit\itbshape{10}{\magstep1}{OT1IT}
   2022 \setfont\secsl\slbshape{10}{\magstep1}{OT1}
   2023 \setfont\sectt\ttbshape{12}{1000}{OT1TT}
   2024 \setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT}
   2025 \setfont\secsf\sfbshape{12}{1000}{OT1}
   2026 \let\secbf\secrm
   2027 \setfont\secsc\scbshape{10}{\magstep1}{OT1}
   2028 \font\seci=cmmi12
   2029 \font\secsy=cmsy10 scaled \magstep1
   2030 \def\sececsize{1200}
   2031 
   2032 % Subsection fonts (10pt).
   2033 \def\ssecnominalsize{10pt}
   2034 \setfont\ssecrm\rmbshape{10}{1000}{OT1}
   2035 \setfont\ssecit\itbshape{10}{1000}{OT1IT}
   2036 \setfont\ssecsl\slbshape{10}{1000}{OT1}
   2037 \setfont\ssectt\ttbshape{10}{1000}{OT1TT}
   2038 \setfont\ssecttsl\ttslshape{10}{1000}{OT1TT}
   2039 \setfont\ssecsf\sfbshape{10}{1000}{OT1}
   2040 \let\ssecbf\ssecrm
   2041 \setfont\ssecsc\scbshape{10}{1000}{OT1}
   2042 \font\sseci=cmmi10
   2043 \font\ssecsy=cmsy10
   2044 \def\ssececsize{1000}
   2045 
   2046 % Reduced fonts for @acro in text (9pt).
   2047 \def\reducednominalsize{9pt}
   2048 \setfont\reducedrm\rmshape{9}{1000}{OT1}
   2049 \setfont\reducedtt\ttshape{9}{1000}{OT1TT}
   2050 \setfont\reducedbf\bfshape{10}{900}{OT1}
   2051 \setfont\reducedit\itshape{9}{1000}{OT1IT}
   2052 \setfont\reducedsl\slshape{9}{1000}{OT1}
   2053 \setfont\reducedsf\sfshape{9}{1000}{OT1}
   2054 \setfont\reducedsc\scshape{10}{900}{OT1}
   2055 \setfont\reducedttsl\ttslshape{10}{900}{OT1TT}
   2056 \font\reducedi=cmmi9
   2057 \font\reducedsy=cmsy9
   2058 \def\reducedecsize{0900}
   2059 
   2060 \divide\parskip by 2  % reduce space between paragraphs
   2061 \textleading = 12pt   % line spacing for 10pt CM
   2062 \textfonts            % reset the current fonts
   2063 \rm
   2064 } % end of 10pt text font size definitions, \definetextfontsizex
   2065 
   2066 
   2067 % We provide the user-level command
   2068 %   @fonttextsize 10
   2069 % (or 11) to redefine the text font size.  pt is assumed.
   2070 %
   2071 \def\xiword{11}
   2072 \def\xword{10}
   2073 \def\xwordpt{10pt}
   2074 %
   2075 \parseargdef\fonttextsize{%
   2076   \def\textsizearg{#1}%
   2077   %\wlog{doing @fonttextsize \textsizearg}%
   2078   %
   2079   % Set \globaldefs so that documents can use this inside @tex, since
   2080   % makeinfo 4.8 does not support it, but we need it nonetheless.
   2081   %
   2082  \begingroup \globaldefs=1
   2083   \ifx\textsizearg\xword \definetextfontsizex
   2084   \else \ifx\textsizearg\xiword \definetextfontsizexi
   2085   \else
   2086     \errhelp=\EMsimple
   2087     \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'}
   2088   \fi\fi
   2089  \endgroup
   2090 }
   2091 
   2092 
   2093 % In order for the font changes to affect most math symbols and letters,
   2094 % we have to define the \textfont of the standard families.  Since
   2095 % texinfo doesn't allow for producing subscripts and superscripts except
   2096 % in the main text, we don't bother to reset \scriptfont and
   2097 % \scriptscriptfont (which would also require loading a lot more fonts).
   2098 %
   2099 \def\resetmathfonts{%
   2100   \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy
   2101   \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf
   2102   \textfont\ttfam=\tentt \textfont\sffam=\tensf
   2103 }
   2104 
   2105 % The font-changing commands redefine the meanings of \tenSTYLE, instead
   2106 % of just \STYLE.  We do this because \STYLE needs to also set the
   2107 % current \fam for math mode.  Our \STYLE (e.g., \rm) commands hardwire
   2108 % \tenSTYLE to set the current font.
   2109 %
   2110 % Each font-changing command also sets the names \lsize (one size lower)
   2111 % and \lllsize (three sizes lower).  These relative commands are used in
   2112 % the LaTeX logo and acronyms.
   2113 %
   2114 % This all needs generalizing, badly.
   2115 %
   2116 \def\textfonts{%
   2117   \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
   2118   \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
   2119   \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy
   2120   \let\tenttsl=\textttsl
   2121   \def\curfontsize{text}%
   2122   \def\lsize{reduced}\def\lllsize{smaller}%
   2123   \resetmathfonts \setleading{\textleading}}
   2124 \def\titlefonts{%
   2125   \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl
   2126   \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc
   2127   \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
   2128   \let\tenttsl=\titlettsl
   2129   \def\curfontsize{title}%
   2130   \def\lsize{chap}\def\lllsize{subsec}%
   2131   \resetmathfonts \setleading{27pt}}
   2132 \def\titlefont#1{{\titlefonts\rmisbold #1}}
   2133 \def\chapfonts{%
   2134   \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
   2135   \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
   2136   \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy
   2137   \let\tenttsl=\chapttsl
   2138   \def\curfontsize{chap}%
   2139   \def\lsize{sec}\def\lllsize{text}%
   2140   \resetmathfonts \setleading{19pt}}
   2141 \def\secfonts{%
   2142   \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
   2143   \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
   2144   \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy
   2145   \let\tenttsl=\secttsl
   2146   \def\curfontsize{sec}%
   2147   \def\lsize{subsec}\def\lllsize{reduced}%
   2148   \resetmathfonts \setleading{16pt}}
   2149 \def\subsecfonts{%
   2150   \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
   2151   \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
   2152   \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy
   2153   \let\tenttsl=\ssecttsl
   2154   \def\curfontsize{ssec}%
   2155   \def\lsize{text}\def\lllsize{small}%
   2156   \resetmathfonts \setleading{15pt}}
   2157 \let\subsubsecfonts = \subsecfonts
   2158 \def\reducedfonts{%
   2159   \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl
   2160   \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc
   2161   \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy
   2162   \let\tenttsl=\reducedttsl
   2163   \def\curfontsize{reduced}%
   2164   \def\lsize{small}\def\lllsize{smaller}%
   2165   \resetmathfonts \setleading{10.5pt}}
   2166 \def\smallfonts{%
   2167   \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl
   2168   \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc
   2169   \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy
   2170   \let\tenttsl=\smallttsl
   2171   \def\curfontsize{small}%
   2172   \def\lsize{smaller}\def\lllsize{smaller}%
   2173   \resetmathfonts \setleading{10.5pt}}
   2174 \def\smallerfonts{%
   2175   \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl
   2176   \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc
   2177   \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy
   2178   \let\tenttsl=\smallerttsl
   2179   \def\curfontsize{smaller}%
   2180   \def\lsize{smaller}\def\lllsize{smaller}%
   2181   \resetmathfonts \setleading{9.5pt}}
   2182 
   2183 % Fonts for short table of contents.
   2184 \setfont\shortcontrm\rmshape{12}{1000}{OT1}
   2185 \setfont\shortcontbf\bfshape{10}{\magstep1}{OT1}  % no cmb12
   2186 \setfont\shortcontsl\slshape{12}{1000}{OT1}
   2187 \setfont\shortconttt\ttshape{12}{1000}{OT1TT}
   2188 
   2189 % Define these just so they can be easily changed for other fonts.
   2190 \def\angleleft{$\langle$}
   2191 \def\angleright{$\rangle$}
   2192 
   2193 % Set the fonts to use with the @small... environments.
   2194 \let\smallexamplefonts = \smallfonts
   2195 
   2196 % About \smallexamplefonts.  If we use \smallfonts (9pt), @smallexample
   2197 % can fit this many characters:
   2198 %   8.5x11=86   smallbook=72  a4=90  a5=69
   2199 % If we use \scriptfonts (8pt), then we can fit this many characters:
   2200 %   8.5x11=90+  smallbook=80  a4=90+  a5=77
   2201 % For me, subjectively, the few extra characters that fit aren't worth
   2202 % the additional smallness of 8pt.  So I'm making the default 9pt.
   2203 %
   2204 % By the way, for comparison, here's what fits with @example (10pt):
   2205 %   8.5x11=71  smallbook=60  a4=75  a5=58
   2206 % --karl, 24jan03.
   2207 
   2208 % Set up the default fonts, so we can use them for creating boxes.
   2209 %
   2210 \definetextfontsizexi
   2211 
   2212 
   2213 \message{markup,}
   2214 
   2215 % Check if we are currently using a typewriter font.  Since all the
   2216 % Computer Modern typewriter fonts have zero interword stretch (and
   2217 % shrink), and it is reasonable to expect all typewriter fonts to have
   2218 % this property, we can check that font parameter.
   2219 %
   2220 \def\ifmonospace{\ifdim\fontdimen3\font=0pt }
   2221 
   2222 % Markup style infrastructure.  \defmarkupstylesetup\INITMACRO will
   2223 % define and register \INITMACRO to be called on markup style changes.
   2224 % \INITMACRO can check \currentmarkupstyle for the innermost
   2225 % style and the set of \ifmarkupSTYLE switches for all styles
   2226 % currently in effect.
   2227 \newif\ifmarkupvar
   2228 \newif\ifmarkupsamp
   2229 \newif\ifmarkupkey
   2230 %\newif\ifmarkupfile % @file == @samp.
   2231 %\newif\ifmarkupoption % @option == @samp.
   2232 \newif\ifmarkupcode
   2233 \newif\ifmarkupkbd
   2234 %\newif\ifmarkupenv % @env == @code.
   2235 %\newif\ifmarkupcommand % @command == @code.
   2236 \newif\ifmarkuptex % @tex (and part of @math, for now).
   2237 \newif\ifmarkupexample
   2238 \newif\ifmarkupverb
   2239 \newif\ifmarkupverbatim
   2240 
   2241 \let\currentmarkupstyle\empty
   2242 
   2243 \def\setupmarkupstyle#1{%
   2244   \csname markup#1true\endcsname
   2245   \def\currentmarkupstyle{#1}%
   2246   \markupstylesetup
   2247 }
   2248 
   2249 \let\markupstylesetup\empty
   2250 
   2251 \def\defmarkupstylesetup#1{%
   2252   \expandafter\def\expandafter\markupstylesetup
   2253     \expandafter{\markupstylesetup #1}%
   2254   \def#1%
   2255 }
   2256 
   2257 % Markup style setup for left and right quotes.
   2258 \defmarkupstylesetup\markupsetuplq{%
   2259   \expandafter\let\expandafter \temp
   2260     \csname markupsetuplq\currentmarkupstyle\endcsname
   2261   \ifx\temp\relax \markupsetuplqdefault \else \temp \fi
   2262 }
   2263 
   2264 \defmarkupstylesetup\markupsetuprq{%
   2265   \expandafter\let\expandafter \temp
   2266     \csname markupsetuprq\currentmarkupstyle\endcsname
   2267   \ifx\temp\relax \markupsetuprqdefault \else \temp \fi
   2268 }
   2269 
   2270 {
   2271 \catcode`\'=\active
   2272 \catcode`\`=\active
   2273 
   2274 \gdef\markupsetuplqdefault{\let`\lq}
   2275 \gdef\markupsetuprqdefault{\let'\rq}
   2276 
   2277 \gdef\markupsetcodequoteleft{\let`\codequoteleft}
   2278 \gdef\markupsetcodequoteright{\let'\codequoteright}
   2279 }
   2280 
   2281 \let\markupsetuplqcode \markupsetcodequoteleft
   2282 \let\markupsetuprqcode \markupsetcodequoteright
   2283 %
   2284 \let\markupsetuplqexample \markupsetcodequoteleft
   2285 \let\markupsetuprqexample \markupsetcodequoteright
   2286 %
   2287 \let\markupsetuplqkbd     \markupsetcodequoteleft
   2288 \let\markupsetuprqkbd     \markupsetcodequoteright
   2289 %
   2290 \let\markupsetuplqsamp \markupsetcodequoteleft
   2291 \let\markupsetuprqsamp \markupsetcodequoteright
   2292 %
   2293 \let\markupsetuplqverb \markupsetcodequoteleft
   2294 \let\markupsetuprqverb \markupsetcodequoteright
   2295 %
   2296 \let\markupsetuplqverbatim \markupsetcodequoteleft
   2297 \let\markupsetuprqverbatim \markupsetcodequoteright
   2298 
   2299 % Allow an option to not use regular directed right quote/apostrophe
   2300 % (char 0x27), but instead the undirected quote from cmtt (char 0x0d).
   2301 % The undirected quote is ugly, so don't make it the default, but it
   2302 % works for pasting with more pdf viewers (at least evince), the
   2303 % lilypond developers report.  xpdf does work with the regular 0x27.
   2304 %
   2305 \def\codequoteright{%
   2306   \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax
   2307     \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax
   2308       '%
   2309     \else \char'15 \fi
   2310   \else \char'15 \fi
   2311 }
   2312 %
   2313 % and a similar option for the left quote char vs. a grave accent.
   2314 % Modern fonts display ASCII 0x60 as a grave accent, so some people like
   2315 % the code environments to do likewise.
   2316 %
   2317 \def\codequoteleft{%
   2318   \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax
   2319     \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax
   2320       % [Knuth] pp. 380,381,391
   2321       % \relax disables Spanish ligatures ?` and !` of \tt font.
   2322       \relax`%
   2323     \else \char'22 \fi
   2324   \else \char'22 \fi
   2325 }
   2326 
   2327 % Commands to set the quote options.
   2328 %
   2329 \parseargdef\codequoteundirected{%
   2330   \def\temp{#1}%
   2331   \ifx\temp\onword
   2332     \expandafter\let\csname SETtxicodequoteundirected\endcsname
   2333       = t%
   2334   \else\ifx\temp\offword
   2335     \expandafter\let\csname SETtxicodequoteundirected\endcsname
   2336       = \relax
   2337   \else
   2338     \errhelp = \EMsimple
   2339     \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}%
   2340   \fi\fi
   2341 }
   2342 %
   2343 \parseargdef\codequotebacktick{%
   2344   \def\temp{#1}%
   2345   \ifx\temp\onword
   2346     \expandafter\let\csname SETtxicodequotebacktick\endcsname
   2347       = t%
   2348   \else\ifx\temp\offword
   2349     \expandafter\let\csname SETtxicodequotebacktick\endcsname
   2350       = \relax
   2351   \else
   2352     \errhelp = \EMsimple
   2353     \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}%
   2354   \fi\fi
   2355 }
   2356 
   2357 % [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font.
   2358 \def\noligaturesquoteleft{\relax\lq}
   2359 
   2360 % Count depth in font-changes, for error checks
   2361 \newcount\fontdepth \fontdepth=0
   2362 
   2363 % Font commands.
   2364 
   2365 % #1 is the font command (\sl or \it), #2 is the text to slant.
   2366 % If we are in a monospaced environment, however, 1) always use \ttsl,
   2367 % and 2) do not add an italic correction.
   2368 \def\dosmartslant#1#2{%
   2369   \ifusingtt
   2370     {{\ttsl #2}\let\next=\relax}%
   2371     {\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}%
   2372   \next
   2373 }
   2374 \def\smartslanted{\dosmartslant\sl}
   2375 \def\smartitalic{\dosmartslant\it}
   2376 
   2377 % Output an italic correction unless \next (presumed to be the following
   2378 % character) is such as not to need one.
   2379 \def\smartitaliccorrection{%
   2380   \ifx\next,%
   2381   \else\ifx\next-%
   2382   \else\ifx\next.%
   2383   \else\ifx\next\.%
   2384   \else\ifx\next\comma%
   2385   \else\ptexslash
   2386   \fi\fi\fi\fi\fi
   2387   \aftersmartic
   2388 }
   2389 
   2390 % Unconditional use \ttsl, and no ic.  @var is set to this for defuns.
   2391 \def\ttslanted#1{{\ttsl #1}}
   2392 
   2393 % @cite is like \smartslanted except unconditionally use \sl.  We never want
   2394 % ttsl for book titles, do we?
   2395 \def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection}
   2396 
   2397 \def\aftersmartic{}
   2398 \def\var#1{%
   2399   \let\saveaftersmartic = \aftersmartic
   2400   \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}%
   2401   \smartslanted{#1}%
   2402 }
   2403 
   2404 \let\i=\smartitalic
   2405 \let\slanted=\smartslanted
   2406 \let\dfn=\smartslanted
   2407 \let\emph=\smartitalic
   2408 
   2409 % Explicit font changes: @r, @sc, undocumented @ii.
   2410 \def\r#1{{\rm #1}}              % roman font
   2411 \def\sc#1{{\smallcaps#1}}       % smallcaps font
   2412 \def\ii#1{{\it #1}}             % italic font
   2413 
   2414 % @b, explicit bold.  Also @strong.
   2415 \def\b#1{{\bf #1}}
   2416 \let\strong=\b
   2417 
   2418 % @sansserif, explicit sans.
   2419 \def\sansserif#1{{\sf #1}}
   2420 
   2421 % We can't just use \exhyphenpenalty, because that only has effect at
   2422 % the end of a paragraph.  Restore normal hyphenation at the end of the
   2423 % group within which \nohyphenation is presumably called.
   2424 %
   2425 \def\nohyphenation{\hyphenchar\font = -1  \aftergroup\restorehyphenation}
   2426 \def\restorehyphenation{\hyphenchar\font = `- }
   2427 
   2428 % Set sfcode to normal for the chars that usually have another value.
   2429 % Can't use plain's \frenchspacing because it uses the `\x notation, and
   2430 % sometimes \x has an active definition that messes things up.
   2431 %
   2432 \catcode`@=11
   2433   \def\plainfrenchspacing{%
   2434     \sfcode\dotChar  =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m
   2435     \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m
   2436     \def\endofsentencespacefactor{1000}% for @. and friends
   2437   }
   2438   \def\plainnonfrenchspacing{%
   2439     \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000
   2440     \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250
   2441     \def\endofsentencespacefactor{3000}% for @. and friends
   2442   }
   2443 \catcode`@=\other
   2444 \def\endofsentencespacefactor{3000}% default
   2445 
   2446 % @t, explicit typewriter.
   2447 \def\t#1{%
   2448   {\tt \rawbackslash \plainfrenchspacing #1}%
   2449   \null
   2450 }
   2451 
   2452 % @samp.
   2453 \def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}}
   2454 
   2455 % @indicateurl is \samp, that is, with quotes.
   2456 \let\indicateurl=\samp
   2457 
   2458 % @code (and similar) prints in typewriter, but with spaces the same
   2459 % size as normal in the surrounding text, without hyphenation, etc.
   2460 % This is a subroutine for that.
   2461 \def\tclose#1{%
   2462   {%
   2463     % Change normal interword space to be same as for the current font.
   2464     \spaceskip = \fontdimen2\font
   2465     %
   2466     % Switch to typewriter.
   2467     \tt
   2468     %
   2469     % But `\ ' produces the large typewriter interword space.
   2470     \def\ {{\spaceskip = 0pt{} }}%
   2471     %
   2472     % Turn off hyphenation.
   2473     \nohyphenation
   2474     %
   2475     \rawbackslash
   2476     \plainfrenchspacing
   2477     #1%
   2478   }%
   2479   \null % reset spacefactor to 1000
   2480 }
   2481 
   2482 % We *must* turn on hyphenation at `-' and `_' in @code.
   2483 % (But see \codedashfinish below.)
   2484 % Otherwise, it is too hard to avoid overfull hboxes
   2485 % in the Emacs manual, the Library manual, etc.
   2486 %
   2487 % Unfortunately, TeX uses one parameter (\hyphenchar) to control
   2488 % both hyphenation at - and hyphenation within words.
   2489 % We must therefore turn them both off (\tclose does that)
   2490 % and arrange explicitly to hyphenate at a dash. -- rms.
   2491 {
   2492   \catcode`\-=\active \catcode`\_=\active
   2493   \catcode`\'=\active \catcode`\`=\active
   2494   \global\let'=\rq \global\let`=\lq  % default definitions
   2495   %
   2496   \global\def\code{\begingroup
   2497     \setupmarkupstyle{code}%
   2498     % The following should really be moved into \setupmarkupstyle handlers.
   2499     \catcode\dashChar=\active  \catcode\underChar=\active
   2500     \ifallowcodebreaks
   2501      \let-\codedash
   2502      \let_\codeunder
   2503     \else
   2504      \let-\normaldash
   2505      \let_\realunder
   2506     \fi
   2507     % Given -foo (with a single dash), we do not want to allow a break
   2508     % after the hyphen.
   2509     \global\let\codedashprev=\codedash
   2510     %
   2511     \codex
   2512   }
   2513   %
   2514   \gdef\codedash{\futurelet\next\codedashfinish}
   2515   \gdef\codedashfinish{%
   2516     \normaldash % always output the dash character itself.
   2517     %
   2518     % Now, output a discretionary to allow a line break, unless
   2519     % (a) the next character is a -, or
   2520     % (b) the preceding character is a -.
   2521     % E.g., given --posix, we do not want to allow a break after either -.
   2522     % Given --foo-bar, we do want to allow a break between the - and the b.
   2523     \ifx\next\codedash \else
   2524       \ifx\codedashprev\codedash
   2525       \else \discretionary{}{}{}\fi
   2526     \fi
   2527     % we need the space after the = for the case when \next itself is a
   2528     % space token; it would get swallowed otherwise.  As in @code{- a}.
   2529     \global\let\codedashprev= \next
   2530   }
   2531 }
   2532 \def\normaldash{-}
   2533 %
   2534 \def\codex #1{\tclose{#1}\endgroup}
   2535 
   2536 \def\codeunder{%
   2537   % this is all so @math{@code{var_name}+1} can work.  In math mode, _
   2538   % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
   2539   % will therefore expand the active definition of _, which is us
   2540   % (inside @code that is), therefore an endless loop.
   2541   \ifusingtt{\ifmmode
   2542                \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_.
   2543              \else\normalunderscore \fi
   2544              \discretionary{}{}{}}%
   2545             {\_}%
   2546 }
   2547 
   2548 % An additional complication: the above will allow breaks after, e.g.,
   2549 % each of the four underscores in __typeof__.  This is bad.
   2550 % @allowcodebreaks provides a document-level way to turn breaking at -
   2551 % and _ on and off.
   2552 %
   2553 \newif\ifallowcodebreaks  \allowcodebreakstrue
   2554 
   2555 \def\keywordtrue{true}
   2556 \def\keywordfalse{false}
   2557 
   2558 \parseargdef\allowcodebreaks{%
   2559   \def\txiarg{#1}%
   2560   \ifx\txiarg\keywordtrue
   2561     \allowcodebreakstrue
   2562   \else\ifx\txiarg\keywordfalse
   2563     \allowcodebreaksfalse
   2564   \else
   2565     \errhelp = \EMsimple
   2566     \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}%
   2567   \fi\fi
   2568 }
   2569 
   2570 % For @command, @env, @file, @option quotes seem unnecessary,
   2571 % so use \code rather than \samp.
   2572 \let\command=\code
   2573 \let\env=\code
   2574 \let\file=\code
   2575 \let\option=\code
   2576 
   2577 % @uref (abbreviation for `urlref') takes an optional (comma-separated)
   2578 % second argument specifying the text to display and an optional third
   2579 % arg as text to display instead of (rather than in addition to) the url
   2580 % itself.  First (mandatory) arg is the url.
   2581 % (This \urefnobreak definition isn't used now, leaving it for a while
   2582 % for comparison.)
   2583 \def\urefnobreak#1{\dourefnobreak #1,,,\finish}
   2584 \def\dourefnobreak#1,#2,#3,#4\finish{\begingroup
   2585   \unsepspaces
   2586   \pdfurl{#1}%
   2587   \setbox0 = \hbox{\ignorespaces #3}%
   2588   \ifdim\wd0 > 0pt
   2589     \unhbox0 % third arg given, show only that
   2590   \else
   2591     \setbox0 = \hbox{\ignorespaces #2}%
   2592     \ifdim\wd0 > 0pt
   2593       \ifpdf
   2594         \unhbox0             % PDF: 2nd arg given, show only it
   2595       \else
   2596         \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url
   2597       \fi
   2598     \else
   2599       \code{#1}% only url given, so show it
   2600     \fi
   2601   \fi
   2602   \endlink
   2603 \endgroup}
   2604 
   2605 % This \urefbreak definition is the active one.
   2606 \def\urefbreak{\begingroup \urefcatcodes \dourefbreak}
   2607 \let\uref=\urefbreak
   2608 \def\dourefbreak#1{\urefbreakfinish #1,,,\finish}
   2609 \def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example
   2610   \unsepspaces
   2611   \pdfurl{#1}%
   2612   \setbox0 = \hbox{\ignorespaces #3}%
   2613   \ifdim\wd0 > 0pt
   2614     \unhbox0 % third arg given, show only that
   2615   \else
   2616     \setbox0 = \hbox{\ignorespaces #2}%
   2617     \ifdim\wd0 > 0pt
   2618       \ifpdf
   2619         \unhbox0             % PDF: 2nd arg given, show only it
   2620       \else
   2621         \unhbox0\ (\urefcode{#1})% DVI: 2nd arg given, show both it and url
   2622       \fi
   2623     \else
   2624       \urefcode{#1}% only url given, so show it
   2625     \fi
   2626   \fi
   2627   \endlink
   2628 \endgroup}
   2629 
   2630 % Allow line breaks around only a few characters (only).
   2631 \def\urefcatcodes{%
   2632   \catcode\ampChar=\active   \catcode\dotChar=\active
   2633   \catcode\hashChar=\active  \catcode\questChar=\active
   2634   \catcode\slashChar=\active
   2635 }
   2636 {
   2637   \urefcatcodes
   2638   %
   2639   \global\def\urefcode{\begingroup
   2640     \setupmarkupstyle{code}%
   2641     \urefcatcodes
   2642     \let&\urefcodeamp
   2643     \let.\urefcodedot
   2644     \let#\urefcodehash
   2645     \let?\urefcodequest
   2646     \let/\urefcodeslash
   2647     \codex
   2648   }
   2649   %
   2650   % By default, they are just regular characters.
   2651   \global\def&{\normalamp}
   2652   \global\def.{\normaldot}
   2653   \global\def#{\normalhash}
   2654   \global\def?{\normalquest}
   2655   \global\def/{\normalslash}
   2656 }
   2657 
   2658 % we put a little stretch before and after the breakable chars, to help
   2659 % line breaking of long url's.  The unequal skips make look better in
   2660 % cmtt at least, especially for dots.
   2661 \def\urefprestretch{\urefprebreak \hskip0pt plus.13em }
   2662 \def\urefpoststretch{\urefpostbreak \hskip0pt plus.1em }
   2663 %
   2664 \def\urefcodeamp{\urefprestretch \&\urefpoststretch}
   2665 \def\urefcodedot{\urefprestretch .\urefpoststretch}
   2666 \def\urefcodehash{\urefprestretch \#\urefpoststretch}
   2667 \def\urefcodequest{\urefprestretch ?\urefpoststretch}
   2668 \def\urefcodeslash{\futurelet\next\urefcodeslashfinish}
   2669 {
   2670   \catcode`\/=\active
   2671   \global\def\urefcodeslashfinish{%
   2672     \urefprestretch \slashChar
   2673     % Allow line break only after the final / in a sequence of
   2674     % slashes, to avoid line break between the slashes in http://.
   2675     \ifx\next/\else \urefpoststretch \fi
   2676   }
   2677 }
   2678 
   2679 % One more complication: by default we'll break after the special
   2680 % characters, but some people like to break before the special chars, so
   2681 % allow that.  Also allow no breaking at all, for manual control.
   2682 %
   2683 \parseargdef\urefbreakstyle{%
   2684   \def\txiarg{#1}%
   2685   \ifx\txiarg\wordnone
   2686     \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak}
   2687   \else\ifx\txiarg\wordbefore
   2688     \def\urefprebreak{\allowbreak}\def\urefpostbreak{\nobreak}
   2689   \else\ifx\txiarg\wordafter
   2690     \def\urefprebreak{\nobreak}\def\urefpostbreak{\allowbreak}
   2691   \else
   2692     \errhelp = \EMsimple
   2693     \errmessage{Unknown @urefbreakstyle setting `\txiarg'}%
   2694   \fi\fi\fi
   2695 }
   2696 \def\wordafter{after}
   2697 \def\wordbefore{before}
   2698 \def\wordnone{none}
   2699 
   2700 \urefbreakstyle after
   2701 
   2702 % @url synonym for @uref, since that's how everyone uses it.
   2703 %
   2704 \let\url=\uref
   2705 
   2706 % rms does not like angle brackets --karl, 17may97.
   2707 % So now @email is just like @uref, unless we are pdf.
   2708 %
   2709 %\def\email#1{\angleleft{\tt #1}\angleright}
   2710 \ifpdf
   2711   \def\email#1{\doemail#1,,\finish}
   2712   \def\doemail#1,#2,#3\finish{\begingroup
   2713     \unsepspaces
   2714     \pdfurl{mailto:#1}%
   2715     \setbox0 = \hbox{\ignorespaces #2}%
   2716     \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
   2717     \endlink
   2718   \endgroup}
   2719 \else
   2720   \let\email=\uref
   2721 \fi
   2722 
   2723 % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
   2724 %   `example' (@kbd uses ttsl only inside of @example and friends),
   2725 %   or `code' (@kbd uses normal tty font always).
   2726 \parseargdef\kbdinputstyle{%
   2727   \def\txiarg{#1}%
   2728   \ifx\txiarg\worddistinct
   2729     \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
   2730   \else\ifx\txiarg\wordexample
   2731     \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
   2732   \else\ifx\txiarg\wordcode
   2733     \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
   2734   \else
   2735     \errhelp = \EMsimple
   2736     \errmessage{Unknown @kbdinputstyle setting `\txiarg'}%
   2737   \fi\fi\fi
   2738 }
   2739 \def\worddistinct{distinct}
   2740 \def\wordexample{example}
   2741 \def\wordcode{code}
   2742 
   2743 % Default is `distinct'.
   2744 \kbdinputstyle distinct
   2745 
   2746 % @kbd is like @code, except that if the argument is just one @key command,
   2747 % then @kbd has no effect.
   2748 \def\kbd#1{{\def\look{#1}\expandafter\kbdsub\look??\par}}
   2749 
   2750 \def\xkey{\key}
   2751 \def\kbdsub#1#2#3\par{%
   2752   \def\one{#1}\def\three{#3}\def\threex{??}%
   2753   \ifx\one\xkey\ifx\threex\three \key{#2}%
   2754   \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
   2755   \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
   2756 }
   2757 
   2758 % definition of @key that produces a lozenge.  Doesn't adjust to text size.
   2759 %\setfont\keyrm\rmshape{8}{1000}{OT1}
   2760 %\font\keysy=cmsy9
   2761 %\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
   2762 %  \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
   2763 %    \vbox{\hrule\kern-0.4pt
   2764 %     \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
   2765 %    \kern-0.4pt\hrule}%
   2766 %  \kern-.06em\raise0.4pt\hbox{\angleright}}}}
   2767 
   2768 % definition of @key with no lozenge.  If the current font is already
   2769 % monospace, don't change it; that way, we respect @kbdinputstyle.  But
   2770 % if it isn't monospace, then use \tt.
   2771 %
   2772 \def\key#1{{\setupmarkupstyle{key}%
   2773   \nohyphenation
   2774   \ifmonospace\else\tt\fi
   2775   #1}\null}
   2776 
   2777 % @clicksequence{File @click{} Open ...}
   2778 \def\clicksequence#1{\begingroup #1\endgroup}
   2779 
   2780 % @clickstyle @arrow   (by default)
   2781 \parseargdef\clickstyle{\def\click{#1}}
   2782 \def\click{\arrow}
   2783 
   2784 % Typeset a dimension, e.g., `in' or `pt'.  The only reason for the
   2785 % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
   2786 %
   2787 \def\dmn#1{\thinspace #1}
   2788 
   2789 % @l was never documented to mean ``switch to the Lisp font'',
   2790 % and it is not used as such in any manual I can find.  We need it for
   2791 % Polish suppressed-l.  --karl, 22sep96.
   2792 %\def\l#1{{\li #1}\null}
   2793 
   2794 % @acronym for "FBI", "NATO", and the like.
   2795 % We print this one point size smaller, since it's intended for
   2796 % all-uppercase.
   2797 %
   2798 \def\acronym#1{\doacronym #1,,\finish}
   2799 \def\doacronym#1,#2,#3\finish{%
   2800   {\selectfonts\lsize #1}%
   2801   \def\temp{#2}%
   2802   \ifx\temp\empty \else
   2803     \space ({\unsepspaces \ignorespaces \temp \unskip})%
   2804   \fi
   2805   \null % reset \spacefactor=1000
   2806 }
   2807 
   2808 % @abbr for "Comput. J." and the like.
   2809 % No font change, but don't do end-of-sentence spacing.
   2810 %
   2811 \def\abbr#1{\doabbr #1,,\finish}
   2812 \def\doabbr#1,#2,#3\finish{%
   2813   {\plainfrenchspacing #1}%
   2814   \def\temp{#2}%
   2815   \ifx\temp\empty \else
   2816     \space ({\unsepspaces \ignorespaces \temp \unskip})%
   2817   \fi
   2818   \null % reset \spacefactor=1000
   2819 }
   2820 
   2821 % @asis just yields its argument.  Used with @table, for example.
   2822 %
   2823 \def\asis#1{#1}
   2824 
   2825 % @math outputs its argument in math mode.
   2826 %
   2827 % One complication: _ usually means subscripts, but it could also mean
   2828 % an actual _ character, as in @math{@var{some_variable} + 1}.  So make
   2829 % _ active, and distinguish by seeing if the current family is \slfam,
   2830 % which is what @var uses.
   2831 {
   2832   \catcode`\_ = \active
   2833   \gdef\mathunderscore{%
   2834     \catcode`\_=\active
   2835     \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
   2836   }
   2837 }
   2838 % Another complication: we want \\ (and @\) to output a math (or tt) \.
   2839 % FYI, plain.tex uses \\ as a temporary control sequence (for no
   2840 % particular reason), but this is not advertised and we don't care.
   2841 %
   2842 % The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
   2843 \def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
   2844 %
   2845 \def\math{%
   2846   \tex
   2847   \mathunderscore
   2848   \let\\ = \mathbackslash
   2849   \mathactive
   2850   % make the texinfo accent commands work in math mode
   2851   \let\"=\ddot
   2852   \let\'=\acute
   2853   \let\==\bar
   2854   \let\^=\hat
   2855   \let\`=\grave
   2856   \let\u=\breve
   2857   \let\v=\check
   2858   \let\~=\tilde
   2859   \let\dotaccent=\dot
   2860   $\finishmath
   2861 }
   2862 \def\finishmath#1{#1$\endgroup}  % Close the group opened by \tex.
   2863 
   2864 % Some active characters (such as <) are spaced differently in math.
   2865 % We have to reset their definitions in case the @math was an argument
   2866 % to a command which sets the catcodes (such as @item or @section).
   2867 %
   2868 {
   2869   \catcode`^ = \active
   2870   \catcode`< = \active
   2871   \catcode`> = \active
   2872   \catcode`+ = \active
   2873   \catcode`' = \active
   2874   \gdef\mathactive{%
   2875     \let^ = \ptexhat
   2876     \let< = \ptexless
   2877     \let> = \ptexgtr
   2878     \let+ = \ptexplus
   2879     \let' = \ptexquoteright
   2880   }
   2881 }
   2882 
   2883 % ctrl is no longer a Texinfo command, but leave this definition for fun.
   2884 \def\ctrl #1{{\tt \rawbackslash \hat}#1}
   2885 
   2886 % @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}.
   2887 % Ignore unless FMTNAME == tex; then it is like @iftex and @tex,
   2888 % except specified as a normal braced arg, so no newlines to worry about.
   2889 %
   2890 \def\outfmtnametex{tex}
   2891 %
   2892 \long\def\inlinefmt#1{\doinlinefmt #1,\finish}
   2893 \long\def\doinlinefmt#1,#2,\finish{%
   2894   \def\inlinefmtname{#1}%
   2895   \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi
   2896 }
   2897 %
   2898 % @inlinefmtifelse{FMTNAME,THEN-TEXT,ELSE-TEXT} expands THEN-TEXT if
   2899 % FMTNAME is tex, else ELSE-TEXT.
   2900 \long\def\inlinefmtifelse#1{\doinlinefmtifelse #1,,,\finish}
   2901 \long\def\doinlinefmtifelse#1,#2,#3,#4,\finish{%
   2902   \def\inlinefmtname{#1}%
   2903   \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\else \ignorespaces #3\fi
   2904 }
   2905 %
   2906 % For raw, must switch into @tex before parsing the argument, to avoid
   2907 % setting catcodes prematurely.  Doing it this way means that, for
   2908 % example, @inlineraw{html, foo{bar} gets a parse error instead of being
   2909 % ignored.  But this isn't important because if people want a literal
   2910 % *right* brace they would have to use a command anyway, so they may as
   2911 % well use a command to get a left brace too.  We could re-use the
   2912 % delimiter character idea from \verb, but it seems like overkill.
   2913 %
   2914 \long\def\inlineraw{\tex \doinlineraw}
   2915 \long\def\doinlineraw#1{\doinlinerawtwo #1,\finish}
   2916 \def\doinlinerawtwo#1,#2,\finish{%
   2917   \def\inlinerawname{#1}%
   2918   \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi
   2919   \endgroup % close group opened by \tex.
   2920 }
   2921 
   2922 % @inlineifset{VAR, TEXT} expands TEXT if VAR is @set.
   2923 %
   2924 \long\def\inlineifset#1{\doinlineifset #1,\finish}
   2925 \long\def\doinlineifset#1,#2,\finish{%
   2926   \def\inlinevarname{#1}%
   2927   \expandafter\ifx\csname SET\inlinevarname\endcsname\relax
   2928   \else\ignorespaces#2\fi
   2929 }
   2930 
   2931 % @inlineifclear{VAR, TEXT} expands TEXT if VAR is not @set.
   2932 %
   2933 \long\def\inlineifclear#1{\doinlineifclear #1,\finish}
   2934 \long\def\doinlineifclear#1,#2,\finish{%
   2935   \def\inlinevarname{#1}%
   2936   \expandafter\ifx\csname SET\inlinevarname\endcsname\relax \ignorespaces#2\fi
   2937 }
   2938 
   2939 
   2940 \message{glyphs,}
   2941 % and logos.
   2942 
   2943 % @@ prints an @, as does @atchar{}.
   2944 \def\@{\char64 }
   2945 \let\atchar=\@
   2946 
   2947 % @{ @} @lbracechar{} @rbracechar{} all generate brace characters.
   2948 % Unless we're in typewriter, use \ecfont because the CM text fonts do
   2949 % not have braces, and we don't want to switch into math.
   2950 \def\mylbrace{{\ifmonospace\else\ecfont\fi \char123}}
   2951 \def\myrbrace{{\ifmonospace\else\ecfont\fi \char125}}
   2952 \let\{=\mylbrace \let\lbracechar=\{
   2953 \let\}=\myrbrace \let\rbracechar=\}
   2954 \begingroup
   2955   % Definitions to produce \{ and \} commands for indices,
   2956   % and @{ and @} for the aux/toc files.
   2957   \catcode`\{ = \other \catcode`\} = \other
   2958   \catcode`\[ = 1 \catcode`\] = 2
   2959   \catcode`\! = 0 \catcode`\\ = \other
   2960   !gdef!lbracecmd[\{]%
   2961   !gdef!rbracecmd[\}]%
   2962   !gdef!lbraceatcmd[@{]%
   2963   !gdef!rbraceatcmd[@}]%
   2964 !endgroup
   2965 
   2966 % @comma{} to avoid , parsing problems.
   2967 \let\comma = ,
   2968 
   2969 % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
   2970 % Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
   2971 \let\, = \ptexc
   2972 \let\dotaccent = \ptexdot
   2973 \def\ringaccent#1{{\accent23 #1}}
   2974 \let\tieaccent = \ptext
   2975 \let\ubaraccent = \ptexb
   2976 \let\udotaccent = \d
   2977 
   2978 % Other special characters: @questiondown @exclamdown @ordf @ordm
   2979 % Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
   2980 \def\questiondown{?`}
   2981 \def\exclamdown{!`}
   2982 \def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}}
   2983 \def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}}
   2984 
   2985 % Dotless i and dotless j, used for accents.
   2986 \def\imacro{i}
   2987 \def\jmacro{j}
   2988 \def\dotless#1{%
   2989   \def\temp{#1}%
   2990   \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi
   2991   \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi
   2992   \else \errmessage{@dotless can be used only with i or j}%
   2993   \fi\fi
   2994 }
   2995 
   2996 % The \TeX{} logo, as in plain, but resetting the spacing so that a
   2997 % period following counts as ending a sentence.  (Idea found in latex.)
   2998 %
   2999 \edef\TeX{\TeX \spacefactor=1000 }
   3000 
   3001 % @LaTeX{} logo.  Not quite the same results as the definition in
   3002 % latex.ltx, since we use a different font for the raised A; it's most
   3003 % convenient for us to use an explicitly smaller font, rather than using
   3004 % the \scriptstyle font (since we don't reset \scriptstyle and
   3005 % \scriptscriptstyle).
   3006 %
   3007 \def\LaTeX{%
   3008   L\kern-.36em
   3009   {\setbox0=\hbox{T}%
   3010    \vbox to \ht0{\hbox{%
   3011      \ifx\textnominalsize\xwordpt
   3012        % for 10pt running text, \lllsize (8pt) is too small for the A in LaTeX.
   3013        % Revert to plain's \scriptsize, which is 7pt.
   3014        \count255=\the\fam $\fam\count255 \scriptstyle A$%
   3015      \else
   3016        % For 11pt, we can use our lllsize.
   3017        \selectfonts\lllsize A%
   3018      \fi
   3019      }%
   3020      \vss
   3021   }}%
   3022   \kern-.15em
   3023   \TeX
   3024 }
   3025 
   3026 % Some math mode symbols.
   3027 \def\bullet{$\ptexbullet$}
   3028 \def\geq{\ifmmode \ge\else $\ge$\fi}
   3029 \def\leq{\ifmmode \le\else $\le$\fi}
   3030 \def\minus{\ifmmode -\else $-$\fi}
   3031 
   3032 % @dots{} outputs an ellipsis using the current font.
   3033 % We do .5em per period so that it has the same spacing in the cm
   3034 % typewriter fonts as three actual period characters; on the other hand,
   3035 % in other typewriter fonts three periods are wider than 1.5em.  So do
   3036 % whichever is larger.
   3037 %
   3038 \def\dots{%
   3039   \leavevmode
   3040   \setbox0=\hbox{...}% get width of three periods
   3041   \ifdim\wd0 > 1.5em
   3042     \dimen0 = \wd0
   3043   \else
   3044     \dimen0 = 1.5em
   3045   \fi
   3046   \hbox to \dimen0{%
   3047     \hskip 0pt plus.25fil
   3048     .\hskip 0pt plus1fil
   3049     .\hskip 0pt plus1fil
   3050     .\hskip 0pt plus.5fil
   3051   }%
   3052 }
   3053 
   3054 % @enddots{} is an end-of-sentence ellipsis.
   3055 %
   3056 \def\enddots{%
   3057   \dots
   3058   \spacefactor=\endofsentencespacefactor
   3059 }
   3060 
   3061 % @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
   3062 %
   3063 % Since these characters are used in examples, they should be an even number of
   3064 % \tt widths. Each \tt character is 1en, so two makes it 1em.
   3065 %
   3066 \def\point{$\star$}
   3067 \def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}}
   3068 \def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
   3069 \def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}}
   3070 \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
   3071 \def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}}
   3072 
   3073 % The @error{} command.
   3074 % Adapted from the TeXbook's \boxit.
   3075 %
   3076 \newbox\errorbox
   3077 %
   3078 {\tentt \global\dimen0 = 3em}% Width of the box.
   3079 \dimen2 = .55pt % Thickness of rules
   3080 % The text. (`r' is open on the right, `e' somewhat less so on the left.)
   3081 \setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt}
   3082 %
   3083 \setbox\errorbox=\hbox to \dimen0{\hfil
   3084    \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
   3085    \advance\hsize by -2\dimen2 % Rules.
   3086    \vbox{%
   3087       \hrule height\dimen2
   3088       \hbox{\vrule width\dimen2 \kern3pt          % Space to left of text.
   3089          \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
   3090          \kern3pt\vrule width\dimen2}% Space to right.
   3091       \hrule height\dimen2}
   3092     \hfil}
   3093 %
   3094 \def\error{\leavevmode\lower.7ex\copy\errorbox}
   3095 
   3096 % @pounds{} is a sterling sign, which Knuth put in the CM italic font.
   3097 %
   3098 \def\pounds{{\it\$}}
   3099 
   3100 % @euro{} comes from a separate font, depending on the current style.
   3101 % We use the free feym* fonts from the eurosym package by Henrik
   3102 % Theiling, which support regular, slanted, bold and bold slanted (and
   3103 % "outlined" (blackboard board, sort of) versions, which we don't need).
   3104 % It is available from https://www.ctan.org/tex-archive/fonts/eurosym.
   3105 %
   3106 % Although only regular is the truly official Euro symbol, we ignore
   3107 % that.  The Euro is designed to be slightly taller than the regular
   3108 % font height.
   3109 %
   3110 % feymr - regular
   3111 % feymo - slanted
   3112 % feybr - bold
   3113 % feybo - bold slanted
   3114 %
   3115 % There is no good (free) typewriter version, to my knowledge.
   3116 % A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide.
   3117 % Hmm.
   3118 %
   3119 % Also doesn't work in math.  Do we need to do math with euro symbols?
   3120 % Hope not.
   3121 %
   3122 %
   3123 \def\euro{{\eurofont e}}
   3124 \def\eurofont{%
   3125   % We set the font at each command, rather than predefining it in
   3126   % \textfonts and the other font-switching commands, so that
   3127   % installations which never need the symbol don't have to have the
   3128   % font installed.
   3129   %
   3130   % There is only one designed size (nominal 10pt), so we always scale
   3131   % that to the current nominal size.
   3132   %
   3133   % By the way, simply using "at 1em" works for cmr10 and the like, but
   3134   % does not work for cmbx10 and other extended/shrunken fonts.
   3135   %
   3136   \def\eurosize{\csname\curfontsize nominalsize\endcsname}%
   3137   %
   3138   \ifx\curfontstyle\bfstylename
   3139     % bold:
   3140     \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize
   3141   \else
   3142     % regular:
   3143     \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize
   3144   \fi
   3145   \thiseurofont
   3146 }
   3147 
   3148 % Glyphs from the EC fonts.  We don't use \let for the aliases, because
   3149 % sometimes we redefine the original macro, and the alias should reflect
   3150 % the redefinition.
   3151 %
   3152 % Use LaTeX names for the Icelandic letters.
   3153 \def\DH{{\ecfont \char"D0}} % Eth
   3154 \def\dh{{\ecfont \char"F0}} % eth
   3155 \def\TH{{\ecfont \char"DE}} % Thorn
   3156 \def\th{{\ecfont \char"FE}} % thorn
   3157 %
   3158 \def\guillemetleft{{\ecfont \char"13}}
   3159 \def\guillemotleft{\guillemetleft}
   3160 \def\guillemetright{{\ecfont \char"14}}
   3161 \def\guillemotright{\guillemetright}
   3162 \def\guilsinglleft{{\ecfont \char"0E}}
   3163 \def\guilsinglright{{\ecfont \char"0F}}
   3164 \def\quotedblbase{{\ecfont \char"12}}
   3165 \def\quotesinglbase{{\ecfont \char"0D}}
   3166 %
   3167 % This positioning is not perfect (see the ogonek LaTeX package), but
   3168 % we have the precomposed glyphs for the most common cases.  We put the
   3169 % tests to use those glyphs in the single \ogonek macro so we have fewer
   3170 % dummy definitions to worry about for index entries, etc.
   3171 %
   3172 % ogonek is also used with other letters in Lithuanian (IOU), but using
   3173 % the precomposed glyphs for those is not so easy since they aren't in
   3174 % the same EC font.
   3175 \def\ogonek#1{{%
   3176   \def\temp{#1}%
   3177   \ifx\temp\macrocharA\Aogonek
   3178   \else\ifx\temp\macrochara\aogonek
   3179   \else\ifx\temp\macrocharE\Eogonek
   3180   \else\ifx\temp\macrochare\eogonek
   3181   \else
   3182     \ecfont \setbox0=\hbox{#1}%
   3183     \ifdim\ht0=1ex\accent"0C #1%
   3184     \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}%
   3185     \fi
   3186   \fi\fi\fi\fi
   3187   }%
   3188 }
   3189 \def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A}
   3190 \def\aogonek{{\ecfont \char"A1}}\def\macrochara{a}
   3191 \def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E}
   3192 \def\eogonek{{\ecfont \char"A6}}\def\macrochare{e}
   3193 %
   3194 % Use the ec* fonts (cm-super in outline format) for non-CM glyphs.
   3195 \def\ecfont{%
   3196   % We can't distinguish serif/sans and italic/slanted, but this
   3197   % is used for crude hacks anyway (like adding French and German
   3198   % quotes to documents typeset with CM, where we lose kerning), so
   3199   % hopefully nobody will notice/care.
   3200   \edef\ecsize{\csname\curfontsize ecsize\endcsname}%
   3201   \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}%
   3202   \ifmonospace
   3203     % typewriter:
   3204     \font\thisecfont = ectt\ecsize \space at \nominalsize
   3205   \else
   3206     \ifx\curfontstyle\bfstylename
   3207       % bold:
   3208       \font\thisecfont = ecb\ifusingit{i}{x}\ecsize \space at \nominalsize
   3209     \else
   3210       % regular:
   3211       \font\thisecfont = ec\ifusingit{ti}{rm}\ecsize \space at \nominalsize
   3212     \fi
   3213   \fi
   3214   \thisecfont
   3215 }
   3216 
   3217 % @registeredsymbol - R in a circle.  The font for the R should really
   3218 % be smaller yet, but lllsize is the best we can do for now.
   3219 % Adapted from the plain.tex definition of \copyright.
   3220 %
   3221 \def\registeredsymbol{%
   3222   $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}%
   3223                \hfil\crcr\Orb}}%
   3224     }$%
   3225 }
   3226 
   3227 % @textdegree - the normal degrees sign.
   3228 %
   3229 \def\textdegree{$^\circ$}
   3230 
   3231 % Laurent Siebenmann reports \Orb undefined with:
   3232 %  Textures 1.7.7 (preloaded format=plain 93.10.14)  (68K)  16 APR 2004 02:38
   3233 % so we'll define it if necessary.
   3234 %
   3235 \ifx\Orb\thisisundefined
   3236 \def\Orb{\mathhexbox20D}
   3237 \fi
   3238 
   3239 % Quotes.
   3240 \chardef\quotedblleft="5C
   3241 \chardef\quotedblright=`\"
   3242 \chardef\quoteleft=`\`
   3243 \chardef\quoteright=`\'
   3244 
   3245 
   3246 \message{page headings,}
   3247 
   3248 \newskip\titlepagetopglue \titlepagetopglue = 1.5in
   3249 \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
   3250 
   3251 % First the title page.  Must do @settitle before @titlepage.
   3252 \newif\ifseenauthor
   3253 \newif\iffinishedtitlepage
   3254 
   3255 % Do an implicit @contents or @shortcontents after @end titlepage if the
   3256 % user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage.
   3257 %
   3258 \newif\ifsetcontentsaftertitlepage
   3259  \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue
   3260 \newif\ifsetshortcontentsaftertitlepage
   3261  \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue
   3262 
   3263 \parseargdef\shorttitlepage{%
   3264   \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}%
   3265   \endgroup\page\hbox{}\page}
   3266 
   3267 \envdef\titlepage{%
   3268   % Open one extra group, as we want to close it in the middle of \Etitlepage.
   3269   \begingroup
   3270     \parindent=0pt \textfonts
   3271     % Leave some space at the very top of the page.
   3272     \vglue\titlepagetopglue
   3273     % No rule at page bottom unless we print one at the top with @title.
   3274     \finishedtitlepagetrue
   3275     %
   3276     % Most title ``pages'' are actually two pages long, with space
   3277     % at the top of the second.  We don't want the ragged left on the second.
   3278     \let\oldpage = \page
   3279     \def\page{%
   3280       \iffinishedtitlepage\else
   3281 	 \finishtitlepage
   3282       \fi
   3283       \let\page = \oldpage
   3284       \page
   3285       \null
   3286     }%
   3287 }
   3288 
   3289 \def\Etitlepage{%
   3290     \iffinishedtitlepage\else
   3291 	\finishtitlepage
   3292     \fi
   3293     % It is important to do the page break before ending the group,
   3294     % because the headline and footline are only empty inside the group.
   3295     % If we use the new definition of \page, we always get a blank page
   3296     % after the title page, which we certainly don't want.
   3297     \oldpage
   3298   \endgroup
   3299   %
   3300   % Need this before the \...aftertitlepage checks so that if they are
   3301   % in effect the toc pages will come out with page numbers.
   3302   \HEADINGSon
   3303   %
   3304   % If they want short, they certainly want long too.
   3305   \ifsetshortcontentsaftertitlepage
   3306     \shortcontents
   3307     \contents
   3308     \global\let\shortcontents = \relax
   3309     \global\let\contents = \relax
   3310   \fi
   3311   %
   3312   \ifsetcontentsaftertitlepage
   3313     \contents
   3314     \global\let\contents = \relax
   3315     \global\let\shortcontents = \relax
   3316   \fi
   3317 }
   3318 
   3319 \def\finishtitlepage{%
   3320   \vskip4pt \hrule height 2pt width \hsize
   3321   \vskip\titlepagebottomglue
   3322   \finishedtitlepagetrue
   3323 }
   3324 
   3325 % Settings used for typesetting titles: no hyphenation, no indentation,
   3326 % don't worry much about spacing, ragged right.  This should be used
   3327 % inside a \vbox, and fonts need to be set appropriately first.  Because
   3328 % it is always used for titles, nothing else, we call \rmisbold.  \par
   3329 % should be specified before the end of the \vbox, since a vbox is a group.
   3330 %
   3331 \def\raggedtitlesettings{%
   3332   \rmisbold
   3333   \hyphenpenalty=10000
   3334   \parindent=0pt
   3335   \tolerance=5000
   3336   \ptexraggedright
   3337 }
   3338 
   3339 % Macros to be used within @titlepage:
   3340 
   3341 \let\subtitlerm=\tenrm
   3342 \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}
   3343 
   3344 \parseargdef\title{%
   3345   \checkenv\titlepage
   3346   \vbox{\titlefonts \raggedtitlesettings #1\par}%
   3347   % print a rule at the page bottom also.
   3348   \finishedtitlepagefalse
   3349   \vskip4pt \hrule height 4pt width \hsize \vskip4pt
   3350 }
   3351 
   3352 \parseargdef\subtitle{%
   3353   \checkenv\titlepage
   3354   {\subtitlefont \rightline{#1}}%
   3355 }
   3356 
   3357 % @author should come last, but may come many times.
   3358 % It can also be used inside @quotation.
   3359 %
   3360 \parseargdef\author{%
   3361   \def\temp{\quotation}%
   3362   \ifx\thisenv\temp
   3363     \def\quotationauthor{#1}% printed in \Equotation.
   3364   \else
   3365     \checkenv\titlepage
   3366     \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi
   3367     {\secfonts\rmisbold \leftline{#1}}%
   3368   \fi
   3369 }
   3370 
   3371 
   3372 % Set up page headings and footings.
   3373 
   3374 \let\thispage=\folio
   3375 
   3376 \newtoks\evenheadline    % headline on even pages
   3377 \newtoks\oddheadline     % headline on odd pages
   3378 \newtoks\evenfootline    % footline on even pages
   3379 \newtoks\oddfootline     % footline on odd pages
   3380 
   3381 % Now make TeX use those variables
   3382 \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
   3383                             \else \the\evenheadline \fi}}
   3384 \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
   3385                             \else \the\evenfootline \fi}\HEADINGShook}
   3386 \let\HEADINGShook=\relax
   3387 
   3388 % Commands to set those variables.
   3389 % For example, this is what  @headings on  does
   3390 % @evenheading @thistitle|@thispage|@thischapter
   3391 % @oddheading @thischapter|@thispage|@thistitle
   3392 % @evenfooting @thisfile||
   3393 % @oddfooting ||@thisfile
   3394 
   3395 
   3396 \def\evenheading{\parsearg\evenheadingxxx}
   3397 \def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish}
   3398 \def\evenheadingyyy #1\|#2\|#3\|#4\finish{%
   3399 \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
   3400 
   3401 \def\oddheading{\parsearg\oddheadingxxx}
   3402 \def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish}
   3403 \def\oddheadingyyy #1\|#2\|#3\|#4\finish{%
   3404 \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
   3405 
   3406 \parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
   3407 
   3408 \def\evenfooting{\parsearg\evenfootingxxx}
   3409 \def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish}
   3410 \def\evenfootingyyy #1\|#2\|#3\|#4\finish{%
   3411 \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
   3412 
   3413 \def\oddfooting{\parsearg\oddfootingxxx}
   3414 \def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish}
   3415 \def\oddfootingyyy #1\|#2\|#3\|#4\finish{%
   3416   \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
   3417   %
   3418   % Leave some space for the footline.  Hopefully ok to assume
   3419   % @evenfooting will not be used by itself.
   3420   \global\advance\pageheight by -12pt
   3421   \global\advance\vsize by -12pt
   3422 }
   3423 
   3424 \parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}}
   3425 
   3426 % @evenheadingmarks top     \thischapter <- chapter at the top of a page
   3427 % @evenheadingmarks bottom  \thischapter <- chapter at the bottom of a page
   3428 %
   3429 % The same set of arguments for:
   3430 %
   3431 % @oddheadingmarks
   3432 % @evenfootingmarks
   3433 % @oddfootingmarks
   3434 % @everyheadingmarks
   3435 % @everyfootingmarks
   3436 
   3437 \def\evenheadingmarks{\headingmarks{even}{heading}}
   3438 \def\oddheadingmarks{\headingmarks{odd}{heading}}
   3439 \def\evenfootingmarks{\headingmarks{even}{footing}}
   3440 \def\oddfootingmarks{\headingmarks{odd}{footing}}
   3441 \def\everyheadingmarks#1 {\headingmarks{even}{heading}{#1}
   3442                           \headingmarks{odd}{heading}{#1} }
   3443 \def\everyfootingmarks#1 {\headingmarks{even}{footing}{#1}
   3444                           \headingmarks{odd}{footing}{#1} }
   3445 % #1 = even/odd, #2 = heading/footing, #3 = top/bottom.
   3446 \def\headingmarks#1#2#3 {%
   3447   \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname
   3448   \global\expandafter\let\csname get#1#2marks\endcsname \temp
   3449 }
   3450 
   3451 \everyheadingmarks bottom
   3452 \everyfootingmarks bottom
   3453 
   3454 % @headings double      turns headings on for double-sided printing.
   3455 % @headings single      turns headings on for single-sided printing.
   3456 % @headings off         turns them off.
   3457 % @headings on          same as @headings double, retained for compatibility.
   3458 % @headings after       turns on double-sided headings after this page.
   3459 % @headings doubleafter turns on double-sided headings after this page.
   3460 % @headings singleafter turns on single-sided headings after this page.
   3461 % By default, they are off at the start of a document,
   3462 % and turned `on' after @end titlepage.
   3463 
   3464 \def\headings #1 {\csname HEADINGS#1\endcsname}
   3465 
   3466 \def\headingsoff{% non-global headings elimination
   3467   \evenheadline={\hfil}\evenfootline={\hfil}%
   3468    \oddheadline={\hfil}\oddfootline={\hfil}%
   3469 }
   3470 
   3471 \def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting
   3472 \HEADINGSoff  % it's the default
   3473 
   3474 % When we turn headings on, set the page number to 1.
   3475 % For double-sided printing, put current file name in lower left corner,
   3476 % chapter name on inside top of right hand pages, document
   3477 % title on inside top of left hand pages, and page numbers on outside top
   3478 % edge of all pages.
   3479 \def\HEADINGSdouble{%
   3480 \global\pageno=1
   3481 \global\evenfootline={\hfil}
   3482 \global\oddfootline={\hfil}
   3483 \global\evenheadline={\line{\folio\hfil\thistitle}}
   3484 \global\oddheadline={\line{\thischapter\hfil\folio}}
   3485 \global\let\contentsalignmacro = \chapoddpage
   3486 }
   3487 \let\contentsalignmacro = \chappager
   3488 
   3489 % For single-sided printing, chapter title goes across top left of page,
   3490 % page number on top right.
   3491 \def\HEADINGSsingle{%
   3492 \global\pageno=1
   3493 \global\evenfootline={\hfil}
   3494 \global\oddfootline={\hfil}
   3495 \global\evenheadline={\line{\thischapter\hfil\folio}}
   3496 \global\oddheadline={\line{\thischapter\hfil\folio}}
   3497 \global\let\contentsalignmacro = \chappager
   3498 }
   3499 \def\HEADINGSon{\HEADINGSdouble}
   3500 
   3501 \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
   3502 \let\HEADINGSdoubleafter=\HEADINGSafter
   3503 \def\HEADINGSdoublex{%
   3504 \global\evenfootline={\hfil}
   3505 \global\oddfootline={\hfil}
   3506 \global\evenheadline={\line{\folio\hfil\thistitle}}
   3507 \global\oddheadline={\line{\thischapter\hfil\folio}}
   3508 \global\let\contentsalignmacro = \chapoddpage
   3509 }
   3510 
   3511 \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
   3512 \def\HEADINGSsinglex{%
   3513 \global\evenfootline={\hfil}
   3514 \global\oddfootline={\hfil}
   3515 \global\evenheadline={\line{\thischapter\hfil\folio}}
   3516 \global\oddheadline={\line{\thischapter\hfil\folio}}
   3517 \global\let\contentsalignmacro = \chappager
   3518 }
   3519 
   3520 % Subroutines used in generating headings
   3521 % This produces Day Month Year style of output.
   3522 % Only define if not already defined, in case a txi-??.tex file has set
   3523 % up a different format (e.g., txi-cs.tex does this).
   3524 \ifx\today\thisisundefined
   3525 \def\today{%
   3526   \number\day\space
   3527   \ifcase\month
   3528   \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
   3529   \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
   3530   \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
   3531   \fi
   3532   \space\number\year}
   3533 \fi
   3534 
   3535 % @settitle line...  specifies the title of the document, for headings.
   3536 % It generates no output of its own.
   3537 \def\thistitle{\putwordNoTitle}
   3538 \def\settitle{\parsearg{\gdef\thistitle}}
   3539 
   3540 
   3541 \message{tables,}
   3542 % Tables -- @table, @ftable, @vtable, @item(x).
   3543 
   3544 % default indentation of table text
   3545 \newdimen\tableindent \tableindent=.8in
   3546 % default indentation of @itemize and @enumerate text
   3547 \newdimen\itemindent  \itemindent=.3in
   3548 % margin between end of table item and start of table text.
   3549 \newdimen\itemmargin  \itemmargin=.1in
   3550 
   3551 % used internally for \itemindent minus \itemmargin
   3552 \newdimen\itemmax
   3553 
   3554 % Note @table, @ftable, and @vtable define @item, @itemx, etc., with
   3555 % these defs.
   3556 % They also define \itemindex
   3557 % to index the item name in whatever manner is desired (perhaps none).
   3558 
   3559 \newif\ifitemxneedsnegativevskip
   3560 
   3561 \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
   3562 
   3563 \def\internalBitem{\smallbreak \parsearg\itemzzz}
   3564 \def\internalBitemx{\itemxpar \parsearg\itemzzz}
   3565 
   3566 \def\itemzzz #1{\begingroup %
   3567   \advance\hsize by -\rightskip
   3568   \advance\hsize by -\tableindent
   3569   \setbox0=\hbox{\itemindicate{#1}}%
   3570   \itemindex{#1}%
   3571   \nobreak % This prevents a break before @itemx.
   3572   %
   3573   % If the item text does not fit in the space we have, put it on a line
   3574   % by itself, and do not allow a page break either before or after that
   3575   % line.  We do not start a paragraph here because then if the next
   3576   % command is, e.g., @kindex, the whatsit would get put into the
   3577   % horizontal list on a line by itself, resulting in extra blank space.
   3578   \ifdim \wd0>\itemmax
   3579     %
   3580     % Make this a paragraph so we get the \parskip glue and wrapping,
   3581     % but leave it ragged-right.
   3582     \begingroup
   3583       \advance\leftskip by-\tableindent
   3584       \advance\hsize by\tableindent
   3585       \advance\rightskip by0pt plus1fil\relax
   3586       \leavevmode\unhbox0\par
   3587     \endgroup
   3588     %
   3589     % We're going to be starting a paragraph, but we don't want the
   3590     % \parskip glue -- logically it's part of the @item we just started.
   3591     \nobreak \vskip-\parskip
   3592     %
   3593     % Stop a page break at the \parskip glue coming up.  However, if
   3594     % what follows is an environment such as @example, there will be no
   3595     % \parskip glue; then the negative vskip we just inserted would
   3596     % cause the example and the item to crash together.  So we use this
   3597     % bizarre value of 10001 as a signal to \aboveenvbreak to insert
   3598     % \parskip glue after all.  Section titles are handled this way also.
   3599     %
   3600     \penalty 10001
   3601     \endgroup
   3602     \itemxneedsnegativevskipfalse
   3603   \else
   3604     % The item text fits into the space.  Start a paragraph, so that the
   3605     % following text (if any) will end up on the same line.
   3606     \noindent
   3607     % Do this with kerns and \unhbox so that if there is a footnote in
   3608     % the item text, it can migrate to the main vertical list and
   3609     % eventually be printed.
   3610     \nobreak\kern-\tableindent
   3611     \dimen0 = \itemmax  \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
   3612     \unhbox0
   3613     \nobreak\kern\dimen0
   3614     \endgroup
   3615     \itemxneedsnegativevskiptrue
   3616   \fi
   3617 }
   3618 
   3619 \def\item{\errmessage{@item while not in a list environment}}
   3620 \def\itemx{\errmessage{@itemx while not in a list environment}}
   3621 
   3622 % @table, @ftable, @vtable.
   3623 \envdef\table{%
   3624   \let\itemindex\gobble
   3625   \tablecheck{table}%
   3626 }
   3627 \envdef\ftable{%
   3628   \def\itemindex ##1{\doind {fn}{\code{##1}}}%
   3629   \tablecheck{ftable}%
   3630 }
   3631 \envdef\vtable{%
   3632   \def\itemindex ##1{\doind {vr}{\code{##1}}}%
   3633   \tablecheck{vtable}%
   3634 }
   3635 \def\tablecheck#1{%
   3636   \ifnum \the\catcode`\^^M=\active
   3637     \endgroup
   3638     \errmessage{This command won't work in this context; perhaps the problem is
   3639       that we are \inenvironment\thisenv}%
   3640     \def\next{\doignore{#1}}%
   3641   \else
   3642     \let\next\tablex
   3643   \fi
   3644   \next
   3645 }
   3646 \def\tablex#1{%
   3647   \def\itemindicate{#1}%
   3648   \parsearg\tabley
   3649 }
   3650 \def\tabley#1{%
   3651   {%
   3652     \makevalueexpandable
   3653     \edef\temp{\noexpand\tablez #1\space\space\space}%
   3654     \expandafter
   3655   }\temp \endtablez
   3656 }
   3657 \def\tablez #1 #2 #3 #4\endtablez{%
   3658   \aboveenvbreak
   3659   \ifnum 0#1>0 \advance \leftskip by #1\mil \fi
   3660   \ifnum 0#2>0 \tableindent=#2\mil \fi
   3661   \ifnum 0#3>0 \advance \rightskip by #3\mil \fi
   3662   \itemmax=\tableindent
   3663   \advance \itemmax by -\itemmargin
   3664   \advance \leftskip by \tableindent
   3665   \exdentamount=\tableindent
   3666   \parindent = 0pt
   3667   \parskip = \smallskipamount
   3668   \ifdim \parskip=0pt \parskip=2pt \fi
   3669   \let\item = \internalBitem
   3670   \let\itemx = \internalBitemx
   3671 }
   3672 \def\Etable{\endgraf\afterenvbreak}
   3673 \let\Eftable\Etable
   3674 \let\Evtable\Etable
   3675 \let\Eitemize\Etable
   3676 \let\Eenumerate\Etable
   3677 
   3678 % This is the counter used by @enumerate, which is really @itemize
   3679 
   3680 \newcount \itemno
   3681 
   3682 \envdef\itemize{\parsearg\doitemize}
   3683 
   3684 \def\doitemize#1{%
   3685   \aboveenvbreak
   3686   \itemmax=\itemindent
   3687   \advance\itemmax by -\itemmargin
   3688   \advance\leftskip by \itemindent
   3689   \exdentamount=\itemindent
   3690   \parindent=0pt
   3691   \parskip=\smallskipamount
   3692   \ifdim\parskip=0pt \parskip=2pt \fi
   3693   %
   3694   % Try typesetting the item mark that if the document erroneously says
   3695   % something like @itemize @samp (intending @table), there's an error
   3696   % right away at the @itemize.  It's not the best error message in the
   3697   % world, but it's better than leaving it to the @item.  This means if
   3698   % the user wants an empty mark, they have to say @w{} not just @w.
   3699   \def\itemcontents{#1}%
   3700   \setbox0 = \hbox{\itemcontents}%
   3701   %
   3702   % @itemize with no arg is equivalent to @itemize @bullet.
   3703   \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
   3704   %
   3705   \let\item=\itemizeitem
   3706 }
   3707 
   3708 % Definition of @item while inside @itemize and @enumerate.
   3709 %
   3710 \def\itemizeitem{%
   3711   \advance\itemno by 1  % for enumerations
   3712   {\let\par=\endgraf \smallbreak}% reasonable place to break
   3713   {%
   3714    % If the document has an @itemize directly after a section title, a
   3715    % \nobreak will be last on the list, and \sectionheading will have
   3716    % done a \vskip-\parskip.  In that case, we don't want to zero
   3717    % parskip, or the item text will crash with the heading.  On the
   3718    % other hand, when there is normal text preceding the item (as there
   3719    % usually is), we do want to zero parskip, or there would be too much
   3720    % space.  In that case, we won't have a \nobreak before.  At least
   3721    % that's the theory.
   3722    \ifnum\lastpenalty<10000 \parskip=0in \fi
   3723    \noindent
   3724    \hbox to 0pt{\hss \itemcontents \kern\itemmargin}%
   3725    %
   3726    \vadjust{\penalty 1200}}% not good to break after first line of item.
   3727   \flushcr
   3728 }
   3729 
   3730 % \splitoff TOKENS\endmark defines \first to be the first token in
   3731 % TOKENS, and \rest to be the remainder.
   3732 %
   3733 \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
   3734 
   3735 % Allow an optional argument of an uppercase letter, lowercase letter,
   3736 % or number, to specify the first label in the enumerated list.  No
   3737 % argument is the same as `1'.
   3738 %
   3739 \envparseargdef\enumerate{\enumeratey #1  \endenumeratey}
   3740 \def\enumeratey #1 #2\endenumeratey{%
   3741   % If we were given no argument, pretend we were given `1'.
   3742   \def\thearg{#1}%
   3743   \ifx\thearg\empty \def\thearg{1}\fi
   3744   %
   3745   % Detect if the argument is a single token.  If so, it might be a
   3746   % letter.  Otherwise, the only valid thing it can be is a number.
   3747   % (We will always have one token, because of the test we just made.
   3748   % This is a good thing, since \splitoff doesn't work given nothing at
   3749   % all -- the first parameter is undelimited.)
   3750   \expandafter\splitoff\thearg\endmark
   3751   \ifx\rest\empty
   3752     % Only one token in the argument.  It could still be anything.
   3753     % A ``lowercase letter'' is one whose \lccode is nonzero.
   3754     % An ``uppercase letter'' is one whose \lccode is both nonzero, and
   3755     %   not equal to itself.
   3756     % Otherwise, we assume it's a number.
   3757     %
   3758     % We need the \relax at the end of the \ifnum lines to stop TeX from
   3759     % continuing to look for a <number>.
   3760     %
   3761     \ifnum\lccode\expandafter`\thearg=0\relax
   3762       \numericenumerate % a number (we hope)
   3763     \else
   3764       % It's a letter.
   3765       \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
   3766         \lowercaseenumerate % lowercase letter
   3767       \else
   3768         \uppercaseenumerate % uppercase letter
   3769       \fi
   3770     \fi
   3771   \else
   3772     % Multiple tokens in the argument.  We hope it's a number.
   3773     \numericenumerate
   3774   \fi
   3775 }
   3776 
   3777 % An @enumerate whose labels are integers.  The starting integer is
   3778 % given in \thearg.
   3779 %
   3780 \def\numericenumerate{%
   3781   \itemno = \thearg
   3782   \startenumeration{\the\itemno}%
   3783 }
   3784 
   3785 % The starting (lowercase) letter is in \thearg.
   3786 \def\lowercaseenumerate{%
   3787   \itemno = \expandafter`\thearg
   3788   \startenumeration{%
   3789     % Be sure we're not beyond the end of the alphabet.
   3790     \ifnum\itemno=0
   3791       \errmessage{No more lowercase letters in @enumerate; get a bigger
   3792                   alphabet}%
   3793     \fi
   3794     \char\lccode\itemno
   3795   }%
   3796 }
   3797 
   3798 % The starting (uppercase) letter is in \thearg.
   3799 \def\uppercaseenumerate{%
   3800   \itemno = \expandafter`\thearg
   3801   \startenumeration{%
   3802     % Be sure we're not beyond the end of the alphabet.
   3803     \ifnum\itemno=0
   3804       \errmessage{No more uppercase letters in @enumerate; get a bigger
   3805                   alphabet}
   3806     \fi
   3807     \char\uccode\itemno
   3808   }%
   3809 }
   3810 
   3811 % Call \doitemize, adding a period to the first argument and supplying the
   3812 % common last two arguments.  Also subtract one from the initial value in
   3813 % \itemno, since @item increments \itemno.
   3814 %
   3815 \def\startenumeration#1{%
   3816   \advance\itemno by -1
   3817   \doitemize{#1.}\flushcr
   3818 }
   3819 
   3820 % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
   3821 % to @enumerate.
   3822 %
   3823 \def\alphaenumerate{\enumerate{a}}
   3824 \def\capsenumerate{\enumerate{A}}
   3825 \def\Ealphaenumerate{\Eenumerate}
   3826 \def\Ecapsenumerate{\Eenumerate}
   3827 
   3828 
   3829 % @multitable macros
   3830 % Amy Hendrickson, 8/18/94, 3/6/96
   3831 %
   3832 % @multitable ... @end multitable will make as many columns as desired.
   3833 % Contents of each column will wrap at width given in preamble.  Width
   3834 % can be specified either with sample text given in a template line,
   3835 % or in percent of \hsize, the current width of text on page.
   3836 
   3837 % Table can continue over pages but will only break between lines.
   3838 
   3839 % To make preamble:
   3840 %
   3841 % Either define widths of columns in terms of percent of \hsize:
   3842 %   @multitable @columnfractions .25 .3 .45
   3843 %   @item ...
   3844 %
   3845 %   Numbers following @columnfractions are the percent of the total
   3846 %   current hsize to be used for each column. You may use as many
   3847 %   columns as desired.
   3848 
   3849 
   3850 % Or use a template:
   3851 %   @multitable {Column 1 template} {Column 2 template} {Column 3 template}
   3852 %   @item ...
   3853 %   using the widest term desired in each column.
   3854 
   3855 % Each new table line starts with @item, each subsequent new column
   3856 % starts with @tab. Empty columns may be produced by supplying @tab's
   3857 % with nothing between them for as many times as empty columns are needed,
   3858 % ie, @tab@tab@tab will produce two empty columns.
   3859 
   3860 % @item, @tab do not need to be on their own lines, but it will not hurt
   3861 % if they are.
   3862 
   3863 % Sample multitable:
   3864 
   3865 %   @multitable {Column 1 template} {Column 2 template} {Column 3 template}
   3866 %   @item first col stuff @tab second col stuff @tab third col
   3867 %   @item
   3868 %   first col stuff
   3869 %   @tab
   3870 %   second col stuff
   3871 %   @tab
   3872 %   third col
   3873 %   @item first col stuff @tab second col stuff
   3874 %   @tab Many paragraphs of text may be used in any column.
   3875 %
   3876 %         They will wrap at the width determined by the template.
   3877 %   @item@tab@tab This will be in third column.
   3878 %   @end multitable
   3879 
   3880 % Default dimensions may be reset by user.
   3881 % @multitableparskip is vertical space between paragraphs in table.
   3882 % @multitableparindent is paragraph indent in table.
   3883 % @multitablecolmargin is horizontal space to be left between columns.
   3884 % @multitablelinespace is space to leave between table items, baseline
   3885 %                                                            to baseline.
   3886 %   0pt means it depends on current normal line spacing.
   3887 %
   3888 \newskip\multitableparskip
   3889 \newskip\multitableparindent
   3890 \newdimen\multitablecolspace
   3891 \newskip\multitablelinespace
   3892 \multitableparskip=0pt
   3893 \multitableparindent=6pt
   3894 \multitablecolspace=12pt
   3895 \multitablelinespace=0pt
   3896 
   3897 % Macros used to set up halign preamble:
   3898 %
   3899 \let\endsetuptable\relax
   3900 \def\xendsetuptable{\endsetuptable}
   3901 \let\columnfractions\relax
   3902 \def\xcolumnfractions{\columnfractions}
   3903 \newif\ifsetpercent
   3904 
   3905 % #1 is the @columnfraction, usually a decimal number like .5, but might
   3906 % be just 1.  We just use it, whatever it is.
   3907 %
   3908 \def\pickupwholefraction#1 {%
   3909   \global\advance\colcount by 1
   3910   \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}%
   3911   \setuptable
   3912 }
   3913 
   3914 \newcount\colcount
   3915 \def\setuptable#1{%
   3916   \def\firstarg{#1}%
   3917   \ifx\firstarg\xendsetuptable
   3918     \let\go = \relax
   3919   \else
   3920     \ifx\firstarg\xcolumnfractions
   3921       \global\setpercenttrue
   3922     \else
   3923       \ifsetpercent
   3924          \let\go\pickupwholefraction
   3925       \else
   3926          \global\advance\colcount by 1
   3927          \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a
   3928                    % separator; typically that is always in the input, anyway.
   3929          \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
   3930       \fi
   3931     \fi
   3932     \ifx\go\pickupwholefraction
   3933       % Put the argument back for the \pickupwholefraction call, so
   3934       % we'll always have a period there to be parsed.
   3935       \def\go{\pickupwholefraction#1}%
   3936     \else
   3937       \let\go = \setuptable
   3938     \fi%
   3939   \fi
   3940   \go
   3941 }
   3942 
   3943 % multitable-only commands.
   3944 %
   3945 % @headitem starts a heading row, which we typeset in bold.
   3946 % Assignments have to be global since we are inside the implicit group
   3947 % of an alignment entry.  \everycr resets \everytab so we don't have to
   3948 % undo it ourselves.
   3949 \def\headitemfont{\b}% for people to use in the template row; not changeable
   3950 \def\headitem{%
   3951   \checkenv\multitable
   3952   \crcr
   3953   \global\everytab={\bf}% can't use \headitemfont since the parsing differs
   3954   \the\everytab % for the first item
   3955 }%
   3956 %
   3957 % A \tab used to include \hskip1sp.  But then the space in a template
   3958 % line is not enough.  That is bad.  So let's go back to just `&' until
   3959 % we again encounter the problem the 1sp was intended to solve.
   3960 %					--karl, nathan@acm.org, 20apr99.
   3961 \def\tab{\checkenv\multitable &\the\everytab}%
   3962 
   3963 % @multitable ... @end multitable definitions:
   3964 %
   3965 \newtoks\everytab  % insert after every tab.
   3966 %
   3967 \envdef\multitable{%
   3968   \vskip\parskip
   3969   \startsavinginserts
   3970   %
   3971   % @item within a multitable starts a normal row.
   3972   % We use \def instead of \let so that if one of the multitable entries
   3973   % contains an @itemize, we don't choke on the \item (seen as \crcr aka
   3974   % \endtemplate) expanding \doitemize.
   3975   \def\item{\crcr}%
   3976   %
   3977   \tolerance=9500
   3978   \hbadness=9500
   3979   \setmultitablespacing
   3980   \parskip=\multitableparskip
   3981   \parindent=\multitableparindent
   3982   \overfullrule=0pt
   3983   \global\colcount=0
   3984   %
   3985   \everycr = {%
   3986     \noalign{%
   3987       \global\everytab={}%
   3988       \global\colcount=0 % Reset the column counter.
   3989       % Check for saved footnotes, etc.
   3990       \checkinserts
   3991       % Keeps underfull box messages off when table breaks over pages.
   3992       %\filbreak
   3993 	% Maybe so, but it also creates really weird page breaks when the
   3994 	% table breaks over pages. Wouldn't \vfil be better?  Wait until the
   3995 	% problem manifests itself, so it can be fixed for real --karl.
   3996     }%
   3997   }%
   3998   %
   3999   \parsearg\domultitable
   4000 }
   4001 \def\domultitable#1{%
   4002   % To parse everything between @multitable and @item:
   4003   \setuptable#1 \endsetuptable
   4004   %
   4005   % This preamble sets up a generic column definition, which will
   4006   % be used as many times as user calls for columns.
   4007   % \vtop will set a single line and will also let text wrap and
   4008   % continue for many paragraphs if desired.
   4009   \halign\bgroup &%
   4010     \global\advance\colcount by 1
   4011     \multistrut
   4012     \vtop{%
   4013       % Use the current \colcount to find the correct column width:
   4014       \hsize=\expandafter\csname col\the\colcount\endcsname
   4015       %
   4016       % In order to keep entries from bumping into each other
   4017       % we will add a \leftskip of \multitablecolspace to all columns after
   4018       % the first one.
   4019       %
   4020       % If a template has been used, we will add \multitablecolspace
   4021       % to the width of each template entry.
   4022       %
   4023       % If the user has set preamble in terms of percent of \hsize we will
   4024       % use that dimension as the width of the column, and the \leftskip
   4025       % will keep entries from bumping into each other.  Table will start at
   4026       % left margin and final column will justify at right margin.
   4027       %
   4028       % Make sure we don't inherit \rightskip from the outer environment.
   4029       \rightskip=0pt
   4030       \ifnum\colcount=1
   4031 	% The first column will be indented with the surrounding text.
   4032 	\advance\hsize by\leftskip
   4033       \else
   4034 	\ifsetpercent \else
   4035 	  % If user has not set preamble in terms of percent of \hsize
   4036 	  % we will advance \hsize by \multitablecolspace.
   4037 	  \advance\hsize by \multitablecolspace
   4038 	\fi
   4039        % In either case we will make \leftskip=\multitablecolspace:
   4040       \leftskip=\multitablecolspace
   4041       \fi
   4042       % Ignoring space at the beginning and end avoids an occasional spurious
   4043       % blank line, when TeX decides to break the line at the space before the
   4044       % box from the multistrut, so the strut ends up on a line by itself.
   4045       % For example:
   4046       % @multitable @columnfractions .11 .89
   4047       % @item @code{#}
   4048       % @tab Legal holiday which is valid in major parts of the whole country.
   4049       % Is automatically provided with highlighting sequences respectively
   4050       % marking characters.
   4051       \noindent\ignorespaces##\unskip\multistrut
   4052     }\cr
   4053 }
   4054 \def\Emultitable{%
   4055   \crcr
   4056   \egroup % end the \halign
   4057   \global\setpercentfalse
   4058 }
   4059 
   4060 \def\setmultitablespacing{%
   4061   \def\multistrut{\strut}% just use the standard line spacing
   4062   %
   4063   % Compute \multitablelinespace (if not defined by user) for use in
   4064   % \multitableparskip calculation.  We used define \multistrut based on
   4065   % this, but (ironically) that caused the spacing to be off.
   4066   % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100.
   4067 \ifdim\multitablelinespace=0pt
   4068 \setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
   4069 \global\advance\multitablelinespace by-\ht0
   4070 \fi
   4071 % Test to see if parskip is larger than space between lines of
   4072 % table. If not, do nothing.
   4073 %        If so, set to same dimension as multitablelinespace.
   4074 \ifdim\multitableparskip>\multitablelinespace
   4075 \global\multitableparskip=\multitablelinespace
   4076 \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
   4077                                       % than skip between lines in the table.
   4078 \fi%
   4079 \ifdim\multitableparskip=0pt
   4080 \global\multitableparskip=\multitablelinespace
   4081 \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
   4082                                       % than skip between lines in the table.
   4083 \fi}
   4084 
   4085 
   4086 \message{conditionals,}
   4087 
   4088 % @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext,
   4089 % @ifnotxml always succeed.  They currently do nothing; we don't
   4090 % attempt to check whether the conditionals are properly nested.  But we
   4091 % have to remember that they are conditionals, so that @end doesn't
   4092 % attempt to close an environment group.
   4093 %
   4094 \def\makecond#1{%
   4095   \expandafter\let\csname #1\endcsname = \relax
   4096   \expandafter\let\csname iscond.#1\endcsname = 1
   4097 }
   4098 \makecond{iftex}
   4099 \makecond{ifnotdocbook}
   4100 \makecond{ifnothtml}
   4101 \makecond{ifnotinfo}
   4102 \makecond{ifnotplaintext}
   4103 \makecond{ifnotxml}
   4104 
   4105 % Ignore @ignore, @ifhtml, @ifinfo, and the like.
   4106 %
   4107 \def\direntry{\doignore{direntry}}
   4108 \def\documentdescription{\doignore{documentdescription}}
   4109 \def\docbook{\doignore{docbook}}
   4110 \def\html{\doignore{html}}
   4111 \def\ifdocbook{\doignore{ifdocbook}}
   4112 \def\ifhtml{\doignore{ifhtml}}
   4113 \def\ifinfo{\doignore{ifinfo}}
   4114 \def\ifnottex{\doignore{ifnottex}}
   4115 \def\ifplaintext{\doignore{ifplaintext}}
   4116 \def\ifxml{\doignore{ifxml}}
   4117 \def\ignore{\doignore{ignore}}
   4118 \def\menu{\doignore{menu}}
   4119 \def\xml{\doignore{xml}}
   4120 
   4121 % Ignore text until a line `@end #1', keeping track of nested conditionals.
   4122 %
   4123 % A count to remember the depth of nesting.
   4124 \newcount\doignorecount
   4125 
   4126 \def\doignore#1{\begingroup
   4127   % Scan in ``verbatim'' mode:
   4128   \obeylines
   4129   \catcode`\@ = \other
   4130   \catcode`\{ = \other
   4131   \catcode`\} = \other
   4132   %
   4133   % Make sure that spaces turn into tokens that match what \doignoretext wants.
   4134   \spaceisspace
   4135   %
   4136   % Count number of #1's that we've seen.
   4137   \doignorecount = 0
   4138   %
   4139   % Swallow text until we reach the matching `@end #1'.
   4140   \dodoignore{#1}%
   4141 }
   4142 
   4143 { \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source.
   4144   \obeylines %
   4145   %
   4146   \gdef\dodoignore#1{%
   4147     % #1 contains the command name as a string, e.g., `ifinfo'.
   4148     %
   4149     % Define a command to find the next `@end #1'.
   4150     \long\def\doignoretext##1^^M@end #1{%
   4151       \doignoretextyyy##1^^M@#1\_STOP_}%
   4152     %
   4153     % And this command to find another #1 command, at the beginning of a
   4154     % line.  (Otherwise, we would consider a line `@c @ifset', for
   4155     % example, to count as an @ifset for nesting.)
   4156     \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}%
   4157     %
   4158     % And now expand that command.
   4159     \doignoretext ^^M%
   4160   }%
   4161 }
   4162 
   4163 \def\doignoreyyy#1{%
   4164   \def\temp{#1}%
   4165   \ifx\temp\empty			% Nothing found.
   4166     \let\next\doignoretextzzz
   4167   \else					% Found a nested condition, ...
   4168     \advance\doignorecount by 1
   4169     \let\next\doignoretextyyy		% ..., look for another.
   4170     % If we're here, #1 ends with ^^M\ifinfo (for example).
   4171   \fi
   4172   \next #1% the token \_STOP_ is present just after this macro.
   4173 }
   4174 
   4175 % We have to swallow the remaining "\_STOP_".
   4176 %
   4177 \def\doignoretextzzz#1{%
   4178   \ifnum\doignorecount = 0	% We have just found the outermost @end.
   4179     \let\next\enddoignore
   4180   \else				% Still inside a nested condition.
   4181     \advance\doignorecount by -1
   4182     \let\next\doignoretext      % Look for the next @end.
   4183   \fi
   4184   \next
   4185 }
   4186 
   4187 % Finish off ignored text.
   4188 { \obeylines%
   4189   % Ignore anything after the last `@end #1'; this matters in verbatim
   4190   % environments, where otherwise the newline after an ignored conditional
   4191   % would result in a blank line in the output.
   4192   \gdef\enddoignore#1^^M{\endgroup\ignorespaces}%
   4193 }
   4194 
   4195 
   4196 % @set VAR sets the variable VAR to an empty value.
   4197 % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
   4198 %
   4199 % Since we want to separate VAR from REST-OF-LINE (which might be
   4200 % empty), we can't just use \parsearg; we have to insert a space of our
   4201 % own to delimit the rest of the line, and then take it out again if we
   4202 % didn't need it.
   4203 % We rely on the fact that \parsearg sets \catcode`\ =10.
   4204 %
   4205 \parseargdef\set{\setyyy#1 \endsetyyy}
   4206 \def\setyyy#1 #2\endsetyyy{%
   4207   {%
   4208     \makevalueexpandable
   4209     \def\temp{#2}%
   4210     \edef\next{\gdef\makecsname{SET#1}}%
   4211     \ifx\temp\empty
   4212       \next{}%
   4213     \else
   4214       \setzzz#2\endsetzzz
   4215     \fi
   4216   }%
   4217 }
   4218 % Remove the trailing space \setxxx inserted.
   4219 \def\setzzz#1 \endsetzzz{\next{#1}}
   4220 
   4221 % @clear VAR clears (i.e., unsets) the variable VAR.
   4222 %
   4223 \parseargdef\clear{%
   4224   {%
   4225     \makevalueexpandable
   4226     \global\expandafter\let\csname SET#1\endcsname=\relax
   4227   }%
   4228 }
   4229 
   4230 % @value{foo} gets the text saved in variable foo.
   4231 \def\value{\begingroup\makevalueexpandable\valuexxx}
   4232 \def\valuexxx#1{\expandablevalue{#1}\endgroup}
   4233 {
   4234   \catcode`\-=\active \catcode`\_=\active
   4235   %
   4236   \gdef\makevalueexpandable{%
   4237     \let\value = \expandablevalue
   4238     % We don't want these characters active, ...
   4239     \catcode`\-=\other \catcode`\_=\other
   4240     % ..., but we might end up with active ones in the argument if
   4241     % we're called from @code, as @code{@value{foo-bar_}}, though.
   4242     % So \let them to their normal equivalents.
   4243     \let-\normaldash \let_\normalunderscore
   4244   }
   4245 }
   4246 
   4247 % We have this subroutine so that we can handle at least some @value's
   4248 % properly in indexes (we call \makevalueexpandable in \indexdummies).
   4249 % The command has to be fully expandable (if the variable is set), since
   4250 % the result winds up in the index file.  This means that if the
   4251 % variable's value contains other Texinfo commands, it's almost certain
   4252 % it will fail (although perhaps we could fix that with sufficient work
   4253 % to do a one-level expansion on the result, instead of complete).
   4254 %
   4255 % Unfortunately, this has the consequence that when _ is in the *value*
   4256 % of an @set, it does not print properly in the roman fonts (get the cmr
   4257 % dot accent at position 126 instead).  No fix comes to mind, and it's
   4258 % been this way since 2003 or earlier, so just ignore it.
   4259 %
   4260 \def\expandablevalue#1{%
   4261   \expandafter\ifx\csname SET#1\endcsname\relax
   4262     {[No value for ``#1'']}%
   4263     \message{Variable `#1', used in @value, is not set.}%
   4264   \else
   4265     \csname SET#1\endcsname
   4266   \fi
   4267 }
   4268 
   4269 % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
   4270 % with @set.
   4271 %
   4272 % To get the special treatment we need for `@end ifset,' we call
   4273 % \makecond and then redefine.
   4274 %
   4275 \makecond{ifset}
   4276 \def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}}
   4277 \def\doifset#1#2{%
   4278   {%
   4279     \makevalueexpandable
   4280     \let\next=\empty
   4281     \expandafter\ifx\csname SET#2\endcsname\relax
   4282       #1% If not set, redefine \next.
   4283     \fi
   4284     \expandafter
   4285   }\next
   4286 }
   4287 \def\ifsetfail{\doignore{ifset}}
   4288 
   4289 % @ifclear VAR ... @end executes the `...' iff VAR has never been
   4290 % defined with @set, or has been undefined with @clear.
   4291 %
   4292 % The `\else' inside the `\doifset' parameter is a trick to reuse the
   4293 % above code: if the variable is not set, do nothing, if it is set,
   4294 % then redefine \next to \ifclearfail.
   4295 %
   4296 \makecond{ifclear}
   4297 \def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}}
   4298 \def\ifclearfail{\doignore{ifclear}}
   4299 
   4300 % @ifcommandisdefined CMD ... @end executes the `...' if CMD (written
   4301 % without the @) is in fact defined.  We can only feasibly check at the
   4302 % TeX level, so something like `mathcode' is going to considered
   4303 % defined even though it is not a Texinfo command.
   4304 %
   4305 \makecond{ifcommanddefined}
   4306 \def\ifcommanddefined{\parsearg{\doifcmddefined{\let\next=\ifcmddefinedfail}}}
   4307 %
   4308 \def\doifcmddefined#1#2{{%
   4309     \makevalueexpandable
   4310     \let\next=\empty
   4311     \expandafter\ifx\csname #2\endcsname\relax
   4312       #1% If not defined, \let\next as above.
   4313     \fi
   4314     \expandafter
   4315   }\next
   4316 }
   4317 \def\ifcmddefinedfail{\doignore{ifcommanddefined}}
   4318 
   4319 % @ifcommandnotdefined CMD ... handled similar to @ifclear above.
   4320 \makecond{ifcommandnotdefined}
   4321 \def\ifcommandnotdefined{%
   4322   \parsearg{\doifcmddefined{\else \let\next=\ifcmdnotdefinedfail}}}
   4323 \def\ifcmdnotdefinedfail{\doignore{ifcommandnotdefined}}
   4324 
   4325 % Set the `txicommandconditionals' variable, so documents have a way to
   4326 % test if the @ifcommand...defined conditionals are available.
   4327 \set txicommandconditionals
   4328 
   4329 % @dircategory CATEGORY  -- specify a category of the dir file
   4330 % which this file should belong to.  Ignore this in TeX.
   4331 \let\dircategory=\comment
   4332 
   4333 % @defininfoenclose.
   4334 \let\definfoenclose=\comment
   4335 
   4336 
   4337 \message{indexing,}
   4338 % Index generation facilities
   4339 
   4340 % Define \newwrite to be identical to plain tex's \newwrite
   4341 % except not \outer, so it can be used within macros and \if's.
   4342 \edef\newwrite{\makecsname{ptexnewwrite}}
   4343 
   4344 % \newindex {foo} defines an index named foo.
   4345 % It automatically defines \fooindex such that
   4346 % \fooindex ...rest of line... puts an entry in the index foo.
   4347 % It also defines \fooindfile to be the number of the output channel for
   4348 % the file that accumulates this index.  The file's extension is foo.
   4349 % The name of an index should be no more than 2 characters long
   4350 % for the sake of vms.
   4351 %
   4352 \def\newindex#1{%
   4353   \iflinks
   4354     \expandafter\newwrite \csname#1indfile\endcsname
   4355     \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
   4356   \fi
   4357   \expandafter\xdef\csname#1index\endcsname{%     % Define @#1index
   4358     \noexpand\doindex{#1}}
   4359 }
   4360 
   4361 % @defindex foo  ==  \newindex{foo}
   4362 %
   4363 \def\defindex{\parsearg\newindex}
   4364 
   4365 % Define @defcodeindex, like @defindex except put all entries in @code.
   4366 %
   4367 \def\defcodeindex{\parsearg\newcodeindex}
   4368 %
   4369 \def\newcodeindex#1{%
   4370   \iflinks
   4371     \expandafter\newwrite \csname#1indfile\endcsname
   4372     \openout \csname#1indfile\endcsname \jobname.#1
   4373   \fi
   4374   \expandafter\xdef\csname#1index\endcsname{%
   4375     \noexpand\docodeindex{#1}}%
   4376 }
   4377 
   4378 
   4379 % @synindex foo bar    makes index foo feed into index bar.
   4380 % Do this instead of @defindex foo if you don't want it as a separate index.
   4381 %
   4382 % @syncodeindex foo bar   similar, but put all entries made for index foo
   4383 % inside @code.
   4384 %
   4385 \def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
   4386 \def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}
   4387 
   4388 % #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
   4389 % #3 the target index (bar).
   4390 \def\dosynindex#1#2#3{%
   4391   % Only do \closeout if we haven't already done it, else we'll end up
   4392   % closing the target index.
   4393   \expandafter \ifx\csname donesynindex#2\endcsname \relax
   4394     % The \closeout helps reduce unnecessary open files; the limit on the
   4395     % Acorn RISC OS is a mere 16 files.
   4396     \expandafter\closeout\csname#2indfile\endcsname
   4397     \expandafter\let\csname donesynindex#2\endcsname = 1
   4398   \fi
   4399   % redefine \fooindfile:
   4400   \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
   4401   \expandafter\let\csname#2indfile\endcsname=\temp
   4402   % redefine \fooindex:
   4403   \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
   4404 }
   4405 
   4406 % Define \doindex, the driver for all \fooindex macros.
   4407 % Argument #1 is generated by the calling \fooindex macro,
   4408 %  and it is "foo", the name of the index.
   4409 
   4410 % \doindex just uses \parsearg; it calls \doind for the actual work.
   4411 % This is because \doind is more useful to call from other macros.
   4412 
   4413 % There is also \dosubind {index}{topic}{subtopic}
   4414 % which makes an entry in a two-level index such as the operation index.
   4415 
   4416 \def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
   4417 \def\singleindexer #1{\doind{\indexname}{#1}}
   4418 
   4419 % like the previous two, but they put @code around the argument.
   4420 \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
   4421 \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
   4422 
   4423 % Take care of Texinfo commands that can appear in an index entry.
   4424 % Since there are some commands we want to expand, and others we don't,
   4425 % we have to laboriously prevent expansion for those that we don't.
   4426 %
   4427 \def\indexdummies{%
   4428   \escapechar = `\\     % use backslash in output files.
   4429   \def\@{@}% change to @@ when we switch to @ as escape char in index files.
   4430   \def\ {\realbackslash\space }%
   4431   %
   4432   % Need these unexpandable (because we define \tt as a dummy)
   4433   % definitions when @{ or @} appear in index entry text.  Also, more
   4434   % complicated, when \tex is in effect and \{ is a \delimiter again.
   4435   % We can't use \lbracecmd and \rbracecmd because texindex assumes
   4436   % braces and backslashes are used only as delimiters.  Perhaps we
   4437   % should define @lbrace and @rbrace commands a la @comma.
   4438   \def\{{{\tt\char123}}%
   4439   \def\}{{\tt\char125}}%
   4440   %
   4441   % I don't entirely understand this, but when an index entry is
   4442   % generated from a macro call, the \endinput which \scanmacro inserts
   4443   % causes processing to be prematurely terminated.  This is,
   4444   % apparently, because \indexsorttmp is fully expanded, and \endinput
   4445   % is an expandable command.  The redefinition below makes \endinput
   4446   % disappear altogether for that purpose -- although logging shows that
   4447   % processing continues to some further point.  On the other hand, it
   4448   % seems \endinput does not hurt in the printed index arg, since that
   4449   % is still getting written without apparent harm.
   4450   %
   4451   % Sample source (mac-idx3.tex, reported by Graham Percival to
   4452   % help-texinfo, 22may06):
   4453   % @macro funindex {WORD}
   4454   % @findex xyz
   4455   % @end macro
   4456   % ...
   4457   % @funindex commtest
   4458   %
   4459   % The above is not enough to reproduce the bug, but it gives the flavor.
   4460   %
   4461   % Sample whatsit resulting:
   4462   % .@write3{\entry{xyz}{@folio }{@code {xyz@endinput }}}
   4463   %
   4464   % So:
   4465   \let\endinput = \empty
   4466   %
   4467   % Do the redefinitions.
   4468   \commondummies
   4469 }
   4470 
   4471 % For the aux and toc files, @ is the escape character.  So we want to
   4472 % redefine everything using @ as the escape character (instead of
   4473 % \realbackslash, still used for index files).  When everything uses @,
   4474 % this will be simpler.
   4475 %
   4476 \def\atdummies{%
   4477   \def\@{@@}%
   4478   \def\ {@ }%
   4479   \let\{ = \lbraceatcmd
   4480   \let\} = \rbraceatcmd
   4481   %
   4482   % Do the redefinitions.
   4483   \commondummies
   4484   \otherbackslash
   4485 }
   4486 
   4487 % Called from \indexdummies and \atdummies.
   4488 %
   4489 \def\commondummies{%
   4490   %
   4491   % \definedummyword defines \#1 as \string\#1\space, thus effectively
   4492   % preventing its expansion.  This is used only for control words,
   4493   % not control letters, because the \space would be incorrect for
   4494   % control characters, but is needed to separate the control word
   4495   % from whatever follows.
   4496   %
   4497   % For control letters, we have \definedummyletter, which omits the
   4498   % space.
   4499   %
   4500   % These can be used both for control words that take an argument and
   4501   % those that do not.  If it is followed by {arg} in the input, then
   4502   % that will dutifully get written to the index (or wherever).
   4503   %
   4504   \def\definedummyword  ##1{\def##1{\string##1\space}}%
   4505   \def\definedummyletter##1{\def##1{\string##1}}%
   4506   \let\definedummyaccent\definedummyletter
   4507   %
   4508   \commondummiesnofonts
   4509   %
   4510   \definedummyletter\_%
   4511   \definedummyletter\-%
   4512   %
   4513   % Non-English letters.
   4514   \definedummyword\AA
   4515   \definedummyword\AE
   4516   \definedummyword\DH
   4517   \definedummyword\L
   4518   \definedummyword\O
   4519   \definedummyword\OE
   4520   \definedummyword\TH
   4521   \definedummyword\aa
   4522   \definedummyword\ae
   4523   \definedummyword\dh
   4524   \definedummyword\exclamdown
   4525   \definedummyword\l
   4526   \definedummyword\o
   4527   \definedummyword\oe
   4528   \definedummyword\ordf
   4529   \definedummyword\ordm
   4530   \definedummyword\questiondown
   4531   \definedummyword\ss
   4532   \definedummyword\th
   4533   %
   4534   % Although these internal commands shouldn't show up, sometimes they do.
   4535   \definedummyword\bf
   4536   \definedummyword\gtr
   4537   \definedummyword\hat
   4538   \definedummyword\less
   4539   \definedummyword\sf
   4540   \definedummyword\sl
   4541   \definedummyword\tclose
   4542   \definedummyword\tt
   4543   %
   4544   \definedummyword\LaTeX
   4545   \definedummyword\TeX
   4546   %
   4547   % Assorted special characters.
   4548   \definedummyword\arrow
   4549   \definedummyword\bullet
   4550   \definedummyword\comma
   4551   \definedummyword\copyright
   4552   \definedummyword\registeredsymbol
   4553   \definedummyword\dots
   4554   \definedummyword\enddots
   4555   \definedummyword\entrybreak
   4556   \definedummyword\equiv
   4557   \definedummyword\error
   4558   \definedummyword\euro
   4559   \definedummyword\expansion
   4560   \definedummyword\geq
   4561   \definedummyword\guillemetleft
   4562   \definedummyword\guillemetright
   4563   \definedummyword\guilsinglleft
   4564   \definedummyword\guilsinglright
   4565   \definedummyword\lbracechar
   4566   \definedummyword\leq
   4567   \definedummyword\minus
   4568   \definedummyword\ogonek
   4569   \definedummyword\pounds
   4570   \definedummyword\point
   4571   \definedummyword\print
   4572   \definedummyword\quotedblbase
   4573   \definedummyword\quotedblleft
   4574   \definedummyword\quotedblright
   4575   \definedummyword\quoteleft
   4576   \definedummyword\quoteright
   4577   \definedummyword\quotesinglbase
   4578   \definedummyword\rbracechar
   4579   \definedummyword\result
   4580   \definedummyword\textdegree
   4581   %
   4582   % We want to disable all macros so that they are not expanded by \write.
   4583   \macrolist
   4584   %
   4585   \normalturnoffactive
   4586   %
   4587   % Handle some cases of @value -- where it does not contain any
   4588   % (non-fully-expandable) commands.
   4589   \makevalueexpandable
   4590 }
   4591 
   4592 % \commondummiesnofonts: common to \commondummies and \indexnofonts.
   4593 %
   4594 \def\commondummiesnofonts{%
   4595   % Control letters and accents.
   4596   \definedummyletter\!%
   4597   \definedummyaccent\"%
   4598   \definedummyaccent\'%
   4599   \definedummyletter\*%
   4600   \definedummyaccent\,%
   4601   \definedummyletter\.%
   4602   \definedummyletter\/%
   4603   \definedummyletter\:%
   4604   \definedummyaccent\=%
   4605   \definedummyletter\?%
   4606   \definedummyaccent\^%
   4607   \definedummyaccent\`%
   4608   \definedummyaccent\~%
   4609   \definedummyword\u
   4610   \definedummyword\v
   4611   \definedummyword\H
   4612   \definedummyword\dotaccent
   4613   \definedummyword\ogonek
   4614   \definedummyword\ringaccent
   4615   \definedummyword\tieaccent
   4616   \definedummyword\ubaraccent
   4617   \definedummyword\udotaccent
   4618   \definedummyword\dotless
   4619   %
   4620   % Texinfo font commands.
   4621   \definedummyword\b
   4622   \definedummyword\i
   4623   \definedummyword\r
   4624   \definedummyword\sansserif
   4625   \definedummyword\sc
   4626   \definedummyword\slanted
   4627   \definedummyword\t
   4628   %
   4629   % Commands that take arguments.
   4630   \definedummyword\abbr
   4631   \definedummyword\acronym
   4632   \definedummyword\anchor
   4633   \definedummyword\cite
   4634   \definedummyword\code
   4635   \definedummyword\command
   4636   \definedummyword\dfn
   4637   \definedummyword\dmn
   4638   \definedummyword\email
   4639   \definedummyword\emph
   4640   \definedummyword\env
   4641   \definedummyword\file
   4642   \definedummyword\image
   4643   \definedummyword\indicateurl
   4644   \definedummyword\inforef
   4645   \definedummyword\kbd
   4646   \definedummyword\key
   4647   \definedummyword\math
   4648   \definedummyword\option
   4649   \definedummyword\pxref
   4650   \definedummyword\ref
   4651   \definedummyword\samp
   4652   \definedummyword\strong
   4653   \definedummyword\tie
   4654   \definedummyword\uref
   4655   \definedummyword\url
   4656   \definedummyword\var
   4657   \definedummyword\verb
   4658   \definedummyword\w
   4659   \definedummyword\xref
   4660 }
   4661 
   4662 % \indexnofonts is used when outputting the strings to sort the index
   4663 % by, and when constructing control sequence names.  It eliminates all
   4664 % control sequences and just writes whatever the best ASCII sort string
   4665 % would be for a given command (usually its argument).
   4666 %
   4667 \def\indexnofonts{%
   4668   % Accent commands should become @asis.
   4669   \def\definedummyaccent##1{\let##1\asis}%
   4670   % We can just ignore other control letters.
   4671   \def\definedummyletter##1{\let##1\empty}%
   4672   % All control words become @asis by default; overrides below.
   4673   \let\definedummyword\definedummyaccent
   4674   %
   4675   \commondummiesnofonts
   4676   %
   4677   % Don't no-op \tt, since it isn't a user-level command
   4678   % and is used in the definitions of the active chars like <, >, |, etc.
   4679   % Likewise with the other plain tex font commands.
   4680   %\let\tt=\asis
   4681   %
   4682   \def\ { }%
   4683   \def\@{@}%
   4684   \def\_{\normalunderscore}%
   4685   \def\-{}% @- shouldn't affect sorting
   4686   %
   4687   % Unfortunately, texindex is not prepared to handle braces in the
   4688   % content at all.  So for index sorting, we map @{ and @} to strings
   4689   % starting with |, since that ASCII character is between ASCII { and }.
   4690   \def\{{|a}%
   4691   \def\lbracechar{|a}%
   4692   %
   4693   \def\}{|b}%
   4694   \def\rbracechar{|b}%
   4695   %
   4696   % Non-English letters.
   4697   \def\AA{AA}%
   4698   \def\AE{AE}%
   4699   \def\DH{DZZ}%
   4700   \def\L{L}%
   4701   \def\OE{OE}%
   4702   \def\O{O}%
   4703   \def\TH{ZZZ}%
   4704   \def\aa{aa}%
   4705   \def\ae{ae}%
   4706   \def\dh{dzz}%
   4707   \def\exclamdown{!}%
   4708   \def\l{l}%
   4709   \def\oe{oe}%
   4710   \def\ordf{a}%
   4711   \def\ordm{o}%
   4712   \def\o{o}%
   4713   \def\questiondown{?}%
   4714   \def\ss{ss}%
   4715   \def\th{zzz}%
   4716   %
   4717   \def\LaTeX{LaTeX}%
   4718   \def\TeX{TeX}%
   4719   %
   4720   % Assorted special characters.
   4721   % (The following {} will end up in the sort string, but that's ok.)
   4722   \def\arrow{->}%
   4723   \def\bullet{bullet}%
   4724   \def\comma{,}%
   4725   \def\copyright{copyright}%
   4726   \def\dots{...}%
   4727   \def\enddots{...}%
   4728   \def\equiv{==}%
   4729   \def\error{error}%
   4730   \def\euro{euro}%
   4731   \def\expansion{==>}%
   4732   \def\geq{>=}%
   4733   \def\guillemetleft{<<}%
   4734   \def\guillemetright{>>}%
   4735   \def\guilsinglleft{<}%
   4736   \def\guilsinglright{>}%
   4737   \def\leq{<=}%
   4738   \def\minus{-}%
   4739   \def\point{.}%
   4740   \def\pounds{pounds}%
   4741   \def\print{-|}%
   4742   \def\quotedblbase{"}%
   4743   \def\quotedblleft{"}%
   4744   \def\quotedblright{"}%
   4745   \def\quoteleft{`}%
   4746   \def\quoteright{'}%
   4747   \def\quotesinglbase{,}%
   4748   \def\registeredsymbol{R}%
   4749   \def\result{=>}%
   4750   \def\textdegree{o}%
   4751   %
   4752   \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax
   4753   \else \indexlquoteignore \fi
   4754   %
   4755   % We need to get rid of all macros, leaving only the arguments (if present).
   4756   % Of course this is not nearly correct, but it is the best we can do for now.
   4757   % makeinfo does not expand macros in the argument to @deffn, which ends up
   4758   % writing an index entry, and texindex isn't prepared for an index sort entry
   4759   % that starts with \.
   4760   %
   4761   % Since macro invocations are followed by braces, we can just redefine them
   4762   % to take a single TeX argument.  The case of a macro invocation that
   4763   % goes to end-of-line is not handled.
   4764   %
   4765   \macrolist
   4766 }
   4767 
   4768 % Undocumented (for FSFS 2nd ed.): @set txiindexlquoteignore makes us
   4769 % ignore left quotes in the sort term.
   4770 {\catcode`\`=\active
   4771  \gdef\indexlquoteignore{\let`=\empty}}
   4772 
   4773 \let\indexbackslash=0  %overridden during \printindex.
   4774 \let\SETmarginindex=\relax % put index entries in margin (undocumented)?
   4775 
   4776 % Most index entries go through here, but \dosubind is the general case.
   4777 % #1 is the index name, #2 is the entry text.
   4778 \def\doind#1#2{\dosubind{#1}{#2}{}}
   4779 
   4780 % Workhorse for all \fooindexes.
   4781 % #1 is name of index, #2 is stuff to put there, #3 is subentry --
   4782 % empty if called from \doind, as we usually are (the main exception
   4783 % is with most defuns, which call us directly).
   4784 %
   4785 \def\dosubind#1#2#3{%
   4786   \iflinks
   4787   {%
   4788     % Store the main index entry text (including the third arg).
   4789     \toks0 = {#2}%
   4790     % If third arg is present, precede it with a space.
   4791     \def\thirdarg{#3}%
   4792     \ifx\thirdarg\empty \else
   4793       \toks0 = \expandafter{\the\toks0 \space #3}%
   4794     \fi
   4795     %
   4796     \edef\writeto{\csname#1indfile\endcsname}%
   4797     %
   4798     \safewhatsit\dosubindwrite
   4799   }%
   4800   \fi
   4801 }
   4802 
   4803 % Write the entry in \toks0 to the index file:
   4804 %
   4805 \def\dosubindwrite{%
   4806   % Put the index entry in the margin if desired.
   4807   \ifx\SETmarginindex\relax\else
   4808     \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}%
   4809   \fi
   4810   %
   4811   % Remember, we are within a group.
   4812   \indexdummies % Must do this here, since \bf, etc expand at this stage
   4813   \def\backslashcurfont{\indexbackslash}% \indexbackslash isn't defined now
   4814       % so it will be output as is; and it will print as backslash.
   4815   %
   4816   % Process the index entry with all font commands turned off, to
   4817   % get the string to sort by.
   4818   {\indexnofonts
   4819    \edef\temp{\the\toks0}% need full expansion
   4820    \xdef\indexsorttmp{\temp}%
   4821   }%
   4822   %
   4823   % Set up the complete index entry, with both the sort key and
   4824   % the original text, including any font commands.  We write
   4825   % three arguments to \entry to the .?? file (four in the
   4826   % subentry case), texindex reduces to two when writing the .??s
   4827   % sorted result.
   4828   \edef\temp{%
   4829     \write\writeto{%
   4830       \string\entry{\indexsorttmp}{\noexpand\folio}{\the\toks0}}%
   4831   }%
   4832   \temp
   4833 }
   4834 
   4835 % Take care of unwanted page breaks/skips around a whatsit:
   4836 %
   4837 % If a skip is the last thing on the list now, preserve it
   4838 % by backing up by \lastskip, doing the \write, then inserting
   4839 % the skip again.  Otherwise, the whatsit generated by the
   4840 % \write or \pdfdest will make \lastskip zero.  The result is that
   4841 % sequences like this:
   4842 % @end defun
   4843 % @tindex whatever
   4844 % @defun ...
   4845 % will have extra space inserted, because the \medbreak in the
   4846 % start of the @defun won't see the skip inserted by the @end of
   4847 % the previous defun.
   4848 %
   4849 % But don't do any of this if we're not in vertical mode.  We
   4850 % don't want to do a \vskip and prematurely end a paragraph.
   4851 %
   4852 % Avoid page breaks due to these extra skips, too.
   4853 %
   4854 % But wait, there is a catch there:
   4855 % We'll have to check whether \lastskip is zero skip.  \ifdim is not
   4856 % sufficient for this purpose, as it ignores stretch and shrink parts
   4857 % of the skip.  The only way seems to be to check the textual
   4858 % representation of the skip.
   4859 %
   4860 % The following is almost like \def\zeroskipmacro{0.0pt} except that
   4861 % the ``p'' and ``t'' characters have catcode \other, not 11 (letter).
   4862 %
   4863 \edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname}
   4864 %
   4865 \newskip\whatsitskip
   4866 \newcount\whatsitpenalty
   4867 %
   4868 % ..., ready, GO:
   4869 %
   4870 \def\safewhatsit#1{\ifhmode
   4871   #1%
   4872  \else
   4873   % \lastskip and \lastpenalty cannot both be nonzero simultaneously.
   4874   \whatsitskip = \lastskip
   4875   \edef\lastskipmacro{\the\lastskip}%
   4876   \whatsitpenalty = \lastpenalty
   4877   %
   4878   % If \lastskip is nonzero, that means the last item was a
   4879   % skip.  And since a skip is discardable, that means this
   4880   % -\whatsitskip glue we're inserting is preceded by a
   4881   % non-discardable item, therefore it is not a potential
   4882   % breakpoint, therefore no \nobreak needed.
   4883   \ifx\lastskipmacro\zeroskipmacro
   4884   \else
   4885     \vskip-\whatsitskip
   4886   \fi
   4887   %
   4888   #1%
   4889   %
   4890   \ifx\lastskipmacro\zeroskipmacro
   4891     % If \lastskip was zero, perhaps the last item was a penalty, and
   4892     % perhaps it was >=10000, e.g., a \nobreak.  In that case, we want
   4893     % to re-insert the same penalty (values >10000 are used for various
   4894     % signals); since we just inserted a non-discardable item, any
   4895     % following glue (such as a \parskip) would be a breakpoint.  For example:
   4896     %   @deffn deffn-whatever
   4897     %   @vindex index-whatever
   4898     %   Description.
   4899     % would allow a break between the index-whatever whatsit
   4900     % and the "Description." paragraph.
   4901     \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi
   4902   \else
   4903     % On the other hand, if we had a nonzero \lastskip,
   4904     % this make-up glue would be preceded by a non-discardable item
   4905     % (the whatsit from the \write), so we must insert a \nobreak.
   4906     \nobreak\vskip\whatsitskip
   4907   \fi
   4908 \fi}
   4909 
   4910 % The index entry written in the file actually looks like
   4911 %  \entry {sortstring}{page}{topic}
   4912 % or
   4913 %  \entry {sortstring}{page}{topic}{subtopic}
   4914 % The texindex program reads in these files and writes files
   4915 % containing these kinds of lines:
   4916 %  \initial {c}
   4917 %     before the first topic whose initial is c
   4918 %  \entry {topic}{pagelist}
   4919 %     for a topic that is used without subtopics
   4920 %  \primary {topic}
   4921 %     for the beginning of a topic that is used with subtopics
   4922 %  \secondary {subtopic}{pagelist}
   4923 %     for each subtopic.
   4924 
   4925 % Define the user-accessible indexing commands
   4926 % @findex, @vindex, @kindex, @cindex.
   4927 
   4928 \def\findex {\fnindex}
   4929 \def\kindex {\kyindex}
   4930 \def\cindex {\cpindex}
   4931 \def\vindex {\vrindex}
   4932 \def\tindex {\tpindex}
   4933 \def\pindex {\pgindex}
   4934 
   4935 \def\cindexsub {\begingroup\obeylines\cindexsub}
   4936 {\obeylines %
   4937 \gdef\cindexsub "#1" #2^^M{\endgroup %
   4938 \dosubind{cp}{#2}{#1}}}
   4939 
   4940 % Define the macros used in formatting output of the sorted index material.
   4941 
   4942 % @printindex causes a particular index (the ??s file) to get printed.
   4943 % It does not print any chapter heading (usually an @unnumbered).
   4944 %
   4945 \parseargdef\printindex{\begingroup
   4946   \dobreak \chapheadingskip{10000}%
   4947   %
   4948   \smallfonts \rm
   4949   \tolerance = 9500
   4950   \plainfrenchspacing
   4951   \everypar = {}% don't want the \kern\-parindent from indentation suppression.
   4952   %
   4953   % See if the index file exists and is nonempty.
   4954   % Change catcode of @ here so that if the index file contains
   4955   % \initial {@}
   4956   % as its first line, TeX doesn't complain about mismatched braces
   4957   % (because it thinks @} is a control sequence).
   4958   \catcode`\@ = 11
   4959   \openin 1 \jobname.#1s
   4960   \ifeof 1
   4961     % \enddoublecolumns gets confused if there is no text in the index,
   4962     % and it loses the chapter title and the aux file entries for the
   4963     % index.  The easiest way to prevent this problem is to make sure
   4964     % there is some text.
   4965     \putwordIndexNonexistent
   4966   \else
   4967     %
   4968     % If the index file exists but is empty, then \openin leaves \ifeof
   4969     % false.  We have to make TeX try to read something from the file, so
   4970     % it can discover if there is anything in it.
   4971     \read 1 to \temp
   4972     \ifeof 1
   4973       \putwordIndexIsEmpty
   4974     \else
   4975       % Index files are almost Texinfo source, but we use \ as the escape
   4976       % character.  It would be better to use @, but that's too big a change
   4977       % to make right now.
   4978       \def\indexbackslash{\backslashcurfont}%
   4979       \catcode`\\ = 0
   4980       \escapechar = `\\
   4981       \begindoublecolumns
   4982       \input \jobname.#1s
   4983       \enddoublecolumns
   4984     \fi
   4985   \fi
   4986   \closein 1
   4987 \endgroup}
   4988 
   4989 % These macros are used by the sorted index file itself.
   4990 % Change them to control the appearance of the index.
   4991 
   4992 \def\initial#1{{%
   4993   % Some minor font changes for the special characters.
   4994   \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
   4995   %
   4996   % Remove any glue we may have, we'll be inserting our own.
   4997   \removelastskip
   4998   %
   4999   % We like breaks before the index initials, so insert a bonus.
   5000   \nobreak
   5001   \vskip 0pt plus 3\baselineskip
   5002   \penalty 0
   5003   \vskip 0pt plus -3\baselineskip
   5004   %
   5005   % Typeset the initial.  Making this add up to a whole number of
   5006   % baselineskips increases the chance of the dots lining up from column
   5007   % to column.  It still won't often be perfect, because of the stretch
   5008   % we need before each entry, but it's better.
   5009   %
   5010   % No shrink because it confuses \balancecolumns.
   5011   \vskip 1.67\baselineskip plus .5\baselineskip
   5012   \leftline{\secbf #1}%
   5013   % Do our best not to break after the initial.
   5014   \nobreak
   5015   \vskip .33\baselineskip plus .1\baselineskip
   5016 }}
   5017 
   5018 % \entry typesets a paragraph consisting of the text (#1), dot leaders, and
   5019 % then page number (#2) flushed to the right margin.  It is used for index
   5020 % and table of contents entries.  The paragraph is indented by \leftskip.
   5021 %
   5022 % A straightforward implementation would start like this:
   5023 %	\def\entry#1#2{...
   5024 % But this freezes the catcodes in the argument, and can cause problems to
   5025 % @code, which sets - active.  This problem was fixed by a kludge---
   5026 % ``-'' was active throughout whole index, but this isn't really right.
   5027 % The right solution is to prevent \entry from swallowing the whole text.
   5028 %                                 --kasal, 21nov03
   5029 \def\entry{%
   5030   \begingroup
   5031     %
   5032     % Start a new paragraph if necessary, so our assignments below can't
   5033     % affect previous text.
   5034     \par
   5035     %
   5036     % Do not fill out the last line with white space.
   5037     \parfillskip = 0in
   5038     %
   5039     % No extra space above this paragraph.
   5040     \parskip = 0in
   5041     %
   5042     % Do not prefer a separate line ending with a hyphen to fewer lines.
   5043     \finalhyphendemerits = 0
   5044     %
   5045     % \hangindent is only relevant when the entry text and page number
   5046     % don't both fit on one line.  In that case, bob suggests starting the
   5047     % dots pretty far over on the line.  Unfortunately, a large
   5048     % indentation looks wrong when the entry text itself is broken across
   5049     % lines.  So we use a small indentation and put up with long leaders.
   5050     %
   5051     % \hangafter is reset to 1 (which is the value we want) at the start
   5052     % of each paragraph, so we need not do anything with that.
   5053     \hangindent = 2em
   5054     %
   5055     % When the entry text needs to be broken, just fill out the first line
   5056     % with blank space.
   5057     \rightskip = 0pt plus1fil
   5058     %
   5059     % A bit of stretch before each entry for the benefit of balancing
   5060     % columns.
   5061     \vskip 0pt plus1pt
   5062     %
   5063     % When reading the text of entry, convert explicit line breaks
   5064     % from @* into spaces.  The user might give these in long section
   5065     % titles, for instance.
   5066     \def\*{\unskip\space\ignorespaces}%
   5067     \def\entrybreak{\hfil\break}%
   5068     %
   5069     % Swallow the left brace of the text (first parameter):
   5070     \afterassignment\doentry
   5071     \let\temp =
   5072 }
   5073 \def\entrybreak{\unskip\space\ignorespaces}%
   5074 \def\doentry{%
   5075     \bgroup % Instead of the swallowed brace.
   5076       \noindent
   5077       \aftergroup\finishentry
   5078       % And now comes the text of the entry.
   5079 }
   5080 \def\finishentry#1{%
   5081     % #1 is the page number.
   5082     %
   5083     % The following is kludged to not output a line of dots in the index if
   5084     % there are no page numbers.  The next person who breaks this will be
   5085     % cursed by a Unix daemon.
   5086     \setbox\boxA = \hbox{#1}%
   5087     \ifdim\wd\boxA = 0pt
   5088       \ %
   5089     \else
   5090       %
   5091       % If we must, put the page number on a line of its own, and fill out
   5092       % this line with blank space.  (The \hfil is overwhelmed with the
   5093       % fill leaders glue in \indexdotfill if the page number does fit.)
   5094       \hfil\penalty50
   5095       \null\nobreak\indexdotfill % Have leaders before the page number.
   5096       %
   5097       % The `\ ' here is removed by the implicit \unskip that TeX does as
   5098       % part of (the primitive) \par.  Without it, a spurious underfull
   5099       % \hbox ensues.
   5100       \ifpdf
   5101 	\pdfgettoks#1.%
   5102 	\ \the\toksA
   5103       \else
   5104 	\ #1%
   5105       \fi
   5106     \fi
   5107     \par
   5108   \endgroup
   5109 }
   5110 
   5111 % Like plain.tex's \dotfill, except uses up at least 1 em.
   5112 \def\indexdotfill{\cleaders
   5113   \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1fill}
   5114 
   5115 \def\primary #1{\line{#1\hfil}}
   5116 
   5117 \newskip\secondaryindent \secondaryindent=0.5cm
   5118 \def\secondary#1#2{{%
   5119   \parfillskip=0in
   5120   \parskip=0in
   5121   \hangindent=1in
   5122   \hangafter=1
   5123   \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill
   5124   \ifpdf
   5125     \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
   5126   \else
   5127     #2
   5128   \fi
   5129   \par
   5130 }}
   5131 
   5132 % Define two-column mode, which we use to typeset indexes.
   5133 % Adapted from the TeXbook, page 416, which is to say,
   5134 % the manmac.tex format used to print the TeXbook itself.
   5135 \catcode`\@=11
   5136 
   5137 \newbox\partialpage
   5138 \newdimen\doublecolumnhsize
   5139 
   5140 \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
   5141   % Grab any single-column material above us.
   5142   \output = {%
   5143     %
   5144     % Here is a possibility not foreseen in manmac: if we accumulate a
   5145     % whole lot of material, we might end up calling this \output
   5146     % routine twice in a row (see the doublecol-lose test, which is
   5147     % essentially a couple of indexes with @setchapternewpage off).  In
   5148     % that case we just ship out what is in \partialpage with the normal
   5149     % output routine.  Generally, \partialpage will be empty when this
   5150     % runs and this will be a no-op.  See the indexspread.tex test case.
   5151     \ifvoid\partialpage \else
   5152       \onepageout{\pagecontents\partialpage}%
   5153     \fi
   5154     %
   5155     \global\setbox\partialpage = \vbox{%
   5156       % Unvbox the main output page.
   5157       \unvbox\PAGE
   5158       \kern-\topskip \kern\baselineskip
   5159     }%
   5160   }%
   5161   \eject % run that output routine to set \partialpage
   5162   %
   5163   % Use the double-column output routine for subsequent pages.
   5164   \output = {\doublecolumnout}%
   5165   %
   5166   % Change the page size parameters.  We could do this once outside this
   5167   % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
   5168   % format, but then we repeat the same computation.  Repeating a couple
   5169   % of assignments once per index is clearly meaningless for the
   5170   % execution time, so we may as well do it in one place.
   5171   %
   5172   % First we halve the line length, less a little for the gutter between
   5173   % the columns.  We compute the gutter based on the line length, so it
   5174   % changes automatically with the paper format.  The magic constant
   5175   % below is chosen so that the gutter has the same value (well, +-<1pt)
   5176   % as it did when we hard-coded it.
   5177   %
   5178   % We put the result in a separate register, \doublecolumhsize, so we
   5179   % can restore it in \pagesofar, after \hsize itself has (potentially)
   5180   % been clobbered.
   5181   %
   5182   \doublecolumnhsize = \hsize
   5183     \advance\doublecolumnhsize by -.04154\hsize
   5184     \divide\doublecolumnhsize by 2
   5185   \hsize = \doublecolumnhsize
   5186   %
   5187   % Double the \vsize as well.  (We don't need a separate register here,
   5188   % since nobody clobbers \vsize.)
   5189   \vsize = 2\vsize
   5190 }
   5191 
   5192 % The double-column output routine for all double-column pages except
   5193 % the last.
   5194 %
   5195 \def\doublecolumnout{%
   5196   \splittopskip=\topskip \splitmaxdepth=\maxdepth
   5197   % Get the available space for the double columns -- the normal
   5198   % (undoubled) page height minus any material left over from the
   5199   % previous page.
   5200   \dimen@ = \vsize
   5201   \divide\dimen@ by 2
   5202   \advance\dimen@ by -\ht\partialpage
   5203   %
   5204   % box0 will be the left-hand column, box2 the right.
   5205   \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
   5206   \onepageout\pagesofar
   5207   \unvbox255
   5208   \penalty\outputpenalty
   5209 }
   5210 %
   5211 % Re-output the contents of the output page -- any previous material,
   5212 % followed by the two boxes we just split, in box0 and box2.
   5213 \def\pagesofar{%
   5214   \unvbox\partialpage
   5215   %
   5216   \hsize = \doublecolumnhsize
   5217   \wd0=\hsize \wd2=\hsize
   5218   \hbox to\pagewidth{\box0\hfil\box2}%
   5219 }
   5220 %
   5221 % All done with double columns.
   5222 \def\enddoublecolumns{%
   5223   % The following penalty ensures that the page builder is exercised
   5224   % _before_ we change the output routine.  This is necessary in the
   5225   % following situation:
   5226   %
   5227   % The last section of the index consists only of a single entry.
   5228   % Before this section, \pagetotal is less than \pagegoal, so no
   5229   % break occurs before the last section starts.  However, the last
   5230   % section, consisting of \initial and the single \entry, does not
   5231   % fit on the page and has to be broken off.  Without the following
   5232   % penalty the page builder will not be exercised until \eject
   5233   % below, and by that time we'll already have changed the output
   5234   % routine to the \balancecolumns version, so the next-to-last
   5235   % double-column page will be processed with \balancecolumns, which
   5236   % is wrong:  The two columns will go to the main vertical list, with
   5237   % the broken-off section in the recent contributions.  As soon as
   5238   % the output routine finishes, TeX starts reconsidering the page
   5239   % break.  The two columns and the broken-off section both fit on the
   5240   % page, because the two columns now take up only half of the page
   5241   % goal.  When TeX sees \eject from below which follows the final
   5242   % section, it invokes the new output routine that we've set after
   5243   % \balancecolumns below; \onepageout will try to fit the two columns
   5244   % and the final section into the vbox of \pageheight (see
   5245   % \pagebody), causing an overfull box.
   5246   %
   5247   % Note that glue won't work here, because glue does not exercise the
   5248   % page builder, unlike penalties (see The TeXbook, pp. 280-281).
   5249   \penalty0
   5250   %
   5251   \output = {%
   5252     % Split the last of the double-column material.  Leave it on the
   5253     % current page, no automatic page break.
   5254     \balancecolumns
   5255     %
   5256     % If we end up splitting too much material for the current page,
   5257     % though, there will be another page break right after this \output
   5258     % invocation ends.  Having called \balancecolumns once, we do not
   5259     % want to call it again.  Therefore, reset \output to its normal
   5260     % definition right away.  (We hope \balancecolumns will never be
   5261     % called on to balance too much material, but if it is, this makes
   5262     % the output somewhat more palatable.)
   5263     \global\output = {\onepageout{\pagecontents\PAGE}}%
   5264   }%
   5265   \eject
   5266   \endgroup % started in \begindoublecolumns
   5267   %
   5268   % \pagegoal was set to the doubled \vsize above, since we restarted
   5269   % the current page.  We're now back to normal single-column
   5270   % typesetting, so reset \pagegoal to the normal \vsize (after the
   5271   % \endgroup where \vsize got restored).
   5272   \pagegoal = \vsize
   5273 }
   5274 %
   5275 % Called at the end of the double column material.
   5276 \def\balancecolumns{%
   5277   \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120.
   5278   \dimen@ = \ht0
   5279   \advance\dimen@ by \topskip
   5280   \advance\dimen@ by-\baselineskip
   5281   \divide\dimen@ by 2 % target to split to
   5282   %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}%
   5283   \splittopskip = \topskip
   5284   % Loop until we get a decent breakpoint.
   5285   {%
   5286     \vbadness = 10000
   5287     \loop
   5288       \global\setbox3 = \copy0
   5289       \global\setbox1 = \vsplit3 to \dimen@
   5290     \ifdim\ht3>\dimen@
   5291       \global\advance\dimen@ by 1pt
   5292     \repeat
   5293   }%
   5294   %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}%
   5295   \setbox0=\vbox to\dimen@{\unvbox1}%
   5296   \setbox2=\vbox to\dimen@{\unvbox3}%
   5297   %
   5298   \pagesofar
   5299 }
   5300 \catcode`\@ = \other
   5301 
   5302 
   5303 \message{sectioning,}
   5304 % Chapters, sections, etc.
   5305 
   5306 % Let's start with @part.
   5307 \outer\parseargdef\part{\partzzz{#1}}
   5308 \def\partzzz#1{%
   5309   \chapoddpage
   5310   \null
   5311   \vskip.3\vsize  % move it down on the page a bit
   5312   \begingroup
   5313     \noindent \titlefonts\rmisbold #1\par % the text
   5314     \let\lastnode=\empty      % no node to associate with
   5315     \writetocentry{part}{#1}{}% but put it in the toc
   5316     \headingsoff              % no headline or footline on the part page
   5317     \chapoddpage
   5318   \endgroup
   5319 }
   5320 
   5321 % \unnumberedno is an oxymoron.  But we count the unnumbered
   5322 % sections so that we can refer to them unambiguously in the pdf
   5323 % outlines by their "section number".  We avoid collisions with chapter
   5324 % numbers by starting them at 10000.  (If a document ever has 10000
   5325 % chapters, we're in trouble anyway, I'm sure.)
   5326 \newcount\unnumberedno \unnumberedno = 10000
   5327 \newcount\chapno
   5328 \newcount\secno        \secno=0
   5329 \newcount\subsecno     \subsecno=0
   5330 \newcount\subsubsecno  \subsubsecno=0
   5331 
   5332 % This counter is funny since it counts through charcodes of letters A, B, ...
   5333 \newcount\appendixno  \appendixno = `\@
   5334 %
   5335 % \def\appendixletter{\char\the\appendixno}
   5336 % We do the following ugly conditional instead of the above simple
   5337 % construct for the sake of pdftex, which needs the actual
   5338 % letter in the expansion, not just typeset.
   5339 %
   5340 \def\appendixletter{%
   5341   \ifnum\appendixno=`A A%
   5342   \else\ifnum\appendixno=`B B%
   5343   \else\ifnum\appendixno=`C C%
   5344   \else\ifnum\appendixno=`D D%
   5345   \else\ifnum\appendixno=`E E%
   5346   \else\ifnum\appendixno=`F F%
   5347   \else\ifnum\appendixno=`G G%
   5348   \else\ifnum\appendixno=`H H%
   5349   \else\ifnum\appendixno=`I I%
   5350   \else\ifnum\appendixno=`J J%
   5351   \else\ifnum\appendixno=`K K%
   5352   \else\ifnum\appendixno=`L L%
   5353   \else\ifnum\appendixno=`M M%
   5354   \else\ifnum\appendixno=`N N%
   5355   \else\ifnum\appendixno=`O O%
   5356   \else\ifnum\appendixno=`P P%
   5357   \else\ifnum\appendixno=`Q Q%
   5358   \else\ifnum\appendixno=`R R%
   5359   \else\ifnum\appendixno=`S S%
   5360   \else\ifnum\appendixno=`T T%
   5361   \else\ifnum\appendixno=`U U%
   5362   \else\ifnum\appendixno=`V V%
   5363   \else\ifnum\appendixno=`W W%
   5364   \else\ifnum\appendixno=`X X%
   5365   \else\ifnum\appendixno=`Y Y%
   5366   \else\ifnum\appendixno=`Z Z%
   5367   % The \the is necessary, despite appearances, because \appendixletter is
   5368   % expanded while writing the .toc file.  \char\appendixno is not
   5369   % expandable, thus it is written literally, thus all appendixes come out
   5370   % with the same letter (or @) in the toc without it.
   5371   \else\char\the\appendixno
   5372   \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
   5373   \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
   5374 
   5375 % Each @chapter defines these (using marks) as the number+name, number
   5376 % and name of the chapter.  Page headings and footings can use
   5377 % these.  @section does likewise.
   5378 \def\thischapter{}
   5379 \def\thischapternum{}
   5380 \def\thischaptername{}
   5381 \def\thissection{}
   5382 \def\thissectionnum{}
   5383 \def\thissectionname{}
   5384 
   5385 \newcount\absseclevel % used to calculate proper heading level
   5386 \newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count
   5387 
   5388 % @raisesections: treat @section as chapter, @subsection as section, etc.
   5389 \def\raisesections{\global\advance\secbase by -1}
   5390 \let\up=\raisesections % original BFox name
   5391 
   5392 % @lowersections: treat @chapter as section, @section as subsection, etc.
   5393 \def\lowersections{\global\advance\secbase by 1}
   5394 \let\down=\lowersections % original BFox name
   5395 
   5396 % we only have subsub.
   5397 \chardef\maxseclevel = 3
   5398 %
   5399 % A numbered section within an unnumbered changes to unnumbered too.
   5400 % To achieve this, remember the "biggest" unnum. sec. we are currently in:
   5401 \chardef\unnlevel = \maxseclevel
   5402 %
   5403 % Trace whether the current chapter is an appendix or not:
   5404 % \chapheadtype is "N" or "A", unnumbered chapters are ignored.
   5405 \def\chapheadtype{N}
   5406 
   5407 % Choose a heading macro
   5408 % #1 is heading type
   5409 % #2 is heading level
   5410 % #3 is text for heading
   5411 \def\genhead#1#2#3{%
   5412   % Compute the abs. sec. level:
   5413   \absseclevel=#2
   5414   \advance\absseclevel by \secbase
   5415   % Make sure \absseclevel doesn't fall outside the range:
   5416   \ifnum \absseclevel < 0
   5417     \absseclevel = 0
   5418   \else
   5419     \ifnum \absseclevel > 3
   5420       \absseclevel = 3
   5421     \fi
   5422   \fi
   5423   % The heading type:
   5424   \def\headtype{#1}%
   5425   \if \headtype U%
   5426     \ifnum \absseclevel < \unnlevel
   5427       \chardef\unnlevel = \absseclevel
   5428     \fi
   5429   \else
   5430     % Check for appendix sections:
   5431     \ifnum \absseclevel = 0
   5432       \edef\chapheadtype{\headtype}%
   5433     \else
   5434       \if \headtype A\if \chapheadtype N%
   5435 	\errmessage{@appendix... within a non-appendix chapter}%
   5436       \fi\fi
   5437     \fi
   5438     % Check for numbered within unnumbered:
   5439     \ifnum \absseclevel > \unnlevel
   5440       \def\headtype{U}%
   5441     \else
   5442       \chardef\unnlevel = 3
   5443     \fi
   5444   \fi
   5445   % Now print the heading:
   5446   \if \headtype U%
   5447     \ifcase\absseclevel
   5448 	\unnumberedzzz{#3}%
   5449     \or \unnumberedseczzz{#3}%
   5450     \or \unnumberedsubseczzz{#3}%
   5451     \or \unnumberedsubsubseczzz{#3}%
   5452     \fi
   5453   \else
   5454     \if \headtype A%
   5455       \ifcase\absseclevel
   5456 	  \appendixzzz{#3}%
   5457       \or \appendixsectionzzz{#3}%
   5458       \or \appendixsubseczzz{#3}%
   5459       \or \appendixsubsubseczzz{#3}%
   5460       \fi
   5461     \else
   5462       \ifcase\absseclevel
   5463 	  \chapterzzz{#3}%
   5464       \or \seczzz{#3}%
   5465       \or \numberedsubseczzz{#3}%
   5466       \or \numberedsubsubseczzz{#3}%
   5467       \fi
   5468     \fi
   5469   \fi
   5470   \suppressfirstparagraphindent
   5471 }
   5472 
   5473 % an interface:
   5474 \def\numhead{\genhead N}
   5475 \def\apphead{\genhead A}
   5476 \def\unnmhead{\genhead U}
   5477 
   5478 % @chapter, @appendix, @unnumbered.  Increment top-level counter, reset
   5479 % all lower-level sectioning counters to zero.
   5480 %
   5481 % Also set \chaplevelprefix, which we prepend to @float sequence numbers
   5482 % (e.g., figures), q.v.  By default (before any chapter), that is empty.
   5483 \let\chaplevelprefix = \empty
   5484 %
   5485 \outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz
   5486 \def\chapterzzz#1{%
   5487   % section resetting is \global in case the chapter is in a group, such
   5488   % as an @include file.
   5489   \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
   5490     \global\advance\chapno by 1
   5491   %
   5492   % Used for \float.
   5493   \gdef\chaplevelprefix{\the\chapno.}%
   5494   \resetallfloatnos
   5495   %
   5496   % \putwordChapter can contain complex things in translations.
   5497   \toks0=\expandafter{\putwordChapter}%
   5498   \message{\the\toks0 \space \the\chapno}%
   5499   %
   5500   % Write the actual heading.
   5501   \chapmacro{#1}{Ynumbered}{\the\chapno}%
   5502   %
   5503   % So @section and the like are numbered underneath this chapter.
   5504   \global\let\section = \numberedsec
   5505   \global\let\subsection = \numberedsubsec
   5506   \global\let\subsubsection = \numberedsubsubsec
   5507 }
   5508 
   5509 \outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz
   5510 %
   5511 \def\appendixzzz#1{%
   5512   \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
   5513     \global\advance\appendixno by 1
   5514   \gdef\chaplevelprefix{\appendixletter.}%
   5515   \resetallfloatnos
   5516   %
   5517   % \putwordAppendix can contain complex things in translations.
   5518   \toks0=\expandafter{\putwordAppendix}%
   5519   \message{\the\toks0 \space \appendixletter}%
   5520   %
   5521   \chapmacro{#1}{Yappendix}{\appendixletter}%
   5522   %
   5523   \global\let\section = \appendixsec
   5524   \global\let\subsection = \appendixsubsec
   5525   \global\let\subsubsection = \appendixsubsubsec
   5526 }
   5527 
   5528 % normally unnmhead0 calls unnumberedzzz:
   5529 \outer\parseargdef\unnumbered{\unnmhead0{#1}}
   5530 \def\unnumberedzzz#1{%
   5531   \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
   5532     \global\advance\unnumberedno by 1
   5533   %
   5534   % Since an unnumbered has no number, no prefix for figures.
   5535   \global\let\chaplevelprefix = \empty
   5536   \resetallfloatnos
   5537   %
   5538   % This used to be simply \message{#1}, but TeX fully expands the
   5539   % argument to \message.  Therefore, if #1 contained @-commands, TeX
   5540   % expanded them.  For example, in `@unnumbered The @cite{Book}', TeX
   5541   % expanded @cite (which turns out to cause errors because \cite is meant
   5542   % to be executed, not expanded).
   5543   %
   5544   % Anyway, we don't want the fully-expanded definition of @cite to appear
   5545   % as a result of the \message, we just want `@cite' itself.  We use
   5546   % \the<toks register> to achieve this: TeX expands \the<toks> only once,
   5547   % simply yielding the contents of <toks register>.  (We also do this for
   5548   % the toc entries.)
   5549   \toks0 = {#1}%
   5550   \message{(\the\toks0)}%
   5551   %
   5552   \chapmacro{#1}{Ynothing}{\the\unnumberedno}%
   5553   %
   5554   \global\let\section = \unnumberedsec
   5555   \global\let\subsection = \unnumberedsubsec
   5556   \global\let\subsubsection = \unnumberedsubsubsec
   5557 }
   5558 
   5559 % @centerchap is like @unnumbered, but the heading is centered.
   5560 \outer\parseargdef\centerchap{%
   5561   % Well, we could do the following in a group, but that would break
   5562   % an assumption that \chapmacro is called at the outermost level.
   5563   % Thus we are safer this way:		--kasal, 24feb04
   5564   \let\centerparametersmaybe = \centerparameters
   5565   \unnmhead0{#1}%
   5566   \let\centerparametersmaybe = \relax
   5567 }
   5568 
   5569 % @top is like @unnumbered.
   5570 \let\top\unnumbered
   5571 
   5572 % Sections.
   5573 %
   5574 \outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz
   5575 \def\seczzz#1{%
   5576   \global\subsecno=0 \global\subsubsecno=0  \global\advance\secno by 1
   5577   \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}%
   5578 }
   5579 
   5580 % normally calls appendixsectionzzz:
   5581 \outer\parseargdef\appendixsection{\apphead1{#1}}
   5582 \def\appendixsectionzzz#1{%
   5583   \global\subsecno=0 \global\subsubsecno=0  \global\advance\secno by 1
   5584   \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}%
   5585 }
   5586 \let\appendixsec\appendixsection
   5587 
   5588 % normally calls unnumberedseczzz:
   5589 \outer\parseargdef\unnumberedsec{\unnmhead1{#1}}
   5590 \def\unnumberedseczzz#1{%
   5591   \global\subsecno=0 \global\subsubsecno=0  \global\advance\secno by 1
   5592   \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}%
   5593 }
   5594 
   5595 % Subsections.
   5596 %
   5597 % normally calls numberedsubseczzz:
   5598 \outer\parseargdef\numberedsubsec{\numhead2{#1}}
   5599 \def\numberedsubseczzz#1{%
   5600   \global\subsubsecno=0  \global\advance\subsecno by 1
   5601   \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}%
   5602 }
   5603 
   5604 % normally calls appendixsubseczzz:
   5605 \outer\parseargdef\appendixsubsec{\apphead2{#1}}
   5606 \def\appendixsubseczzz#1{%
   5607   \global\subsubsecno=0  \global\advance\subsecno by 1
   5608   \sectionheading{#1}{subsec}{Yappendix}%
   5609                  {\appendixletter.\the\secno.\the\subsecno}%
   5610 }
   5611 
   5612 % normally calls unnumberedsubseczzz:
   5613 \outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}}
   5614 \def\unnumberedsubseczzz#1{%
   5615   \global\subsubsecno=0  \global\advance\subsecno by 1
   5616   \sectionheading{#1}{subsec}{Ynothing}%
   5617                  {\the\unnumberedno.\the\secno.\the\subsecno}%
   5618 }
   5619 
   5620 % Subsubsections.
   5621 %
   5622 % normally numberedsubsubseczzz:
   5623 \outer\parseargdef\numberedsubsubsec{\numhead3{#1}}
   5624 \def\numberedsubsubseczzz#1{%
   5625   \global\advance\subsubsecno by 1
   5626   \sectionheading{#1}{subsubsec}{Ynumbered}%
   5627                  {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}%
   5628 }
   5629 
   5630 % normally appendixsubsubseczzz:
   5631 \outer\parseargdef\appendixsubsubsec{\apphead3{#1}}
   5632 \def\appendixsubsubseczzz#1{%
   5633   \global\advance\subsubsecno by 1
   5634   \sectionheading{#1}{subsubsec}{Yappendix}%
   5635                  {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}%
   5636 }
   5637 
   5638 % normally unnumberedsubsubseczzz:
   5639 \outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}}
   5640 \def\unnumberedsubsubseczzz#1{%
   5641   \global\advance\subsubsecno by 1
   5642   \sectionheading{#1}{subsubsec}{Ynothing}%
   5643                  {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}%
   5644 }
   5645 
   5646 % These macros control what the section commands do, according
   5647 % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
   5648 % Define them by default for a numbered chapter.
   5649 \let\section = \numberedsec
   5650 \let\subsection = \numberedsubsec
   5651 \let\subsubsection = \numberedsubsubsec
   5652 
   5653 % Define @majorheading, @heading and @subheading
   5654 
   5655 \def\majorheading{%
   5656   {\advance\chapheadingskip by 10pt \chapbreak }%
   5657   \parsearg\chapheadingzzz
   5658 }
   5659 
   5660 \def\chapheading{\chapbreak \parsearg\chapheadingzzz}
   5661 \def\chapheadingzzz#1{%
   5662   \vbox{\chapfonts \raggedtitlesettings #1\par}%
   5663   \nobreak\bigskip \nobreak
   5664   \suppressfirstparagraphindent
   5665 }
   5666 
   5667 % @heading, @subheading, @subsubheading.
   5668 \parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{}
   5669   \suppressfirstparagraphindent}
   5670 \parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{}
   5671   \suppressfirstparagraphindent}
   5672 \parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{}
   5673   \suppressfirstparagraphindent}
   5674 
   5675 % These macros generate a chapter, section, etc. heading only
   5676 % (including whitespace, linebreaking, etc. around it),
   5677 % given all the information in convenient, parsed form.
   5678 
   5679 % Args are the skip and penalty (usually negative)
   5680 \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
   5681 
   5682 % Parameter controlling skip before chapter headings (if needed)
   5683 \newskip\chapheadingskip
   5684 
   5685 % Define plain chapter starts, and page on/off switching for it.
   5686 \def\chapbreak{\dobreak \chapheadingskip {-4000}}
   5687 \def\chappager{\par\vfill\supereject}
   5688 % Because \domark is called before \chapoddpage, the filler page will
   5689 % get the headings for the next chapter, which is wrong.  But we don't
   5690 % care -- we just disable all headings on the filler page.
   5691 \def\chapoddpage{%
   5692   \chappager
   5693   \ifodd\pageno \else
   5694     \begingroup
   5695       \headingsoff
   5696       \null
   5697       \chappager
   5698     \endgroup
   5699   \fi
   5700 }
   5701 
   5702 \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
   5703 
   5704 \def\CHAPPAGoff{%
   5705 \global\let\contentsalignmacro = \chappager
   5706 \global\let\pchapsepmacro=\chapbreak
   5707 \global\let\pagealignmacro=\chappager}
   5708 
   5709 \def\CHAPPAGon{%
   5710 \global\let\contentsalignmacro = \chappager
   5711 \global\let\pchapsepmacro=\chappager
   5712 \global\let\pagealignmacro=\chappager
   5713 \global\def\HEADINGSon{\HEADINGSsingle}}
   5714 
   5715 \def\CHAPPAGodd{%
   5716 \global\let\contentsalignmacro = \chapoddpage
   5717 \global\let\pchapsepmacro=\chapoddpage
   5718 \global\let\pagealignmacro=\chapoddpage
   5719 \global\def\HEADINGSon{\HEADINGSdouble}}
   5720 
   5721 \CHAPPAGon
   5722 
   5723 % Chapter opening.
   5724 %
   5725 % #1 is the text, #2 is the section type (Ynumbered, Ynothing,
   5726 % Yappendix, Yomitfromtoc), #3 the chapter number.
   5727 %
   5728 % To test against our argument.
   5729 \def\Ynothingkeyword{Ynothing}
   5730 \def\Yomitfromtockeyword{Yomitfromtoc}
   5731 \def\Yappendixkeyword{Yappendix}
   5732 %
   5733 \def\chapmacro#1#2#3{%
   5734   % Insert the first mark before the heading break (see notes for \domark).
   5735   \let\prevchapterdefs=\lastchapterdefs
   5736   \let\prevsectiondefs=\lastsectiondefs
   5737   \gdef\lastsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}%
   5738                         \gdef\thissection{}}%
   5739   %
   5740   \def\temptype{#2}%
   5741   \ifx\temptype\Ynothingkeyword
   5742     \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
   5743                           \gdef\thischapter{\thischaptername}}%
   5744   \else\ifx\temptype\Yomitfromtockeyword
   5745     \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
   5746                           \gdef\thischapter{}}%
   5747   \else\ifx\temptype\Yappendixkeyword
   5748     \toks0={#1}%
   5749     \xdef\lastchapterdefs{%
   5750       \gdef\noexpand\thischaptername{\the\toks0}%
   5751       \gdef\noexpand\thischapternum{\appendixletter}%
   5752       % \noexpand\putwordAppendix avoids expanding indigestible
   5753       % commands in some of the translations.
   5754       \gdef\noexpand\thischapter{\noexpand\putwordAppendix{}
   5755                                  \noexpand\thischapternum:
   5756                                  \noexpand\thischaptername}%
   5757     }%
   5758   \else
   5759     \toks0={#1}%
   5760     \xdef\lastchapterdefs{%
   5761       \gdef\noexpand\thischaptername{\the\toks0}%
   5762       \gdef\noexpand\thischapternum{\the\chapno}%
   5763       % \noexpand\putwordChapter avoids expanding indigestible
   5764       % commands in some of the translations.
   5765       \gdef\noexpand\thischapter{\noexpand\putwordChapter{}
   5766                                  \noexpand\thischapternum:
   5767                                  \noexpand\thischaptername}%
   5768     }%
   5769   \fi\fi\fi
   5770   %
   5771   % Output the mark.  Pass it through \safewhatsit, to take care of
   5772   % the preceding space.
   5773   \safewhatsit\domark
   5774   %
   5775   % Insert the chapter heading break.
   5776   \pchapsepmacro
   5777   %
   5778   % Now the second mark, after the heading break.  No break points
   5779   % between here and the heading.
   5780   \let\prevchapterdefs=\lastchapterdefs
   5781   \let\prevsectiondefs=\lastsectiondefs
   5782   \domark
   5783   %
   5784   {%
   5785     \chapfonts \rmisbold
   5786     %
   5787     % Have to define \lastsection before calling \donoderef, because the
   5788     % xref code eventually uses it.  On the other hand, it has to be called
   5789     % after \pchapsepmacro, or the headline will change too soon.
   5790     \gdef\lastsection{#1}%
   5791     %
   5792     % Only insert the separating space if we have a chapter/appendix
   5793     % number, and don't print the unnumbered ``number''.
   5794     \ifx\temptype\Ynothingkeyword
   5795       \setbox0 = \hbox{}%
   5796       \def\toctype{unnchap}%
   5797     \else\ifx\temptype\Yomitfromtockeyword
   5798       \setbox0 = \hbox{}% contents like unnumbered, but no toc entry
   5799       \def\toctype{omit}%
   5800     \else\ifx\temptype\Yappendixkeyword
   5801       \setbox0 = \hbox{\putwordAppendix{} #3\enspace}%
   5802       \def\toctype{app}%
   5803     \else
   5804       \setbox0 = \hbox{#3\enspace}%
   5805       \def\toctype{numchap}%
   5806     \fi\fi\fi
   5807     %
   5808     % Write the toc entry for this chapter.  Must come before the
   5809     % \donoderef, because we include the current node name in the toc
   5810     % entry, and \donoderef resets it to empty.
   5811     \writetocentry{\toctype}{#1}{#3}%
   5812     %
   5813     % For pdftex, we have to write out the node definition (aka, make
   5814     % the pdfdest) after any page break, but before the actual text has
   5815     % been typeset.  If the destination for the pdf outline is after the
   5816     % text, then jumping from the outline may wind up with the text not
   5817     % being visible, for instance under high magnification.
   5818     \donoderef{#2}%
   5819     %
   5820     % Typeset the actual heading.
   5821     \nobreak % Avoid page breaks at the interline glue.
   5822     \vbox{\raggedtitlesettings \hangindent=\wd0 \centerparametersmaybe
   5823           \unhbox0 #1\par}%
   5824   }%
   5825   \nobreak\bigskip % no page break after a chapter title
   5826   \nobreak
   5827 }
   5828 
   5829 % @centerchap -- centered and unnumbered.
   5830 \let\centerparametersmaybe = \relax
   5831 \def\centerparameters{%
   5832   \advance\rightskip by 3\rightskip
   5833   \leftskip = \rightskip
   5834   \parfillskip = 0pt
   5835 }
   5836 
   5837 
   5838 % I don't think this chapter style is supported any more, so I'm not
   5839 % updating it with the new noderef stuff.  We'll see.  --karl, 11aug03.
   5840 %
   5841 \def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
   5842 %
   5843 \def\unnchfopen #1{%
   5844   \chapoddpage
   5845   \vbox{\chapfonts \raggedtitlesettings #1\par}%
   5846   \nobreak\bigskip\nobreak
   5847 }
   5848 \def\chfopen #1#2{\chapoddpage {\chapfonts
   5849 \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
   5850 \par\penalty 5000 %
   5851 }
   5852 \def\centerchfopen #1{%
   5853   \chapoddpage
   5854   \vbox{\chapfonts \raggedtitlesettings \hfill #1\hfill}%
   5855   \nobreak\bigskip \nobreak
   5856 }
   5857 \def\CHAPFopen{%
   5858   \global\let\chapmacro=\chfopen
   5859   \global\let\centerchapmacro=\centerchfopen}
   5860 
   5861 
   5862 % Section titles.  These macros combine the section number parts and
   5863 % call the generic \sectionheading to do the printing.
   5864 %
   5865 \newskip\secheadingskip
   5866 \def\secheadingbreak{\dobreak \secheadingskip{-1000}}
   5867 
   5868 % Subsection titles.
   5869 \newskip\subsecheadingskip
   5870 \def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}}
   5871 
   5872 % Subsubsection titles.
   5873 \def\subsubsecheadingskip{\subsecheadingskip}
   5874 \def\subsubsecheadingbreak{\subsecheadingbreak}
   5875 
   5876 
   5877 % Print any size, any type, section title.
   5878 %
   5879 % #1 is the text, #2 is the section level (sec/subsec/subsubsec), #3 is
   5880 % the section type for xrefs (Ynumbered, Ynothing, Yappendix), #4 is the
   5881 % section number.
   5882 %
   5883 \def\seckeyword{sec}
   5884 %
   5885 \def\sectionheading#1#2#3#4{%
   5886   {%
   5887     \checkenv{}% should not be in an environment.
   5888     %
   5889     % Switch to the right set of fonts.
   5890     \csname #2fonts\endcsname \rmisbold
   5891     %
   5892     \def\sectionlevel{#2}%
   5893     \def\temptype{#3}%
   5894     %
   5895     % Insert first mark before the heading break (see notes for \domark).
   5896     \let\prevsectiondefs=\lastsectiondefs
   5897     \ifx\temptype\Ynothingkeyword
   5898       \ifx\sectionlevel\seckeyword
   5899         \gdef\lastsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}%
   5900                               \gdef\thissection{\thissectionname}}%
   5901       \fi
   5902     \else\ifx\temptype\Yomitfromtockeyword
   5903       % Don't redefine \thissection.
   5904     \else\ifx\temptype\Yappendixkeyword
   5905       \ifx\sectionlevel\seckeyword
   5906         \toks0={#1}%
   5907         \xdef\lastsectiondefs{%
   5908           \gdef\noexpand\thissectionname{\the\toks0}%
   5909           \gdef\noexpand\thissectionnum{#4}%
   5910           % \noexpand\putwordSection avoids expanding indigestible
   5911           % commands in some of the translations.
   5912           \gdef\noexpand\thissection{\noexpand\putwordSection{}
   5913                                      \noexpand\thissectionnum:
   5914                                      \noexpand\thissectionname}%
   5915         }%
   5916       \fi
   5917     \else
   5918       \ifx\sectionlevel\seckeyword
   5919         \toks0={#1}%
   5920         \xdef\lastsectiondefs{%
   5921           \gdef\noexpand\thissectionname{\the\toks0}%
   5922           \gdef\noexpand\thissectionnum{#4}%
   5923           % \noexpand\putwordSection avoids expanding indigestible
   5924           % commands in some of the translations.
   5925           \gdef\noexpand\thissection{\noexpand\putwordSection{}
   5926                                      \noexpand\thissectionnum:
   5927                                      \noexpand\thissectionname}%
   5928         }%
   5929       \fi
   5930     \fi\fi\fi
   5931     %
   5932     % Go into vertical mode.  Usually we'll already be there, but we
   5933     % don't want the following whatsit to end up in a preceding paragraph
   5934     % if the document didn't happen to have a blank line.
   5935     \par
   5936     %
   5937     % Output the mark.  Pass it through \safewhatsit, to take care of
   5938     % the preceding space.
   5939     \safewhatsit\domark
   5940     %
   5941     % Insert space above the heading.
   5942     \csname #2headingbreak\endcsname
   5943     %
   5944     % Now the second mark, after the heading break.  No break points
   5945     % between here and the heading.
   5946     \global\let\prevsectiondefs=\lastsectiondefs
   5947     \domark
   5948     %
   5949     % Only insert the space after the number if we have a section number.
   5950     \ifx\temptype\Ynothingkeyword
   5951       \setbox0 = \hbox{}%
   5952       \def\toctype{unn}%
   5953       \gdef\lastsection{#1}%
   5954     \else\ifx\temptype\Yomitfromtockeyword
   5955       % for @headings -- no section number, don't include in toc,
   5956       % and don't redefine \lastsection.
   5957       \setbox0 = \hbox{}%
   5958       \def\toctype{omit}%
   5959       \let\sectionlevel=\empty
   5960     \else\ifx\temptype\Yappendixkeyword
   5961       \setbox0 = \hbox{#4\enspace}%
   5962       \def\toctype{app}%
   5963       \gdef\lastsection{#1}%
   5964     \else
   5965       \setbox0 = \hbox{#4\enspace}%
   5966       \def\toctype{num}%
   5967       \gdef\lastsection{#1}%
   5968     \fi\fi\fi
   5969     %
   5970     % Write the toc entry (before \donoderef).  See comments in \chapmacro.
   5971     \writetocentry{\toctype\sectionlevel}{#1}{#4}%
   5972     %
   5973     % Write the node reference (= pdf destination for pdftex).
   5974     % Again, see comments in \chapmacro.
   5975     \donoderef{#3}%
   5976     %
   5977     % Interline glue will be inserted when the vbox is completed.
   5978     % That glue will be a valid breakpoint for the page, since it'll be
   5979     % preceded by a whatsit (usually from the \donoderef, or from the
   5980     % \writetocentry if there was no node).  We don't want to allow that
   5981     % break, since then the whatsits could end up on page n while the
   5982     % section is on page n+1, thus toc/etc. are wrong.  Debian bug 276000.
   5983     \nobreak
   5984     %
   5985     % Output the actual section heading.
   5986     \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright
   5987           \hangindent=\wd0  % zero if no section number
   5988           \unhbox0 #1}%
   5989   }%
   5990   % Add extra space after the heading -- half of whatever came above it.
   5991   % Don't allow stretch, though.
   5992   \kern .5 \csname #2headingskip\endcsname
   5993   %
   5994   % Do not let the kern be a potential breakpoint, as it would be if it
   5995   % was followed by glue.
   5996   \nobreak
   5997   %
   5998   % We'll almost certainly start a paragraph next, so don't let that
   5999   % glue accumulate.  (Not a breakpoint because it's preceded by a
   6000   % discardable item.)  However, when a paragraph is not started next
   6001   % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out
   6002   % or the negative glue will cause weirdly wrong output, typically
   6003   % obscuring the section heading with something else.
   6004   \vskip-\parskip
   6005   %
   6006   % This is so the last item on the main vertical list is a known
   6007   % \penalty > 10000, so \startdefun, etc., can recognize the situation
   6008   % and do the needful.
   6009   \penalty 10001
   6010 }
   6011 
   6012 
   6013 \message{toc,}
   6014 % Table of contents.
   6015 \newwrite\tocfile
   6016 
   6017 % Write an entry to the toc file, opening it if necessary.
   6018 % Called from @chapter, etc.
   6019 %
   6020 % Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno}
   6021 % We append the current node name (if any) and page number as additional
   6022 % arguments for the \{chap,sec,...}entry macros which will eventually
   6023 % read this.  The node name is used in the pdf outlines as the
   6024 % destination to jump to.
   6025 %
   6026 % We open the .toc file for writing here instead of at @setfilename (or
   6027 % any other fixed time) so that @contents can be anywhere in the document.
   6028 % But if #1 is `omit', then we don't do anything.  This is used for the
   6029 % table of contents chapter openings themselves.
   6030 %
   6031 \newif\iftocfileopened
   6032 \def\omitkeyword{omit}%
   6033 %
   6034 \def\writetocentry#1#2#3{%
   6035   \edef\writetoctype{#1}%
   6036   \ifx\writetoctype\omitkeyword \else
   6037     \iftocfileopened\else
   6038       \immediate\openout\tocfile = \jobname.toc
   6039       \global\tocfileopenedtrue
   6040     \fi
   6041     %
   6042     \iflinks
   6043       {\atdummies
   6044        \edef\temp{%
   6045          \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}%
   6046        \temp
   6047       }%
   6048     \fi
   6049   \fi
   6050   %
   6051   % Tell \shipout to create a pdf destination on each page, if we're
   6052   % writing pdf.  These are used in the table of contents.  We can't
   6053   % just write one on every page because the title pages are numbered
   6054   % 1 and 2 (the page numbers aren't printed), and so are the first
   6055   % two pages of the document.  Thus, we'd have two destinations named
   6056   % `1', and two named `2'.
   6057   \ifpdf \global\pdfmakepagedesttrue \fi
   6058 }
   6059 
   6060 
   6061 % These characters do not print properly in the Computer Modern roman
   6062 % fonts, so we must take special care.  This is more or less redundant
   6063 % with the Texinfo input format setup at the end of this file.
   6064 %
   6065 \def\activecatcodes{%
   6066   \catcode`\"=\active
   6067   \catcode`\$=\active
   6068   \catcode`\<=\active
   6069   \catcode`\>=\active
   6070   \catcode`\\=\active
   6071   \catcode`\^=\active
   6072   \catcode`\_=\active
   6073   \catcode`\|=\active
   6074   \catcode`\~=\active
   6075 }
   6076 
   6077 
   6078 % Read the toc file, which is essentially Texinfo input.
   6079 \def\readtocfile{%
   6080   \setupdatafile
   6081   \activecatcodes
   6082   \input \tocreadfilename
   6083 }
   6084 
   6085 \newskip\contentsrightmargin \contentsrightmargin=1in
   6086 \newcount\savepageno
   6087 \newcount\lastnegativepageno \lastnegativepageno = -1
   6088 
   6089 % Prepare to read what we've written to \tocfile.
   6090 %
   6091 \def\startcontents#1{%
   6092   % If @setchapternewpage on, and @headings double, the contents should
   6093   % start on an odd page, unlike chapters.  Thus, we maintain
   6094   % \contentsalignmacro in parallel with \pagealignmacro.
   6095   % From: Torbjorn Granlund <tege@matematik.su.se>
   6096   \contentsalignmacro
   6097   \immediate\closeout\tocfile
   6098   %
   6099   % Don't need to put `Contents' or `Short Contents' in the headline.
   6100   % It is abundantly clear what they are.
   6101   \chapmacro{#1}{Yomitfromtoc}{}%
   6102   %
   6103   \savepageno = \pageno
   6104   \begingroup                  % Set up to handle contents files properly.
   6105     \raggedbottom              % Worry more about breakpoints than the bottom.
   6106     \advance\hsize by -\contentsrightmargin % Don't use the full line length.
   6107     %
   6108     % Roman numerals for page numbers.
   6109     \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
   6110 }
   6111 
   6112 % redefined for the two-volume lispref.  We always output on
   6113 % \jobname.toc even if this is redefined.
   6114 %
   6115 \def\tocreadfilename{\jobname.toc}
   6116 
   6117 % Normal (long) toc.
   6118 %
   6119 \def\contents{%
   6120   \startcontents{\putwordTOC}%
   6121     \openin 1 \tocreadfilename\space
   6122     \ifeof 1 \else
   6123       \readtocfile
   6124     \fi
   6125     \vfill \eject
   6126     \contentsalignmacro % in case @setchapternewpage odd is in effect
   6127     \ifeof 1 \else
   6128       \pdfmakeoutlines
   6129     \fi
   6130     \closein 1
   6131   \endgroup
   6132   \lastnegativepageno = \pageno
   6133   \global\pageno = \savepageno
   6134 }
   6135 
   6136 % And just the chapters.
   6137 \def\summarycontents{%
   6138   \startcontents{\putwordShortTOC}%
   6139     %
   6140     \let\partentry = \shortpartentry
   6141     \let\numchapentry = \shortchapentry
   6142     \let\appentry = \shortchapentry
   6143     \let\unnchapentry = \shortunnchapentry
   6144     % We want a true roman here for the page numbers.
   6145     \secfonts
   6146     \let\rm=\shortcontrm \let\bf=\shortcontbf
   6147     \let\sl=\shortcontsl \let\tt=\shortconttt
   6148     \rm
   6149     \hyphenpenalty = 10000
   6150     \advance\baselineskip by 1pt % Open it up a little.
   6151     \def\numsecentry##1##2##3##4{}
   6152     \let\appsecentry = \numsecentry
   6153     \let\unnsecentry = \numsecentry
   6154     \let\numsubsecentry = \numsecentry
   6155     \let\appsubsecentry = \numsecentry
   6156     \let\unnsubsecentry = \numsecentry
   6157     \let\numsubsubsecentry = \numsecentry
   6158     \let\appsubsubsecentry = \numsecentry
   6159     \let\unnsubsubsecentry = \numsecentry
   6160     \openin 1 \tocreadfilename\space
   6161     \ifeof 1 \else
   6162       \readtocfile
   6163     \fi
   6164     \closein 1
   6165     \vfill \eject
   6166     \contentsalignmacro % in case @setchapternewpage odd is in effect
   6167   \endgroup
   6168   \lastnegativepageno = \pageno
   6169   \global\pageno = \savepageno
   6170 }
   6171 \let\shortcontents = \summarycontents
   6172 
   6173 % Typeset the label for a chapter or appendix for the short contents.
   6174 % The arg is, e.g., `A' for an appendix, or `3' for a chapter.
   6175 %
   6176 \def\shortchaplabel#1{%
   6177   % This space should be enough, since a single number is .5em, and the
   6178   % widest letter (M) is 1em, at least in the Computer Modern fonts.
   6179   % But use \hss just in case.
   6180   % (This space doesn't include the extra space that gets added after
   6181   % the label; that gets put in by \shortchapentry above.)
   6182   %
   6183   % We'd like to right-justify chapter numbers, but that looks strange
   6184   % with appendix letters.  And right-justifying numbers and
   6185   % left-justifying letters looks strange when there is less than 10
   6186   % chapters.  Have to read the whole toc once to know how many chapters
   6187   % there are before deciding ...
   6188   \hbox to 1em{#1\hss}%
   6189 }
   6190 
   6191 % These macros generate individual entries in the table of contents.
   6192 % The first argument is the chapter or section name.
   6193 % The last argument is the page number.
   6194 % The arguments in between are the chapter number, section number, ...
   6195 
   6196 % Parts, in the main contents.  Replace the part number, which doesn't
   6197 % exist, with an empty box.  Let's hope all the numbers have the same width.
   6198 % Also ignore the page number, which is conventionally not printed.
   6199 \def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}}
   6200 \def\partentry#1#2#3#4{\dochapentry{\numeralbox\labelspace#1}{}}
   6201 %
   6202 % Parts, in the short toc.
   6203 \def\shortpartentry#1#2#3#4{%
   6204   \penalty-300
   6205   \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip
   6206   \shortchapentry{{\bf #1}}{\numeralbox}{}{}%
   6207 }
   6208 
   6209 % Chapters, in the main contents.
   6210 \def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}}
   6211 %
   6212 % Chapters, in the short toc.
   6213 % See comments in \dochapentry re vbox and related settings.
   6214 \def\shortchapentry#1#2#3#4{%
   6215   \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}%
   6216 }
   6217 
   6218 % Appendices, in the main contents.
   6219 % Need the word Appendix, and a fixed-size box.
   6220 %
   6221 \def\appendixbox#1{%
   6222   % We use M since it's probably the widest letter.
   6223   \setbox0 = \hbox{\putwordAppendix{} M}%
   6224   \hbox to \wd0{\putwordAppendix{} #1\hss}}
   6225 %
   6226 \def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\labelspace#1}{#4}}
   6227 
   6228 % Unnumbered chapters.
   6229 \def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}}
   6230 \def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}}
   6231 
   6232 % Sections.
   6233 \def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}}
   6234 \let\appsecentry=\numsecentry
   6235 \def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}}
   6236 
   6237 % Subsections.
   6238 \def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}}
   6239 \let\appsubsecentry=\numsubsecentry
   6240 \def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}}
   6241 
   6242 % And subsubsections.
   6243 \def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}}
   6244 \let\appsubsubsecentry=\numsubsubsecentry
   6245 \def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}}
   6246 
   6247 % This parameter controls the indentation of the various levels.
   6248 % Same as \defaultparindent.
   6249 \newdimen\tocindent \tocindent = 15pt
   6250 
   6251 % Now for the actual typesetting. In all these, #1 is the text and #2 is the
   6252 % page number.
   6253 %
   6254 % If the toc has to be broken over pages, we want it to be at chapters
   6255 % if at all possible; hence the \penalty.
   6256 \def\dochapentry#1#2{%
   6257    \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
   6258    \begingroup
   6259      \chapentryfonts
   6260      \tocentry{#1}{\dopageno\bgroup#2\egroup}%
   6261    \endgroup
   6262    \nobreak\vskip .25\baselineskip plus.1\baselineskip
   6263 }
   6264 
   6265 \def\dosecentry#1#2{\begingroup
   6266   \secentryfonts \leftskip=\tocindent
   6267   \tocentry{#1}{\dopageno\bgroup#2\egroup}%
   6268 \endgroup}
   6269 
   6270 \def\dosubsecentry#1#2{\begingroup
   6271   \subsecentryfonts \leftskip=2\tocindent
   6272   \tocentry{#1}{\dopageno\bgroup#2\egroup}%
   6273 \endgroup}
   6274 
   6275 \def\dosubsubsecentry#1#2{\begingroup
   6276   \subsubsecentryfonts \leftskip=3\tocindent
   6277   \tocentry{#1}{\dopageno\bgroup#2\egroup}%
   6278 \endgroup}
   6279 
   6280 % We use the same \entry macro as for the index entries.
   6281 \let\tocentry = \entry
   6282 
   6283 % Space between chapter (or whatever) number and the title.
   6284 \def\labelspace{\hskip1em \relax}
   6285 
   6286 \def\dopageno#1{{\rm #1}}
   6287 \def\doshortpageno#1{{\rm #1}}
   6288 
   6289 \def\chapentryfonts{\secfonts \rm}
   6290 \def\secentryfonts{\textfonts}
   6291 \def\subsecentryfonts{\textfonts}
   6292 \def\subsubsecentryfonts{\textfonts}
   6293 
   6294 
   6295 \message{environments,}
   6296 % @foo ... @end foo.
   6297 
   6298 % @tex ... @end tex    escapes into raw TeX temporarily.
   6299 % One exception: @ is still an escape character, so that @end tex works.
   6300 % But \@ or @@ will get a plain @ character.
   6301 
   6302 \envdef\tex{%
   6303   \setupmarkupstyle{tex}%
   6304   \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
   6305   \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
   6306   \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
   6307   \catcode `\%=14
   6308   \catcode `\+=\other
   6309   \catcode `\"=\other
   6310   \catcode `\|=\other
   6311   \catcode `\<=\other
   6312   \catcode `\>=\other
   6313   \catcode `\`=\other
   6314   \catcode `\'=\other
   6315   \escapechar=`\\
   6316   %
   6317   % ' is active in math mode (mathcode"8000).  So reset it, and all our
   6318   % other math active characters (just in case), to plain's definitions.
   6319   \mathactive
   6320   %
   6321   \let\b=\ptexb
   6322   \let\bullet=\ptexbullet
   6323   \let\c=\ptexc
   6324   \let\,=\ptexcomma
   6325   \let\.=\ptexdot
   6326   \let\dots=\ptexdots
   6327   \let\equiv=\ptexequiv
   6328   \let\!=\ptexexclam
   6329   \let\i=\ptexi
   6330   \let\indent=\ptexindent
   6331   \let\noindent=\ptexnoindent
   6332   \let\{=\ptexlbrace
   6333   \let\+=\tabalign
   6334   \let\}=\ptexrbrace
   6335   \let\/=\ptexslash
   6336   \let\*=\ptexstar
   6337   \let\t=\ptext
   6338   \expandafter \let\csname top\endcsname=\ptextop  % we've made it outer
   6339   \let\frenchspacing=\plainfrenchspacing
   6340   %
   6341   \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
   6342   \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
   6343   \def\@{@}%
   6344 }
   6345 % There is no need to define \Etex.
   6346 
   6347 % Define @lisp ... @end lisp.
   6348 % @lisp environment forms a group so it can rebind things,
   6349 % including the definition of @end lisp (which normally is erroneous).
   6350 
   6351 % Amount to narrow the margins by for @lisp.
   6352 \newskip\lispnarrowing \lispnarrowing=0.4in
   6353 
   6354 % This is the definition that ^^M gets inside @lisp, @example, and other
   6355 % such environments.  \null is better than a space, since it doesn't
   6356 % have any width.
   6357 \def\lisppar{\null\endgraf}
   6358 
   6359 % This space is always present above and below environments.
   6360 \newskip\envskipamount \envskipamount = 0pt
   6361 
   6362 % Make spacing and below environment symmetrical.  We use \parskip here
   6363 % to help in doing that, since in @example-like environments \parskip
   6364 % is reset to zero; thus the \afterenvbreak inserts no space -- but the
   6365 % start of the next paragraph will insert \parskip.
   6366 %
   6367 \def\aboveenvbreak{{%
   6368   % =10000 instead of <10000 because of a special case in \itemzzz and
   6369   % \sectionheading, q.v.
   6370   \ifnum \lastpenalty=10000 \else
   6371     \advance\envskipamount by \parskip
   6372     \endgraf
   6373     \ifdim\lastskip<\envskipamount
   6374       \removelastskip
   6375       % it's not a good place to break if the last penalty was \nobreak
   6376       % or better ...
   6377       \ifnum\lastpenalty<10000 \penalty-50 \fi
   6378       \vskip\envskipamount
   6379     \fi
   6380   \fi
   6381 }}
   6382 
   6383 \let\afterenvbreak = \aboveenvbreak
   6384 
   6385 % \nonarrowing is a flag.  If "set", @lisp etc don't narrow margins; it will
   6386 % also clear it, so that its embedded environments do the narrowing again.
   6387 \let\nonarrowing=\relax
   6388 
   6389 % @cartouche ... @end cartouche: draw rectangle w/rounded corners around
   6390 % environment contents.
   6391 \font\circle=lcircle10
   6392 \newdimen\circthick
   6393 \newdimen\cartouter\newdimen\cartinner
   6394 \newskip\normbskip\newskip\normpskip\newskip\normlskip
   6395 \circthick=\fontdimen8\circle
   6396 %
   6397 \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
   6398 \def\ctr{{\hskip 6pt\circle\char'010}}
   6399 \def\cbl{{\circle\char'012\hskip -6pt}}
   6400 \def\cbr{{\hskip 6pt\circle\char'011}}
   6401 \def\carttop{\hbox to \cartouter{\hskip\lskip
   6402         \ctl\leaders\hrule height\circthick\hfil\ctr
   6403         \hskip\rskip}}
   6404 \def\cartbot{\hbox to \cartouter{\hskip\lskip
   6405         \cbl\leaders\hrule height\circthick\hfil\cbr
   6406         \hskip\rskip}}
   6407 %
   6408 \newskip\lskip\newskip\rskip
   6409 
   6410 \envdef\cartouche{%
   6411   \ifhmode\par\fi  % can't be in the midst of a paragraph.
   6412   \startsavinginserts
   6413   \lskip=\leftskip \rskip=\rightskip
   6414   \leftskip=0pt\rightskip=0pt % we want these *outside*.
   6415   \cartinner=\hsize \advance\cartinner by-\lskip
   6416   \advance\cartinner by-\rskip
   6417   \cartouter=\hsize
   6418   \advance\cartouter by 18.4pt	% allow for 3pt kerns on either
   6419 				% side, and for 6pt waste from
   6420 				% each corner char, and rule thickness
   6421   \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
   6422   % Flag to tell @lisp, etc., not to narrow margin.
   6423   \let\nonarrowing = t%
   6424   %
   6425   % If this cartouche directly follows a sectioning command, we need the
   6426   % \parskip glue (backspaced over by default) or the cartouche can
   6427   % collide with the section heading.
   6428   \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi
   6429   %
   6430   \vbox\bgroup
   6431       \baselineskip=0pt\parskip=0pt\lineskip=0pt
   6432       \carttop
   6433       \hbox\bgroup
   6434 	  \hskip\lskip
   6435 	  \vrule\kern3pt
   6436 	  \vbox\bgroup
   6437 	      \kern3pt
   6438 	      \hsize=\cartinner
   6439 	      \baselineskip=\normbskip
   6440 	      \lineskip=\normlskip
   6441 	      \parskip=\normpskip
   6442 	      \vskip -\parskip
   6443 	      \comment % For explanation, see the end of def\group.
   6444 }
   6445 \def\Ecartouche{%
   6446               \ifhmode\par\fi
   6447 	      \kern3pt
   6448 	  \egroup
   6449 	  \kern3pt\vrule
   6450 	  \hskip\rskip
   6451       \egroup
   6452       \cartbot
   6453   \egroup
   6454   \checkinserts
   6455 }
   6456 
   6457 
   6458 % This macro is called at the beginning of all the @example variants,
   6459 % inside a group.
   6460 \newdimen\nonfillparindent
   6461 \def\nonfillstart{%
   6462   \aboveenvbreak
   6463   \ifdim\hfuzz < 12pt \hfuzz = 12pt \fi % Don't be fussy
   6464   \sepspaces % Make spaces be word-separators rather than space tokens.
   6465   \let\par = \lisppar % don't ignore blank lines
   6466   \obeylines % each line of input is a line of output
   6467   \parskip = 0pt
   6468   % Turn off paragraph indentation but redefine \indent to emulate
   6469   % the normal \indent.
   6470   \nonfillparindent=\parindent
   6471   \parindent = 0pt
   6472   \let\indent\nonfillindent
   6473   %
   6474   \emergencystretch = 0pt % don't try to avoid overfull boxes
   6475   \ifx\nonarrowing\relax
   6476     \advance \leftskip by \lispnarrowing
   6477     \exdentamount=\lispnarrowing
   6478   \else
   6479     \let\nonarrowing = \relax
   6480   \fi
   6481   \let\exdent=\nofillexdent
   6482 }
   6483 
   6484 \begingroup
   6485 \obeyspaces
   6486 % We want to swallow spaces (but not other tokens) after the fake
   6487 % @indent in our nonfill-environments, where spaces are normally
   6488 % active and set to @tie, resulting in them not being ignored after
   6489 % @indent.
   6490 \gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}%
   6491 \gdef\nonfillindentcheck{%
   6492 \ifx\temp %
   6493 \expandafter\nonfillindentgobble%
   6494 \else%
   6495 \leavevmode\nonfillindentbox%
   6496 \fi%
   6497 }%
   6498 \endgroup
   6499 \def\nonfillindentgobble#1{\nonfillindent}
   6500 \def\nonfillindentbox{\hbox to \nonfillparindent{\hss}}
   6501 
   6502 % If you want all examples etc. small: @set dispenvsize small.
   6503 % If you want even small examples the full size: @set dispenvsize nosmall.
   6504 % This affects the following displayed environments:
   6505 %    @example, @display, @format, @lisp
   6506 %
   6507 \def\smallword{small}
   6508 \def\nosmallword{nosmall}
   6509 \let\SETdispenvsize\relax
   6510 \def\setnormaldispenv{%
   6511   \ifx\SETdispenvsize\smallword
   6512     % end paragraph for sake of leading, in case document has no blank
   6513     % line.  This is redundant with what happens in \aboveenvbreak, but
   6514     % we need to do it before changing the fonts, and it's inconvenient
   6515     % to change the fonts afterward.
   6516     \ifnum \lastpenalty=10000 \else \endgraf \fi
   6517     \smallexamplefonts \rm
   6518   \fi
   6519 }
   6520 \def\setsmalldispenv{%
   6521   \ifx\SETdispenvsize\nosmallword
   6522   \else
   6523     \ifnum \lastpenalty=10000 \else \endgraf \fi
   6524     \smallexamplefonts \rm
   6525   \fi
   6526 }
   6527 
   6528 % We often define two environments, @foo and @smallfoo.
   6529 % Let's do it in one command.  #1 is the env name, #2 the definition.
   6530 \def\makedispenvdef#1#2{%
   6531   \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}%
   6532   \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}%
   6533   \expandafter\let\csname E#1\endcsname \afterenvbreak
   6534   \expandafter\let\csname Esmall#1\endcsname \afterenvbreak
   6535 }
   6536 
   6537 % Define two environment synonyms (#1 and #2) for an environment.
   6538 \def\maketwodispenvdef#1#2#3{%
   6539   \makedispenvdef{#1}{#3}%
   6540   \makedispenvdef{#2}{#3}%
   6541 }
   6542 %
   6543 % @lisp: indented, narrowed, typewriter font;
   6544 % @example: same as @lisp.
   6545 %
   6546 % @smallexample and @smalllisp: use smaller fonts.
   6547 % Originally contributed by Pavel@xerox.
   6548 %
   6549 \maketwodispenvdef{lisp}{example}{%
   6550   \nonfillstart
   6551   \tt\setupmarkupstyle{example}%
   6552   \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
   6553   \gobble % eat return
   6554 }
   6555 % @display/@smalldisplay: same as @lisp except keep current font.
   6556 %
   6557 \makedispenvdef{display}{%
   6558   \nonfillstart
   6559   \gobble
   6560 }
   6561 
   6562 % @format/@smallformat: same as @display except don't narrow margins.
   6563 %
   6564 \makedispenvdef{format}{%
   6565   \let\nonarrowing = t%
   6566   \nonfillstart
   6567   \gobble
   6568 }
   6569 
   6570 % @flushleft: same as @format, but doesn't obey \SETdispenvsize.
   6571 \envdef\flushleft{%
   6572   \let\nonarrowing = t%
   6573   \nonfillstart
   6574   \gobble
   6575 }
   6576 \let\Eflushleft = \afterenvbreak
   6577 
   6578 % @flushright.
   6579 %
   6580 \envdef\flushright{%
   6581   \let\nonarrowing = t%
   6582   \nonfillstart
   6583   \advance\leftskip by 0pt plus 1fill\relax
   6584   \gobble
   6585 }
   6586 \let\Eflushright = \afterenvbreak
   6587 
   6588 
   6589 % @raggedright does more-or-less normal line breaking but no right
   6590 % justification.  From plain.tex.
   6591 \envdef\raggedright{%
   6592   \rightskip0pt plus2em \spaceskip.3333em \xspaceskip.5em\relax
   6593 }
   6594 \let\Eraggedright\par
   6595 
   6596 \envdef\raggedleft{%
   6597   \parindent=0pt \leftskip0pt plus2em
   6598   \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
   6599   \hbadness=10000 % Last line will usually be underfull, so turn off
   6600                   % badness reporting.
   6601 }
   6602 \let\Eraggedleft\par
   6603 
   6604 \envdef\raggedcenter{%
   6605   \parindent=0pt \rightskip0pt plus1em \leftskip0pt plus1em
   6606   \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
   6607   \hbadness=10000 % Last line will usually be underfull, so turn off
   6608                   % badness reporting.
   6609 }
   6610 \let\Eraggedcenter\par
   6611 
   6612 
   6613 % @quotation does normal linebreaking (hence we can't use \nonfillstart)
   6614 % and narrows the margins.  We keep \parskip nonzero in general, since
   6615 % we're doing normal filling.  So, when using \aboveenvbreak and
   6616 % \afterenvbreak, temporarily make \parskip 0.
   6617 %
   6618 \makedispenvdef{quotation}{\quotationstart}
   6619 %
   6620 \def\quotationstart{%
   6621   \indentedblockstart % same as \indentedblock, but increase right margin too.
   6622   \ifx\nonarrowing\relax
   6623     \advance\rightskip by \lispnarrowing
   6624   \fi
   6625   \parsearg\quotationlabel
   6626 }
   6627 
   6628 % We have retained a nonzero parskip for the environment, since we're
   6629 % doing normal filling.
   6630 %
   6631 \def\Equotation{%
   6632   \par
   6633   \ifx\quotationauthor\thisisundefined\else
   6634     % indent a bit.
   6635     \leftline{\kern 2\leftskip \sl ---\quotationauthor}%
   6636   \fi
   6637   {\parskip=0pt \afterenvbreak}%
   6638 }
   6639 \def\Esmallquotation{\Equotation}
   6640 
   6641 % If we're given an argument, typeset it in bold with a colon after.
   6642 \def\quotationlabel#1{%
   6643   \def\temp{#1}%
   6644   \ifx\temp\empty \else
   6645     {\bf #1: }%
   6646   \fi
   6647 }
   6648 
   6649 % @indentedblock is like @quotation, but indents only on the left and
   6650 % has no optional argument.
   6651 %
   6652 \makedispenvdef{indentedblock}{\indentedblockstart}
   6653 %
   6654 \def\indentedblockstart{%
   6655   {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
   6656   \parindent=0pt
   6657   %
   6658   % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
   6659   \ifx\nonarrowing\relax
   6660     \advance\leftskip by \lispnarrowing
   6661     \exdentamount = \lispnarrowing
   6662   \else
   6663     \let\nonarrowing = \relax
   6664   \fi
   6665 }
   6666 
   6667 % Keep a nonzero parskip for the environment, since we're doing normal filling.
   6668 %
   6669 \def\Eindentedblock{%
   6670   \par
   6671   {\parskip=0pt \afterenvbreak}%
   6672 }
   6673 \def\Esmallindentedblock{\Eindentedblock}
   6674 
   6675 
   6676 % LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
   6677 % If we want to allow any <char> as delimiter,
   6678 % we need the curly braces so that makeinfo sees the @verb command, eg:
   6679 % `@verbx...x' would look like the '@verbx' command.  --janneke@gnu.org
   6680 %
   6681 % [Knuth]: Donald Ervin Knuth, 1996.  The TeXbook.
   6682 %
   6683 % [Knuth] p.344; only we need to do the other characters Texinfo sets
   6684 % active too.  Otherwise, they get lost as the first character on a
   6685 % verbatim line.
   6686 \def\dospecials{%
   6687   \do\ \do\\\do\{\do\}\do\$\do\&%
   6688   \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~%
   6689   \do\<\do\>\do\|\do\@\do+\do\"%
   6690   % Don't do the quotes -- if we do, @set txicodequoteundirected and
   6691   % @set txicodequotebacktick will not have effect on @verb and
   6692   % @verbatim, and ?` and !` ligatures won't get disabled.
   6693   %\do\`\do\'%
   6694 }
   6695 %
   6696 % [Knuth] p. 380
   6697 \def\uncatcodespecials{%
   6698   \def\do##1{\catcode`##1=\other}\dospecials}
   6699 %
   6700 % Setup for the @verb command.
   6701 %
   6702 % Eight spaces for a tab
   6703 \begingroup
   6704   \catcode`\^^I=\active
   6705   \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
   6706 \endgroup
   6707 %
   6708 \def\setupverb{%
   6709   \tt  % easiest (and conventionally used) font for verbatim
   6710   \def\par{\leavevmode\endgraf}%
   6711   \setupmarkupstyle{verb}%
   6712   \tabeightspaces
   6713   % Respect line breaks,
   6714   % print special symbols as themselves, and
   6715   % make each space count
   6716   % must do in this order:
   6717   \obeylines \uncatcodespecials \sepspaces
   6718 }
   6719 
   6720 % Setup for the @verbatim environment
   6721 %
   6722 % Real tab expansion.
   6723 \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
   6724 %
   6725 % We typeset each line of the verbatim in an \hbox, so we can handle
   6726 % tabs.  The \global is in case the verbatim line starts with an accent,
   6727 % or some other command that starts with a begin-group.  Otherwise, the
   6728 % entire \verbbox would disappear at the corresponding end-group, before
   6729 % it is typeset.  Meanwhile, we can't have nested verbatim commands
   6730 % (can we?), so the \global won't be overwriting itself.
   6731 \newbox\verbbox
   6732 \def\starttabbox{\global\setbox\verbbox=\hbox\bgroup}
   6733 %
   6734 \begingroup
   6735   \catcode`\^^I=\active
   6736   \gdef\tabexpand{%
   6737     \catcode`\^^I=\active
   6738     \def^^I{\leavevmode\egroup
   6739       \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab
   6740       \divide\dimen\verbbox by\tabw
   6741       \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw
   6742       \advance\dimen\verbbox by\tabw  % advance to next multiple of \tabw
   6743       \wd\verbbox=\dimen\verbbox \box\verbbox \starttabbox
   6744     }%
   6745   }
   6746 \endgroup
   6747 
   6748 % start the verbatim environment.
   6749 \def\setupverbatim{%
   6750   \let\nonarrowing = t%
   6751   \nonfillstart
   6752   \tt % easiest (and conventionally used) font for verbatim
   6753   % The \leavevmode here is for blank lines.  Otherwise, we would
   6754   % never \starttabox and the \egroup would end verbatim mode.
   6755   \def\par{\leavevmode\egroup\box\verbbox\endgraf}%
   6756   \tabexpand
   6757   \setupmarkupstyle{verbatim}%
   6758   % Respect line breaks,
   6759   % print special symbols as themselves, and
   6760   % make each space count.
   6761   % Must do in this order:
   6762   \obeylines \uncatcodespecials \sepspaces
   6763   \everypar{\starttabbox}%
   6764 }
   6765 
   6766 % Do the @verb magic: verbatim text is quoted by unique
   6767 % delimiter characters.  Before first delimiter expect a
   6768 % right brace, after last delimiter expect closing brace:
   6769 %
   6770 %    \def\doverb'{'<char>#1<char>'}'{#1}
   6771 %
   6772 % [Knuth] p. 382; only eat outer {}
   6773 \begingroup
   6774   \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other
   6775   \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
   6776 \endgroup
   6777 %
   6778 \def\verb{\begingroup\setupverb\doverb}
   6779 %
   6780 %
   6781 % Do the @verbatim magic: define the macro \doverbatim so that
   6782 % the (first) argument ends when '@end verbatim' is reached, ie:
   6783 %
   6784 %     \def\doverbatim#1@end verbatim{#1}
   6785 %
   6786 % For Texinfo it's a lot easier than for LaTeX,
   6787 % because texinfo's \verbatim doesn't stop at '\end{verbatim}':
   6788 % we need not redefine '\', '{' and '}'.
   6789 %
   6790 % Inspired by LaTeX's verbatim command set [latex.ltx]
   6791 %
   6792 \begingroup
   6793   \catcode`\ =\active
   6794   \obeylines %
   6795   % ignore everything up to the first ^^M, that's the newline at the end
   6796   % of the @verbatim input line itself.  Otherwise we get an extra blank
   6797   % line in the output.
   6798   \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}%
   6799   % We really want {...\end verbatim} in the body of the macro, but
   6800   % without the active space; thus we have to use \xdef and \gobble.
   6801 \endgroup
   6802 %
   6803 \envdef\verbatim{%
   6804     \setupverbatim\doverbatim
   6805 }
   6806 \let\Everbatim = \afterenvbreak
   6807 
   6808 
   6809 % @verbatiminclude FILE - insert text of file in verbatim environment.
   6810 %
   6811 \def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude}
   6812 %
   6813 \def\doverbatiminclude#1{%
   6814   {%
   6815     \makevalueexpandable
   6816     \setupverbatim
   6817     \indexnofonts       % Allow `@@' and other weird things in file names.
   6818     \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}%
   6819     \input #1
   6820     \afterenvbreak
   6821   }%
   6822 }
   6823 
   6824 % @copying ... @end copying.
   6825 % Save the text away for @insertcopying later.
   6826 %
   6827 % We save the uninterpreted tokens, rather than creating a box.
   6828 % Saving the text in a box would be much easier, but then all the
   6829 % typesetting commands (@smallbook, font changes, etc.) have to be done
   6830 % beforehand -- and a) we want @copying to be done first in the source
   6831 % file; b) letting users define the frontmatter in as flexible order as
   6832 % possible is very desirable.
   6833 %
   6834 \def\copying{\checkenv{}\begingroup\scanargctxt\docopying}
   6835 \def\docopying#1@end copying{\endgroup\def\copyingtext{#1}}
   6836 %
   6837 \def\insertcopying{%
   6838   \begingroup
   6839     \parindent = 0pt  % paragraph indentation looks wrong on title page
   6840     \scanexp\copyingtext
   6841   \endgroup
   6842 }
   6843 
   6844 
   6845 \message{defuns,}
   6846 % @defun etc.
   6847 
   6848 \newskip\defbodyindent \defbodyindent=.4in
   6849 \newskip\defargsindent \defargsindent=50pt
   6850 \newskip\deflastargmargin \deflastargmargin=18pt
   6851 \newcount\defunpenalty
   6852 
   6853 % Start the processing of @deffn:
   6854 \def\startdefun{%
   6855   \ifnum\lastpenalty<10000
   6856     \medbreak
   6857     \defunpenalty=10003 % Will keep this @deffn together with the
   6858                         % following @def command, see below.
   6859   \else
   6860     % If there are two @def commands in a row, we'll have a \nobreak,
   6861     % which is there to keep the function description together with its
   6862     % header.  But if there's nothing but headers, we need to allow a
   6863     % break somewhere.  Check specifically for penalty 10002, inserted
   6864     % by \printdefunline, instead of 10000, since the sectioning
   6865     % commands also insert a nobreak penalty, and we don't want to allow
   6866     % a break between a section heading and a defun.
   6867     %
   6868     % As a further refinement, we avoid "club" headers by signalling
   6869     % with penalty of 10003 after the very first @deffn in the
   6870     % sequence (see above), and penalty of 10002 after any following
   6871     % @def command.
   6872     \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi
   6873     %
   6874     % Similarly, after a section heading, do not allow a break.
   6875     % But do insert the glue.
   6876     \medskip  % preceded by discardable penalty, so not a breakpoint
   6877   \fi
   6878   %
   6879   \parindent=0in
   6880   \advance\leftskip by \defbodyindent
   6881   \exdentamount=\defbodyindent
   6882 }
   6883 
   6884 \def\dodefunx#1{%
   6885   % First, check whether we are in the right environment:
   6886   \checkenv#1%
   6887   %
   6888   % As above, allow line break if we have multiple x headers in a row.
   6889   % It's not a great place, though.
   6890   \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi
   6891   %
   6892   % And now, it's time to reuse the body of the original defun:
   6893   \expandafter\gobbledefun#1%
   6894 }
   6895 \def\gobbledefun#1\startdefun{}
   6896 
   6897 % \printdefunline \deffnheader{text}
   6898 %
   6899 \def\printdefunline#1#2{%
   6900   \begingroup
   6901     % call \deffnheader:
   6902     #1#2 \endheader
   6903     % common ending:
   6904     \interlinepenalty = 10000
   6905     \advance\rightskip by 0pt plus 1fil\relax
   6906     \endgraf
   6907     \nobreak\vskip -\parskip
   6908     \penalty\defunpenalty  % signal to \startdefun and \dodefunx
   6909     % Some of the @defun-type tags do not enable magic parentheses,
   6910     % rendering the following check redundant.  But we don't optimize.
   6911     \checkparencounts
   6912   \endgroup
   6913 }
   6914 
   6915 \def\Edefun{\endgraf\medbreak}
   6916 
   6917 % \makedefun{deffn} creates \deffn, \deffnx and \Edeffn;
   6918 % the only thing remaining is to define \deffnheader.
   6919 %
   6920 \def\makedefun#1{%
   6921   \expandafter\let\csname E#1\endcsname = \Edefun
   6922   \edef\temp{\noexpand\domakedefun
   6923     \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}%
   6924   \temp
   6925 }
   6926 
   6927 % \domakedefun \deffn \deffnx \deffnheader
   6928 %
   6929 % Define \deffn and \deffnx, without parameters.
   6930 % \deffnheader has to be defined explicitly.
   6931 %
   6932 \def\domakedefun#1#2#3{%
   6933   \envdef#1{%
   6934     \startdefun
   6935     \doingtypefnfalse    % distinguish typed functions from all else
   6936     \parseargusing\activeparens{\printdefunline#3}%
   6937   }%
   6938   \def#2{\dodefunx#1}%
   6939   \def#3%
   6940 }
   6941 
   6942 \newif\ifdoingtypefn       % doing typed function?
   6943 \newif\ifrettypeownline    % typeset return type on its own line?
   6944 
   6945 % @deftypefnnewline on|off says whether the return type of typed functions
   6946 % are printed on their own line.  This affects @deftypefn, @deftypefun,
   6947 % @deftypeop, and @deftypemethod.
   6948 %
   6949 \parseargdef\deftypefnnewline{%
   6950   \def\temp{#1}%
   6951   \ifx\temp\onword
   6952     \expandafter\let\csname SETtxideftypefnnl\endcsname
   6953       = \empty
   6954   \else\ifx\temp\offword
   6955     \expandafter\let\csname SETtxideftypefnnl\endcsname
   6956       = \relax
   6957   \else
   6958     \errhelp = \EMsimple
   6959     \errmessage{Unknown @txideftypefnnl value `\temp',
   6960                 must be on|off}%
   6961   \fi\fi
   6962 }
   6963 
   6964 % Untyped functions:
   6965 
   6966 % @deffn category name args
   6967 \makedefun{deffn}{\deffngeneral{}}
   6968 
   6969 % @deffn category class name args
   6970 \makedefun{defop}#1 {\defopon{#1\ \putwordon}}
   6971 
   6972 % \defopon {category on}class name args
   6973 \def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
   6974 
   6975 % \deffngeneral {subind}category name args
   6976 %
   6977 \def\deffngeneral#1#2 #3 #4\endheader{%
   6978   % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}.
   6979   \dosubind{fn}{\code{#3}}{#1}%
   6980   \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}%
   6981 }
   6982 
   6983 % Typed functions:
   6984 
   6985 % @deftypefn category type name args
   6986 \makedefun{deftypefn}{\deftypefngeneral{}}
   6987 
   6988 % @deftypeop category class type name args
   6989 \makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}}
   6990 
   6991 % \deftypeopon {category on}class type name args
   6992 \def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
   6993 
   6994 % \deftypefngeneral {subind}category type name args
   6995 %
   6996 \def\deftypefngeneral#1#2 #3 #4 #5\endheader{%
   6997   \dosubind{fn}{\code{#4}}{#1}%
   6998   \doingtypefntrue
   6999   \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
   7000 }
   7001 
   7002 % Typed variables:
   7003 
   7004 % @deftypevr category type var args
   7005 \makedefun{deftypevr}{\deftypecvgeneral{}}
   7006 
   7007 % @deftypecv category class type var args
   7008 \makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}}
   7009 
   7010 % \deftypecvof {category of}class type var args
   7011 \def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} }
   7012 
   7013 % \deftypecvgeneral {subind}category type var args
   7014 %
   7015 \def\deftypecvgeneral#1#2 #3 #4 #5\endheader{%
   7016   \dosubind{vr}{\code{#4}}{#1}%
   7017   \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
   7018 }
   7019 
   7020 % Untyped variables:
   7021 
   7022 % @defvr category var args
   7023 \makedefun{defvr}#1 {\deftypevrheader{#1} {} }
   7024 
   7025 % @defcv category class var args
   7026 \makedefun{defcv}#1 {\defcvof{#1\ \putwordof}}
   7027 
   7028 % \defcvof {category of}class var args
   7029 \def\defcvof#1#2 {\deftypecvof{#1}#2 {} }
   7030 
   7031 % Types:
   7032 
   7033 % @deftp category name args
   7034 \makedefun{deftp}#1 #2 #3\endheader{%
   7035   \doind{tp}{\code{#2}}%
   7036   \defname{#1}{}{#2}\defunargs{#3\unskip}%
   7037 }
   7038 
   7039 % Remaining @defun-like shortcuts:
   7040 \makedefun{defun}{\deffnheader{\putwordDeffunc} }
   7041 \makedefun{defmac}{\deffnheader{\putwordDefmac} }
   7042 \makedefun{defspec}{\deffnheader{\putwordDefspec} }
   7043 \makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} }
   7044 \makedefun{defvar}{\defvrheader{\putwordDefvar} }
   7045 \makedefun{defopt}{\defvrheader{\putwordDefopt} }
   7046 \makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} }
   7047 \makedefun{defmethod}{\defopon\putwordMethodon}
   7048 \makedefun{deftypemethod}{\deftypeopon\putwordMethodon}
   7049 \makedefun{defivar}{\defcvof\putwordInstanceVariableof}
   7050 \makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof}
   7051 
   7052 % \defname, which formats the name of the @def (not the args).
   7053 % #1 is the category, such as "Function".
   7054 % #2 is the return type, if any.
   7055 % #3 is the function name.
   7056 %
   7057 % We are followed by (but not passed) the arguments, if any.
   7058 %
   7059 \def\defname#1#2#3{%
   7060   \par
   7061   % Get the values of \leftskip and \rightskip as they were outside the @def...
   7062   \advance\leftskip by -\defbodyindent
   7063   %
   7064   % Determine if we are typesetting the return type of a typed function
   7065   % on a line by itself.
   7066   \rettypeownlinefalse
   7067   \ifdoingtypefn  % doing a typed function specifically?
   7068     % then check user option for putting return type on its own line:
   7069     \expandafter\ifx\csname SETtxideftypefnnl\endcsname\relax \else
   7070       \rettypeownlinetrue
   7071     \fi
   7072   \fi
   7073   %
   7074   % How we'll format the category name.  Putting it in brackets helps
   7075   % distinguish it from the body text that may end up on the next line
   7076   % just below it.
   7077   \def\temp{#1}%
   7078   \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi}
   7079   %
   7080   % Figure out line sizes for the paragraph shape.  We'll always have at
   7081   % least two.
   7082   \tempnum = 2
   7083   %
   7084   % The first line needs space for \box0; but if \rightskip is nonzero,
   7085   % we need only space for the part of \box0 which exceeds it:
   7086   \dimen0=\hsize  \advance\dimen0 by -\wd0  \advance\dimen0 by \rightskip
   7087   %
   7088   % If doing a return type on its own line, we'll have another line.
   7089   \ifrettypeownline
   7090     \advance\tempnum by 1
   7091     \def\maybeshapeline{0in \hsize}%
   7092   \else
   7093     \def\maybeshapeline{}%
   7094   \fi
   7095   %
   7096   % The continuations:
   7097   \dimen2=\hsize  \advance\dimen2 by -\defargsindent
   7098   %
   7099   % The final paragraph shape:
   7100   \parshape \tempnum  0in \dimen0  \maybeshapeline  \defargsindent \dimen2
   7101   %
   7102   % Put the category name at the right margin.
   7103   \noindent
   7104   \hbox to 0pt{%
   7105     \hfil\box0 \kern-\hsize
   7106     % \hsize has to be shortened this way:
   7107     \kern\leftskip
   7108     % Intentionally do not respect \rightskip, since we need the space.
   7109   }%
   7110   %
   7111   % Allow all lines to be underfull without complaint:
   7112   \tolerance=10000 \hbadness=10000
   7113   \exdentamount=\defbodyindent
   7114   {%
   7115     % defun fonts. We use typewriter by default (used to be bold) because:
   7116     % . we're printing identifiers, they should be in tt in principle.
   7117     % . in languages with many accents, such as Czech or French, it's
   7118     %   common to leave accents off identifiers.  The result looks ok in
   7119     %   tt, but exceedingly strange in rm.
   7120     % . we don't want -- and --- to be treated as ligatures.
   7121     % . this still does not fix the ?` and !` ligatures, but so far no
   7122     %   one has made identifiers using them :).
   7123     \df \tt
   7124     \def\temp{#2}% text of the return type
   7125     \ifx\temp\empty\else
   7126       \tclose{\temp}% typeset the return type
   7127       \ifrettypeownline
   7128         % put return type on its own line; prohibit line break following:
   7129         \hfil\vadjust{\nobreak}\break
   7130       \else
   7131         \space  % type on same line, so just followed by a space
   7132       \fi
   7133     \fi           % no return type
   7134     #3% output function name
   7135   }%
   7136   {\rm\enskip}% hskip 0.5 em of \tenrm
   7137   %
   7138   \boldbrax
   7139   % arguments will be output next, if any.
   7140 }
   7141 
   7142 % Print arguments in slanted roman (not ttsl), inconsistently with using
   7143 % tt for the name.  This is because literal text is sometimes needed in
   7144 % the argument list (groff manual), and ttsl and tt are not very
   7145 % distinguishable.  Prevent hyphenation at `-' chars.
   7146 %
   7147 \def\defunargs#1{%
   7148   % use sl by default (not ttsl),
   7149   % tt for the names.
   7150   \df \sl \hyphenchar\font=0
   7151   %
   7152   % On the other hand, if an argument has two dashes (for instance), we
   7153   % want a way to get ttsl.  We used to recommend @var for that, so
   7154   % leave the code in, but it's strange for @var to lead to typewriter.
   7155   % Nowadays we recommend @code, since the difference between a ttsl hyphen
   7156   % and a tt hyphen is pretty tiny.  @code also disables ?` !`.
   7157   \def\var##1{{\setupmarkupstyle{var}\ttslanted{##1}}}%
   7158   #1%
   7159   \sl\hyphenchar\font=45
   7160 }
   7161 
   7162 % We want ()&[] to print specially on the defun line.
   7163 %
   7164 \def\activeparens{%
   7165   \catcode`\(=\active \catcode`\)=\active
   7166   \catcode`\[=\active \catcode`\]=\active
   7167   \catcode`\&=\active
   7168 }
   7169 
   7170 % Make control sequences which act like normal parenthesis chars.
   7171 \let\lparen = ( \let\rparen = )
   7172 
   7173 % Be sure that we always have a definition for `(', etc.  For example,
   7174 % if the fn name has parens in it, \boldbrax will not be in effect yet,
   7175 % so TeX would otherwise complain about undefined control sequence.
   7176 {
   7177   \activeparens
   7178   \global\let(=\lparen \global\let)=\rparen
   7179   \global\let[=\lbrack \global\let]=\rbrack
   7180   \global\let& = \&
   7181 
   7182   \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
   7183   \gdef\magicamp{\let&=\amprm}
   7184 }
   7185 
   7186 \newcount\parencount
   7187 
   7188 % If we encounter &foo, then turn on ()-hacking afterwards
   7189 \newif\ifampseen
   7190 \def\amprm#1 {\ampseentrue{\bf\&#1 }}
   7191 
   7192 \def\parenfont{%
   7193   \ifampseen
   7194     % At the first level, print parens in roman,
   7195     % otherwise use the default font.
   7196     \ifnum \parencount=1 \rm \fi
   7197   \else
   7198     % The \sf parens (in \boldbrax) actually are a little bolder than
   7199     % the contained text.  This is especially needed for [ and ] .
   7200     \sf
   7201   \fi
   7202 }
   7203 \def\infirstlevel#1{%
   7204   \ifampseen
   7205     \ifnum\parencount=1
   7206       #1%
   7207     \fi
   7208   \fi
   7209 }
   7210 \def\bfafterword#1 {#1 \bf}
   7211 
   7212 \def\opnr{%
   7213   \global\advance\parencount by 1
   7214   {\parenfont(}%
   7215   \infirstlevel \bfafterword
   7216 }
   7217 \def\clnr{%
   7218   {\parenfont)}%
   7219   \infirstlevel \sl
   7220   \global\advance\parencount by -1
   7221 }
   7222 
   7223 \newcount\brackcount
   7224 \def\lbrb{%
   7225   \global\advance\brackcount by 1
   7226   {\bf[}%
   7227 }
   7228 \def\rbrb{%
   7229   {\bf]}%
   7230   \global\advance\brackcount by -1
   7231 }
   7232 
   7233 \def\checkparencounts{%
   7234   \ifnum\parencount=0 \else \badparencount \fi
   7235   \ifnum\brackcount=0 \else \badbrackcount \fi
   7236 }
   7237 % these should not use \errmessage; the glibc manual, at least, actually
   7238 % has such constructs (when documenting function pointers).
   7239 \def\badparencount{%
   7240   \message{Warning: unbalanced parentheses in @def...}%
   7241   \global\parencount=0
   7242 }
   7243 \def\badbrackcount{%
   7244   \message{Warning: unbalanced square brackets in @def...}%
   7245   \global\brackcount=0
   7246 }
   7247 
   7248 
   7249 \message{macros,}
   7250 % @macro.
   7251 
   7252 % To do this right we need a feature of e-TeX, \scantokens,
   7253 % which we arrange to emulate with a temporary file in ordinary TeX.
   7254 \ifx\eTeXversion\thisisundefined
   7255   \newwrite\macscribble
   7256   \def\scantokens#1{%
   7257     \toks0={#1}%
   7258     \immediate\openout\macscribble=\jobname.tmp
   7259     \immediate\write\macscribble{\the\toks0}%
   7260     \immediate\closeout\macscribble
   7261     \input \jobname.tmp
   7262   }
   7263 \fi
   7264 
   7265 \def\scanmacro#1{\begingroup
   7266   \newlinechar`\^^M
   7267   \let\xeatspaces\eatspaces
   7268   %
   7269   % Undo catcode changes of \startcontents and \doprintindex
   7270   % When called from @insertcopying or (short)caption, we need active
   7271   % backslash to get it printed correctly.  Previously, we had
   7272   % \catcode`\\=\other instead.  We'll see whether a problem appears
   7273   % with macro expansion.				--kasal, 19aug04
   7274   \catcode`\@=0 \catcode`\\=\active \escapechar=`\@
   7275   %
   7276   % ... and for \example:
   7277   \spaceisspace
   7278   %
   7279   % The \empty here causes a following catcode 5 newline to be eaten as
   7280   % part of reading whitespace after a control sequence.  It does not
   7281   % eat a catcode 13 newline.  There's no good way to handle the two
   7282   % cases (untried: maybe e-TeX's \everyeof could help, though plain TeX
   7283   % would then have different behavior).  See the Macro Details node in
   7284   % the manual for the workaround we recommend for macros and
   7285   % line-oriented commands.
   7286   %
   7287   \scantokens{#1\empty}%
   7288 \endgroup}
   7289 
   7290 \def\scanexp#1{%
   7291   \edef\temp{\noexpand\scanmacro{#1}}%
   7292   \temp
   7293 }
   7294 
   7295 \newcount\paramno   % Count of parameters
   7296 \newtoks\macname    % Macro name
   7297 \newif\ifrecursive  % Is it recursive?
   7298 
   7299 % List of all defined macros in the form
   7300 %    \definedummyword\macro1\definedummyword\macro2...
   7301 % Currently is also contains all @aliases; the list can be split
   7302 % if there is a need.
   7303 \def\macrolist{}
   7304 
   7305 % Add the macro to \macrolist
   7306 \def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname}
   7307 \def\addtomacrolistxxx#1{%
   7308      \toks0 = \expandafter{\macrolist\definedummyword#1}%
   7309      \xdef\macrolist{\the\toks0}%
   7310 }
   7311 
   7312 % Utility routines.
   7313 % This does \let #1 = #2, with \csnames; that is,
   7314 %   \let \csname#1\endcsname = \csname#2\endcsname
   7315 % (except of course we have to play expansion games).
   7316 %
   7317 \def\cslet#1#2{%
   7318   \expandafter\let
   7319   \csname#1\expandafter\endcsname
   7320   \csname#2\endcsname
   7321 }
   7322 
   7323 % Trim leading and trailing spaces off a string.
   7324 % Concepts from aro-bend problem 15 (see CTAN).
   7325 {\catcode`\@=11
   7326 \gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
   7327 \gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
   7328 \gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
   7329 \def\unbrace#1{#1}
   7330 \unbrace{\gdef\trim@@@ #1 } #2@{#1}
   7331 }
   7332 
   7333 % Trim a single trailing ^^M off a string.
   7334 {\catcode`\^^M=\other \catcode`\Q=3%
   7335 \gdef\eatcr #1{\eatcra #1Q^^MQ}%
   7336 \gdef\eatcra#1^^MQ{\eatcrb#1Q}%
   7337 \gdef\eatcrb#1Q#2Q{#1}%
   7338 }
   7339 
   7340 % Macro bodies are absorbed as an argument in a context where
   7341 % all characters are catcode 10, 11 or 12, except \ which is active
   7342 % (as in normal texinfo). It is necessary to change the definition of \
   7343 % to recognize macro arguments; this is the job of \mbodybackslash.
   7344 %
   7345 % Non-ASCII encodings make 8-bit characters active, so un-activate
   7346 % them to avoid their expansion.  Must do this non-globally, to
   7347 % confine the change to the current group.
   7348 %
   7349 % It's necessary to have hard CRs when the macro is executed. This is
   7350 % done by making ^^M (\endlinechar) catcode 12 when reading the macro
   7351 % body, and then making it the \newlinechar in \scanmacro.
   7352 %
   7353 \def\scanctxt{% used as subroutine
   7354   \catcode`\"=\other
   7355   \catcode`\+=\other
   7356   \catcode`\<=\other
   7357   \catcode`\>=\other
   7358   \catcode`\@=\other
   7359   \catcode`\^=\other
   7360   \catcode`\_=\other
   7361   \catcode`\|=\other
   7362   \catcode`\~=\other
   7363   \ifx\declaredencoding\ascii \else \setnonasciicharscatcodenonglobal\other \fi
   7364 }
   7365 
   7366 \def\scanargctxt{% used for copying and captions, not macros.
   7367   \scanctxt
   7368   \catcode`\\=\other
   7369   \catcode`\^^M=\other
   7370 }
   7371 
   7372 \def\macrobodyctxt{% used for @macro definitions
   7373   \scanctxt
   7374   \catcode`\{=\other
   7375   \catcode`\}=\other
   7376   \catcode`\^^M=\other
   7377   \usembodybackslash
   7378 }
   7379 
   7380 \def\macroargctxt{% used when scanning invocations
   7381   \scanctxt
   7382   \catcode`\\=0
   7383 }
   7384 % why catcode 0 for \ in the above?  To recognize \\ \{ \} as "escapes"
   7385 % for the single characters \ { }.  Thus, we end up with the "commands"
   7386 % that would be written @\ @{ @} in a Texinfo document.
   7387 %
   7388 % We already have @{ and @}.  For @\, we define it here, and only for
   7389 % this purpose, to produce a typewriter backslash (so, the @\ that we
   7390 % define for @math can't be used with @macro calls):
   7391 %
   7392 \def\\{\normalbackslash}%
   7393 %
   7394 % We would like to do this for \, too, since that is what makeinfo does.
   7395 % But it is not possible, because Texinfo already has a command @, for a
   7396 % cedilla accent.  Documents must use @comma{} instead.
   7397 %
   7398 % \anythingelse will almost certainly be an error of some kind.
   7399 
   7400 
   7401 % \mbodybackslash is the definition of \ in @macro bodies.
   7402 % It maps \foo\ => \csname macarg.foo\endcsname => #N
   7403 % where N is the macro parameter number.
   7404 % We define \csname macarg.\endcsname to be \realbackslash, so
   7405 % \\ in macro replacement text gets you a backslash.
   7406 %
   7407 {\catcode`@=0 @catcode`@\=@active
   7408  @gdef@usembodybackslash{@let\=@mbodybackslash}
   7409  @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
   7410 }
   7411 \expandafter\def\csname macarg.\endcsname{\realbackslash}
   7412 
   7413 \def\margbackslash#1{\char`\#1 }
   7414 
   7415 \def\macro{\recursivefalse\parsearg\macroxxx}
   7416 \def\rmacro{\recursivetrue\parsearg\macroxxx}
   7417 
   7418 \def\macroxxx#1{%
   7419   \getargs{#1}% now \macname is the macname and \argl the arglist
   7420   \ifx\argl\empty       % no arguments
   7421      \paramno=0\relax
   7422   \else
   7423      \expandafter\parsemargdef \argl;%
   7424      \if\paramno>256\relax
   7425        \ifx\eTeXversion\thisisundefined
   7426          \errhelp = \EMsimple
   7427          \errmessage{You need eTeX to compile a file with macros with more than 256 arguments}
   7428        \fi
   7429      \fi
   7430   \fi
   7431   \if1\csname ismacro.\the\macname\endcsname
   7432      \message{Warning: redefining \the\macname}%
   7433   \else
   7434      \expandafter\ifx\csname \the\macname\endcsname \relax
   7435      \else \errmessage{Macro name \the\macname\space already defined}\fi
   7436      \global\cslet{macsave.\the\macname}{\the\macname}%
   7437      \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
   7438      \addtomacrolist{\the\macname}%
   7439   \fi
   7440   \begingroup \macrobodyctxt
   7441   \ifrecursive \expandafter\parsermacbody
   7442   \else \expandafter\parsemacbody
   7443   \fi}
   7444 
   7445 \parseargdef\unmacro{%
   7446   \if1\csname ismacro.#1\endcsname
   7447     \global\cslet{#1}{macsave.#1}%
   7448     \global\expandafter\let \csname ismacro.#1\endcsname=0%
   7449     % Remove the macro name from \macrolist:
   7450     \begingroup
   7451       \expandafter\let\csname#1\endcsname \relax
   7452       \let\definedummyword\unmacrodo
   7453       \xdef\macrolist{\macrolist}%
   7454     \endgroup
   7455   \else
   7456     \errmessage{Macro #1 not defined}%
   7457   \fi
   7458 }
   7459 
   7460 % Called by \do from \dounmacro on each macro.  The idea is to omit any
   7461 % macro definitions that have been changed to \relax.
   7462 %
   7463 \def\unmacrodo#1{%
   7464   \ifx #1\relax
   7465     % remove this
   7466   \else
   7467     \noexpand\definedummyword \noexpand#1%
   7468   \fi
   7469 }
   7470 
   7471 % This makes use of the obscure feature that if the last token of a
   7472 % <parameter list> is #, then the preceding argument is delimited by
   7473 % an opening brace, and that opening brace is not consumed.
   7474 \def\getargs#1{\getargsxxx#1{}}
   7475 \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
   7476 \def\getmacname#1 #2\relax{\macname={#1}}
   7477 \def\getmacargs#1{\def\argl{#1}}
   7478 
   7479 % For macro processing make @ a letter so that we can make Texinfo private macro names.
   7480 \edef\texiatcatcode{\the\catcode`\@}
   7481 \catcode `@=11\relax
   7482 
   7483 % Parse the optional {params} list.  Set up \paramno and \paramlist
   7484 % so \defmacro knows what to do.  Define \macarg.BLAH for each BLAH
   7485 % in the params list to some hook where the argument si to be expanded.  If
   7486 % there are less than 10 arguments that hook is to be replaced by ##N where N
   7487 % is the position in that list, that is to say the macro arguments are to be
   7488 % defined `a la TeX in the macro body.
   7489 %
   7490 % That gets used by \mbodybackslash (above).
   7491 %
   7492 % We need to get `macro parameter char #' into several definitions.
   7493 % The technique used is stolen from LaTeX: let \hash be something
   7494 % unexpandable, insert that wherever you need a #, and then redefine
   7495 % it to # just before using the token list produced.
   7496 %
   7497 % The same technique is used to protect \eatspaces till just before
   7498 % the macro is used.
   7499 %
   7500 % If there are 10 or more arguments, a different technique is used, where the
   7501 % hook remains in the body, and when macro is to be expanded the body is
   7502 % processed again to replace the arguments.
   7503 %
   7504 % In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the
   7505 % argument N value and then \edef  the body (nothing else will expand because of
   7506 % the catcode regime underwhich the body was input).
   7507 %
   7508 % If you compile with TeX (not eTeX), and you have macros with 10 or more
   7509 % arguments, you need that no macro has more than 256 arguments, otherwise an
   7510 % error is produced.
   7511 \def\parsemargdef#1;{%
   7512   \paramno=0\def\paramlist{}%
   7513   \let\hash\relax
   7514   \let\xeatspaces\relax
   7515   \parsemargdefxxx#1,;,%
   7516   % In case that there are 10 or more arguments we parse again the arguments
   7517   % list to set new definitions for the \macarg.BLAH macros corresponding to
   7518   % each BLAH argument. It was anyhow needed to parse already once this list
   7519   % in order to count the arguments, and as macros with at most 9 arguments
   7520   % are by far more frequent than macro with 10 or more arguments, defining
   7521   % twice the \macarg.BLAH macros does not cost too much processing power.
   7522   \ifnum\paramno<10\relax\else
   7523     \paramno0\relax
   7524     \parsemmanyargdef@@#1,;,% 10 or more arguments
   7525   \fi
   7526 }
   7527 \def\parsemargdefxxx#1,{%
   7528   \if#1;\let\next=\relax
   7529   \else \let\next=\parsemargdefxxx
   7530     \advance\paramno by 1
   7531     \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
   7532         {\xeatspaces{\hash\the\paramno}}%
   7533     \edef\paramlist{\paramlist\hash\the\paramno,}%
   7534   \fi\next}
   7535 
   7536 \def\parsemmanyargdef@@#1,{%
   7537   \if#1;\let\next=\relax
   7538   \else
   7539     \let\next=\parsemmanyargdef@@
   7540     \edef\tempb{\eatspaces{#1}}%
   7541     \expandafter\def\expandafter\tempa
   7542        \expandafter{\csname macarg.\tempb\endcsname}%
   7543     % Note that we need some extra \noexpand\noexpand, this is because we
   7544     % don't want \the  to be expanded in the \parsermacbody  as it uses an
   7545     % \xdef .
   7546     \expandafter\edef\tempa
   7547       {\noexpand\noexpand\noexpand\the\toks\the\paramno}%
   7548     \advance\paramno by 1\relax
   7549   \fi\next}
   7550 
   7551 % These two commands read recursive and nonrecursive macro bodies.
   7552 % (They're different since rec and nonrec macros end differently.)
   7553 %
   7554 
   7555 \catcode `\@\texiatcatcode
   7556 \long\def\parsemacbody#1@end macro%
   7557 {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
   7558 \long\def\parsermacbody#1@end rmacro%
   7559 {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
   7560 \catcode `\@=11\relax
   7561 
   7562 \let\endargs@\relax
   7563 \let\nil@\relax
   7564 \def\nilm@{\nil@}%
   7565 \long\def\nillm@{\nil@}%
   7566 
   7567 % This macro is expanded during the Texinfo macro expansion, not during its
   7568 % definition.  It gets all the arguments values and assigns them to macros
   7569 % macarg.ARGNAME
   7570 %
   7571 % #1 is the macro name
   7572 % #2 is the list of argument names
   7573 % #3 is the list of argument values
   7574 \def\getargvals@#1#2#3{%
   7575   \def\macargdeflist@{}%
   7576   \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion.
   7577   \def\paramlist{#2,\nil@}%
   7578   \def\macroname{#1}%
   7579   \begingroup
   7580   \macroargctxt
   7581   \def\argvaluelist{#3,\nil@}%
   7582   \def\@tempa{#3}%
   7583   \ifx\@tempa\empty
   7584     \setemptyargvalues@
   7585   \else
   7586     \getargvals@@
   7587   \fi
   7588 }
   7589 
   7590 %
   7591 \def\getargvals@@{%
   7592   \ifx\paramlist\nilm@
   7593       % Some sanity check needed here that \argvaluelist is also empty.
   7594       \ifx\argvaluelist\nillm@
   7595       \else
   7596         \errhelp = \EMsimple
   7597         \errmessage{Too many arguments in macro `\macroname'!}%
   7598       \fi
   7599       \let\next\macargexpandinbody@
   7600   \else
   7601     \ifx\argvaluelist\nillm@
   7602        % No more arguments values passed to macro.  Set remaining named-arg
   7603        % macros to empty.
   7604        \let\next\setemptyargvalues@
   7605     \else
   7606       % pop current arg name into \@tempb
   7607       \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}%
   7608       \expandafter\@tempa\expandafter{\paramlist}%
   7609        % pop current argument value into \@tempc
   7610       \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}%
   7611       \expandafter\@tempa\expandafter{\argvaluelist}%
   7612        % Here \@tempb is the current arg name and \@tempc is the current arg value.
   7613        % First place the new argument macro definition into \@tempd
   7614        \expandafter\macname\expandafter{\@tempc}%
   7615        \expandafter\let\csname macarg.\@tempb\endcsname\relax
   7616        \expandafter\def\expandafter\@tempe\expandafter{%
   7617          \csname macarg.\@tempb\endcsname}%
   7618        \edef\@tempd{\long\def\@tempe{\the\macname}}%
   7619        \push@\@tempd\macargdeflist@
   7620        \let\next\getargvals@@
   7621     \fi
   7622   \fi
   7623   \next
   7624 }
   7625 
   7626 \def\push@#1#2{%
   7627   \expandafter\expandafter\expandafter\def
   7628   \expandafter\expandafter\expandafter#2%
   7629   \expandafter\expandafter\expandafter{%
   7630   \expandafter#1#2}%
   7631 }
   7632 
   7633 % Replace arguments by their values in the macro body, and place the result
   7634 % in macro \@tempa
   7635 \def\macvalstoargs@{%
   7636   %  To do this we use the property that token registers that are \the'ed
   7637   % within an \edef  expand only once. So we are going to place all argument
   7638   % values into respective token registers.
   7639   %
   7640   % First we save the token context, and initialize argument numbering.
   7641   \begingroup
   7642     \paramno0\relax
   7643     % Then, for each argument number #N, we place the corresponding argument
   7644     % value into a new token list register \toks#N
   7645     \expandafter\putargsintokens@\saveparamlist@,;,%
   7646     % Then, we expand the body so that argument are replaced by their
   7647     % values. The trick for values not to be expanded themselves is that they
   7648     % are within tokens and that tokens expand only once in an \edef .
   7649     \edef\@tempc{\csname mac.\macroname .body\endcsname}%
   7650     % Now we restore the token stack pointer to free the token list registers
   7651     % which we have used, but we make sure that expanded body is saved after
   7652     % group.
   7653     \expandafter
   7654   \endgroup
   7655   \expandafter\def\expandafter\@tempa\expandafter{\@tempc}%
   7656   }
   7657 
   7658 \def\macargexpandinbody@{%
   7659   %% Define the named-macro outside of this group and then close this group.
   7660   \expandafter
   7661   \endgroup
   7662   \macargdeflist@
   7663   % First the replace in body the macro arguments by their values, the result
   7664   % is in \@tempa .
   7665   \macvalstoargs@
   7666   % Then we point at the \norecurse or \gobble (for recursive) macro value
   7667   % with \@tempb .
   7668   \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname
   7669   % Depending on whether it is recursive or not, we need some tailing
   7670   % \egroup .
   7671   \ifx\@tempb\gobble
   7672      \let\@tempc\relax
   7673   \else
   7674      \let\@tempc\egroup
   7675   \fi
   7676   % And now we do the real job:
   7677   \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}%
   7678   \@tempd
   7679 }
   7680 
   7681 \def\putargsintokens@#1,{%
   7682   \if#1;\let\next\relax
   7683   \else
   7684     \let\next\putargsintokens@
   7685     % First we allocate the new token list register, and give it a temporary
   7686     % alias \@tempb .
   7687     \toksdef\@tempb\the\paramno
   7688     % Then we place the argument value into that token list register.
   7689     \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname
   7690     \expandafter\@tempb\expandafter{\@tempa}%
   7691     \advance\paramno by 1\relax
   7692   \fi
   7693   \next
   7694 }
   7695 
   7696 % Save the token stack pointer into macro #1
   7697 \def\texisavetoksstackpoint#1{\edef#1{\the\@cclvi}}
   7698 % Restore the token stack pointer from number in macro #1
   7699 \def\texirestoretoksstackpoint#1{\expandafter\mathchardef\expandafter\@cclvi#1\relax}
   7700 % newtoks that can be used non \outer .
   7701 \def\texinonouternewtoks{\alloc@ 5\toks \toksdef \@cclvi}
   7702 
   7703 % Tailing missing arguments are set to empty
   7704 \def\setemptyargvalues@{%
   7705   \ifx\paramlist\nilm@
   7706     \let\next\macargexpandinbody@
   7707   \else
   7708     \expandafter\setemptyargvaluesparser@\paramlist\endargs@
   7709     \let\next\setemptyargvalues@
   7710   \fi
   7711   \next
   7712 }
   7713 
   7714 \def\setemptyargvaluesparser@#1,#2\endargs@{%
   7715   \expandafter\def\expandafter\@tempa\expandafter{%
   7716     \expandafter\def\csname macarg.#1\endcsname{}}%
   7717   \push@\@tempa\macargdeflist@
   7718   \def\paramlist{#2}%
   7719 }
   7720 
   7721 % #1 is the element target macro
   7722 % #2 is the list macro
   7723 % #3,#4\endargs@ is the list value
   7724 \def\pop@#1#2#3,#4\endargs@{%
   7725    \def#1{#3}%
   7726    \def#2{#4}%
   7727 }
   7728 \long\def\longpop@#1#2#3,#4\endargs@{%
   7729    \long\def#1{#3}%
   7730    \long\def#2{#4}%
   7731 }
   7732 
   7733 % This defines a Texinfo @macro. There are eight cases: recursive and
   7734 % nonrecursive macros of zero, one, up to nine, and many arguments.
   7735 % Much magic with \expandafter here.
   7736 % \xdef is used so that macro definitions will survive the file
   7737 % they're defined in; @include reads the file inside a group.
   7738 %
   7739 \def\defmacro{%
   7740   \let\hash=##% convert placeholders to macro parameter chars
   7741   \ifrecursive
   7742     \ifcase\paramno
   7743     % 0
   7744       \expandafter\xdef\csname\the\macname\endcsname{%
   7745         \noexpand\scanmacro{\temp}}%
   7746     \or % 1
   7747       \expandafter\xdef\csname\the\macname\endcsname{%
   7748          \bgroup\noexpand\macroargctxt
   7749          \noexpand\braceorline
   7750          \expandafter\noexpand\csname\the\macname xxx\endcsname}%
   7751       \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
   7752          \egroup\noexpand\scanmacro{\temp}}%
   7753     \else
   7754       \ifnum\paramno<10\relax % at most 9
   7755         \expandafter\xdef\csname\the\macname\endcsname{%
   7756            \bgroup\noexpand\macroargctxt
   7757            \noexpand\csname\the\macname xx\endcsname}%
   7758         \expandafter\xdef\csname\the\macname xx\endcsname##1{%
   7759             \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
   7760         \expandafter\expandafter
   7761         \expandafter\xdef
   7762         \expandafter\expandafter
   7763           \csname\the\macname xxx\endcsname
   7764             \paramlist{\egroup\noexpand\scanmacro{\temp}}%
   7765       \else % 10 or more
   7766         \expandafter\xdef\csname\the\macname\endcsname{%
   7767           \noexpand\getargvals@{\the\macname}{\argl}%
   7768         }%
   7769         \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp
   7770         \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble
   7771       \fi
   7772     \fi
   7773   \else
   7774     \ifcase\paramno
   7775     % 0
   7776       \expandafter\xdef\csname\the\macname\endcsname{%
   7777         \noexpand\norecurse{\the\macname}%
   7778         \noexpand\scanmacro{\temp}\egroup}%
   7779     \or % 1
   7780       \expandafter\xdef\csname\the\macname\endcsname{%
   7781          \bgroup\noexpand\macroargctxt
   7782          \noexpand\braceorline
   7783          \expandafter\noexpand\csname\the\macname xxx\endcsname}%
   7784       \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
   7785         \egroup
   7786         \noexpand\norecurse{\the\macname}%
   7787         \noexpand\scanmacro{\temp}\egroup}%
   7788     \else % at most 9
   7789       \ifnum\paramno<10\relax
   7790         \expandafter\xdef\csname\the\macname\endcsname{%
   7791            \bgroup\noexpand\macroargctxt
   7792            \expandafter\noexpand\csname\the\macname xx\endcsname}%
   7793         \expandafter\xdef\csname\the\macname xx\endcsname##1{%
   7794             \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
   7795         \expandafter\expandafter
   7796         \expandafter\xdef
   7797         \expandafter\expandafter
   7798         \csname\the\macname xxx\endcsname
   7799         \paramlist{%
   7800             \egroup
   7801             \noexpand\norecurse{\the\macname}%
   7802             \noexpand\scanmacro{\temp}\egroup}%
   7803       \else % 10 or more:
   7804         \expandafter\xdef\csname\the\macname\endcsname{%
   7805           \noexpand\getargvals@{\the\macname}{\argl}%
   7806         }%
   7807         \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp
   7808         \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\norecurse
   7809       \fi
   7810     \fi
   7811   \fi}
   7812 
   7813 \catcode `\@\texiatcatcode\relax
   7814 
   7815 \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
   7816 
   7817 % \braceorline decides whether the next nonwhitespace character is a
   7818 % {.  If so it reads up to the closing }, if not, it reads the whole
   7819 % line.  Whatever was read is then fed to the next control sequence
   7820 % as an argument (by \parsebrace or \parsearg).
   7821 %
   7822 \def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx}
   7823 \def\braceorlinexxx{%
   7824   \ifx\nchar\bgroup\else
   7825     \expandafter\parsearg
   7826   \fi \macnamexxx}
   7827 
   7828 
   7829 % @alias.
   7830 % We need some trickery to remove the optional spaces around the equal
   7831 % sign.  Make them active and then expand them all to nothing.
   7832 %
   7833 \def\alias{\parseargusing\obeyspaces\aliasxxx}
   7834 \def\aliasxxx #1{\aliasyyy#1\relax}
   7835 \def\aliasyyy #1=#2\relax{%
   7836   {%
   7837     \expandafter\let\obeyedspace=\empty
   7838     \addtomacrolist{#1}%
   7839     \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}%
   7840   }%
   7841   \next
   7842 }
   7843 
   7844 
   7845 \message{cross references,}
   7846 
   7847 \newwrite\auxfile
   7848 \newif\ifhavexrefs    % True if xref values are known.
   7849 \newif\ifwarnedxrefs  % True if we warned once that they aren't known.
   7850 
   7851 % @inforef is relatively simple.
   7852 \def\inforef #1{\inforefzzz #1,,,,**}
   7853 \def\inforefzzz #1,#2,#3,#4**{%
   7854   \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
   7855   node \samp{\ignorespaces#1{}}}
   7856 
   7857 % @node's only job in TeX is to define \lastnode, which is used in
   7858 % cross-references.  The @node line might or might not have commas, and
   7859 % might or might not have spaces before the first comma, like:
   7860 % @node foo , bar , ...
   7861 % We don't want such trailing spaces in the node name.
   7862 %
   7863 \parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse}
   7864 %
   7865 % also remove a trailing comma, in case of something like this:
   7866 % @node Help-Cross,  ,  , Cross-refs
   7867 \def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse}
   7868 \def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}}
   7869 
   7870 \let\nwnode=\node
   7871 \let\lastnode=\empty
   7872 
   7873 % Write a cross-reference definition for the current node.  #1 is the
   7874 % type (Ynumbered, Yappendix, Ynothing).
   7875 %
   7876 \def\donoderef#1{%
   7877   \ifx\lastnode\empty\else
   7878     \setref{\lastnode}{#1}%
   7879     \global\let\lastnode=\empty
   7880   \fi
   7881 }
   7882 
   7883 % @anchor{NAME} -- define xref target at arbitrary point.
   7884 %
   7885 \newcount\savesfregister
   7886 %
   7887 \def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
   7888 \def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
   7889 \def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
   7890 
   7891 % \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
   7892 % anchor), which consists of three parts:
   7893 % 1) NAME-title - the current sectioning name taken from \lastsection,
   7894 %                 or the anchor name.
   7895 % 2) NAME-snt   - section number and type, passed as the SNT arg, or
   7896 %                 empty for anchors.
   7897 % 3) NAME-pg    - the page number.
   7898 %
   7899 % This is called from \donoderef, \anchor, and \dofloat.  In the case of
   7900 % floats, there is an additional part, which is not written here:
   7901 % 4) NAME-lof   - the text as it should appear in a @listoffloats.
   7902 %
   7903 \def\setref#1#2{%
   7904   \pdfmkdest{#1}%
   7905   \iflinks
   7906     {%
   7907       \atdummies  % preserve commands, but don't expand them
   7908       \edef\writexrdef##1##2{%
   7909 	\write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef
   7910 	  ##1}{##2}}% these are parameters of \writexrdef
   7911       }%
   7912       \toks0 = \expandafter{\lastsection}%
   7913       \immediate \writexrdef{title}{\the\toks0 }%
   7914       \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
   7915       \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout
   7916     }%
   7917   \fi
   7918 }
   7919 
   7920 % @xrefautosectiontitle on|off says whether @section(ing) names are used
   7921 % automatically in xrefs, if the third arg is not explicitly specified.
   7922 % This was provided as a "secret" @set xref-automatic-section-title
   7923 % variable, now it's official.
   7924 %
   7925 \parseargdef\xrefautomaticsectiontitle{%
   7926   \def\temp{#1}%
   7927   \ifx\temp\onword
   7928     \expandafter\let\csname SETxref-automatic-section-title\endcsname
   7929       = \empty
   7930   \else\ifx\temp\offword
   7931     \expandafter\let\csname SETxref-automatic-section-title\endcsname
   7932       = \relax
   7933   \else
   7934     \errhelp = \EMsimple
   7935     \errmessage{Unknown @xrefautomaticsectiontitle value `\temp',
   7936                 must be on|off}%
   7937   \fi\fi
   7938 }
   7939 
   7940 % 
   7941 % @xref, @pxref, and @ref generate cross-references.  For \xrefX, #1 is
   7942 % the node name, #2 the name of the Info cross-reference, #3 the printed
   7943 % node name, #4 the name of the Info file, #5 the name of the printed
   7944 % manual.  All but the node name can be omitted.
   7945 %
   7946 \def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]}
   7947 \def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]}
   7948 \def\ref#1{\xrefX[#1,,,,,,,]}
   7949 %
   7950 \newbox\toprefbox
   7951 \newbox\printedrefnamebox
   7952 \newbox\infofilenamebox
   7953 \newbox\printedmanualbox
   7954 %
   7955 \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
   7956   \unsepspaces
   7957   %
   7958   % Get args without leading/trailing spaces.
   7959   \def\printedrefname{\ignorespaces #3}%
   7960   \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}%
   7961   %
   7962   \def\infofilename{\ignorespaces #4}%
   7963   \setbox\infofilenamebox = \hbox{\infofilename\unskip}%
   7964   %
   7965   \def\printedmanual{\ignorespaces #5}%
   7966   \setbox\printedmanualbox  = \hbox{\printedmanual\unskip}%
   7967   %
   7968   % If the printed reference name (arg #3) was not explicitly given in
   7969   % the @xref, figure out what we want to use.
   7970   \ifdim \wd\printedrefnamebox = 0pt
   7971     % No printed node name was explicitly given.
   7972     \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax
   7973       % Not auto section-title: use node name inside the square brackets.
   7974       \def\printedrefname{\ignorespaces #1}%
   7975     \else
   7976       % Auto section-title: use chapter/section title inside
   7977       % the square brackets if we have it.
   7978       \ifdim \wd\printedmanualbox > 0pt
   7979         % It is in another manual, so we don't have it; use node name.
   7980         \def\printedrefname{\ignorespaces #1}%
   7981       \else
   7982         \ifhavexrefs
   7983           % We (should) know the real title if we have the xref values.
   7984           \def\printedrefname{\refx{#1-title}{}}%
   7985         \else
   7986           % Otherwise just copy the Info node name.
   7987           \def\printedrefname{\ignorespaces #1}%
   7988         \fi%
   7989       \fi
   7990     \fi
   7991   \fi
   7992   %
   7993   % Make link in pdf output.
   7994   \ifpdf
   7995     {\indexnofonts
   7996      \turnoffactive
   7997      \makevalueexpandable
   7998      % This expands tokens, so do it after making catcode changes, so _
   7999      % etc. don't get their TeX definitions.  This ignores all spaces in
   8000      % #4, including (wrongly) those in the middle of the filename.
   8001      \getfilename{#4}%
   8002      %
   8003      % This (wrongly) does not take account of leading or trailing
   8004      % spaces in #1, which should be ignored.
   8005      \edef\pdfxrefdest{#1}%
   8006      \ifx\pdfxrefdest\empty
   8007        \def\pdfxrefdest{Top}% no empty targets
   8008      \else
   8009        \txiescapepdf\pdfxrefdest  % escape PDF special chars
   8010      \fi
   8011      %
   8012      \leavevmode
   8013      \startlink attr{/Border [0 0 0]}%
   8014      \ifnum\filenamelength>0
   8015        goto file{\the\filename.pdf} name{\pdfxrefdest}%
   8016      \else
   8017        goto name{\pdfmkpgn{\pdfxrefdest}}%
   8018      \fi
   8019     }%
   8020     \setcolor{\linkcolor}%
   8021   \fi
   8022   %
   8023   % Float references are printed completely differently: "Figure 1.2"
   8024   % instead of "[somenode], p.3".  We distinguish them by the
   8025   % LABEL-title being set to a magic string.
   8026   {%
   8027     % Have to otherify everything special to allow the \csname to
   8028     % include an _ in the xref name, etc.
   8029     \indexnofonts
   8030     \turnoffactive
   8031     \expandafter\global\expandafter\let\expandafter\Xthisreftitle
   8032       \csname XR#1-title\endcsname
   8033   }%
   8034   \iffloat\Xthisreftitle
   8035     % If the user specified the print name (third arg) to the ref,
   8036     % print it instead of our usual "Figure 1.2".
   8037     \ifdim\wd\printedrefnamebox = 0pt
   8038       \refx{#1-snt}{}%
   8039     \else
   8040       \printedrefname
   8041     \fi
   8042     %
   8043     % If the user also gave the printed manual name (fifth arg), append
   8044     % "in MANUALNAME".
   8045     \ifdim \wd\printedmanualbox > 0pt
   8046       \space \putwordin{} \cite{\printedmanual}%
   8047     \fi
   8048   \else
   8049     % node/anchor (non-float) references.
   8050     %
   8051     % If we use \unhbox to print the node names, TeX does not insert
   8052     % empty discretionaries after hyphens, which means that it will not
   8053     % find a line break at a hyphen in a node names.  Since some manuals
   8054     % are best written with fairly long node names, containing hyphens,
   8055     % this is a loss.  Therefore, we give the text of the node name
   8056     % again, so it is as if TeX is seeing it for the first time.
   8057     %
   8058     \ifdim \wd\printedmanualbox > 0pt
   8059       % Cross-manual reference with a printed manual name.
   8060       %
   8061       \crossmanualxref{\cite{\printedmanual\unskip}}%
   8062     %
   8063     \else\ifdim \wd\infofilenamebox > 0pt
   8064       % Cross-manual reference with only an info filename (arg 4), no
   8065       % printed manual name (arg 5).  This is essentially the same as
   8066       % the case above; we output the filename, since we have nothing else.
   8067       %
   8068       \crossmanualxref{\code{\infofilename\unskip}}%
   8069     %
   8070     \else
   8071       % Reference within this manual.
   8072       %
   8073       % _ (for example) has to be the character _ for the purposes of the
   8074       % control sequence corresponding to the node, but it has to expand
   8075       % into the usual \leavevmode...\vrule stuff for purposes of
   8076       % printing. So we \turnoffactive for the \refx-snt, back on for the
   8077       % printing, back off for the \refx-pg.
   8078       {\turnoffactive
   8079        % Only output a following space if the -snt ref is nonempty; for
   8080        % @unnumbered and @anchor, it won't be.
   8081        \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
   8082        \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
   8083       }%
   8084       % output the `[mynode]' via the macro below so it can be overridden.
   8085       \xrefprintnodename\printedrefname
   8086       %
   8087       % But we always want a comma and a space:
   8088       ,\space
   8089       %
   8090       % output the `page 3'.
   8091       \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
   8092     \fi\fi
   8093   \fi
   8094   \endlink
   8095 \endgroup}
   8096 
   8097 % Output a cross-manual xref to #1.  Used just above (twice).
   8098 %
   8099 % Only include the text "Section ``foo'' in" if the foo is neither
   8100 % missing or Top.  Thus, @xref{,,,foo,The Foo Manual} outputs simply
   8101 % "see The Foo Manual", the idea being to refer to the whole manual.
   8102 %
   8103 % But, this being TeX, we can't easily compare our node name against the
   8104 % string "Top" while ignoring the possible spaces before and after in
   8105 % the input.  By adding the arbitrary 7sp below, we make it much less
   8106 % likely that a real node name would have the same width as "Top" (e.g.,
   8107 % in a monospaced font).  Hopefully it will never happen in practice.
   8108 %
   8109 % For the same basic reason, we retypeset the "Top" at every
   8110 % reference, since the current font is indeterminate.
   8111 %
   8112 \def\crossmanualxref#1{%
   8113   \setbox\toprefbox = \hbox{Top\kern7sp}%
   8114   \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}%
   8115   \ifdim \wd2 > 7sp  % nonempty?
   8116     \ifdim \wd2 = \wd\toprefbox \else  % same as Top?
   8117       \putwordSection{} ``\printedrefname'' \putwordin{}\space
   8118     \fi
   8119   \fi
   8120   #1%
   8121 }
   8122 
   8123 % This macro is called from \xrefX for the `[nodename]' part of xref
   8124 % output.  It's a separate macro only so it can be changed more easily,
   8125 % since square brackets don't work well in some documents.  Particularly
   8126 % one that Bob is working on :).
   8127 %
   8128 \def\xrefprintnodename#1{[#1]}
   8129 
   8130 % Things referred to by \setref.
   8131 %
   8132 \def\Ynothing{}
   8133 \def\Yomitfromtoc{}
   8134 \def\Ynumbered{%
   8135   \ifnum\secno=0
   8136     \putwordChapter@tie \the\chapno
   8137   \else \ifnum\subsecno=0
   8138     \putwordSection@tie \the\chapno.\the\secno
   8139   \else \ifnum\subsubsecno=0
   8140     \putwordSection@tie \the\chapno.\the\secno.\the\subsecno
   8141   \else
   8142     \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno
   8143   \fi\fi\fi
   8144 }
   8145 \def\Yappendix{%
   8146   \ifnum\secno=0
   8147      \putwordAppendix@tie @char\the\appendixno{}%
   8148   \else \ifnum\subsecno=0
   8149      \putwordSection@tie @char\the\appendixno.\the\secno
   8150   \else \ifnum\subsubsecno=0
   8151     \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno
   8152   \else
   8153     \putwordSection@tie
   8154       @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno
   8155   \fi\fi\fi
   8156 }
   8157 
   8158 % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
   8159 % If its value is nonempty, SUFFIX is output afterward.
   8160 %
   8161 \def\refx#1#2{%
   8162   {%
   8163     \indexnofonts
   8164     \otherbackslash
   8165     \expandafter\global\expandafter\let\expandafter\thisrefX
   8166       \csname XR#1\endcsname
   8167   }%
   8168   \ifx\thisrefX\relax
   8169     % If not defined, say something at least.
   8170     \angleleft un\-de\-fined\angleright
   8171     \iflinks
   8172       \ifhavexrefs
   8173         {\toks0 = {#1}% avoid expansion of possibly-complex value
   8174          \message{\linenumber Undefined cross reference `\the\toks0'.}}%
   8175       \else
   8176         \ifwarnedxrefs\else
   8177           \global\warnedxrefstrue
   8178           \message{Cross reference values unknown; you must run TeX again.}%
   8179         \fi
   8180       \fi
   8181     \fi
   8182   \else
   8183     % It's defined, so just use it.
   8184     \thisrefX
   8185   \fi
   8186   #2% Output the suffix in any case.
   8187 }
   8188 
   8189 % This is the macro invoked by entries in the aux file.  Usually it's
   8190 % just a \def (we prepend XR to the control sequence name to avoid
   8191 % collisions).  But if this is a float type, we have more work to do.
   8192 %
   8193 \def\xrdef#1#2{%
   8194   {% The node name might contain 8-bit characters, which in our current
   8195    % implementation are changed to commands like @'e.  Don't let these
   8196    % mess up the control sequence name.
   8197     \indexnofonts
   8198     \turnoffactive
   8199     \xdef\safexrefname{#1}%
   8200   }%
   8201   %
   8202   \expandafter\gdef\csname XR\safexrefname\endcsname{#2}% remember this xref
   8203   %
   8204   % Was that xref control sequence that we just defined for a float?
   8205   \expandafter\iffloat\csname XR\safexrefname\endcsname
   8206     % it was a float, and we have the (safe) float type in \iffloattype.
   8207     \expandafter\let\expandafter\floatlist
   8208       \csname floatlist\iffloattype\endcsname
   8209     %
   8210     % Is this the first time we've seen this float type?
   8211     \expandafter\ifx\floatlist\relax
   8212       \toks0 = {\do}% yes, so just \do
   8213     \else
   8214       % had it before, so preserve previous elements in list.
   8215       \toks0 = \expandafter{\floatlist\do}%
   8216     \fi
   8217     %
   8218     % Remember this xref in the control sequence \floatlistFLOATTYPE,
   8219     % for later use in \listoffloats.
   8220     \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0
   8221       {\safexrefname}}%
   8222   \fi
   8223 }
   8224 
   8225 % Read the last existing aux file, if any.  No error if none exists.
   8226 %
   8227 \def\tryauxfile{%
   8228   \openin 1 \jobname.aux
   8229   \ifeof 1 \else
   8230     \readdatafile{aux}%
   8231     \global\havexrefstrue
   8232   \fi
   8233   \closein 1
   8234 }
   8235 
   8236 \def\setupdatafile{%
   8237   \catcode`\^^@=\other
   8238   \catcode`\^^A=\other
   8239   \catcode`\^^B=\other
   8240   \catcode`\^^C=\other
   8241   \catcode`\^^D=\other
   8242   \catcode`\^^E=\other
   8243   \catcode`\^^F=\other
   8244   \catcode`\^^G=\other
   8245   \catcode`\^^H=\other
   8246   \catcode`\^^K=\other
   8247   \catcode`\^^L=\other
   8248   \catcode`\^^N=\other
   8249   \catcode`\^^P=\other
   8250   \catcode`\^^Q=\other
   8251   \catcode`\^^R=\other
   8252   \catcode`\^^S=\other
   8253   \catcode`\^^T=\other
   8254   \catcode`\^^U=\other
   8255   \catcode`\^^V=\other
   8256   \catcode`\^^W=\other
   8257   \catcode`\^^X=\other
   8258   \catcode`\^^Z=\other
   8259   \catcode`\^^[=\other
   8260   \catcode`\^^\=\other
   8261   \catcode`\^^]=\other
   8262   \catcode`\^^^=\other
   8263   \catcode`\^^_=\other
   8264   % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc.
   8265   % in xref tags, i.e., node names.  But since ^^e4 notation isn't
   8266   % supported in the main text, it doesn't seem desirable.  Furthermore,
   8267   % that is not enough: for node names that actually contain a ^
   8268   % character, we would end up writing a line like this: 'xrdef {'hat
   8269   % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
   8270   % argument, and \hat is not an expandable control sequence.  It could
   8271   % all be worked out, but why?  Either we support ^^ or we don't.
   8272   %
   8273   % The other change necessary for this was to define \auxhat:
   8274   % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
   8275   % and then to call \auxhat in \setq.
   8276   %
   8277   \catcode`\^=\other
   8278   %
   8279   % Special characters.  Should be turned off anyway, but...
   8280   \catcode`\~=\other
   8281   \catcode`\[=\other
   8282   \catcode`\]=\other
   8283   \catcode`\"=\other
   8284   \catcode`\_=\other
   8285   \catcode`\|=\other
   8286   \catcode`\<=\other
   8287   \catcode`\>=\other
   8288   \catcode`\$=\other
   8289   \catcode`\#=\other
   8290   \catcode`\&=\other
   8291   \catcode`\%=\other
   8292   \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
   8293   %
   8294   % This is to support \ in node names and titles, since the \
   8295   % characters end up in a \csname.  It's easier than
   8296   % leaving it active and making its active definition an actual \
   8297   % character.  What I don't understand is why it works in the *value*
   8298   % of the xrdef.  Seems like it should be a catcode12 \, and that
   8299   % should not typeset properly.  But it works, so I'm moving on for
   8300   % now.  --karl, 15jan04.
   8301   \catcode`\\=\other
   8302   %
   8303   % Make the characters 128-255 be printing characters.
   8304   {%
   8305     \count1=128
   8306     \def\loop{%
   8307       \catcode\count1=\other
   8308       \advance\count1 by 1
   8309       \ifnum \count1<256 \loop \fi
   8310     }%
   8311   }%
   8312   %
   8313   % @ is our escape character in .aux files, and we need braces.
   8314   \catcode`\{=1
   8315   \catcode`\}=2
   8316   \catcode`\@=0
   8317 }
   8318 
   8319 \def\readdatafile#1{%
   8320 \begingroup
   8321   \setupdatafile
   8322   \input\jobname.#1
   8323 \endgroup}
   8324 
   8325 
   8326 \message{insertions,}
   8327 % including footnotes.
   8328 
   8329 \newcount \footnoteno
   8330 
   8331 % The trailing space in the following definition for supereject is
   8332 % vital for proper filling; pages come out unaligned when you do a
   8333 % pagealignmacro call if that space before the closing brace is
   8334 % removed. (Generally, numeric constants should always be followed by a
   8335 % space to prevent strange expansion errors.)
   8336 \def\supereject{\par\penalty -20000\footnoteno =0 }
   8337 
   8338 % @footnotestyle is meaningful for Info output only.
   8339 \let\footnotestyle=\comment
   8340 
   8341 {\catcode `\@=11
   8342 %
   8343 % Auto-number footnotes.  Otherwise like plain.
   8344 \gdef\footnote{%
   8345   \let\indent=\ptexindent
   8346   \let\noindent=\ptexnoindent
   8347   \global\advance\footnoteno by \@ne
   8348   \edef\thisfootno{$^{\the\footnoteno}$}%
   8349   %
   8350   % In case the footnote comes at the end of a sentence, preserve the
   8351   % extra spacing after we do the footnote number.
   8352   \let\@sf\empty
   8353   \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi
   8354   %
   8355   % Remove inadvertent blank space before typesetting the footnote number.
   8356   \unskip
   8357   \thisfootno\@sf
   8358   \dofootnote
   8359 }%
   8360 
   8361 % Don't bother with the trickery in plain.tex to not require the
   8362 % footnote text as a parameter.  Our footnotes don't need to be so general.
   8363 %
   8364 % Oh yes, they do; otherwise, @ifset (and anything else that uses
   8365 % \parseargline) fails inside footnotes because the tokens are fixed when
   8366 % the footnote is read.  --karl, 16nov96.
   8367 %
   8368 \gdef\dofootnote{%
   8369   \insert\footins\bgroup
   8370   % We want to typeset this text as a normal paragraph, even if the
   8371   % footnote reference occurs in (for example) a display environment.
   8372   % So reset some parameters.
   8373   \hsize=\pagewidth
   8374   \interlinepenalty\interfootnotelinepenalty
   8375   \splittopskip\ht\strutbox % top baseline for broken footnotes
   8376   \splitmaxdepth\dp\strutbox
   8377   \floatingpenalty\@MM
   8378   \leftskip\z@skip
   8379   \rightskip\z@skip
   8380   \spaceskip\z@skip
   8381   \xspaceskip\z@skip
   8382   \parindent\defaultparindent
   8383   %
   8384   \smallfonts \rm
   8385   %
   8386   % Because we use hanging indentation in footnotes, a @noindent appears
   8387   % to exdent this text, so make it be a no-op.  makeinfo does not use
   8388   % hanging indentation so @noindent can still be needed within footnote
   8389   % text after an @example or the like (not that this is good style).
   8390   \let\noindent = \relax
   8391   %
   8392   % Hang the footnote text off the number.  Use \everypar in case the
   8393   % footnote extends for more than one paragraph.
   8394   \everypar = {\hang}%
   8395   \textindent{\thisfootno}%
   8396   %
   8397   % Don't crash into the line above the footnote text.  Since this
   8398   % expands into a box, it must come within the paragraph, lest it
   8399   % provide a place where TeX can split the footnote.
   8400   \footstrut
   8401   %
   8402   % Invoke rest of plain TeX footnote routine.
   8403   \futurelet\next\fo@t
   8404 }
   8405 }%end \catcode `\@=11
   8406 
   8407 % In case a @footnote appears in a vbox, save the footnote text and create
   8408 % the real \insert just after the vbox finished.  Otherwise, the insertion
   8409 % would be lost.
   8410 % Similarly, if a @footnote appears inside an alignment, save the footnote
   8411 % text to a box and make the \insert when a row of the table is finished.
   8412 % And the same can be done for other insert classes.  --kasal, 16nov03.
   8413 
   8414 % Replace the \insert primitive by a cheating macro.
   8415 % Deeper inside, just make sure that the saved insertions are not spilled
   8416 % out prematurely.
   8417 %
   8418 \def\startsavinginserts{%
   8419   \ifx \insert\ptexinsert
   8420     \let\insert\saveinsert
   8421   \else
   8422     \let\checkinserts\relax
   8423   \fi
   8424 }
   8425 
   8426 % This \insert replacement works for both \insert\footins{foo} and
   8427 % \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}.
   8428 %
   8429 \def\saveinsert#1{%
   8430   \edef\next{\noexpand\savetobox \makeSAVEname#1}%
   8431   \afterassignment\next
   8432   % swallow the left brace
   8433   \let\temp =
   8434 }
   8435 \def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}}
   8436 \def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1}
   8437 
   8438 \def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi}
   8439 
   8440 \def\placesaveins#1{%
   8441   \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname
   8442     {\box#1}%
   8443 }
   8444 
   8445 % eat @SAVE -- beware, all of them have catcode \other:
   8446 {
   8447   \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials  %  ;-)
   8448   \gdef\gobblesave @SAVE{}
   8449 }
   8450 
   8451 % initialization:
   8452 \def\newsaveins #1{%
   8453   \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}%
   8454   \next
   8455 }
   8456 \def\newsaveinsX #1{%
   8457   \csname newbox\endcsname #1%
   8458   \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts
   8459     \checksaveins #1}%
   8460 }
   8461 
   8462 % initialize:
   8463 \let\checkinserts\empty
   8464 \newsaveins\footins
   8465 \newsaveins\margin
   8466 
   8467 
   8468 % @image.  We use the macros from epsf.tex to support this.
   8469 % If epsf.tex is not installed and @image is used, we complain.
   8470 %
   8471 % Check for and read epsf.tex up front.  If we read it only at @image
   8472 % time, we might be inside a group, and then its definitions would get
   8473 % undone and the next image would fail.
   8474 \openin 1 = epsf.tex
   8475 \ifeof 1 \else
   8476   % Do not bother showing banner with epsf.tex v2.7k (available in
   8477   % doc/epsf.tex and on ctan).
   8478   \def\epsfannounce{\toks0 = }%
   8479   \input epsf.tex
   8480 \fi
   8481 \closein 1
   8482 %
   8483 % We will only complain once about lack of epsf.tex.
   8484 \newif\ifwarnednoepsf
   8485 \newhelp\noepsfhelp{epsf.tex must be installed for images to
   8486   work.  It is also included in the Texinfo distribution, or you can get
   8487   it from ftp://tug.org/tex/epsf.tex.}
   8488 %
   8489 \def\image#1{%
   8490   \ifx\epsfbox\thisisundefined
   8491     \ifwarnednoepsf \else
   8492       \errhelp = \noepsfhelp
   8493       \errmessage{epsf.tex not found, images will be ignored}%
   8494       \global\warnednoepsftrue
   8495     \fi
   8496   \else
   8497     \imagexxx #1,,,,,\finish
   8498   \fi
   8499 }
   8500 %
   8501 % Arguments to @image:
   8502 % #1 is (mandatory) image filename; we tack on .eps extension.
   8503 % #2 is (optional) width, #3 is (optional) height.
   8504 % #4 is (ignored optional) html alt text.
   8505 % #5 is (ignored optional) extension.
   8506 % #6 is just the usual extra ignored arg for parsing stuff.
   8507 \newif\ifimagevmode
   8508 \def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
   8509   \catcode`\^^M = 5     % in case we're inside an example
   8510   \normalturnoffactive  % allow _ et al. in names
   8511   % If the image is by itself, center it.
   8512   \ifvmode
   8513     \imagevmodetrue
   8514   \else \ifx\centersub\centerV
   8515     % for @center @image, we need a vbox so we can have our vertical space
   8516     \imagevmodetrue
   8517     \vbox\bgroup % vbox has better behavior than vtop herev
   8518   \fi\fi
   8519   %
   8520   \ifimagevmode
   8521     \nobreak\medskip
   8522     % Usually we'll have text after the image which will insert
   8523     % \parskip glue, so insert it here too to equalize the space
   8524     % above and below.
   8525     \nobreak\vskip\parskip
   8526     \nobreak
   8527   \fi
   8528   %
   8529   % Leave vertical mode so that indentation from an enclosing
   8530   %  environment such as @quotation is respected.
   8531   % However, if we're at the top level, we don't want the
   8532   %  normal paragraph indentation.
   8533   % On the other hand, if we are in the case of @center @image, we don't
   8534   %  want to start a paragraph, which will create a hsize-width box and
   8535   %  eradicate the centering.
   8536   \ifx\centersub\centerV\else \noindent \fi
   8537   %
   8538   % Output the image.
   8539   \ifpdf
   8540     \dopdfimage{#1}{#2}{#3}%
   8541   \else
   8542     % \epsfbox itself resets \epsf?size at each figure.
   8543     \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
   8544     \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
   8545     \epsfbox{#1.eps}%
   8546   \fi
   8547   %
   8548   \ifimagevmode
   8549     \medskip  % space after a standalone image
   8550   \fi
   8551   \ifx\centersub\centerV \egroup \fi
   8552 \endgroup}
   8553 
   8554 
   8555 % @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables,
   8556 % etc.  We don't actually implement floating yet, we always include the
   8557 % float "here".  But it seemed the best name for the future.
   8558 %
   8559 \envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish}
   8560 
   8561 % There may be a space before second and/or third parameter; delete it.
   8562 \def\eatcommaspace#1, {#1,}
   8563 
   8564 % #1 is the optional FLOATTYPE, the text label for this float, typically
   8565 % "Figure", "Table", "Example", etc.  Can't contain commas.  If omitted,
   8566 % this float will not be numbered and cannot be referred to.
   8567 %
   8568 % #2 is the optional xref label.  Also must be present for the float to
   8569 % be referable.
   8570 %
   8571 % #3 is the optional positioning argument; for now, it is ignored.  It
   8572 % will somehow specify the positions allowed to float to (here, top, bottom).
   8573 %
   8574 % We keep a separate counter for each FLOATTYPE, which we reset at each
   8575 % chapter-level command.
   8576 \let\resetallfloatnos=\empty
   8577 %
   8578 \def\dofloat#1,#2,#3,#4\finish{%
   8579   \let\thiscaption=\empty
   8580   \let\thisshortcaption=\empty
   8581   %
   8582   % don't lose footnotes inside @float.
   8583   %
   8584   % BEWARE: when the floats start float, we have to issue warning whenever an
   8585   % insert appears inside a float which could possibly float. --kasal, 26may04
   8586   %
   8587   \startsavinginserts
   8588   %
   8589   % We can't be used inside a paragraph.
   8590   \par
   8591   %
   8592   \vtop\bgroup
   8593     \def\floattype{#1}%
   8594     \def\floatlabel{#2}%
   8595     \def\floatloc{#3}% we do nothing with this yet.
   8596     %
   8597     \ifx\floattype\empty
   8598       \let\safefloattype=\empty
   8599     \else
   8600       {%
   8601         % the floattype might have accents or other special characters,
   8602         % but we need to use it in a control sequence name.
   8603         \indexnofonts
   8604         \turnoffactive
   8605         \xdef\safefloattype{\floattype}%
   8606       }%
   8607     \fi
   8608     %
   8609     % If label is given but no type, we handle that as the empty type.
   8610     \ifx\floatlabel\empty \else
   8611       % We want each FLOATTYPE to be numbered separately (Figure 1,
   8612       % Table 1, Figure 2, ...).  (And if no label, no number.)
   8613       %
   8614       \expandafter\getfloatno\csname\safefloattype floatno\endcsname
   8615       \global\advance\floatno by 1
   8616       %
   8617       {%
   8618         % This magic value for \lastsection is output by \setref as the
   8619         % XREFLABEL-title value.  \xrefX uses it to distinguish float
   8620         % labels (which have a completely different output format) from
   8621         % node and anchor labels.  And \xrdef uses it to construct the
   8622         % lists of floats.
   8623         %
   8624         \edef\lastsection{\floatmagic=\safefloattype}%
   8625         \setref{\floatlabel}{Yfloat}%
   8626       }%
   8627     \fi
   8628     %
   8629     % start with \parskip glue, I guess.
   8630     \vskip\parskip
   8631     %
   8632     % Don't suppress indentation if a float happens to start a section.
   8633     \restorefirstparagraphindent
   8634 }
   8635 
   8636 % we have these possibilities:
   8637 % @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap
   8638 % @float Foo,lbl & no caption:    Foo 1.1
   8639 % @float Foo & @caption{Cap}:     Foo: Cap
   8640 % @float Foo & no caption:        Foo
   8641 % @float ,lbl & Caption{Cap}:     1.1: Cap
   8642 % @float ,lbl & no caption:       1.1
   8643 % @float & @caption{Cap}:         Cap
   8644 % @float & no caption:
   8645 %
   8646 \def\Efloat{%
   8647     \let\floatident = \empty
   8648     %
   8649     % In all cases, if we have a float type, it comes first.
   8650     \ifx\floattype\empty \else \def\floatident{\floattype}\fi
   8651     %
   8652     % If we have an xref label, the number comes next.
   8653     \ifx\floatlabel\empty \else
   8654       \ifx\floattype\empty \else % if also had float type, need tie first.
   8655         \appendtomacro\floatident{\tie}%
   8656       \fi
   8657       % the number.
   8658       \appendtomacro\floatident{\chaplevelprefix\the\floatno}%
   8659     \fi
   8660     %
   8661     % Start the printed caption with what we've constructed in
   8662     % \floatident, but keep it separate; we need \floatident again.
   8663     \let\captionline = \floatident
   8664     %
   8665     \ifx\thiscaption\empty \else
   8666       \ifx\floatident\empty \else
   8667 	\appendtomacro\captionline{: }% had ident, so need a colon between
   8668       \fi
   8669       %
   8670       % caption text.
   8671       \appendtomacro\captionline{\scanexp\thiscaption}%
   8672     \fi
   8673     %
   8674     % If we have anything to print, print it, with space before.
   8675     % Eventually this needs to become an \insert.
   8676     \ifx\captionline\empty \else
   8677       \vskip.5\parskip
   8678       \captionline
   8679       %
   8680       % Space below caption.
   8681       \vskip\parskip
   8682     \fi
   8683     %
   8684     % If have an xref label, write the list of floats info.  Do this
   8685     % after the caption, to avoid chance of it being a breakpoint.
   8686     \ifx\floatlabel\empty \else
   8687       % Write the text that goes in the lof to the aux file as
   8688       % \floatlabel-lof.  Besides \floatident, we include the short
   8689       % caption if specified, else the full caption if specified, else nothing.
   8690       {%
   8691         \atdummies
   8692         %
   8693         % since we read the caption text in the macro world, where ^^M
   8694         % is turned into a normal character, we have to scan it back, so
   8695         % we don't write the literal three characters "^^M" into the aux file.
   8696 	\scanexp{%
   8697 	  \xdef\noexpand\gtemp{%
   8698 	    \ifx\thisshortcaption\empty
   8699 	      \thiscaption
   8700 	    \else
   8701 	      \thisshortcaption
   8702 	    \fi
   8703 	  }%
   8704 	}%
   8705         \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident
   8706 	  \ifx\gtemp\empty \else : \gtemp \fi}}%
   8707       }%
   8708     \fi
   8709   \egroup  % end of \vtop
   8710   %
   8711   % place the captured inserts
   8712   %
   8713   % BEWARE: when the floats start floating, we have to issue warning
   8714   % whenever an insert appears inside a float which could possibly
   8715   % float. --kasal, 26may04
   8716   %
   8717   \checkinserts
   8718 }
   8719 
   8720 % Append the tokens #2 to the definition of macro #1, not expanding either.
   8721 %
   8722 \def\appendtomacro#1#2{%
   8723   \expandafter\def\expandafter#1\expandafter{#1#2}%
   8724 }
   8725 
   8726 % @caption, @shortcaption
   8727 %
   8728 \def\caption{\docaption\thiscaption}
   8729 \def\shortcaption{\docaption\thisshortcaption}
   8730 \def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption}
   8731 \def\defcaption#1#2{\egroup \def#1{#2}}
   8732 
   8733 % The parameter is the control sequence identifying the counter we are
   8734 % going to use.  Create it if it doesn't exist and assign it to \floatno.
   8735 \def\getfloatno#1{%
   8736   \ifx#1\relax
   8737       % Haven't seen this figure type before.
   8738       \csname newcount\endcsname #1%
   8739       %
   8740       % Remember to reset this floatno at the next chap.
   8741       \expandafter\gdef\expandafter\resetallfloatnos
   8742         \expandafter{\resetallfloatnos #1=0 }%
   8743   \fi
   8744   \let\floatno#1%
   8745 }
   8746 
   8747 % \setref calls this to get the XREFLABEL-snt value.  We want an @xref
   8748 % to the FLOATLABEL to expand to "Figure 3.1".  We call \setref when we
   8749 % first read the @float command.
   8750 %
   8751 \def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}%
   8752 
   8753 % Magic string used for the XREFLABEL-title value, so \xrefX can
   8754 % distinguish floats from other xref types.
   8755 \def\floatmagic{!!float!!}
   8756 
   8757 % #1 is the control sequence we are passed; we expand into a conditional
   8758 % which is true if #1 represents a float ref.  That is, the magic
   8759 % \lastsection value which we \setref above.
   8760 %
   8761 \def\iffloat#1{\expandafter\doiffloat#1==\finish}
   8762 %
   8763 % #1 is (maybe) the \floatmagic string.  If so, #2 will be the
   8764 % (safe) float type for this float.  We set \iffloattype to #2.
   8765 %
   8766 \def\doiffloat#1=#2=#3\finish{%
   8767   \def\temp{#1}%
   8768   \def\iffloattype{#2}%
   8769   \ifx\temp\floatmagic
   8770 }
   8771 
   8772 % @listoffloats FLOATTYPE - print a list of floats like a table of contents.
   8773 %
   8774 \parseargdef\listoffloats{%
   8775   \def\floattype{#1}% floattype
   8776   {%
   8777     % the floattype might have accents or other special characters,
   8778     % but we need to use it in a control sequence name.
   8779     \indexnofonts
   8780     \turnoffactive
   8781     \xdef\safefloattype{\floattype}%
   8782   }%
   8783   %
   8784   % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE.
   8785   \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax
   8786     \ifhavexrefs
   8787       % if the user said @listoffloats foo but never @float foo.
   8788       \message{\linenumber No `\safefloattype' floats to list.}%
   8789     \fi
   8790   \else
   8791     \begingroup
   8792       \leftskip=\tocindent  % indent these entries like a toc
   8793       \let\do=\listoffloatsdo
   8794       \csname floatlist\safefloattype\endcsname
   8795     \endgroup
   8796   \fi
   8797 }
   8798 
   8799 % This is called on each entry in a list of floats.  We're passed the
   8800 % xref label, in the form LABEL-title, which is how we save it in the
   8801 % aux file.  We strip off the -title and look up \XRLABEL-lof, which
   8802 % has the text we're supposed to typeset here.
   8803 %
   8804 % Figures without xref labels will not be included in the list (since
   8805 % they won't appear in the aux file).
   8806 %
   8807 \def\listoffloatsdo#1{\listoffloatsdoentry#1\finish}
   8808 \def\listoffloatsdoentry#1-title\finish{{%
   8809   % Can't fully expand XR#1-lof because it can contain anything.  Just
   8810   % pass the control sequence.  On the other hand, XR#1-pg is just the
   8811   % page number, and we want to fully expand that so we can get a link
   8812   % in pdf output.
   8813   \toksA = \expandafter{\csname XR#1-lof\endcsname}%
   8814   %
   8815   % use the same \entry macro we use to generate the TOC and index.
   8816   \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}%
   8817   \writeentry
   8818 }}
   8819 
   8820 
   8821 \message{localization,}
   8822 
   8823 % For single-language documents, @documentlanguage is usually given very
   8824 % early, just after @documentencoding.  Single argument is the language
   8825 % (de) or locale (de_DE) abbreviation.
   8826 %
   8827 {
   8828   \catcode`\_ = \active
   8829   \globaldefs=1
   8830 \parseargdef\documentlanguage{\begingroup
   8831   \let_=\normalunderscore  % normal _ character for filenames
   8832   \tex % read txi-??.tex file in plain TeX.
   8833     % Read the file by the name they passed if it exists.
   8834     \openin 1 txi-#1.tex
   8835     \ifeof 1
   8836       \documentlanguagetrywithoutunderscore{#1_\finish}%
   8837     \else
   8838       \globaldefs = 1  % everything in the txi-LL files needs to persist
   8839       \input txi-#1.tex
   8840     \fi
   8841     \closein 1
   8842   \endgroup % end raw TeX
   8843 \endgroup}
   8844 %
   8845 % If they passed de_DE, and txi-de_DE.tex doesn't exist,
   8846 % try txi-de.tex.
   8847 %
   8848 \gdef\documentlanguagetrywithoutunderscore#1_#2\finish{%
   8849   \openin 1 txi-#1.tex
   8850   \ifeof 1
   8851     \errhelp = \nolanghelp
   8852     \errmessage{Cannot read language file txi-#1.tex}%
   8853   \else
   8854     \globaldefs = 1  % everything in the txi-LL files needs to persist
   8855     \input txi-#1.tex
   8856   \fi
   8857   \closein 1
   8858 }
   8859 }% end of special _ catcode
   8860 %
   8861 \newhelp\nolanghelp{The given language definition file cannot be found or
   8862 is empty.  Maybe you need to install it?  Putting it in the current
   8863 directory should work if nowhere else does.}
   8864 
   8865 % This macro is called from txi-??.tex files; the first argument is the
   8866 % \language name to set (without the "\lang@" prefix), the second and
   8867 % third args are \{left,right}hyphenmin.
   8868 %
   8869 % The language names to pass are determined when the format is built.
   8870 % See the etex.log file created at that time, e.g.,
   8871 % /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log.
   8872 %
   8873 % With TeX Live 2008, etex now includes hyphenation patterns for all
   8874 % available languages.  This means we can support hyphenation in
   8875 % Texinfo, at least to some extent.  (This still doesn't solve the
   8876 % accented characters problem.)
   8877 %
   8878 \catcode`@=11
   8879 \def\txisetlanguage#1#2#3{%
   8880   % do not set the language if the name is undefined in the current TeX.
   8881   \expandafter\ifx\csname lang@#1\endcsname \relax
   8882     \message{no patterns for #1}%
   8883   \else
   8884     \global\language = \csname lang@#1\endcsname
   8885   \fi
   8886   % but there is no harm in adjusting the hyphenmin values regardless.
   8887   \global\lefthyphenmin = #2\relax
   8888   \global\righthyphenmin = #3\relax
   8889 }
   8890 
   8891 % Helpers for encodings.
   8892 % Set the catcode of characters 128 through 255 to the specified number.
   8893 %
   8894 \def\setnonasciicharscatcode#1{%
   8895    \count255=128
   8896    \loop\ifnum\count255<256
   8897       \global\catcode\count255=#1\relax
   8898       \advance\count255 by 1
   8899    \repeat
   8900 }
   8901 
   8902 \def\setnonasciicharscatcodenonglobal#1{%
   8903    \count255=128
   8904    \loop\ifnum\count255<256
   8905       \catcode\count255=#1\relax
   8906       \advance\count255 by 1
   8907    \repeat
   8908 }
   8909 
   8910 % @documentencoding sets the definition of non-ASCII characters
   8911 % according to the specified encoding.
   8912 %
   8913 \parseargdef\documentencoding{%
   8914   % Encoding being declared for the document.
   8915   \def\declaredencoding{\csname #1.enc\endcsname}%
   8916   %
   8917   % Supported encodings: names converted to tokens in order to be able
   8918   % to compare them with \ifx.
   8919   \def\ascii{\csname US-ASCII.enc\endcsname}%
   8920   \def\latnine{\csname ISO-8859-15.enc\endcsname}%
   8921   \def\latone{\csname ISO-8859-1.enc\endcsname}%
   8922   \def\lattwo{\csname ISO-8859-2.enc\endcsname}%
   8923   \def\utfeight{\csname UTF-8.enc\endcsname}%
   8924   %
   8925   \ifx \declaredencoding \ascii
   8926      \asciichardefs
   8927   %
   8928   \else \ifx \declaredencoding \lattwo
   8929      \setnonasciicharscatcode\active
   8930      \lattwochardefs
   8931   %
   8932   \else \ifx \declaredencoding \latone
   8933      \setnonasciicharscatcode\active
   8934      \latonechardefs
   8935   %
   8936   \else \ifx \declaredencoding \latnine
   8937      \setnonasciicharscatcode\active
   8938      \latninechardefs
   8939   %
   8940   \else \ifx \declaredencoding \utfeight
   8941      \setnonasciicharscatcode\active
   8942      \utfeightchardefs
   8943   %
   8944   \else
   8945     \message{Unknown document encoding #1, ignoring.}%
   8946   %
   8947   \fi % utfeight
   8948   \fi % latnine
   8949   \fi % latone
   8950   \fi % lattwo
   8951   \fi % ascii
   8952 }
   8953 
   8954 % A message to be logged when using a character that isn't available
   8955 % the default font encoding (OT1).
   8956 %
   8957 \def\missingcharmsg#1{\message{Character missing in OT1 encoding: #1.}}
   8958 
   8959 % Take account of \c (plain) vs. \, (Texinfo) difference.
   8960 \def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi}
   8961 
   8962 % First, make active non-ASCII characters in order for them to be
   8963 % correctly categorized when TeX reads the replacement text of
   8964 % macros containing the character definitions.
   8965 \setnonasciicharscatcode\active
   8966 %
   8967 % Latin1 (ISO-8859-1) character definitions.
   8968 \def\latonechardefs{%
   8969   \gdef^^a0{\tie}
   8970   \gdef^^a1{\exclamdown}
   8971   \gdef^^a2{\missingcharmsg{CENT SIGN}}
   8972   \gdef^^a3{{\pounds}}
   8973   \gdef^^a4{\missingcharmsg{CURRENCY SIGN}}
   8974   \gdef^^a5{\missingcharmsg{YEN SIGN}}
   8975   \gdef^^a6{\missingcharmsg{BROKEN BAR}}
   8976   \gdef^^a7{\S}
   8977   \gdef^^a8{\"{}}
   8978   \gdef^^a9{\copyright}
   8979   \gdef^^aa{\ordf}
   8980   \gdef^^ab{\guillemetleft}
   8981   \gdef^^ac{$\lnot$}
   8982   \gdef^^ad{\-}
   8983   \gdef^^ae{\registeredsymbol}
   8984   \gdef^^af{\={}}
   8985   %
   8986   \gdef^^b0{\textdegree}
   8987   \gdef^^b1{$\pm$}
   8988   \gdef^^b2{$^2$}
   8989   \gdef^^b3{$^3$}
   8990   \gdef^^b4{\'{}}
   8991   \gdef^^b5{$\mu$}
   8992   \gdef^^b6{\P}
   8993   %
   8994   \gdef^^b7{$^.$}
   8995   \gdef^^b8{\cedilla\ }
   8996   \gdef^^b9{$^1$}
   8997   \gdef^^ba{\ordm}
   8998   %
   8999   \gdef^^bb{\guillemetright}
   9000   \gdef^^bc{$1\over4$}
   9001   \gdef^^bd{$1\over2$}
   9002   \gdef^^be{$3\over4$}
   9003   \gdef^^bf{\questiondown}
   9004   %
   9005   \gdef^^c0{\`A}
   9006   \gdef^^c1{\'A}
   9007   \gdef^^c2{\^A}
   9008   \gdef^^c3{\~A}
   9009   \gdef^^c4{\"A}
   9010   \gdef^^c5{\ringaccent A}
   9011   \gdef^^c6{\AE}
   9012   \gdef^^c7{\cedilla C}
   9013   \gdef^^c8{\`E}
   9014   \gdef^^c9{\'E}
   9015   \gdef^^ca{\^E}
   9016   \gdef^^cb{\"E}
   9017   \gdef^^cc{\`I}
   9018   \gdef^^cd{\'I}
   9019   \gdef^^ce{\^I}
   9020   \gdef^^cf{\"I}
   9021   %
   9022   \gdef^^d0{\DH}
   9023   \gdef^^d1{\~N}
   9024   \gdef^^d2{\`O}
   9025   \gdef^^d3{\'O}
   9026   \gdef^^d4{\^O}
   9027   \gdef^^d5{\~O}
   9028   \gdef^^d6{\"O}
   9029   \gdef^^d7{$\times$}
   9030   \gdef^^d8{\O}
   9031   \gdef^^d9{\`U}
   9032   \gdef^^da{\'U}
   9033   \gdef^^db{\^U}
   9034   \gdef^^dc{\"U}
   9035   \gdef^^dd{\'Y}
   9036   \gdef^^de{\TH}
   9037   \gdef^^df{\ss}
   9038   %
   9039   \gdef^^e0{\`a}
   9040   \gdef^^e1{\'a}
   9041   \gdef^^e2{\^a}
   9042   \gdef^^e3{\~a}
   9043   \gdef^^e4{\"a}
   9044   \gdef^^e5{\ringaccent a}
   9045   \gdef^^e6{\ae}
   9046   \gdef^^e7{\cedilla c}
   9047   \gdef^^e8{\`e}
   9048   \gdef^^e9{\'e}
   9049   \gdef^^ea{\^e}
   9050   \gdef^^eb{\"e}
   9051   \gdef^^ec{\`{\dotless i}}
   9052   \gdef^^ed{\'{\dotless i}}
   9053   \gdef^^ee{\^{\dotless i}}
   9054   \gdef^^ef{\"{\dotless i}}
   9055   %
   9056   \gdef^^f0{\dh}
   9057   \gdef^^f1{\~n}
   9058   \gdef^^f2{\`o}
   9059   \gdef^^f3{\'o}
   9060   \gdef^^f4{\^o}
   9061   \gdef^^f5{\~o}
   9062   \gdef^^f6{\"o}
   9063   \gdef^^f7{$\div$}
   9064   \gdef^^f8{\o}
   9065   \gdef^^f9{\`u}
   9066   \gdef^^fa{\'u}
   9067   \gdef^^fb{\^u}
   9068   \gdef^^fc{\"u}
   9069   \gdef^^fd{\'y}
   9070   \gdef^^fe{\th}
   9071   \gdef^^ff{\"y}
   9072 }
   9073 
   9074 % Latin9 (ISO-8859-15) encoding character definitions.
   9075 \def\latninechardefs{%
   9076   % Encoding is almost identical to Latin1.
   9077   \latonechardefs
   9078   %
   9079   \gdef^^a4{\euro}
   9080   \gdef^^a6{\v S}
   9081   \gdef^^a8{\v s}
   9082   \gdef^^b4{\v Z}
   9083   \gdef^^b8{\v z}
   9084   \gdef^^bc{\OE}
   9085   \gdef^^bd{\oe}
   9086   \gdef^^be{\"Y}
   9087 }
   9088 
   9089 % Latin2 (ISO-8859-2) character definitions.
   9090 \def\lattwochardefs{%
   9091   \gdef^^a0{\tie}
   9092   \gdef^^a1{\ogonek{A}}
   9093   \gdef^^a2{\u{}}
   9094   \gdef^^a3{\L}
   9095   \gdef^^a4{\missingcharmsg{CURRENCY SIGN}}
   9096   \gdef^^a5{\v L}
   9097   \gdef^^a6{\'S}
   9098   \gdef^^a7{\S}
   9099   \gdef^^a8{\"{}}
   9100   \gdef^^a9{\v S}
   9101   \gdef^^aa{\cedilla S}
   9102   \gdef^^ab{\v T}
   9103   \gdef^^ac{\'Z}
   9104   \gdef^^ad{\-}
   9105   \gdef^^ae{\v Z}
   9106   \gdef^^af{\dotaccent Z}
   9107   %
   9108   \gdef^^b0{\textdegree}
   9109   \gdef^^b1{\ogonek{a}}
   9110   \gdef^^b2{\ogonek{ }}
   9111   \gdef^^b3{\l}
   9112   \gdef^^b4{\'{}}
   9113   \gdef^^b5{\v l}
   9114   \gdef^^b6{\'s}
   9115   \gdef^^b7{\v{}}
   9116   \gdef^^b8{\cedilla\ }
   9117   \gdef^^b9{\v s}
   9118   \gdef^^ba{\cedilla s}
   9119   \gdef^^bb{\v t}
   9120   \gdef^^bc{\'z}
   9121   \gdef^^bd{\H{}}
   9122   \gdef^^be{\v z}
   9123   \gdef^^bf{\dotaccent z}
   9124   %
   9125   \gdef^^c0{\'R}
   9126   \gdef^^c1{\'A}
   9127   \gdef^^c2{\^A}
   9128   \gdef^^c3{\u A}
   9129   \gdef^^c4{\"A}
   9130   \gdef^^c5{\'L}
   9131   \gdef^^c6{\'C}
   9132   \gdef^^c7{\cedilla C}
   9133   \gdef^^c8{\v C}
   9134   \gdef^^c9{\'E}
   9135   \gdef^^ca{\ogonek{E}}
   9136   \gdef^^cb{\"E}
   9137   \gdef^^cc{\v E}
   9138   \gdef^^cd{\'I}
   9139   \gdef^^ce{\^I}
   9140   \gdef^^cf{\v D}
   9141   %
   9142   \gdef^^d0{\DH}
   9143   \gdef^^d1{\'N}
   9144   \gdef^^d2{\v N}
   9145   \gdef^^d3{\'O}
   9146   \gdef^^d4{\^O}
   9147   \gdef^^d5{\H O}
   9148   \gdef^^d6{\"O}
   9149   \gdef^^d7{$\times$}
   9150   \gdef^^d8{\v R}
   9151   \gdef^^d9{\ringaccent U}
   9152   \gdef^^da{\'U}
   9153   \gdef^^db{\H U}
   9154   \gdef^^dc{\"U}
   9155   \gdef^^dd{\'Y}
   9156   \gdef^^de{\cedilla T}
   9157   \gdef^^df{\ss}
   9158   %
   9159   \gdef^^e0{\'r}
   9160   \gdef^^e1{\'a}
   9161   \gdef^^e2{\^a}
   9162   \gdef^^e3{\u a}
   9163   \gdef^^e4{\"a}
   9164   \gdef^^e5{\'l}
   9165   \gdef^^e6{\'c}
   9166   \gdef^^e7{\cedilla c}
   9167   \gdef^^e8{\v c}
   9168   \gdef^^e9{\'e}
   9169   \gdef^^ea{\ogonek{e}}
   9170   \gdef^^eb{\"e}
   9171   \gdef^^ec{\v e}
   9172   \gdef^^ed{\'{\dotless{i}}}
   9173   \gdef^^ee{\^{\dotless{i}}}
   9174   \gdef^^ef{\v d}
   9175   %
   9176   \gdef^^f0{\dh}
   9177   \gdef^^f1{\'n}
   9178   \gdef^^f2{\v n}
   9179   \gdef^^f3{\'o}
   9180   \gdef^^f4{\^o}
   9181   \gdef^^f5{\H o}
   9182   \gdef^^f6{\"o}
   9183   \gdef^^f7{$\div$}
   9184   \gdef^^f8{\v r}
   9185   \gdef^^f9{\ringaccent u}
   9186   \gdef^^fa{\'u}
   9187   \gdef^^fb{\H u}
   9188   \gdef^^fc{\"u}
   9189   \gdef^^fd{\'y}
   9190   \gdef^^fe{\cedilla t}
   9191   \gdef^^ff{\dotaccent{}}
   9192 }
   9193 
   9194 % UTF-8 character definitions.
   9195 %
   9196 % This code to support UTF-8 is based on LaTeX's utf8.def, with some
   9197 % changes for Texinfo conventions.  It is included here under the GPL by
   9198 % permission from Frank Mittelbach and the LaTeX team.
   9199 %
   9200 \newcount\countUTFx
   9201 \newcount\countUTFy
   9202 \newcount\countUTFz
   9203 
   9204 \gdef\UTFviiiTwoOctets#1#2{\expandafter
   9205    \UTFviiiDefined\csname u8:#1\string #2\endcsname}
   9206 %
   9207 \gdef\UTFviiiThreeOctets#1#2#3{\expandafter
   9208    \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname}
   9209 %
   9210 \gdef\UTFviiiFourOctets#1#2#3#4{\expandafter
   9211    \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname}
   9212 
   9213 \gdef\UTFviiiDefined#1{%
   9214   \ifx #1\relax
   9215     \message{\linenumber Unicode char \string #1 not defined for Texinfo}%
   9216   \else
   9217     \expandafter #1%
   9218   \fi
   9219 }
   9220 
   9221 \begingroup
   9222   \catcode`\~13
   9223   \catcode`\"12
   9224 
   9225   \def\UTFviiiLoop{%
   9226     \global\catcode\countUTFx\active
   9227     \uccode`\~\countUTFx
   9228     \uppercase\expandafter{\UTFviiiTmp}%
   9229     \advance\countUTFx by 1
   9230     \ifnum\countUTFx < \countUTFy
   9231       \expandafter\UTFviiiLoop
   9232     \fi}
   9233 
   9234   \countUTFx = "C2
   9235   \countUTFy = "E0
   9236   \def\UTFviiiTmp{%
   9237     \xdef~{\noexpand\UTFviiiTwoOctets\string~}}
   9238   \UTFviiiLoop
   9239 
   9240   \countUTFx = "E0
   9241   \countUTFy = "F0
   9242   \def\UTFviiiTmp{%
   9243     \xdef~{\noexpand\UTFviiiThreeOctets\string~}}
   9244   \UTFviiiLoop
   9245 
   9246   \countUTFx = "F0
   9247   \countUTFy = "F4
   9248   \def\UTFviiiTmp{%
   9249     \xdef~{\noexpand\UTFviiiFourOctets\string~}}
   9250   \UTFviiiLoop
   9251 \endgroup
   9252 
   9253 \begingroup
   9254   \catcode`\"=12
   9255   \catcode`\<=12
   9256   \catcode`\.=12
   9257   \catcode`\,=12
   9258   \catcode`\;=12
   9259   \catcode`\!=12
   9260   \catcode`\~=13
   9261 
   9262   \gdef\DeclareUnicodeCharacter#1#2{%
   9263     \countUTFz = "#1\relax
   9264     %\wlog{\space\space defining Unicode char U+#1 (decimal \the\countUTFz)}%
   9265     \begingroup
   9266       \parseXMLCharref
   9267       \def\UTFviiiTwoOctets##1##2{%
   9268         \csname u8:##1\string ##2\endcsname}%
   9269       \def\UTFviiiThreeOctets##1##2##3{%
   9270         \csname u8:##1\string ##2\string ##3\endcsname}%
   9271       \def\UTFviiiFourOctets##1##2##3##4{%
   9272         \csname u8:##1\string ##2\string ##3\string ##4\endcsname}%
   9273       \expandafter\expandafter\expandafter\expandafter
   9274        \expandafter\expandafter\expandafter
   9275        \gdef\UTFviiiTmp{#2}%
   9276     \endgroup}
   9277 
   9278   \gdef\parseXMLCharref{%
   9279     \ifnum\countUTFz < "A0\relax
   9280       \errhelp = \EMsimple
   9281       \errmessage{Cannot define Unicode char value < 00A0}%
   9282     \else\ifnum\countUTFz < "800\relax
   9283       \parseUTFviiiA,%
   9284       \parseUTFviiiB C\UTFviiiTwoOctets.,%
   9285     \else\ifnum\countUTFz < "10000\relax
   9286       \parseUTFviiiA;%
   9287       \parseUTFviiiA,%
   9288       \parseUTFviiiB E\UTFviiiThreeOctets.{,;}%
   9289     \else
   9290       \parseUTFviiiA;%
   9291       \parseUTFviiiA,%
   9292       \parseUTFviiiA!%
   9293       \parseUTFviiiB F\UTFviiiFourOctets.{!,;}%
   9294     \fi\fi\fi
   9295   }
   9296 
   9297   \gdef\parseUTFviiiA#1{%
   9298     \countUTFx = \countUTFz
   9299     \divide\countUTFz by 64
   9300     \countUTFy = \countUTFz
   9301     \multiply\countUTFz by 64
   9302     \advance\countUTFx by -\countUTFz
   9303     \advance\countUTFx by 128
   9304     \uccode `#1\countUTFx
   9305     \countUTFz = \countUTFy}
   9306 
   9307   \gdef\parseUTFviiiB#1#2#3#4{%
   9308     \advance\countUTFz by "#10\relax
   9309     \uccode `#3\countUTFz
   9310     \uppercase{\gdef\UTFviiiTmp{#2#3#4}}}
   9311 \endgroup
   9312 
   9313 \def\utfeightchardefs{%
   9314   \DeclareUnicodeCharacter{00A0}{\tie}
   9315   \DeclareUnicodeCharacter{00A1}{\exclamdown}
   9316   \DeclareUnicodeCharacter{00A3}{\pounds}
   9317   \DeclareUnicodeCharacter{00A8}{\"{ }}
   9318   \DeclareUnicodeCharacter{00A9}{\copyright}
   9319   \DeclareUnicodeCharacter{00AA}{\ordf}
   9320   \DeclareUnicodeCharacter{00AB}{\guillemetleft}
   9321   \DeclareUnicodeCharacter{00AD}{\-}
   9322   \DeclareUnicodeCharacter{00AE}{\registeredsymbol}
   9323   \DeclareUnicodeCharacter{00AF}{\={ }}
   9324 
   9325   \DeclareUnicodeCharacter{00B0}{\ringaccent{ }}
   9326   \DeclareUnicodeCharacter{00B4}{\'{ }}
   9327   \DeclareUnicodeCharacter{00B8}{\cedilla{ }}
   9328   \DeclareUnicodeCharacter{00BA}{\ordm}
   9329   \DeclareUnicodeCharacter{00BB}{\guillemetright}
   9330   \DeclareUnicodeCharacter{00BF}{\questiondown}
   9331 
   9332   \DeclareUnicodeCharacter{00C0}{\`A}
   9333   \DeclareUnicodeCharacter{00C1}{\'A}
   9334   \DeclareUnicodeCharacter{00C2}{\^A}
   9335   \DeclareUnicodeCharacter{00C3}{\~A}
   9336   \DeclareUnicodeCharacter{00C4}{\"A}
   9337   \DeclareUnicodeCharacter{00C5}{\AA}
   9338   \DeclareUnicodeCharacter{00C6}{\AE}
   9339   \DeclareUnicodeCharacter{00C7}{\cedilla{C}}
   9340   \DeclareUnicodeCharacter{00C8}{\`E}
   9341   \DeclareUnicodeCharacter{00C9}{\'E}
   9342   \DeclareUnicodeCharacter{00CA}{\^E}
   9343   \DeclareUnicodeCharacter{00CB}{\"E}
   9344   \DeclareUnicodeCharacter{00CC}{\`I}
   9345   \DeclareUnicodeCharacter{00CD}{\'I}
   9346   \DeclareUnicodeCharacter{00CE}{\^I}
   9347   \DeclareUnicodeCharacter{00CF}{\"I}
   9348 
   9349   \DeclareUnicodeCharacter{00D0}{\DH}
   9350   \DeclareUnicodeCharacter{00D1}{\~N}
   9351   \DeclareUnicodeCharacter{00D2}{\`O}
   9352   \DeclareUnicodeCharacter{00D3}{\'O}
   9353   \DeclareUnicodeCharacter{00D4}{\^O}
   9354   \DeclareUnicodeCharacter{00D5}{\~O}
   9355   \DeclareUnicodeCharacter{00D6}{\"O}
   9356   \DeclareUnicodeCharacter{00D8}{\O}
   9357   \DeclareUnicodeCharacter{00D9}{\`U}
   9358   \DeclareUnicodeCharacter{00DA}{\'U}
   9359   \DeclareUnicodeCharacter{00DB}{\^U}
   9360   \DeclareUnicodeCharacter{00DC}{\"U}
   9361   \DeclareUnicodeCharacter{00DD}{\'Y}
   9362   \DeclareUnicodeCharacter{00DE}{\TH}
   9363   \DeclareUnicodeCharacter{00DF}{\ss}
   9364 
   9365   \DeclareUnicodeCharacter{00E0}{\`a}
   9366   \DeclareUnicodeCharacter{00E1}{\'a}
   9367   \DeclareUnicodeCharacter{00E2}{\^a}
   9368   \DeclareUnicodeCharacter{00E3}{\~a}
   9369   \DeclareUnicodeCharacter{00E4}{\"a}
   9370   \DeclareUnicodeCharacter{00E5}{\aa}
   9371   \DeclareUnicodeCharacter{00E6}{\ae}
   9372   \DeclareUnicodeCharacter{00E7}{\cedilla{c}}
   9373   \DeclareUnicodeCharacter{00E8}{\`e}
   9374   \DeclareUnicodeCharacter{00E9}{\'e}
   9375   \DeclareUnicodeCharacter{00EA}{\^e}
   9376   \DeclareUnicodeCharacter{00EB}{\"e}
   9377   \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}}
   9378   \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}}
   9379   \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}}
   9380   \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}}
   9381 
   9382   \DeclareUnicodeCharacter{00F0}{\dh}
   9383   \DeclareUnicodeCharacter{00F1}{\~n}
   9384   \DeclareUnicodeCharacter{00F2}{\`o}
   9385   \DeclareUnicodeCharacter{00F3}{\'o}
   9386   \DeclareUnicodeCharacter{00F4}{\^o}
   9387   \DeclareUnicodeCharacter{00F5}{\~o}
   9388   \DeclareUnicodeCharacter{00F6}{\"o}
   9389   \DeclareUnicodeCharacter{00F8}{\o}
   9390   \DeclareUnicodeCharacter{00F9}{\`u}
   9391   \DeclareUnicodeCharacter{00FA}{\'u}
   9392   \DeclareUnicodeCharacter{00FB}{\^u}
   9393   \DeclareUnicodeCharacter{00FC}{\"u}
   9394   \DeclareUnicodeCharacter{00FD}{\'y}
   9395   \DeclareUnicodeCharacter{00FE}{\th}
   9396   \DeclareUnicodeCharacter{00FF}{\"y}
   9397 
   9398   \DeclareUnicodeCharacter{0100}{\=A}
   9399   \DeclareUnicodeCharacter{0101}{\=a}
   9400   \DeclareUnicodeCharacter{0102}{\u{A}}
   9401   \DeclareUnicodeCharacter{0103}{\u{a}}
   9402   \DeclareUnicodeCharacter{0104}{\ogonek{A}}
   9403   \DeclareUnicodeCharacter{0105}{\ogonek{a}}
   9404   \DeclareUnicodeCharacter{0106}{\'C}
   9405   \DeclareUnicodeCharacter{0107}{\'c}
   9406   \DeclareUnicodeCharacter{0108}{\^C}
   9407   \DeclareUnicodeCharacter{0109}{\^c}
   9408   \DeclareUnicodeCharacter{0118}{\ogonek{E}}
   9409   \DeclareUnicodeCharacter{0119}{\ogonek{e}}
   9410   \DeclareUnicodeCharacter{010A}{\dotaccent{C}}
   9411   \DeclareUnicodeCharacter{010B}{\dotaccent{c}}
   9412   \DeclareUnicodeCharacter{010C}{\v{C}}
   9413   \DeclareUnicodeCharacter{010D}{\v{c}}
   9414   \DeclareUnicodeCharacter{010E}{\v{D}}
   9415 
   9416   \DeclareUnicodeCharacter{0112}{\=E}
   9417   \DeclareUnicodeCharacter{0113}{\=e}
   9418   \DeclareUnicodeCharacter{0114}{\u{E}}
   9419   \DeclareUnicodeCharacter{0115}{\u{e}}
   9420   \DeclareUnicodeCharacter{0116}{\dotaccent{E}}
   9421   \DeclareUnicodeCharacter{0117}{\dotaccent{e}}
   9422   \DeclareUnicodeCharacter{011A}{\v{E}}
   9423   \DeclareUnicodeCharacter{011B}{\v{e}}
   9424   \DeclareUnicodeCharacter{011C}{\^G}
   9425   \DeclareUnicodeCharacter{011D}{\^g}
   9426   \DeclareUnicodeCharacter{011E}{\u{G}}
   9427   \DeclareUnicodeCharacter{011F}{\u{g}}
   9428 
   9429   \DeclareUnicodeCharacter{0120}{\dotaccent{G}}
   9430   \DeclareUnicodeCharacter{0121}{\dotaccent{g}}
   9431   \DeclareUnicodeCharacter{0124}{\^H}
   9432   \DeclareUnicodeCharacter{0125}{\^h}
   9433   \DeclareUnicodeCharacter{0128}{\~I}
   9434   \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}}
   9435   \DeclareUnicodeCharacter{012A}{\=I}
   9436   \DeclareUnicodeCharacter{012B}{\={\dotless{i}}}
   9437   \DeclareUnicodeCharacter{012C}{\u{I}}
   9438   \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}}
   9439 
   9440   \DeclareUnicodeCharacter{0130}{\dotaccent{I}}
   9441   \DeclareUnicodeCharacter{0131}{\dotless{i}}
   9442   \DeclareUnicodeCharacter{0132}{IJ}
   9443   \DeclareUnicodeCharacter{0133}{ij}
   9444   \DeclareUnicodeCharacter{0134}{\^J}
   9445   \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}}
   9446   \DeclareUnicodeCharacter{0139}{\'L}
   9447   \DeclareUnicodeCharacter{013A}{\'l}
   9448 
   9449   \DeclareUnicodeCharacter{0141}{\L}
   9450   \DeclareUnicodeCharacter{0142}{\l}
   9451   \DeclareUnicodeCharacter{0143}{\'N}
   9452   \DeclareUnicodeCharacter{0144}{\'n}
   9453   \DeclareUnicodeCharacter{0147}{\v{N}}
   9454   \DeclareUnicodeCharacter{0148}{\v{n}}
   9455   \DeclareUnicodeCharacter{014C}{\=O}
   9456   \DeclareUnicodeCharacter{014D}{\=o}
   9457   \DeclareUnicodeCharacter{014E}{\u{O}}
   9458   \DeclareUnicodeCharacter{014F}{\u{o}}
   9459 
   9460   \DeclareUnicodeCharacter{0150}{\H{O}}
   9461   \DeclareUnicodeCharacter{0151}{\H{o}}
   9462   \DeclareUnicodeCharacter{0152}{\OE}
   9463   \DeclareUnicodeCharacter{0153}{\oe}
   9464   \DeclareUnicodeCharacter{0154}{\'R}
   9465   \DeclareUnicodeCharacter{0155}{\'r}
   9466   \DeclareUnicodeCharacter{0158}{\v{R}}
   9467   \DeclareUnicodeCharacter{0159}{\v{r}}
   9468   \DeclareUnicodeCharacter{015A}{\'S}
   9469   \DeclareUnicodeCharacter{015B}{\'s}
   9470   \DeclareUnicodeCharacter{015C}{\^S}
   9471   \DeclareUnicodeCharacter{015D}{\^s}
   9472   \DeclareUnicodeCharacter{015E}{\cedilla{S}}
   9473   \DeclareUnicodeCharacter{015F}{\cedilla{s}}
   9474 
   9475   \DeclareUnicodeCharacter{0160}{\v{S}}
   9476   \DeclareUnicodeCharacter{0161}{\v{s}}
   9477   \DeclareUnicodeCharacter{0162}{\cedilla{t}}
   9478   \DeclareUnicodeCharacter{0163}{\cedilla{T}}
   9479   \DeclareUnicodeCharacter{0164}{\v{T}}
   9480 
   9481   \DeclareUnicodeCharacter{0168}{\~U}
   9482   \DeclareUnicodeCharacter{0169}{\~u}
   9483   \DeclareUnicodeCharacter{016A}{\=U}
   9484   \DeclareUnicodeCharacter{016B}{\=u}
   9485   \DeclareUnicodeCharacter{016C}{\u{U}}
   9486   \DeclareUnicodeCharacter{016D}{\u{u}}
   9487   \DeclareUnicodeCharacter{016E}{\ringaccent{U}}
   9488   \DeclareUnicodeCharacter{016F}{\ringaccent{u}}
   9489 
   9490   \DeclareUnicodeCharacter{0170}{\H{U}}
   9491   \DeclareUnicodeCharacter{0171}{\H{u}}
   9492   \DeclareUnicodeCharacter{0174}{\^W}
   9493   \DeclareUnicodeCharacter{0175}{\^w}
   9494   \DeclareUnicodeCharacter{0176}{\^Y}
   9495   \DeclareUnicodeCharacter{0177}{\^y}
   9496   \DeclareUnicodeCharacter{0178}{\"Y}
   9497   \DeclareUnicodeCharacter{0179}{\'Z}
   9498   \DeclareUnicodeCharacter{017A}{\'z}
   9499   \DeclareUnicodeCharacter{017B}{\dotaccent{Z}}
   9500   \DeclareUnicodeCharacter{017C}{\dotaccent{z}}
   9501   \DeclareUnicodeCharacter{017D}{\v{Z}}
   9502   \DeclareUnicodeCharacter{017E}{\v{z}}
   9503 
   9504   \DeclareUnicodeCharacter{01C4}{D\v{Z}}
   9505   \DeclareUnicodeCharacter{01C5}{D\v{z}}
   9506   \DeclareUnicodeCharacter{01C6}{d\v{z}}
   9507   \DeclareUnicodeCharacter{01C7}{LJ}
   9508   \DeclareUnicodeCharacter{01C8}{Lj}
   9509   \DeclareUnicodeCharacter{01C9}{lj}
   9510   \DeclareUnicodeCharacter{01CA}{NJ}
   9511   \DeclareUnicodeCharacter{01CB}{Nj}
   9512   \DeclareUnicodeCharacter{01CC}{nj}
   9513   \DeclareUnicodeCharacter{01CD}{\v{A}}
   9514   \DeclareUnicodeCharacter{01CE}{\v{a}}
   9515   \DeclareUnicodeCharacter{01CF}{\v{I}}
   9516 
   9517   \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}}
   9518   \DeclareUnicodeCharacter{01D1}{\v{O}}
   9519   \DeclareUnicodeCharacter{01D2}{\v{o}}
   9520   \DeclareUnicodeCharacter{01D3}{\v{U}}
   9521   \DeclareUnicodeCharacter{01D4}{\v{u}}
   9522 
   9523   \DeclareUnicodeCharacter{01E2}{\={\AE}}
   9524   \DeclareUnicodeCharacter{01E3}{\={\ae}}
   9525   \DeclareUnicodeCharacter{01E6}{\v{G}}
   9526   \DeclareUnicodeCharacter{01E7}{\v{g}}
   9527   \DeclareUnicodeCharacter{01E8}{\v{K}}
   9528   \DeclareUnicodeCharacter{01E9}{\v{k}}
   9529 
   9530   \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}}
   9531   \DeclareUnicodeCharacter{01F1}{DZ}
   9532   \DeclareUnicodeCharacter{01F2}{Dz}
   9533   \DeclareUnicodeCharacter{01F3}{dz}
   9534   \DeclareUnicodeCharacter{01F4}{\'G}
   9535   \DeclareUnicodeCharacter{01F5}{\'g}
   9536   \DeclareUnicodeCharacter{01F8}{\`N}
   9537   \DeclareUnicodeCharacter{01F9}{\`n}
   9538   \DeclareUnicodeCharacter{01FC}{\'{\AE}}
   9539   \DeclareUnicodeCharacter{01FD}{\'{\ae}}
   9540   \DeclareUnicodeCharacter{01FE}{\'{\O}}
   9541   \DeclareUnicodeCharacter{01FF}{\'{\o}}
   9542 
   9543   \DeclareUnicodeCharacter{021E}{\v{H}}
   9544   \DeclareUnicodeCharacter{021F}{\v{h}}
   9545 
   9546   \DeclareUnicodeCharacter{0226}{\dotaccent{A}}
   9547   \DeclareUnicodeCharacter{0227}{\dotaccent{a}}
   9548   \DeclareUnicodeCharacter{0228}{\cedilla{E}}
   9549   \DeclareUnicodeCharacter{0229}{\cedilla{e}}
   9550   \DeclareUnicodeCharacter{022E}{\dotaccent{O}}
   9551   \DeclareUnicodeCharacter{022F}{\dotaccent{o}}
   9552 
   9553   \DeclareUnicodeCharacter{0232}{\=Y}
   9554   \DeclareUnicodeCharacter{0233}{\=y}
   9555   \DeclareUnicodeCharacter{0237}{\dotless{j}}
   9556 
   9557   \DeclareUnicodeCharacter{02DB}{\ogonek{ }}
   9558 
   9559   \DeclareUnicodeCharacter{1E02}{\dotaccent{B}}
   9560   \DeclareUnicodeCharacter{1E03}{\dotaccent{b}}
   9561   \DeclareUnicodeCharacter{1E04}{\udotaccent{B}}
   9562   \DeclareUnicodeCharacter{1E05}{\udotaccent{b}}
   9563   \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}}
   9564   \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}}
   9565   \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}}
   9566   \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}}
   9567   \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}}
   9568   \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}}
   9569   \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}}
   9570   \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}}
   9571 
   9572   \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}}
   9573   \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}}
   9574 
   9575   \DeclareUnicodeCharacter{1E20}{\=G}
   9576   \DeclareUnicodeCharacter{1E21}{\=g}
   9577   \DeclareUnicodeCharacter{1E22}{\dotaccent{H}}
   9578   \DeclareUnicodeCharacter{1E23}{\dotaccent{h}}
   9579   \DeclareUnicodeCharacter{1E24}{\udotaccent{H}}
   9580   \DeclareUnicodeCharacter{1E25}{\udotaccent{h}}
   9581   \DeclareUnicodeCharacter{1E26}{\"H}
   9582   \DeclareUnicodeCharacter{1E27}{\"h}
   9583 
   9584   \DeclareUnicodeCharacter{1E30}{\'K}
   9585   \DeclareUnicodeCharacter{1E31}{\'k}
   9586   \DeclareUnicodeCharacter{1E32}{\udotaccent{K}}
   9587   \DeclareUnicodeCharacter{1E33}{\udotaccent{k}}
   9588   \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}}
   9589   \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}}
   9590   \DeclareUnicodeCharacter{1E36}{\udotaccent{L}}
   9591   \DeclareUnicodeCharacter{1E37}{\udotaccent{l}}
   9592   \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}}
   9593   \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}}
   9594   \DeclareUnicodeCharacter{1E3E}{\'M}
   9595   \DeclareUnicodeCharacter{1E3F}{\'m}
   9596 
   9597   \DeclareUnicodeCharacter{1E40}{\dotaccent{M}}
   9598   \DeclareUnicodeCharacter{1E41}{\dotaccent{m}}
   9599   \DeclareUnicodeCharacter{1E42}{\udotaccent{M}}
   9600   \DeclareUnicodeCharacter{1E43}{\udotaccent{m}}
   9601   \DeclareUnicodeCharacter{1E44}{\dotaccent{N}}
   9602   \DeclareUnicodeCharacter{1E45}{\dotaccent{n}}
   9603   \DeclareUnicodeCharacter{1E46}{\udotaccent{N}}
   9604   \DeclareUnicodeCharacter{1E47}{\udotaccent{n}}
   9605   \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}}
   9606   \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}}
   9607 
   9608   \DeclareUnicodeCharacter{1E54}{\'P}
   9609   \DeclareUnicodeCharacter{1E55}{\'p}
   9610   \DeclareUnicodeCharacter{1E56}{\dotaccent{P}}
   9611   \DeclareUnicodeCharacter{1E57}{\dotaccent{p}}
   9612   \DeclareUnicodeCharacter{1E58}{\dotaccent{R}}
   9613   \DeclareUnicodeCharacter{1E59}{\dotaccent{r}}
   9614   \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}}
   9615   \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}}
   9616   \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}}
   9617   \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}}
   9618 
   9619   \DeclareUnicodeCharacter{1E60}{\dotaccent{S}}
   9620   \DeclareUnicodeCharacter{1E61}{\dotaccent{s}}
   9621   \DeclareUnicodeCharacter{1E62}{\udotaccent{S}}
   9622   \DeclareUnicodeCharacter{1E63}{\udotaccent{s}}
   9623   \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}}
   9624   \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}}
   9625   \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}}
   9626   \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}}
   9627   \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}}
   9628   \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}}
   9629 
   9630   \DeclareUnicodeCharacter{1E7C}{\~V}
   9631   \DeclareUnicodeCharacter{1E7D}{\~v}
   9632   \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}}
   9633   \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}}
   9634 
   9635   \DeclareUnicodeCharacter{1E80}{\`W}
   9636   \DeclareUnicodeCharacter{1E81}{\`w}
   9637   \DeclareUnicodeCharacter{1E82}{\'W}
   9638   \DeclareUnicodeCharacter{1E83}{\'w}
   9639   \DeclareUnicodeCharacter{1E84}{\"W}
   9640   \DeclareUnicodeCharacter{1E85}{\"w}
   9641   \DeclareUnicodeCharacter{1E86}{\dotaccent{W}}
   9642   \DeclareUnicodeCharacter{1E87}{\dotaccent{w}}
   9643   \DeclareUnicodeCharacter{1E88}{\udotaccent{W}}
   9644   \DeclareUnicodeCharacter{1E89}{\udotaccent{w}}
   9645   \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}}
   9646   \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}}
   9647   \DeclareUnicodeCharacter{1E8C}{\"X}
   9648   \DeclareUnicodeCharacter{1E8D}{\"x}
   9649   \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}}
   9650   \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}}
   9651 
   9652   \DeclareUnicodeCharacter{1E90}{\^Z}
   9653   \DeclareUnicodeCharacter{1E91}{\^z}
   9654   \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}}
   9655   \DeclareUnicodeCharacter{1E93}{\udotaccent{z}}
   9656   \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}}
   9657   \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}}
   9658   \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}}
   9659   \DeclareUnicodeCharacter{1E97}{\"t}
   9660   \DeclareUnicodeCharacter{1E98}{\ringaccent{w}}
   9661   \DeclareUnicodeCharacter{1E99}{\ringaccent{y}}
   9662 
   9663   \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}}
   9664   \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}}
   9665 
   9666   \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}}
   9667   \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}}
   9668   \DeclareUnicodeCharacter{1EBC}{\~E}
   9669   \DeclareUnicodeCharacter{1EBD}{\~e}
   9670 
   9671   \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}}
   9672   \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}}
   9673   \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}}
   9674   \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}}
   9675 
   9676   \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}}
   9677   \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}}
   9678 
   9679   \DeclareUnicodeCharacter{1EF2}{\`Y}
   9680   \DeclareUnicodeCharacter{1EF3}{\`y}
   9681   \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}}
   9682 
   9683   \DeclareUnicodeCharacter{1EF8}{\~Y}
   9684   \DeclareUnicodeCharacter{1EF9}{\~y}
   9685 
   9686   \DeclareUnicodeCharacter{2013}{--}
   9687   \DeclareUnicodeCharacter{2014}{---}
   9688   \DeclareUnicodeCharacter{2018}{\quoteleft}
   9689   \DeclareUnicodeCharacter{2019}{\quoteright}
   9690   \DeclareUnicodeCharacter{201A}{\quotesinglbase}
   9691   \DeclareUnicodeCharacter{201C}{\quotedblleft}
   9692   \DeclareUnicodeCharacter{201D}{\quotedblright}
   9693   \DeclareUnicodeCharacter{201E}{\quotedblbase}
   9694   \DeclareUnicodeCharacter{2022}{\bullet}
   9695   \DeclareUnicodeCharacter{2026}{\dots}
   9696   \DeclareUnicodeCharacter{2039}{\guilsinglleft}
   9697   \DeclareUnicodeCharacter{203A}{\guilsinglright}
   9698   \DeclareUnicodeCharacter{20AC}{\euro}
   9699 
   9700   \DeclareUnicodeCharacter{2192}{\expansion}
   9701   \DeclareUnicodeCharacter{21D2}{\result}
   9702 
   9703   \DeclareUnicodeCharacter{2212}{\minus}
   9704   \DeclareUnicodeCharacter{2217}{\point}
   9705   \DeclareUnicodeCharacter{2261}{\equiv}
   9706 }% end of \utfeightchardefs
   9707 
   9708 
   9709 % US-ASCII character definitions.
   9710 \def\asciichardefs{% nothing need be done
   9711    \relax
   9712 }
   9713 
   9714 % Make non-ASCII characters printable again for compatibility with
   9715 % existing Texinfo documents that may use them, even without declaring a
   9716 % document encoding.
   9717 %
   9718 \setnonasciicharscatcode \other
   9719 
   9720 
   9721 \message{formatting,}
   9722 
   9723 \newdimen\defaultparindent \defaultparindent = 15pt
   9724 
   9725 \chapheadingskip = 15pt plus 4pt minus 2pt
   9726 \secheadingskip = 12pt plus 3pt minus 2pt
   9727 \subsecheadingskip = 9pt plus 2pt minus 2pt
   9728 
   9729 % Prevent underfull vbox error messages.
   9730 \vbadness = 10000
   9731 
   9732 % Don't be very finicky about underfull hboxes, either.
   9733 \hbadness = 6666
   9734 
   9735 % Following George Bush, get rid of widows and orphans.
   9736 \widowpenalty=10000
   9737 \clubpenalty=10000
   9738 
   9739 % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
   9740 % using an old version of TeX, don't do anything.  We want the amount of
   9741 % stretch added to depend on the line length, hence the dependence on
   9742 % \hsize.  We call this whenever the paper size is set.
   9743 %
   9744 \def\setemergencystretch{%
   9745   \ifx\emergencystretch\thisisundefined
   9746     % Allow us to assign to \emergencystretch anyway.
   9747     \def\emergencystretch{\dimen0}%
   9748   \else
   9749     \emergencystretch = .15\hsize
   9750   \fi
   9751 }
   9752 
   9753 % Parameters in order: 1) textheight; 2) textwidth;
   9754 % 3) voffset; 4) hoffset; 5) binding offset; 6) topskip;
   9755 % 7) physical page height; 8) physical page width.
   9756 %
   9757 % We also call \setleading{\textleading}, so the caller should define
   9758 % \textleading.  The caller should also set \parskip.
   9759 %
   9760 \def\internalpagesizes#1#2#3#4#5#6#7#8{%
   9761   \voffset = #3\relax
   9762   \topskip = #6\relax
   9763   \splittopskip = \topskip
   9764   %
   9765   \vsize = #1\relax
   9766   \advance\vsize by \topskip
   9767   \outervsize = \vsize
   9768   \advance\outervsize by 2\topandbottommargin
   9769   \pageheight = \vsize
   9770   %
   9771   \hsize = #2\relax
   9772   \outerhsize = \hsize
   9773   \advance\outerhsize by 0.5in
   9774   \pagewidth = \hsize
   9775   %
   9776   \normaloffset = #4\relax
   9777   \bindingoffset = #5\relax
   9778   %
   9779   \ifpdf
   9780     \pdfpageheight #7\relax
   9781     \pdfpagewidth #8\relax
   9782     % if we don't reset these, they will remain at "1 true in" of
   9783     % whatever layout pdftex was dumped with.
   9784     \pdfhorigin = 1 true in
   9785     \pdfvorigin = 1 true in
   9786   \fi
   9787   %
   9788   \setleading{\textleading}
   9789   %
   9790   \parindent = \defaultparindent
   9791   \setemergencystretch
   9792 }
   9793 
   9794 % @letterpaper (the default).
   9795 \def\letterpaper{{\globaldefs = 1
   9796   \parskip = 3pt plus 2pt minus 1pt
   9797   \textleading = 13.2pt
   9798   %
   9799   % If page is nothing but text, make it come out even.
   9800   \internalpagesizes{607.2pt}{6in}% that's 46 lines
   9801                     {\voffset}{.25in}%
   9802                     {\bindingoffset}{36pt}%
   9803                     {11in}{8.5in}%
   9804 }}
   9805 
   9806 % Use @smallbook to reset parameters for 7x9.25 trim size.
   9807 \def\smallbook{{\globaldefs = 1
   9808   \parskip = 2pt plus 1pt
   9809   \textleading = 12pt
   9810   %
   9811   \internalpagesizes{7.5in}{5in}%
   9812                     {-.2in}{0in}%
   9813                     {\bindingoffset}{16pt}%
   9814                     {9.25in}{7in}%
   9815   %
   9816   \lispnarrowing = 0.3in
   9817   \tolerance = 700
   9818   \hfuzz = 1pt
   9819   \contentsrightmargin = 0pt
   9820   \defbodyindent = .5cm
   9821 }}
   9822 
   9823 % Use @smallerbook to reset parameters for 6x9 trim size.
   9824 % (Just testing, parameters still in flux.)
   9825 \def\smallerbook{{\globaldefs = 1
   9826   \parskip = 1.5pt plus 1pt
   9827   \textleading = 12pt
   9828   %
   9829   \internalpagesizes{7.4in}{4.8in}%
   9830                     {-.2in}{-.4in}%
   9831                     {0pt}{14pt}%
   9832                     {9in}{6in}%
   9833   %
   9834   \lispnarrowing = 0.25in
   9835   \tolerance = 700
   9836   \hfuzz = 1pt
   9837   \contentsrightmargin = 0pt
   9838   \defbodyindent = .4cm
   9839 }}
   9840 
   9841 % Use @afourpaper to print on European A4 paper.
   9842 \def\afourpaper{{\globaldefs = 1
   9843   \parskip = 3pt plus 2pt minus 1pt
   9844   \textleading = 13.2pt
   9845   %
   9846   % Double-side printing via postscript on Laserjet 4050
   9847   % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm.
   9848   % To change the settings for a different printer or situation, adjust
   9849   % \normaloffset until the front-side and back-side texts align.  Then
   9850   % do the same for \bindingoffset.  You can set these for testing in
   9851   % your texinfo source file like this:
   9852   % @tex
   9853   % \global\normaloffset = -6mm
   9854   % \global\bindingoffset = 10mm
   9855   % @end tex
   9856   \internalpagesizes{673.2pt}{160mm}% that's 51 lines
   9857                     {\voffset}{\hoffset}%
   9858                     {\bindingoffset}{44pt}%
   9859                     {297mm}{210mm}%
   9860   %
   9861   \tolerance = 700
   9862   \hfuzz = 1pt
   9863   \contentsrightmargin = 0pt
   9864   \defbodyindent = 5mm
   9865 }}
   9866 
   9867 % Use @afivepaper to print on European A5 paper.
   9868 % From romildo@urano.iceb.ufop.br, 2 July 2000.
   9869 % He also recommends making @example and @lisp be small.
   9870 \def\afivepaper{{\globaldefs = 1
   9871   \parskip = 2pt plus 1pt minus 0.1pt
   9872   \textleading = 12.5pt
   9873   %
   9874   \internalpagesizes{160mm}{120mm}%
   9875                     {\voffset}{\hoffset}%
   9876                     {\bindingoffset}{8pt}%
   9877                     {210mm}{148mm}%
   9878   %
   9879   \lispnarrowing = 0.2in
   9880   \tolerance = 800
   9881   \hfuzz = 1.2pt
   9882   \contentsrightmargin = 0pt
   9883   \defbodyindent = 2mm
   9884   \tableindent = 12mm
   9885 }}
   9886 
   9887 % A specific text layout, 24x15cm overall, intended for A4 paper.
   9888 \def\afourlatex{{\globaldefs = 1
   9889   \afourpaper
   9890   \internalpagesizes{237mm}{150mm}%
   9891                     {\voffset}{4.6mm}%
   9892                     {\bindingoffset}{7mm}%
   9893                     {297mm}{210mm}%
   9894   %
   9895   % Must explicitly reset to 0 because we call \afourpaper.
   9896   \globaldefs = 0
   9897 }}
   9898 
   9899 % Use @afourwide to print on A4 paper in landscape format.
   9900 \def\afourwide{{\globaldefs = 1
   9901   \afourpaper
   9902   \internalpagesizes{241mm}{165mm}%
   9903                     {\voffset}{-2.95mm}%
   9904                     {\bindingoffset}{7mm}%
   9905                     {297mm}{210mm}%
   9906   \globaldefs = 0
   9907 }}
   9908 
   9909 % @pagesizes TEXTHEIGHT[,TEXTWIDTH]
   9910 % Perhaps we should allow setting the margins, \topskip, \parskip,
   9911 % and/or leading, also. Or perhaps we should compute them somehow.
   9912 %
   9913 \parseargdef\pagesizes{\pagesizesyyy #1,,\finish}
   9914 \def\pagesizesyyy#1,#2,#3\finish{{%
   9915   \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
   9916   \globaldefs = 1
   9917   %
   9918   \parskip = 3pt plus 2pt minus 1pt
   9919   \setleading{\textleading}%
   9920   %
   9921   \dimen0 = #1\relax
   9922   \advance\dimen0 by \voffset
   9923   %
   9924   \dimen2 = \hsize
   9925   \advance\dimen2 by \normaloffset
   9926   %
   9927   \internalpagesizes{#1}{\hsize}%
   9928                     {\voffset}{\normaloffset}%
   9929                     {\bindingoffset}{44pt}%
   9930                     {\dimen0}{\dimen2}%
   9931 }}
   9932 
   9933 % Set default to letter.
   9934 %
   9935 \letterpaper
   9936 
   9937 
   9938 \message{and turning on texinfo input format.}
   9939 
   9940 \def^^L{\par} % remove \outer, so ^L can appear in an @comment
   9941 
   9942 % DEL is a comment character, in case @c does not suffice.
   9943 \catcode`\^^? = 14
   9944 
   9945 % Define macros to output various characters with catcode for normal text.
   9946 \catcode`\"=\other \def\normaldoublequote{"}
   9947 \catcode`\$=\other \def\normaldollar{$}%$ font-lock fix
   9948 \catcode`\+=\other \def\normalplus{+}
   9949 \catcode`\<=\other \def\normalless{<}
   9950 \catcode`\>=\other \def\normalgreater{>}
   9951 \catcode`\^=\other \def\normalcaret{^}
   9952 \catcode`\_=\other \def\normalunderscore{_}
   9953 \catcode`\|=\other \def\normalverticalbar{|}
   9954 \catcode`\~=\other \def\normaltilde{~}
   9955 
   9956 % This macro is used to make a character print one way in \tt
   9957 % (where it can probably be output as-is), and another way in other fonts,
   9958 % where something hairier probably needs to be done.
   9959 %
   9960 % #1 is what to print if we are indeed using \tt; #2 is what to print
   9961 % otherwise.  Since all the Computer Modern typewriter fonts have zero
   9962 % interword stretch (and shrink), and it is reasonable to expect all
   9963 % typewriter fonts to have this, we can check that font parameter.
   9964 %
   9965 \def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
   9966 
   9967 % Same as above, but check for italic font.  Actually this also catches
   9968 % non-italic slanted fonts since it is impossible to distinguish them from
   9969 % italic fonts.  But since this is only used by $ and it uses \sl anyway
   9970 % this is not a problem.
   9971 \def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
   9972 
   9973 % Turn off all special characters except @
   9974 % (and those which the user can use as if they were ordinary).
   9975 % Most of these we simply print from the \tt font, but for some, we can
   9976 % use math or other variants that look better in normal text.
   9977 
   9978 \catcode`\"=\active
   9979 \def\activedoublequote{{\tt\char34}}
   9980 \let"=\activedoublequote
   9981 \catcode`\~=\active \def\activetilde{{\tt\char126}} \let~ = \activetilde
   9982 \chardef\hat=`\^
   9983 \catcode`\^=\active \def\activehat{{\tt \hat}} \let^ = \activehat
   9984 
   9985 \catcode`\_=\active
   9986 \def_{\ifusingtt\normalunderscore\_}
   9987 \let\realunder=_
   9988 % Subroutine for the previous macro.
   9989 \def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }
   9990 
   9991 \catcode`\|=\active
   9992 \def|{{\tt\char124}}
   9993 
   9994 \chardef \less=`\<
   9995 \catcode`\<=\active \def\activeless{{\tt \less}}\let< = \activeless
   9996 \chardef \gtr=`\>
   9997 \catcode`\>=\active \def\activegtr{{\tt \gtr}}\let> = \activegtr
   9998 \catcode`\+=\active \def+{{\tt \char 43}}
   9999 \catcode`\$=\active \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
  10000 
  10001 % used for headline/footline in the output routine, in case the page
  10002 % breaks in the middle of an @tex block.
  10003 \def\texinfochars{%
  10004   \let< = \activeless
  10005   \let> = \activegtr
  10006   \let~ = \activetilde
  10007   \let^ = \activehat
  10008   \markupsetuplqdefault \markupsetuprqdefault
  10009   \let\b = \strong
  10010   \let\i = \smartitalic
  10011   % in principle, all other definitions in \tex have to be undone too.
  10012 }
  10013 
  10014 % If a .fmt file is being used, characters that might appear in a file
  10015 % name cannot be active until we have parsed the command line.
  10016 % So turn them off again, and have \everyjob (or @setfilename) turn them on.
  10017 % \otherifyactive is called near the end of this file.
  10018 \def\otherifyactive{\catcode`+=\other \catcode`\_=\other}
  10019 
  10020 % Used sometimes to turn off (effectively) the active characters even after
  10021 % parsing them.
  10022 \def\turnoffactive{%
  10023   \normalturnoffactive
  10024   \otherbackslash
  10025 }
  10026 
  10027 \catcode`\@=0
  10028 
  10029 % \backslashcurfont outputs one backslash character in current font,
  10030 % as in \char`\\.
  10031 \global\chardef\backslashcurfont=`\\
  10032 \global\let\rawbackslashxx=\backslashcurfont  % let existing .??s files work
  10033 
  10034 % \realbackslash is an actual character `\' with catcode other, and
  10035 % \doublebackslash is two of them (for the pdf outlines).
  10036 {\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}}
  10037 
  10038 % In texinfo, backslash is an active character; it prints the backslash
  10039 % in fixed width font.
  10040 \catcode`\\=\active  % @ for escape char from now on.
  10041 
  10042 % The story here is that in math mode, the \char of \backslashcurfont
  10043 % ends up printing the roman \ from the math symbol font (because \char
  10044 % in math mode uses the \mathcode, and plain.tex sets
  10045 % \mathcode`\\="026E).  It seems better for @backslashchar{} to always
  10046 % print a typewriter backslash, hence we use an explicit \mathchar,
  10047 % which is the decimal equivalent of "715c (class 7, e.g., use \fam;
  10048 % ignored family value; char position "5C).  We can't use " for the
  10049 % usual hex value because it has already been made active.
  10050 @def@normalbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}}
  10051 @let@backslashchar = @normalbackslash % @backslashchar{} is for user documents.
  10052 
  10053 % On startup, @fixbackslash assigns:
  10054 %  @let \ = @normalbackslash
  10055 % \rawbackslash defines an active \ to do \backslashcurfont.
  10056 % \otherbackslash defines an active \ to be a literal `\' character with
  10057 % catcode other.  We switch back and forth between these.
  10058 @gdef@rawbackslash{@let\=@backslashcurfont}
  10059 @gdef@otherbackslash{@let\=@realbackslash}
  10060 
  10061 % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
  10062 % the literal character `\'.  Also revert - to its normal character, in
  10063 % case the active - from code has slipped in.
  10064 %
  10065 {@catcode`- = @active
  10066  @gdef@normalturnoffactive{%
  10067    @let-=@normaldash
  10068    @let"=@normaldoublequote
  10069    @let$=@normaldollar %$ font-lock fix
  10070    @let+=@normalplus
  10071    @let<=@normalless
  10072    @let>=@normalgreater
  10073    @let\=@normalbackslash
  10074    @let^=@normalcaret
  10075    @let_=@normalunderscore
  10076    @let|=@normalverticalbar
  10077    @let~=@normaltilde
  10078    @markupsetuplqdefault
  10079    @markupsetuprqdefault
  10080    @unsepspaces
  10081  }
  10082 }
  10083 
  10084 % Make _ and + \other characters, temporarily.
  10085 % This is canceled by @fixbackslash.
  10086 @otherifyactive
  10087 
  10088 % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
  10089 % That is what \eatinput is for; after that, the `\' should revert to printing
  10090 % a backslash.
  10091 %
  10092 @gdef@eatinput input texinfo{@fixbackslash}
  10093 @global@let\ = @eatinput
  10094 
  10095 % On the other hand, perhaps the file did not have a `\input texinfo'. Then
  10096 % the first `\' in the file would cause an error. This macro tries to fix
  10097 % that, assuming it is called before the first `\' could plausibly occur.
  10098 % Also turn back on active characters that might appear in the input
  10099 % file name, in case not using a pre-dumped format.
  10100 %
  10101 @gdef@fixbackslash{%
  10102   @ifx\@eatinput @let\ = @normalbackslash @fi
  10103   @catcode`+=@active
  10104   @catcode`@_=@active
  10105 }
  10106 
  10107 % Say @foo, not \foo, in error messages.
  10108 @escapechar = `@@
  10109 
  10110 % These (along with & and #) are made active for url-breaking, so need
  10111 % active definitions as the normal characters.
  10112 @def@normaldot{.}
  10113 @def@normalquest{?}
  10114 @def@normalslash{/}
  10115 
  10116 % These look ok in all fonts, so just make them not special.
  10117 % @hashchar{} gets its own user-level command, because of #line.
  10118 @catcode`@& = @other @def@normalamp{&}
  10119 @catcode`@# = @other @def@normalhash{#}
  10120 @catcode`@% = @other @def@normalpercent{%}
  10121 
  10122 @let @hashchar = @normalhash
  10123 
  10124 @c Finally, make ` and ' active, so that txicodequoteundirected and
  10125 @c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}.  If we
  10126 @c don't make ` and ' active, @code will not get them as active chars.
  10127 @c Do this last of all since we use ` in the previous @catcode assignments.
  10128 @catcode`@'=@active
  10129 @catcode`@`=@active
  10130 @markupsetuplqdefault
  10131 @markupsetuprqdefault
  10132 
  10133 @c Local variables:
  10134 @c eval: (add-hook 'write-file-hooks 'time-stamp)
  10135 @c page-delimiter: "^\\\\message"
  10136 @c time-stamp-start: "def\\\\texinfoversion{"
  10137 @c time-stamp-format: "%:y-%02m-%02d.%02H"
  10138 @c time-stamp-end: "}"
  10139 @c End:
  10140 
  10141 @c vim:sw=2:
  10142 
  10143 @ignore
  10144    arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115
  10145 @end ignore