"Fossies" - the Fresh Open Source Software Archive

Member "emacs-25.3/doc/misc/texinfo.tex" (14 Apr 2017, 379114 Bytes) of package /linux/misc/emacs-25.3.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) TeX and LaTeX source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    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{2016-04-14.07}
    7 %
    8 % Copyright 1985-1986, 1988, 1990-2017 Free Software Foundation, Inc.
    9 %
   10 % This texinfo.tex file is free software: you can redistribute it and/or
   11 % modify it under the terms of the GNU General Public License as
   12 % published by the Free Software Foundation, either version 3 of the
   13 % License, or (at your option) any later version.
   14 %
   15 % This texinfo.tex file is distributed in the hope that it will be
   16 % useful, but WITHOUT ANY WARRANTY; without even the implied warranty
   17 % of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   18 % General Public License for more details.
   19 %
   20 % You should have received a copy of the GNU General Public License
   21 % along with this program.  If not, see <http://www.gnu.org/licenses/>.
   22 %
   23 % As a special exception, when this file is read by TeX when processing
   24 % a Texinfo source document, you may use the result without
   25 % restriction. This Exception is an additional permission under section 7
   26 % of the GNU General Public License, version 3 ("GPLv3").
   27 %
   28 % Please try the latest version of texinfo.tex before submitting bug
   29 % reports; you can get the latest version from:
   30 %   http://ftp.gnu.org/gnu/texinfo/ (the Texinfo release area), or
   31 %   http://ftpmirror.gnu.org/texinfo/ (same, via a mirror), or
   32 %   http://www.gnu.org/software/texinfo/ (the Texinfo home page)
   33 % The texinfo.tex in any given distribution could well be out
   34 % of date, so if that's what you're using, please check.
   35 %
   36 % Send bug reports to bug-texinfo@gnu.org.  Please include including a
   37 % complete document in each bug report with which we can reproduce the
   38 % problem.  Patches are, of course, greatly appreciated.
   39 %
   40 % To process a Texinfo manual with TeX, it's most reliable to use the
   41 % texi2dvi shell script that comes with the distribution.  For a simple
   42 % manual foo.texi, however, you can get away with this:
   43 %   tex foo.texi
   44 %   texindex foo.??
   45 %   tex foo.texi
   46 %   tex foo.texi
   47 %   dvips foo.dvi -o  # or whatever; this makes foo.ps.
   48 % The extra TeX runs get the cross-reference information correct.
   49 % Sometimes one run after texindex suffices, and sometimes you need more
   50 % than two; texi2dvi does it as many times as necessary.
   51 %
   52 % It is possible to adapt texinfo.tex for other languages, to some
   53 % extent.  You can get the existing language-specific files from the
   54 % full Texinfo distribution.
   55 %
   56 % The GNU Texinfo home page is http://www.gnu.org/software/texinfo.
   57 
   58 
   59 \message{Loading texinfo [version \texinfoversion]:}
   60 
   61 % If in a .fmt file, print the version number
   62 % and turn on active characters that we couldn't do earlier because
   63 % they might have appeared in the input file name.
   64 \everyjob{\message{[Texinfo version \texinfoversion]}%
   65   \catcode`+=\active \catcode`\_=\active}
   66 
   67 \chardef\other=12
   68 
   69 % We never want plain's \outer definition of \+ in Texinfo.
   70 % For @tex, we can use \tabalign.
   71 \let\+ = \relax
   72 
   73 % Save some plain tex macros whose names we will redefine.
   74 \let\ptexb=\b
   75 \let\ptexbullet=\bullet
   76 \let\ptexc=\c
   77 \let\ptexcomma=\,
   78 \let\ptexdot=\.
   79 \let\ptexdots=\dots
   80 \let\ptexend=\end
   81 \let\ptexequiv=\equiv
   82 \let\ptexexclam=\!
   83 \let\ptexfootnote=\footnote
   84 \let\ptexgtr=>
   85 \let\ptexhat=^
   86 \let\ptexi=\i
   87 \let\ptexindent=\indent
   88 \let\ptexinsert=\insert
   89 \let\ptexlbrace=\{
   90 \let\ptexless=<
   91 \let\ptexnewwrite\newwrite
   92 \let\ptexnoindent=\noindent
   93 \let\ptexplus=+
   94 \let\ptexraggedright=\raggedright
   95 \let\ptexrbrace=\}
   96 \let\ptexslash=\/
   97 \let\ptexsp=\sp
   98 \let\ptexstar=\*
   99 \let\ptexsup=\sup
  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 % Give the space character the catcode for a space.
  159 \def\spaceisspace{\catcode`\ =10\relax}
  160 
  161 \chardef\dashChar  = `\-
  162 \chardef\slashChar = `\/
  163 \chardef\underChar = `\_
  164 
  165 % Ignore a token.
  166 %
  167 \def\gobble#1{}
  168 
  169 % The following is used inside several \edef's.
  170 \def\makecsname#1{\expandafter\noexpand\csname#1\endcsname}
  171 
  172 % Hyphenation fixes.
  173 \hyphenation{
  174   Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script
  175   ap-pen-dix bit-map bit-maps
  176   data-base data-bases eshell fall-ing half-way long-est man-u-script
  177   man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm
  178   par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces
  179   spell-ing spell-ings
  180   stand-alone strong-est time-stamp time-stamps which-ever white-space
  181   wide-spread wrap-around
  182 }
  183 
  184 % Sometimes it is convenient to have everything in the transcript file
  185 % and nothing on the terminal.  We don't just call \tracingall here,
  186 % since that produces some useless output on the terminal.  We also make
  187 % some effort to order the tracing commands to reduce output in the log
  188 % file; cf. trace.sty in LaTeX.
  189 %
  190 \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
  191 \def\loggingall{%
  192   \tracingstats2
  193   \tracingpages1
  194   \tracinglostchars2  % 2 gives us more in etex
  195   \tracingparagraphs1
  196   \tracingoutput1
  197   \tracingmacros2
  198   \tracingrestores1
  199   \showboxbreadth\maxdimen \showboxdepth\maxdimen
  200   \ifx\eTeXversion\thisisundefined\else % etex gives us more logging
  201     \tracingscantokens1
  202     \tracingifs1
  203     \tracinggroups1
  204     \tracingnesting2
  205     \tracingassigns1
  206   \fi
  207   \tracingcommands3  % 3 gives us more in etex
  208   \errorcontextlines16
  209 }%
  210 
  211 % @errormsg{MSG}.  Do the index-like expansions on MSG, but if things
  212 % aren't perfect, it's not the end of the world, being an error message,
  213 % after all.
  214 % 
  215 \def\errormsg{\begingroup \indexnofonts \doerrormsg}
  216 \def\doerrormsg#1{\errmessage{#1}}
  217 
  218 % add check for \lastpenalty to plain's definitions.  If the last thing
  219 % we did was a \nobreak, we don't want to insert more space.
  220 %
  221 \def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount
  222   \removelastskip\penalty-50\smallskip\fi\fi}
  223 \def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount
  224   \removelastskip\penalty-100\medskip\fi\fi}
  225 \def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
  226   \removelastskip\penalty-200\bigskip\fi\fi}
  227 
  228 % Output routine
  229 %
  230 
  231 % For a final copy, take out the rectangles
  232 % that mark overfull boxes (in case you have decided
  233 % that the text looks ok even though it passes the margin).
  234 %
  235 \def\finalout{\overfullrule=0pt }
  236 
  237 % Do @cropmarks to get crop marks.
  238 %
  239 \newif\ifcropmarks
  240 \let\cropmarks = \cropmarkstrue
  241 %
  242 % Dimensions to add cropmarks at corners.
  243 % Added by P. A. MacKay, 12 Nov. 1986
  244 %
  245 \newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
  246 \newdimen\cornerlong  \cornerlong=1pc
  247 \newdimen\cornerthick \cornerthick=.3pt
  248 \newdimen\topandbottommargin \topandbottommargin=.75in
  249 
  250 % Output a mark which sets \thischapter, \thissection and \thiscolor.
  251 % We dump everything together because we only have one kind of mark.
  252 % This works because we only use \botmark / \topmark, not \firstmark.
  253 %
  254 % A mark contains a subexpression of the \ifcase ... \fi construct.
  255 % \get*marks macros below extract the needed part using \ifcase.
  256 %
  257 % Another complication is to let the user choose whether \thischapter
  258 % (\thissection) refers to the chapter (section) in effect at the top
  259 % of a page, or that at the bottom of a page.
  260 
  261 % \domark is called twice inside \chapmacro, to add one
  262 % mark before the section break, and one after.
  263 %   In the second call \prevchapterdefs is the same as \lastchapterdefs,
  264 % and \prevsectiondefs is the same as \lastsectiondefs.
  265 %   Then if the page is not broken at the mark, some of the previous
  266 % section appears on the page, and we can get the name of this section
  267 % from \firstmark for @everyheadingmarks top.
  268 %   @everyheadingmarks bottom uses \botmark.
  269 %
  270 % See page 260 of The TeXbook.
  271 \def\domark{%
  272   \toks0=\expandafter{\lastchapterdefs}%
  273   \toks2=\expandafter{\lastsectiondefs}%
  274   \toks4=\expandafter{\prevchapterdefs}%
  275   \toks6=\expandafter{\prevsectiondefs}%
  276   \toks8=\expandafter{\lastcolordefs}%
  277   \mark{%
  278                    \the\toks0 \the\toks2  % 0: marks for @everyheadingmarks top
  279       \noexpand\or \the\toks4 \the\toks6  % 1: for @everyheadingmarks bottom
  280     \noexpand\else \the\toks8             % 2: color marks
  281   }%
  282 }
  283 
  284 % \gettopheadingmarks, \getbottomheadingmarks,
  285 % \getcolormarks - extract needed part of mark.
  286 %
  287 % \topmark doesn't work for the very first chapter (after the title
  288 % page or the contents), so we use \firstmark there -- this gets us
  289 % the mark with the chapter defs, unless the user sneaks in, e.g.,
  290 % @setcolor (or @url, or @link, etc.) between @contents and the very
  291 % first @chapter.
  292 \def\gettopheadingmarks{%
  293   \ifcase0\topmark\fi
  294   \ifx\thischapter\empty \ifcase0\firstmark\fi \fi
  295 }
  296 \def\getbottomheadingmarks{\ifcase1\botmark\fi}
  297 \def\getcolormarks{\ifcase2\topmark\fi}
  298 
  299 % Avoid "undefined control sequence" errors.
  300 \def\lastchapterdefs{}
  301 \def\lastsectiondefs{}
  302 \def\lastsection{}
  303 \def\prevchapterdefs{}
  304 \def\prevsectiondefs{}
  305 \def\lastcolordefs{}
  306 
  307 % Margin to add to right of even pages, to left of odd pages.
  308 \newdimen\bindingoffset
  309 \newdimen\normaloffset
  310 \newdimen\txipagewidth \newdimen\txipageheight
  311 
  312 % Main output routine.
  313 %
  314 \chardef\PAGE = 255
  315 \output = {\onepageout{\pagecontents\PAGE}}
  316 
  317 \newbox\headlinebox
  318 \newbox\footlinebox
  319 
  320 % \onepageout takes a vbox as an argument.
  321 % \shipout a vbox for a single page, adding an optional header, footer,
  322 % cropmarks, and footnote.  This also causes index entries for this page
  323 % to be written to the auxiliary files.
  324 %
  325 \def\onepageout#1{%
  326   \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
  327   %
  328   \ifodd\pageno  \advance\hoffset by \bindingoffset
  329   \else \advance\hoffset by -\bindingoffset\fi
  330   %
  331   % Common context changes for both heading and footing.
  332   % Do this outside of the \shipout so @code etc. will be expanded in
  333   % the headline as they should be, not taken literally (outputting ''code).
  334   \def\commmonheadfootline{\let\hsize=\txipagewidth \texinfochars}
  335   %
  336   % Retrieve the information for the headings from the marks in the page,
  337   % and call Plain TeX's \makeheadline and \makefootline, which use the
  338   % values in \headline and \footline.
  339   %
  340   % This is used to check if we are on the first page of a chapter.
  341   \ifcase1\topmark\fi
  342   \let\prevchaptername\thischaptername
  343   \ifcase0\firstmark\fi
  344   \let\curchaptername\thischaptername
  345   %
  346   \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
  347   \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi
  348   %
  349   \ifx\curchaptername\prevchaptername
  350     \let\thischapterheading\thischapter
  351   \else
  352     % \thischapterheading is the same as \thischapter except it is blank
  353     % for the first page of a chapter.  This is to prevent the chapter name 
  354     % being shown twice.
  355     \def\thischapterheading{}%
  356   \fi
  357   %
  358   \global\setbox\headlinebox = \vbox{\commmonheadfootline \makeheadline}%
  359   \global\setbox\footlinebox = \vbox{\commmonheadfootline \makefootline}%
  360   %
  361   {%
  362     % Set context for writing to auxiliary files like index files.
  363     % Have to do this stuff outside the \shipout because we want it to
  364     % take effect in \write's, yet the group defined by the \vbox ends
  365     % before the \shipout runs.
  366     %
  367     \indexdummies         % don't expand commands in the output.
  368     \normalturnoffactive  % \ in index entries must not stay \, e.g., if
  369                % the page break happens to be in the middle of an example.
  370                % We don't want .vr (or whatever) entries like this:
  371                % \entry{{\indexbackslash }acronym}{32}{\code {\acronym}}
  372                % "\acronym" won't work when it's read back in;
  373                % it needs to be
  374                % {\code {{\backslashcurfont }acronym}
  375     \shipout\vbox{%
  376       % Do this early so pdf references go to the beginning of the page.
  377       \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi
  378       %
  379       \ifcropmarks \vbox to \outervsize\bgroup
  380         \hsize = \outerhsize
  381         \vskip-\topandbottommargin
  382         \vtop to0pt{%
  383           \line{\ewtop\hfil\ewtop}%
  384           \nointerlineskip
  385           \line{%
  386             \vbox{\moveleft\cornerthick\nstop}%
  387             \hfill
  388             \vbox{\moveright\cornerthick\nstop}%
  389           }%
  390           \vss}%
  391         \vskip\topandbottommargin
  392         \line\bgroup
  393           \hfil % center the page within the outer (page) hsize.
  394           \ifodd\pageno\hskip\bindingoffset\fi
  395           \vbox\bgroup
  396       \fi
  397       %
  398       \unvbox\headlinebox
  399       \pagebody{#1}%
  400       \ifdim\ht\footlinebox > 0pt
  401         % Only leave this space if the footline is nonempty.
  402         % (We lessened \vsize for it in \oddfootingyyy.)
  403         % The \baselineskip=24pt in plain's \makefootline has no effect.
  404         \vskip 24pt
  405         \unvbox\footlinebox
  406       \fi
  407       %
  408       \ifcropmarks
  409           \egroup % end of \vbox\bgroup
  410         \hfil\egroup % end of (centering) \line\bgroup
  411         \vskip\topandbottommargin plus1fill minus1fill
  412         \boxmaxdepth = \cornerthick
  413         \vbox to0pt{\vss
  414           \line{%
  415             \vbox{\moveleft\cornerthick\nsbot}%
  416             \hfill
  417             \vbox{\moveright\cornerthick\nsbot}%
  418           }%
  419           \nointerlineskip
  420           \line{\ewbot\hfil\ewbot}%
  421         }%
  422       \egroup % \vbox from first cropmarks clause
  423       \fi
  424     }% end of \shipout\vbox
  425   }% end of group with \indexdummies
  426   \advancepageno
  427   \ifnum\outputpenalty>-20000 \else\dosupereject\fi
  428 }
  429 
  430 \newinsert\margin \dimen\margin=\maxdimen
  431 
  432 % Main part of page, including any footnotes
  433 \def\pagebody#1{\vbox to\txipageheight{\boxmaxdepth=\maxdepth #1}}
  434 {\catcode`\@ =11
  435 \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
  436 % marginal hacks, juha@viisa.uucp (Juha Takala)
  437 \ifvoid\margin\else % marginal info is present
  438   \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
  439 \dimen@=\dp#1\relax \unvbox#1\relax
  440 \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
  441 \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
  442 }
  443 
  444 % Here are the rules for the cropmarks.  Note that they are
  445 % offset so that the space between them is truly \outerhsize or \outervsize
  446 % (P. A. MacKay, 12 November, 1986)
  447 %
  448 \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
  449 \def\nstop{\vbox
  450   {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
  451 \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
  452 \def\nsbot{\vbox
  453   {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
  454 
  455 
  456 % Argument parsing
  457 
  458 % Parse an argument, then pass it to #1.  The argument is the rest of
  459 % the input line (except we remove a trailing comment).  #1 should be a
  460 % macro which expects an ordinary undelimited TeX argument.
  461 % For example, \def\foo{\parsearg\fooxxx}.
  462 %
  463 \def\parsearg{\parseargusing{}}
  464 \def\parseargusing#1#2{%
  465   \def\argtorun{#2}%
  466   \begingroup
  467     \obeylines
  468     \spaceisspace
  469     #1%
  470     \parseargline\empty% Insert the \empty token, see \finishparsearg below.
  471 }
  472 
  473 {\obeylines %
  474   \gdef\parseargline#1^^M{%
  475     \endgroup % End of the group started in \parsearg.
  476     \argremovecomment #1\comment\ArgTerm%
  477   }%
  478 }
  479 
  480 % First remove any @comment, then any @c comment.  Also remove a @texinfoc
  481 % comment (see \scanmacro for details).  Pass the result on to \argcheckspaces.
  482 \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
  483 \def\argremovec#1\c#2\ArgTerm{\argremovetexinfoc #1\texinfoc\ArgTerm}
  484 \def\argremovetexinfoc#1\texinfoc#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
  485 
  486 % Each occurrence of `\^^M' or `<space>\^^M' is replaced by a single space.
  487 %
  488 % \argremovec might leave us with trailing space, e.g.,
  489 %    @end itemize  @c foo
  490 % This space token undergoes the same procedure and is eventually removed
  491 % by \finishparsearg.
  492 %
  493 \def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M}
  494 \def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M}
  495 \def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{%
  496   \def\temp{#3}%
  497   \ifx\temp\empty
  498     % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp:
  499     \let\temp\finishparsearg
  500   \else
  501     \let\temp\argcheckspaces
  502   \fi
  503   % Put the space token in:
  504   \temp#1 #3\ArgTerm
  505 }
  506 
  507 % If a _delimited_ argument is enclosed in braces, they get stripped; so
  508 % to get _exactly_ the rest of the line, we had to prevent such situation.
  509 % We prepended an \empty token at the very beginning and we expand it now,
  510 % just before passing the control to \argtorun.
  511 % (Similarly, we have to think about #3 of \argcheckspacesY above: it is
  512 % either the null string, or it ends with \^^M---thus there is no danger
  513 % that a pair of braces would be stripped.
  514 %
  515 % But first, we have to remove the trailing space token.
  516 %
  517 \def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}}
  518 
  519 
  520 % \parseargdef - define a command taking an argument on the line
  521 %
  522 % \parseargdef\foo{...}
  523 %   is roughly equivalent to
  524 % \def\foo{\parsearg\Xfoo}
  525 % \def\Xfoo#1{...}
  526 \def\parseargdef#1{%
  527   \expandafter \doparseargdef \csname\string#1\endcsname #1%
  528 }
  529 \def\doparseargdef#1#2{%
  530   \def#2{\parsearg#1}%
  531   \def#1##1%
  532 }
  533 
  534 % Several utility definitions with active space:
  535 {
  536   \obeyspaces
  537   \gdef\obeyedspace{ }
  538 
  539   % Make each space character in the input produce a normal interword
  540   % space in the output.  Don't allow a line break at this space, as this
  541   % is used only in environments like @example, where each line of input
  542   % should produce a line of output anyway.
  543   %
  544   \gdef\sepspaces{\obeyspaces\let =\tie}
  545 
  546   % If an index command is used in an @example environment, any spaces
  547   % therein should become regular spaces in the raw index file, not the
  548   % expansion of \tie (\leavevmode \penalty \@M \ ).
  549   \gdef\unsepspaces{\let =\space}
  550 }
  551 
  552 
  553 \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
  554 
  555 % Define the framework for environments in texinfo.tex.  It's used like this:
  556 %
  557 %   \envdef\foo{...}
  558 %   \def\Efoo{...}
  559 %
  560 % It's the responsibility of \envdef to insert \begingroup before the
  561 % actual body; @end closes the group after calling \Efoo.  \envdef also
  562 % defines \thisenv, so the current environment is known; @end checks
  563 % whether the environment name matches.  The \checkenv macro can also be
  564 % used to check whether the current environment is the one expected.
  565 %
  566 % Non-false conditionals (@iftex, @ifset) don't fit into this, so they
  567 % are not treated as environments; they don't open a group.  (The
  568 % implementation of @end takes care not to call \endgroup in this
  569 % special case.)
  570 
  571 
  572 % At run-time, environments start with this:
  573 \def\startenvironment#1{\begingroup\def\thisenv{#1}}
  574 % initialize
  575 \let\thisenv\empty
  576 
  577 % ... but they get defined via ``\envdef\foo{...}'':
  578 \long\def\envdef#1#2{\def#1{\startenvironment#1#2}}
  579 \def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}}
  580 
  581 % Check whether we're in the right environment:
  582 \def\checkenv#1{%
  583   \def\temp{#1}%
  584   \ifx\thisenv\temp
  585   \else
  586     \badenverr
  587   \fi
  588 }
  589 
  590 % Environment mismatch, #1 expected:
  591 \def\badenverr{%
  592   \errhelp = \EMsimple
  593   \errmessage{This command can appear only \inenvironment\temp,
  594     not \inenvironment\thisenv}%
  595 }
  596 \def\inenvironment#1{%
  597   \ifx#1\empty
  598     outside of any environment%
  599   \else
  600     in environment \expandafter\string#1%
  601   \fi
  602 }
  603 
  604 % @end foo executes the definition of \Efoo.
  605 % But first, it executes a specialized version of \checkenv
  606 %
  607 \parseargdef\end{%
  608   \if 1\csname iscond.#1\endcsname
  609   \else
  610     % The general wording of \badenverr may not be ideal.
  611     \expandafter\checkenv\csname#1\endcsname
  612     \csname E#1\endcsname
  613     \endgroup
  614   \fi
  615 }
  616 
  617 \newhelp\EMsimple{Press RETURN to continue.}
  618 
  619 
  620 % Be sure we're in horizontal mode when doing a tie, since we make space
  621 % equivalent to this in @example-like environments. Otherwise, a space
  622 % at the beginning of a line will start with \penalty -- and
  623 % since \penalty is valid in vertical mode, we'd end up putting the
  624 % penalty on the vertical list instead of in the new paragraph.
  625 {\catcode`@ = 11
  626  % Avoid using \@M directly, because that causes trouble
  627  % if the definition is written into an index file.
  628  \global\let\tiepenalty = \@M
  629  \gdef\tie{\leavevmode\penalty\tiepenalty\ }
  630 }
  631 
  632 % @: forces normal size whitespace following.
  633 \def\:{\spacefactor=1000 }
  634 
  635 % @* forces a line break.
  636 \def\*{\unskip\hfil\break\hbox{}\ignorespaces}
  637 
  638 % @/ allows a line break.
  639 \let\/=\allowbreak
  640 
  641 % @. is an end-of-sentence period.
  642 \def\.{.\spacefactor=\endofsentencespacefactor\space}
  643 
  644 % @! is an end-of-sentence bang.
  645 \def\!{!\spacefactor=\endofsentencespacefactor\space}
  646 
  647 % @? is an end-of-sentence query.
  648 \def\?{?\spacefactor=\endofsentencespacefactor\space}
  649 
  650 % @frenchspacing on|off  says whether to put extra space after punctuation.
  651 %
  652 \def\onword{on}
  653 \def\offword{off}
  654 %
  655 \parseargdef\frenchspacing{%
  656   \def\temp{#1}%
  657   \ifx\temp\onword \plainfrenchspacing
  658   \else\ifx\temp\offword \plainnonfrenchspacing
  659   \else
  660     \errhelp = \EMsimple
  661     \errmessage{Unknown @frenchspacing option `\temp', must be on|off}%
  662   \fi\fi
  663 }
  664 
  665 % @w prevents a word break.  Without the \leavevmode, @w at the
  666 % beginning of a paragraph, when TeX is still in vertical mode, would
  667 % produce a whole line of output instead of starting the paragraph.
  668 \def\w#1{\leavevmode\hbox{#1}}
  669 
  670 % @group ... @end group forces ... to be all on one page, by enclosing
  671 % it in a TeX vbox.  We use \vtop instead of \vbox to construct the box
  672 % to keep its height that of a normal line.  According to the rules for
  673 % \topskip (p.114 of the TeXbook), the glue inserted is
  674 % max (\topskip - \ht (first item), 0).  If that height is large,
  675 % therefore, no glue is inserted, and the space between the headline and
  676 % the text is small, which looks bad.
  677 %
  678 % Another complication is that the group might be very large.  This can
  679 % cause the glue on the previous page to be unduly stretched, because it
  680 % does not have much material.  In this case, it's better to add an
  681 % explicit \vfill so that the extra space is at the bottom.  The
  682 % threshold for doing this is if the group is more than \vfilllimit
  683 % percent of a page (\vfilllimit can be changed inside of @tex).
  684 %
  685 \newbox\groupbox
  686 \def\vfilllimit{0.7}
  687 %
  688 \envdef\group{%
  689   \ifnum\catcode`\^^M=\active \else
  690     \errhelp = \groupinvalidhelp
  691     \errmessage{@group invalid in context where filling is enabled}%
  692   \fi
  693   \startsavinginserts
  694   %
  695   \setbox\groupbox = \vtop\bgroup
  696     % Do @comment since we are called inside an environment such as
  697     % @example, where each end-of-line in the input causes an
  698     % end-of-line in the output.  We don't want the end-of-line after
  699     % the `@group' to put extra space in the output.  Since @group
  700     % should appear on a line by itself (according to the Texinfo
  701     % manual), we don't worry about eating any user text.
  702     \comment
  703 }
  704 %
  705 % The \vtop produces a box with normal height and large depth; thus, TeX puts
  706 % \baselineskip glue before it, and (when the next line of text is done)
  707 % \lineskip glue after it.  Thus, space below is not quite equal to space
  708 % above.  But it's pretty close.
  709 \def\Egroup{%
  710     % To get correct interline space between the last line of the group
  711     % and the first line afterwards, we have to propagate \prevdepth.
  712     \endgraf % Not \par, as it may have been set to \lisppar.
  713     \global\dimen1 = \prevdepth
  714   \egroup           % End the \vtop.
  715   \addgroupbox
  716   \prevdepth = \dimen1
  717   \checkinserts
  718 }
  719 
  720 \def\addgroupbox{
  721   % \dimen0 is the vertical size of the group's box.
  722   \dimen0 = \ht\groupbox  \advance\dimen0 by \dp\groupbox
  723   % \dimen2 is how much space is left on the page (more or less).
  724   \dimen2 = \txipageheight   \advance\dimen2 by -\pagetotal
  725   % if the group doesn't fit on the current page, and it's a big big
  726   % group, force a page break.
  727   \ifdim \dimen0 > \dimen2
  728     \ifdim \pagetotal < \vfilllimit\txipageheight
  729       \page
  730     \fi
  731   \fi
  732   \box\groupbox
  733 }
  734 
  735 %
  736 % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
  737 % message, so this ends up printing `@group can only ...'.
  738 %
  739 \newhelp\groupinvalidhelp{%
  740 group can only be used in environments such as @example,^^J%
  741 where each line of input produces a line of output.}
  742 
  743 % @need space-in-mils
  744 % forces a page break if there is not space-in-mils remaining.
  745 
  746 \newdimen\mil  \mil=0.001in
  747 
  748 \parseargdef\need{%
  749   % Ensure vertical mode, so we don't make a big box in the middle of a
  750   % paragraph.
  751   \par
  752   %
  753   % If the @need value is less than one line space, it's useless.
  754   \dimen0 = #1\mil
  755   \dimen2 = \ht\strutbox
  756   \advance\dimen2 by \dp\strutbox
  757   \ifdim\dimen0 > \dimen2
  758     %
  759     % Do a \strut just to make the height of this box be normal, so the
  760     % normal leading is inserted relative to the preceding line.
  761     % And a page break here is fine.
  762     \vtop to #1\mil{\strut\vfil}%
  763     %
  764     % TeX does not even consider page breaks if a penalty added to the
  765     % main vertical list is 10000 or more.  But in order to see if the
  766     % empty box we just added fits on the page, we must make it consider
  767     % page breaks.  On the other hand, we don't want to actually break the
  768     % page after the empty box.  So we use a penalty of 9999.
  769     %
  770     % There is an extremely small chance that TeX will actually break the
  771     % page at this \penalty, if there are no other feasible breakpoints in
  772     % sight.  (If the user is using lots of big @group commands, which
  773     % almost-but-not-quite fill up a page, TeX will have a hard time doing
  774     % good page breaking, for example.)  However, I could not construct an
  775     % example where a page broke at this \penalty; if it happens in a real
  776     % document, then we can reconsider our strategy.
  777     \penalty9999
  778     %
  779     % Back up by the size of the box, whether we did a page break or not.
  780     \kern -#1\mil
  781     %
  782     % Do not allow a page break right after this kern.
  783     \nobreak
  784   \fi
  785 }
  786 
  787 % @br   forces paragraph break (and is undocumented).
  788 
  789 \let\br = \par
  790 
  791 % @page forces the start of a new page.
  792 %
  793 \def\page{\par\vfill\supereject}
  794 
  795 % @exdent text....
  796 % outputs text on separate line in roman font, starting at standard page margin
  797 
  798 % This records the amount of indent in the innermost environment.
  799 % That's how much \exdent should take out.
  800 \newskip\exdentamount
  801 
  802 % This defn is used inside fill environments such as @defun.
  803 \parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}
  804 
  805 % This defn is used inside nofill environments such as @example.
  806 \parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount
  807   \leftline{\hskip\leftskip{\rm#1}}}}
  808 
  809 % @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
  810 % paragraph.  For more general purposes, use the \margin insertion
  811 % class.  WHICH is `l' or `r'.  Not documented, written for gawk manual.
  812 %
  813 \newskip\inmarginspacing \inmarginspacing=1cm
  814 \def\strutdepth{\dp\strutbox}
  815 %
  816 \def\doinmargin#1#2{\strut\vadjust{%
  817   \nobreak
  818   \kern-\strutdepth
  819   \vtop to \strutdepth{%
  820     \baselineskip=\strutdepth
  821     \vss
  822     % if you have multiple lines of stuff to put here, you'll need to
  823     % make the vbox yourself of the appropriate size.
  824     \ifx#1l%
  825       \llap{\ignorespaces #2\hskip\inmarginspacing}%
  826     \else
  827       \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
  828     \fi
  829     \null
  830   }%
  831 }}
  832 \def\inleftmargin{\doinmargin l}
  833 \def\inrightmargin{\doinmargin r}
  834 %
  835 % @inmargin{TEXT [, RIGHT-TEXT]}
  836 % (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
  837 % else use TEXT for both).
  838 %
  839 \def\inmargin#1{\parseinmargin #1,,\finish}
  840 \def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
  841   \setbox0 = \hbox{\ignorespaces #2}%
  842   \ifdim\wd0 > 0pt
  843     \def\lefttext{#1}%  have both texts
  844     \def\righttext{#2}%
  845   \else
  846     \def\lefttext{#1}%  have only one text
  847     \def\righttext{#1}%
  848   \fi
  849   %
  850   \ifodd\pageno
  851     \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
  852   \else
  853     \def\temp{\inleftmargin\lefttext}%
  854   \fi
  855   \temp
  856 }
  857 
  858 % @| inserts a changebar to the left of the current line.  It should
  859 % surround any changed text.  This approach does *not* work if the
  860 % change spans more than two lines of output.  To handle that, we would
  861 % have adopt a much more difficult approach (putting marks into the main
  862 % vertical list for the beginning and end of each change).  This command
  863 % is not documented, not supported, and doesn't work.
  864 %
  865 \def\|{%
  866   % \vadjust can only be used in horizontal mode.
  867   \leavevmode
  868   %
  869   % Append this vertical mode material after the current line in the output.
  870   \vadjust{%
  871     % We want to insert a rule with the height and depth of the current
  872     % leading; that is exactly what \strutbox is supposed to record.
  873     \vskip-\baselineskip
  874     %
  875     % \vadjust-items are inserted at the left edge of the type.  So
  876     % the \llap here moves out into the left-hand margin.
  877     \llap{%
  878       %
  879       % For a thicker or thinner bar, change the `1pt'.
  880       \vrule height\baselineskip width1pt
  881       %
  882       % This is the space between the bar and the text.
  883       \hskip 12pt
  884     }%
  885   }%
  886 }
  887 
  888 % @include FILE -- \input text of FILE.
  889 %
  890 \def\include{\parseargusing\filenamecatcodes\includezzz}
  891 \def\includezzz#1{%
  892   \pushthisfilestack
  893   \def\thisfile{#1}%
  894   {%
  895     \makevalueexpandable  % we want to expand any @value in FILE.
  896     \turnoffactive        % and allow special characters in the expansion
  897     \indexnofonts         % Allow `@@' and other weird things in file names.
  898     \wlog{texinfo.tex: doing @include of #1^^J}%
  899     \edef\temp{\noexpand\input #1 }%
  900     %
  901     % This trickery is to read FILE outside of a group, in case it makes
  902     % definitions, etc.
  903     \expandafter
  904   }\temp
  905   \popthisfilestack
  906 }
  907 \def\filenamecatcodes{%
  908   \catcode`\\=\other
  909   \catcode`~=\other
  910   \catcode`^=\other
  911   \catcode`_=\other
  912   \catcode`|=\other
  913   \catcode`<=\other
  914   \catcode`>=\other
  915   \catcode`+=\other
  916   \catcode`-=\other
  917   \catcode`\`=\other
  918   \catcode`\'=\other
  919 }
  920 
  921 \def\pushthisfilestack{%
  922   \expandafter\pushthisfilestackX\popthisfilestack\StackTerm
  923 }
  924 \def\pushthisfilestackX{%
  925   \expandafter\pushthisfilestackY\thisfile\StackTerm
  926 }
  927 \def\pushthisfilestackY #1\StackTerm #2\StackTerm {%
  928   \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}%
  929 }
  930 
  931 \def\popthisfilestack{\errthisfilestackempty}
  932 \def\errthisfilestackempty{\errmessage{Internal error:
  933   the stack of filenames is empty.}}
  934 %
  935 \def\thisfile{}
  936 
  937 % @center line
  938 % outputs that line, centered.
  939 %
  940 \parseargdef\center{%
  941   \ifhmode
  942     \let\centersub\centerH
  943   \else
  944     \let\centersub\centerV
  945   \fi
  946   \centersub{\hfil \ignorespaces#1\unskip \hfil}%
  947   \let\centersub\relax % don't let the definition persist, just in case
  948 }
  949 \def\centerH#1{{%
  950   \hfil\break
  951   \advance\hsize by -\leftskip
  952   \advance\hsize by -\rightskip
  953   \line{#1}%
  954   \break
  955 }}
  956 %
  957 \newcount\centerpenalty
  958 \def\centerV#1{%
  959   % The idea here is the same as in \startdefun, \cartouche, etc.: if
  960   % @center is the first thing after a section heading, we need to wipe
  961   % out the negative parskip inserted by \sectionheading, but still
  962   % prevent a page break here.
  963   \centerpenalty = \lastpenalty
  964   \ifnum\centerpenalty>10000 \vskip\parskip \fi
  965   \ifnum\centerpenalty>9999 \penalty\centerpenalty \fi
  966   \line{\kern\leftskip #1\kern\rightskip}%
  967 }
  968 
  969 % @sp n   outputs n lines of vertical space
  970 %
  971 \parseargdef\sp{\vskip #1\baselineskip}
  972 
  973 % @comment ...line which is ignored...
  974 % @c is the same as @comment
  975 % @ignore ... @end ignore  is another way to write a comment
  976 %
  977 \def\comment{\begingroup \catcode`\^^M=\active%
  978 \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other\commentxxx}%
  979 
  980 {\catcode`\^^M=\active%
  981 \gdef\commentxxx#1^^M{\endgroup%
  982 \futurelet\nexttoken\commentxxxx}%
  983 \gdef\commentxxxx{\ifx\nexttoken\aftermacro\expandafter\comment\fi}%
  984 }
  985 
  986 \def\c{\begingroup \catcode`\^^M=\active%
  987 \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
  988 \cxxx}
  989 {\catcode`\^^M=\active \gdef\cxxx#1^^M{\endgroup}}
  990 % See comment in \scanmacro about why the definitions of @c and @comment differ
  991 
  992 % @paragraphindent NCHARS
  993 % We'll use ems for NCHARS, close enough.
  994 % NCHARS can also be the word `asis' or `none'.
  995 % We cannot feasibly implement @paragraphindent asis, though.
  996 %
  997 \def\asisword{asis} % no translation, these are keywords
  998 \def\noneword{none}
  999 %
 1000 \parseargdef\paragraphindent{%
 1001   \def\temp{#1}%
 1002   \ifx\temp\asisword
 1003   \else
 1004     \ifx\temp\noneword
 1005       \defaultparindent = 0pt
 1006     \else
 1007       \defaultparindent = #1em
 1008     \fi
 1009   \fi
 1010   \parindent = \defaultparindent
 1011 }
 1012 
 1013 % @exampleindent NCHARS
 1014 % We'll use ems for NCHARS like @paragraphindent.
 1015 % It seems @exampleindent asis isn't necessary, but
 1016 % I preserve it to make it similar to @paragraphindent.
 1017 \parseargdef\exampleindent{%
 1018   \def\temp{#1}%
 1019   \ifx\temp\asisword
 1020   \else
 1021     \ifx\temp\noneword
 1022       \lispnarrowing = 0pt
 1023     \else
 1024       \lispnarrowing = #1em
 1025     \fi
 1026   \fi
 1027 }
 1028 
 1029 % @firstparagraphindent WORD
 1030 % If WORD is `none', then suppress indentation of the first paragraph
 1031 % after a section heading.  If WORD is `insert', then do indent at such
 1032 % paragraphs.
 1033 %
 1034 % The paragraph indentation is suppressed or not by calling
 1035 % \suppressfirstparagraphindent, which the sectioning commands do.
 1036 % We switch the definition of this back and forth according to WORD.
 1037 % By default, we suppress indentation.
 1038 %
 1039 \def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
 1040 \def\insertword{insert}
 1041 %
 1042 \parseargdef\firstparagraphindent{%
 1043   \def\temp{#1}%
 1044   \ifx\temp\noneword
 1045     \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
 1046   \else\ifx\temp\insertword
 1047     \let\suppressfirstparagraphindent = \relax
 1048   \else
 1049     \errhelp = \EMsimple
 1050     \errmessage{Unknown @firstparagraphindent option `\temp'}%
 1051   \fi\fi
 1052 }
 1053 
 1054 % Here is how we actually suppress indentation.  Redefine \everypar to
 1055 % \kern backwards by \parindent, and then reset itself to empty.
 1056 %
 1057 % We also make \indent itself not actually do anything until the next
 1058 % paragraph.
 1059 %
 1060 \gdef\dosuppressfirstparagraphindent{%
 1061   \gdef\indent  {\restorefirstparagraphindent \indent}%
 1062   \gdef\noindent{\restorefirstparagraphindent \noindent}%
 1063   \global\everypar = {\kern -\parindent \restorefirstparagraphindent}%
 1064 }
 1065 %
 1066 \gdef\restorefirstparagraphindent{%
 1067   \global\let\indent = \ptexindent
 1068   \global\let\noindent = \ptexnoindent
 1069   \global\everypar = {}%
 1070 }
 1071 
 1072 
 1073 % @refill is a no-op.
 1074 \let\refill=\relax
 1075 
 1076 % @setfilename INFO-FILENAME - ignored
 1077 \let\setfilename=\comment
 1078 
 1079 % @bye.
 1080 \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
 1081 
 1082 
 1083 \message{pdf,}
 1084 % adobe `portable' document format
 1085 \newcount\tempnum
 1086 \newcount\lnkcount
 1087 \newtoks\filename
 1088 \newcount\filenamelength
 1089 \newcount\pgn
 1090 \newtoks\toksA
 1091 \newtoks\toksB
 1092 \newtoks\toksC
 1093 \newtoks\toksD
 1094 \newbox\boxA
 1095 \newbox\boxB
 1096 \newcount\countA
 1097 \newif\ifpdf
 1098 \newif\ifpdfmakepagedest
 1099 
 1100 %
 1101 % For LuaTeX
 1102 %
 1103 
 1104 \ifx\luatexversion\thisisundefined
 1105 \else
 1106   % Escape PDF strings UTF-8 to UTF-16
 1107   \begingroup
 1108     \catcode`\%=12
 1109     \directlua{
 1110       function UTF16oct(str)
 1111         tex.sprint(string.char(0x5c) .. '376' .. string.char(0x5c) .. '377')
 1112         for c in string.utfvalues(str) do
 1113           if c < 0x10000 then
 1114             tex.sprint(
 1115               string.format(string.char(0x5c) .. string.char(0x25) .. '03o' ..
 1116                             string.char(0x5c) .. string.char(0x25) .. '03o',
 1117                             (c / 256), (c % 256)))
 1118           else
 1119             c = c - 0x10000
 1120             local c_hi = c / 1024 + 0xd800
 1121             local c_lo = c % 1024 + 0xdc00
 1122             tex.sprint(
 1123               string.format(string.char(0x5c) .. string.char(0x25) .. '03o' ..
 1124                             string.char(0x5c) .. string.char(0x25) .. '03o' ..
 1125                             string.char(0x5c) .. string.char(0x25) .. '03o' ..
 1126                             string.char(0x5c) .. string.char(0x25) .. '03o',
 1127                             (c_hi / 256), (c_hi % 256),
 1128                             (c_lo / 256), (c_lo % 256)))
 1129           end
 1130         end
 1131       end
 1132     }
 1133   \endgroup
 1134   \def\pdfescapestring#1{\directlua{UTF16oct('\luaescapestring{#1}')}}
 1135   \ifnum\luatexversion>84
 1136     % For LuaTeX >= 0.85
 1137     \def\pdfdest{\pdfextension dest}
 1138     \let\pdfoutput\outputmode
 1139     \def\pdfliteral{\pdfextension literal}
 1140     \def\pdfcatalog{\pdfextension catalog}
 1141     \def\pdftexversion{\numexpr\pdffeedback version\relax}
 1142     \let\pdfximage\saveimageresource
 1143     \let\pdfrefximage\useimageresource
 1144     \let\pdflastximage\lastsavedimageresourceindex
 1145     \def\pdfendlink{\pdfextension endlink\relax}
 1146     \def\pdfoutline{\pdfextension outline}
 1147     \def\pdfstartlink{\pdfextension startlink}
 1148     \def\pdffontattr{\pdfextension fontattr}
 1149     \def\pdfobj{\pdfextension obj}
 1150     \def\pdflastobj{\numexpr\pdffeedback lastobj\relax}
 1151     \let\pdfpagewidth\pagewidth
 1152     \let\pdfpageheight\pageheight
 1153     \edef\pdfhorigin{\pdfvariable horigin}
 1154     \edef\pdfvorigin{\pdfvariable vorigin}
 1155   \fi
 1156 \fi
 1157 
 1158 % when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
 1159 % can be set).  So we test for \relax and 0 as well as being undefined.
 1160 \ifx\pdfoutput\thisisundefined
 1161 \else
 1162   \ifx\pdfoutput\relax
 1163   \else
 1164     \ifcase\pdfoutput
 1165     \else
 1166       \pdftrue
 1167     \fi
 1168   \fi
 1169 \fi
 1170 
 1171 % PDF uses PostScript string constants for the names of xref targets,
 1172 % for display in the outlines, and in other places.  Thus, we have to
 1173 % double any backslashes.  Otherwise, a name like "\node" will be
 1174 % interpreted as a newline (\n), followed by o, d, e.  Not good.
 1175 % 
 1176 % See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and
 1177 % related messages.  The final outcome is that it is up to the TeX user
 1178 % to double the backslashes and otherwise make the string valid, so
 1179 % that's what we do.  pdftex 1.30.0 (ca.2005) introduced a primitive to
 1180 % do this reliably, so we use it.
 1181 
 1182 % #1 is a control sequence in which to do the replacements,
 1183 % which we \xdef.
 1184 \def\txiescapepdf#1{%
 1185   \ifx\pdfescapestring\thisisundefined
 1186     % No primitive available; should we give a warning or log?
 1187     % Many times it won't matter.
 1188   \else
 1189     % The expandable \pdfescapestring primitive escapes parentheses,
 1190     % backslashes, and other special chars.
 1191     \xdef#1{\pdfescapestring{#1}}%
 1192   \fi
 1193 }
 1194 
 1195 \newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images
 1196 with PDF output, and none of those formats could be found.  (.eps cannot
 1197 be supported due to the design of the PDF format; use regular TeX (DVI
 1198 output) for that.)}
 1199 
 1200 \ifpdf
 1201   %
 1202   % Color manipulation macros using ideas from pdfcolor.tex,
 1203   % except using rgb instead of cmyk; the latter is said to render as a
 1204   % very dark gray on-screen and a very dark halftone in print, instead
 1205   % of actual black. The dark red here is dark enough to print on paper as
 1206   % nearly black, but still distinguishable for online viewing.  We use
 1207   % black by default, though.
 1208   \def\rgbDarkRed{0.50 0.09 0.12}
 1209   \def\rgbBlack{0 0 0}
 1210   %
 1211   % rg sets the color for filling (usual text, etc.);
 1212   % RG sets the color for stroking (thin rules, e.g., normal _'s).
 1213   \def\pdfsetcolor#1{\pdfliteral{#1 rg  #1 RG}}
 1214   %
 1215   % Set color, and create a mark which defines \thiscolor accordingly,
 1216   % so that \makeheadline knows which color to restore.
 1217   \def\setcolor#1{%
 1218     \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}%
 1219     \domark
 1220     \pdfsetcolor{#1}%
 1221   }
 1222   %
 1223   \def\maincolor{\rgbBlack}
 1224   \pdfsetcolor{\maincolor}
 1225   \edef\thiscolor{\maincolor}
 1226   \def\lastcolordefs{}
 1227   %
 1228   \def\makefootline{%
 1229     \baselineskip24pt
 1230     \line{\pdfsetcolor{\maincolor}\the\footline}%
 1231   }
 1232   %
 1233   \def\makeheadline{%
 1234     \vbox to 0pt{%
 1235       \vskip-22.5pt
 1236       \line{%
 1237         \vbox to8.5pt{}%
 1238         % Extract \thiscolor definition from the marks.
 1239         \getcolormarks
 1240         % Typeset the headline with \maincolor, then restore the color.
 1241         \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
 1242       }%
 1243       \vss
 1244     }%
 1245     \nointerlineskip
 1246   }
 1247   %
 1248   %
 1249   \pdfcatalog{/PageMode /UseOutlines}
 1250   %
 1251   % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
 1252   \def\dopdfimage#1#2#3{%
 1253     \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
 1254     \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
 1255     %
 1256     % pdftex (and the PDF format) support .pdf, .png, .jpg (among
 1257     % others).  Let's try in that order, PDF first since if
 1258     % someone has a scalable image, presumably better to use that than a
 1259     % bitmap.
 1260     \let\pdfimgext=\empty
 1261     \begingroup
 1262       \openin 1 #1.pdf \ifeof 1
 1263         \openin 1 #1.PDF \ifeof 1
 1264           \openin 1 #1.png \ifeof 1
 1265             \openin 1 #1.jpg \ifeof 1
 1266               \openin 1 #1.jpeg \ifeof 1
 1267                 \openin 1 #1.JPG \ifeof 1
 1268                   \errhelp = \nopdfimagehelp
 1269                   \errmessage{Could not find image file #1 for pdf}%
 1270                 \else \gdef\pdfimgext{JPG}%
 1271                 \fi
 1272               \else \gdef\pdfimgext{jpeg}%
 1273               \fi
 1274             \else \gdef\pdfimgext{jpg}%
 1275             \fi
 1276           \else \gdef\pdfimgext{png}%
 1277           \fi
 1278         \else \gdef\pdfimgext{PDF}%
 1279         \fi
 1280       \else \gdef\pdfimgext{pdf}%
 1281       \fi
 1282       \closein 1
 1283     \endgroup
 1284     %
 1285     % without \immediate, ancient pdftex seg faults when the same image is
 1286     % included twice.  (Version 3.14159-pre-1.0-unofficial-20010704.)
 1287     \ifnum\pdftexversion < 14
 1288       \immediate\pdfimage
 1289     \else
 1290       \immediate\pdfximage
 1291     \fi
 1292       \ifdim \wd0 >0pt width \pdfimagewidth \fi
 1293       \ifdim \wd2 >0pt height \pdfimageheight \fi
 1294       \ifnum\pdftexversion<13
 1295          #1.\pdfimgext
 1296        \else
 1297          {#1.\pdfimgext}%
 1298        \fi
 1299     \ifnum\pdftexversion < 14 \else
 1300       \pdfrefximage \pdflastximage
 1301     \fi}
 1302   %
 1303   \def\pdfmkdest#1{{%
 1304     % We have to set dummies so commands such as @code, and characters
 1305     % such as \, aren't expanded when present in a section title.
 1306     \indexnofonts
 1307     \turnoffactive
 1308     \makevalueexpandable
 1309     \def\pdfdestname{#1}%
 1310     \txiescapepdf\pdfdestname
 1311     \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
 1312   }}
 1313   %
 1314   % used to mark target names; must be expandable.
 1315   \def\pdfmkpgn#1{#1}
 1316   %
 1317   % by default, use black for everything.
 1318   \def\urlcolor{\rgbBlack}
 1319   \def\linkcolor{\rgbBlack}
 1320   \def\endlink{\setcolor{\maincolor}\pdfendlink}
 1321   %
 1322   % Adding outlines to PDF; macros for calculating structure of outlines
 1323   % come from Petr Olsak
 1324   \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
 1325     \else \csname#1\endcsname \fi}
 1326   \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
 1327     \advance\tempnum by 1
 1328     \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
 1329   %
 1330   % #1 is the section text, which is what will be displayed in the
 1331   % outline by the pdf viewer.  #2 is the pdf expression for the number
 1332   % of subentries (or empty, for subsubsections).  #3 is the node text,
 1333   % which might be empty if this toc entry had no corresponding node.
 1334   % #4 is the page number
 1335   %
 1336   \def\dopdfoutline#1#2#3#4{%
 1337     % Generate a link to the node text if that exists; else, use the
 1338     % page number.  We could generate a destination for the section
 1339     % text in the case where a section has no node, but it doesn't
 1340     % seem worth the trouble, since most documents are normally structured.
 1341     {
 1342       \ifx\luatexversion\thisisundefined \else
 1343         \turnoffactive % LuaTeX can use Unicode strings for PDF
 1344       \fi
 1345       \edef\pdfoutlinedest{#3}%
 1346       \ifx\pdfoutlinedest\empty
 1347         \def\pdfoutlinedest{#4}%
 1348       \else
 1349         \txiescapepdf\pdfoutlinedest
 1350       \fi
 1351       %
 1352       % Also escape PDF chars in the display string.
 1353       \edef\pdfoutlinetext{#1}%
 1354       \txiescapepdf\pdfoutlinetext
 1355       %
 1356       \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}%
 1357     }
 1358   }
 1359   %
 1360   \def\pdfmakeoutlines{%
 1361     \begingroup
 1362       % Read toc silently, to get counts of subentries for \pdfoutline.
 1363       \def\partentry##1##2##3##4{}% ignore parts in the outlines
 1364       \def\numchapentry##1##2##3##4{%
 1365     \def\thischapnum{##2}%
 1366     \def\thissecnum{0}%
 1367     \def\thissubsecnum{0}%
 1368       }%
 1369       \def\numsecentry##1##2##3##4{%
 1370     \advancenumber{chap\thischapnum}%
 1371     \def\thissecnum{##2}%
 1372     \def\thissubsecnum{0}%
 1373       }%
 1374       \def\numsubsecentry##1##2##3##4{%
 1375     \advancenumber{sec\thissecnum}%
 1376     \def\thissubsecnum{##2}%
 1377       }%
 1378       \def\numsubsubsecentry##1##2##3##4{%
 1379     \advancenumber{subsec\thissubsecnum}%
 1380       }%
 1381       \def\thischapnum{0}%
 1382       \def\thissecnum{0}%
 1383       \def\thissubsecnum{0}%
 1384       %
 1385       % use \def rather than \let here because we redefine \chapentry et
 1386       % al. a second time, below.
 1387       \def\appentry{\numchapentry}%
 1388       \def\appsecentry{\numsecentry}%
 1389       \def\appsubsecentry{\numsubsecentry}%
 1390       \def\appsubsubsecentry{\numsubsubsecentry}%
 1391       \def\unnchapentry{\numchapentry}%
 1392       \def\unnsecentry{\numsecentry}%
 1393       \def\unnsubsecentry{\numsubsecentry}%
 1394       \def\unnsubsubsecentry{\numsubsubsecentry}%
 1395       \readdatafile{toc}%
 1396       %
 1397       % Read toc second time, this time actually producing the outlines.
 1398       % The `-' means take the \expnumber as the absolute number of
 1399       % subentries, which we calculated on our first read of the .toc above.
 1400       %
 1401       % We use the node names as the destinations.
 1402       \def\numchapentry##1##2##3##4{%
 1403         \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}%
 1404       \def\numsecentry##1##2##3##4{%
 1405         \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}%
 1406       \def\numsubsecentry##1##2##3##4{%
 1407         \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}%
 1408       \def\numsubsubsecentry##1##2##3##4{% count is always zero
 1409         \dopdfoutline{##1}{}{##3}{##4}}%
 1410       %
 1411       % PDF outlines are displayed using system fonts, instead of
 1412       % document fonts.  Therefore we cannot use special characters,
 1413       % since the encoding is unknown.  For example, the eogonek from
 1414       % Latin 2 (0xea) gets translated to a | character.  Info from
 1415       % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
 1416       %
 1417       % TODO this right, we have to translate 8-bit characters to
 1418       % their "best" equivalent, based on the @documentencoding.  Too
 1419       % much work for too little return.  Just use the ASCII equivalents
 1420       % we use for the index sort strings.
 1421       % 
 1422       \indexnofonts
 1423       \setupdatafile
 1424       % We can have normal brace characters in the PDF outlines, unlike
 1425       % Texinfo index files.  So set that up.
 1426       \def\{{\lbracecharliteral}%
 1427       \def\}{\rbracecharliteral}%
 1428       \catcode`\\=\active \otherbackslash
 1429       \input \tocreadfilename
 1430     \endgroup
 1431   }
 1432   {\catcode`[=1 \catcode`]=2
 1433    \catcode`{=\other \catcode`}=\other
 1434    \gdef\lbracecharliteral[{]%
 1435    \gdef\rbracecharliteral[}]%
 1436   ]
 1437   %
 1438   \def\skipspaces#1{\def\PP{#1}\def\D{|}%
 1439     \ifx\PP\D\let\nextsp\relax
 1440     \else\let\nextsp\skipspaces
 1441       \addtokens{\filename}{\PP}%
 1442       \advance\filenamelength by 1
 1443     \fi
 1444     \nextsp}
 1445   \def\getfilename#1{%
 1446     \filenamelength=0
 1447     % If we don't expand the argument now, \skipspaces will get
 1448     % snagged on things like "@value{foo}".
 1449     \edef\temp{#1}%
 1450     \expandafter\skipspaces\temp|\relax
 1451   }
 1452   \ifnum\pdftexversion < 14
 1453     \let \startlink \pdfannotlink
 1454   \else
 1455     \let \startlink \pdfstartlink
 1456   \fi
 1457   % make a live url in pdf output.
 1458   \def\pdfurl#1{%
 1459     \begingroup
 1460       % it seems we really need yet another set of dummies; have not
 1461       % tried to figure out what each command should do in the context
 1462       % of @url.  for now, just make @/ a no-op, that's the only one
 1463       % people have actually reported a problem with.
 1464       %
 1465       \normalturnoffactive
 1466       \def\@{@}%
 1467       \let\/=\empty
 1468       \makevalueexpandable
 1469       % do we want to go so far as to use \indexnofonts instead of just
 1470       % special-casing \var here?
 1471       \def\var##1{##1}%
 1472       %
 1473       \leavevmode\setcolor{\urlcolor}%
 1474       \startlink attr{/Border [0 0 0]}%
 1475         user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
 1476     \endgroup}
 1477   \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
 1478   \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
 1479   \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
 1480   \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
 1481   \def\maketoks{%
 1482     \expandafter\poptoks\the\toksA|ENDTOKS|\relax
 1483     \ifx\first0\adn0
 1484     \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
 1485     \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
 1486     \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
 1487     \else
 1488       \ifnum0=\countA\else\makelink\fi
 1489       \ifx\first.\let\next=\done\else
 1490         \let\next=\maketoks
 1491         \addtokens{\toksB}{\the\toksD}
 1492         \ifx\first,\addtokens{\toksB}{\space}\fi
 1493       \fi
 1494     \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
 1495     \next}
 1496   \def\makelink{\addtokens{\toksB}%
 1497     {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
 1498   \def\pdflink#1{%
 1499     \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
 1500     \setcolor{\linkcolor}#1\endlink}
 1501   \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
 1502 \else
 1503   % non-pdf mode
 1504   \let\pdfmkdest = \gobble
 1505   \let\pdfurl = \gobble
 1506   \let\endlink = \relax
 1507   \let\setcolor = \gobble
 1508   \let\pdfsetcolor = \gobble
 1509   \let\pdfmakeoutlines = \relax
 1510 \fi  % \ifx\pdfoutput
 1511 
 1512 %
 1513 % For XeTeX
 1514 %
 1515 \newif\iftxiuseunicodedestname
 1516 \ifx\XeTeXrevision\thisisundefined
 1517 \else
 1518   %
 1519   % XeTeX version check
 1520   %
 1521   \ifnum\strcmp{\the\XeTeXversion\XeTeXrevision}{0.99995}>-1
 1522     % XeTeX 0.99995+ contains xdvipdfmx 20160307+.
 1523     % It can handle Unicode destination name for PDF.
 1524     \txiuseunicodedestnametrue
 1525   \else
 1526     % XeTeX < 0.99995 can not handle Unicode destination name for PDF
 1527     % because xdvipdfmx 20150315 has UTF-16 convert issue.
 1528     % It fixed by xdvipdfmx 20160106 (TeX Live SVN r39753).
 1529     \txiuseunicodedestnamefalse
 1530   \fi
 1531   %
 1532   % PDF outline support
 1533   %
 1534   \pdfmakepagedesttrue \relax
 1535   % Emulate the primitive of pdfTeX
 1536   \def\pdfdest name#1 xyz{%
 1537     \special{pdf:dest (name#1) [@thispage /XYZ @xpos @ypos]}%
 1538   }
 1539   \def\pdfmkdest#1{{%
 1540     % We have to set dummies so commands such as @code, and characters
 1541     % such as \, aren't expanded when present in a section title.
 1542     \indexnofonts
 1543     \iftxiuseunicodedestname
 1544       \def\pdfdestname{#1}% Pass through Unicode characters.
 1545     \else
 1546       \edef\pdfdestname{#1}% Replace Unicode characters to ASCII.
 1547     \fi
 1548     \turnoffactive
 1549     \makevalueexpandable
 1550     \txiescapepdf\pdfdestname
 1551     \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
 1552   }}
 1553   %
 1554   \def\dopdfoutline#1#2#3#4{%
 1555     \iftxiuseunicodedestname
 1556       \def\pdfoutlinedest{#3}% Pass through Unicode characters.
 1557     \else
 1558       \edef\pdfoutlinedest{#3}% Replace Unicode characters to ASCII.
 1559     \fi
 1560     \ifx\pdfoutlinedest\empty
 1561       \def\pdfoutlinedest{#4}%
 1562     \fi
 1563     {
 1564       \turnoffactive
 1565       \txiescapepdf\pdfoutlinedest
 1566       \edef\pdfoutlinetext{#1}%
 1567       \txiescapepdf\pdfoutlinetext
 1568       %
 1569       \special{pdf:out [-] #2 << /Title (\pdfoutlinetext) /A
 1570         << /S /GoTo /D (name\pdfoutlinedest) >> >> }%
 1571     }
 1572   }
 1573   %
 1574   \def\pdfmakeoutlines{%
 1575     \begingroup
 1576       %
 1577       % In the case of XeTeX, counts of subentries is not necesary.
 1578       % Therefore, read toc only once.
 1579       %
 1580       % We use the node names as the destinations.
 1581       \def\partentry##1##2##3##4{}% ignore parts in the outlines
 1582       \def\numchapentry##1##2##3##4{%
 1583         \dopdfoutline{##1}{1}{##3}{##4}}%
 1584       \def\numsecentry##1##2##3##4{%
 1585         \dopdfoutline{##1}{2}{##3}{##4}}%
 1586       \def\numsubsecentry##1##2##3##4{%
 1587         \dopdfoutline{##1}{3}{##3}{##4}}%
 1588       \def\numsubsubsecentry##1##2##3##4{%
 1589         \dopdfoutline{##1}{4}{##3}{##4}}%
 1590       %
 1591       \let\appentry\numchapentry%
 1592       \let\appsecentry\numsecentry%
 1593       \let\appsubsecentry\numsubsecentry%
 1594       \let\appsubsubsecentry\numsubsubsecentry%
 1595       \let\unnchapentry\numchapentry%
 1596       \let\unnsecentry\numsecentry%
 1597       \let\unnsubsecentry\numsubsecentry%
 1598       \let\unnsubsubsecentry\numsubsubsecentry%
 1599       %
 1600       % In the case of XeTeX, xdvipdfmx converts strings to UTF-16.
 1601       % Therefore, the encoding and the language may not be considered.
 1602       %
 1603       \indexnofonts
 1604       \setupdatafile
 1605       % We can have normal brace characters in the PDF outlines, unlike
 1606       % Texinfo index files.  So set that up.
 1607       \def\{{\lbracecharliteral}%
 1608       \def\}{\rbracecharliteral}%
 1609       \catcode`\\=\active \otherbackslash
 1610       \input \tocreadfilename
 1611     \endgroup
 1612   }
 1613   {\catcode`[=1 \catcode`]=2
 1614    \catcode`{=\other \catcode`}=\other
 1615    \gdef\lbracecharliteral[{]%
 1616    \gdef\rbracecharliteral[}]%
 1617   ]
 1618 
 1619   \special{pdf:docview << /PageMode /UseOutlines >> }
 1620   % ``\special{pdf:tounicode ...}'' is not necessary
 1621   % because xdvipdfmx converts strings from UTF-8 to UTF-16 without it.
 1622   % However, due to UTF-16 convert issue of xdvipdfmx 20150315,
 1623   % ``\special{pdf:dest ...}'' can not handle non-ASCII strings.
 1624   % It fixed by xdvipdfmx 20160106 (TeX Live SVN r39753).
 1625 %
 1626   \def\skipspaces#1{\def\PP{#1}\def\D{|}%
 1627     \ifx\PP\D\let\nextsp\relax
 1628     \else\let\nextsp\skipspaces
 1629       \addtokens{\filename}{\PP}%
 1630       \advance\filenamelength by 1
 1631     \fi
 1632     \nextsp}
 1633   \def\getfilename#1{%
 1634     \filenamelength=0
 1635     % If we don't expand the argument now, \skipspaces will get
 1636     % snagged on things like "@value{foo}".
 1637     \edef\temp{#1}%
 1638     \expandafter\skipspaces\temp|\relax
 1639   }
 1640   % make a live url in pdf output.
 1641   \def\pdfurl#1{%
 1642     \begingroup
 1643       % it seems we really need yet another set of dummies; have not
 1644       % tried to figure out what each command should do in the context
 1645       % of @url.  for now, just make @/ a no-op, that's the only one
 1646       % people have actually reported a problem with.
 1647       %
 1648       \normalturnoffactive
 1649       \def\@{@}%
 1650       \let\/=\empty
 1651       \makevalueexpandable
 1652       % do we want to go so far as to use \indexnofonts instead of just
 1653       % special-casing \var here?
 1654       \def\var##1{##1}%
 1655       %
 1656       \leavevmode\setcolor{\urlcolor}%
 1657       \special{pdf:bann << /Border [0 0 0]
 1658         /Subtype /Link /A << /S /URI /URI (#1) >> >>}%
 1659     \endgroup}
 1660   \def\endlink{\setcolor{\maincolor}\special{pdf:eann}}
 1661   \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
 1662   \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
 1663   \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
 1664   \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
 1665   \def\maketoks{%
 1666     \expandafter\poptoks\the\toksA|ENDTOKS|\relax
 1667     \ifx\first0\adn0
 1668     \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
 1669     \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
 1670     \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
 1671     \else
 1672       \ifnum0=\countA\else\makelink\fi
 1673       \ifx\first.\let\next=\done\else
 1674         \let\next=\maketoks
 1675         \addtokens{\toksB}{\the\toksD}
 1676         \ifx\first,\addtokens{\toksB}{\space}\fi
 1677       \fi
 1678     \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
 1679     \next}
 1680   \def\makelink{\addtokens{\toksB}%
 1681     {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
 1682   \def\pdflink#1{%
 1683     \special{pdf:bann << /Border [0 0 0]
 1684       /Type /Annot /Subtype /Link /A << /S /GoTo /D (name#1) >> >>}%
 1685     \setcolor{\linkcolor}#1\endlink}
 1686   \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
 1687 %
 1688   %
 1689   % @image support
 1690   %
 1691   % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
 1692   \def\doxeteximage#1#2#3{%
 1693     \def\xeteximagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
 1694     \def\xeteximageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
 1695     %
 1696     % XeTeX (and the PDF format) support .pdf, .png, .jpg (among
 1697     % others).  Let's try in that order, PDF first since if
 1698     % someone has a scalable image, presumably better to use that than a
 1699     % bitmap.
 1700     \let\xeteximgext=\empty
 1701     \begingroup
 1702       \openin 1 #1.pdf \ifeof 1
 1703         \openin 1 #1.PDF \ifeof 1
 1704           \openin 1 #1.png \ifeof 1
 1705             \openin 1 #1.jpg \ifeof 1
 1706               \openin 1 #1.jpeg \ifeof 1
 1707                 \openin 1 #1.JPG \ifeof 1
 1708                   \errmessage{Could not find image file #1 for XeTeX}%
 1709                 \else \gdef\xeteximgext{JPG}%
 1710                 \fi
 1711               \else \gdef\xeteximgext{jpeg}%
 1712               \fi
 1713             \else \gdef\xeteximgext{jpg}%
 1714             \fi
 1715           \else \gdef\xeteximgext{png}%
 1716           \fi
 1717         \else \gdef\xeteximgext{PDF}%
 1718         \fi
 1719       \else \gdef\xeteximgext{pdf}%
 1720       \fi
 1721       \closein 1
 1722     \endgroup
 1723     %
 1724     \def\xetexpdfext{pdf}%
 1725     \ifx\xeteximgext\xetexpdfext
 1726       \XeTeXpdffile "#1".\xeteximgext ""
 1727     \else
 1728       \def\xetexpdfext{PDF}%
 1729       \ifx\xeteximgext\xetexpdfext
 1730         \XeTeXpdffile "#1".\xeteximgext ""
 1731       \else
 1732         \XeTeXpicfile "#1".\xeteximgext ""
 1733       \fi
 1734     \fi
 1735     \ifdim \wd0 >0pt width \xeteximagewidth \fi
 1736     \ifdim \wd2 >0pt height \xeteximageheight \fi \relax
 1737   }
 1738 \fi
 1739 
 1740 \message{fonts,}
 1741 
 1742 % Change the current font style to #1, remembering it in \curfontstyle.
 1743 % For now, we do not accumulate font styles: @b{@i{foo}} prints foo in
 1744 % italics, not bold italics.
 1745 %
 1746 \def\setfontstyle#1{%
 1747   \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd.
 1748   \csname ten#1\endcsname  % change the current font
 1749 }
 1750 
 1751 % Select #1 fonts with the current style.
 1752 %
 1753 \def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname}
 1754 
 1755 \def\rm{\fam=0 \setfontstyle{rm}}
 1756 \def\it{\fam=\itfam \setfontstyle{it}}
 1757 \def\sl{\fam=\slfam \setfontstyle{sl}}
 1758 \def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
 1759 \def\tt{\fam=\ttfam \setfontstyle{tt}}
 1760 
 1761 % Unfortunately, we have to override this for titles and the like, since
 1762 % in those cases "rm" is bold.  Sigh.
 1763 \def\rmisbold{\rm\def\curfontstyle{bf}}
 1764 
 1765 % Texinfo sort of supports the sans serif font style, which plain TeX does not.
 1766 % So we set up a \sf.
 1767 \newfam\sffam
 1768 \def\sf{\fam=\sffam \setfontstyle{sf}}
 1769 \let\li = \sf % Sometimes we call it \li, not \sf.
 1770 
 1771 % We don't need math for this font style.
 1772 \def\ttsl{\setfontstyle{ttsl}}
 1773 
 1774 
 1775 % Set the baselineskip to #1, and the lineskip and strut size
 1776 % correspondingly.  There is no deep meaning behind these magic numbers
 1777 % used as factors; they just match (closely enough) what Knuth defined.
 1778 %
 1779 \def\lineskipfactor{.08333}
 1780 \def\strutheightpercent{.70833}
 1781 \def\strutdepthpercent {.29167}
 1782 %
 1783 % can get a sort of poor man's double spacing by redefining this.
 1784 \def\baselinefactor{1}
 1785 %
 1786 \newdimen\textleading
 1787 \def\setleading#1{%
 1788   \dimen0 = #1\relax
 1789   \normalbaselineskip = \baselinefactor\dimen0
 1790   \normallineskip = \lineskipfactor\normalbaselineskip
 1791   \normalbaselines
 1792   \setbox\strutbox =\hbox{%
 1793     \vrule width0pt height\strutheightpercent\baselineskip
 1794                     depth \strutdepthpercent \baselineskip
 1795   }%
 1796 }
 1797 
 1798 % PDF CMaps.  See also LaTeX's t1.cmap.
 1799 %
 1800 % do nothing with this by default.
 1801 \expandafter\let\csname cmapOT1\endcsname\gobble
 1802 \expandafter\let\csname cmapOT1IT\endcsname\gobble
 1803 \expandafter\let\csname cmapOT1TT\endcsname\gobble
 1804 
 1805 % if we are producing pdf, and we have \pdffontattr, then define cmaps.
 1806 % (\pdffontattr was introduced many years ago, but people still run
 1807 % older pdftex's; it's easy to conditionalize, so we do.)
 1808 \ifpdf \ifx\pdffontattr\thisisundefined \else
 1809   \begingroup
 1810     \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
 1811     \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
 1812 %%DocumentNeededResources: ProcSet (CIDInit)
 1813 %%IncludeResource: ProcSet (CIDInit)
 1814 %%BeginResource: CMap (TeX-OT1-0)
 1815 %%Title: (TeX-OT1-0 TeX OT1 0)
 1816 %%Version: 1.000
 1817 %%EndComments
 1818 /CIDInit /ProcSet findresource begin
 1819 12 dict begin
 1820 begincmap
 1821 /CIDSystemInfo
 1822 << /Registry (TeX)
 1823 /Ordering (OT1)
 1824 /Supplement 0
 1825 >> def
 1826 /CMapName /TeX-OT1-0 def
 1827 /CMapType 2 def
 1828 1 begincodespacerange
 1829 <00> <7F>
 1830 endcodespacerange
 1831 8 beginbfrange
 1832 <00> <01> <0393>
 1833 <09> <0A> <03A8>
 1834 <23> <26> <0023>
 1835 <28> <3B> <0028>
 1836 <3F> <5B> <003F>
 1837 <5D> <5E> <005D>
 1838 <61> <7A> <0061>
 1839 <7B> <7C> <2013>
 1840 endbfrange
 1841 40 beginbfchar
 1842 <02> <0398>
 1843 <03> <039B>
 1844 <04> <039E>
 1845 <05> <03A0>
 1846 <06> <03A3>
 1847 <07> <03D2>
 1848 <08> <03A6>
 1849 <0B> <00660066>
 1850 <0C> <00660069>
 1851 <0D> <0066006C>
 1852 <0E> <006600660069>
 1853 <0F> <00660066006C>
 1854 <10> <0131>
 1855 <11> <0237>
 1856 <12> <0060>
 1857 <13> <00B4>
 1858 <14> <02C7>
 1859 <15> <02D8>
 1860 <16> <00AF>
 1861 <17> <02DA>
 1862 <18> <00B8>
 1863 <19> <00DF>
 1864 <1A> <00E6>
 1865 <1B> <0153>
 1866 <1C> <00F8>
 1867 <1D> <00C6>
 1868 <1E> <0152>
 1869 <1F> <00D8>
 1870 <21> <0021>
 1871 <22> <201D>
 1872 <27> <2019>
 1873 <3C> <00A1>
 1874 <3D> <003D>
 1875 <3E> <00BF>
 1876 <5C> <201C>
 1877 <5F> <02D9>
 1878 <60> <2018>
 1879 <7D> <02DD>
 1880 <7E> <007E>
 1881 <7F> <00A8>
 1882 endbfchar
 1883 endcmap
 1884 CMapName currentdict /CMap defineresource pop
 1885 end
 1886 end
 1887 %%EndResource
 1888 %%EOF
 1889     }\endgroup
 1890   \expandafter\edef\csname cmapOT1\endcsname#1{%
 1891     \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
 1892   }%
 1893 %
 1894 % \cmapOT1IT
 1895   \begingroup
 1896     \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
 1897     \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
 1898 %%DocumentNeededResources: ProcSet (CIDInit)
 1899 %%IncludeResource: ProcSet (CIDInit)
 1900 %%BeginResource: CMap (TeX-OT1IT-0)
 1901 %%Title: (TeX-OT1IT-0 TeX OT1IT 0)
 1902 %%Version: 1.000
 1903 %%EndComments
 1904 /CIDInit /ProcSet findresource begin
 1905 12 dict begin
 1906 begincmap
 1907 /CIDSystemInfo
 1908 << /Registry (TeX)
 1909 /Ordering (OT1IT)
 1910 /Supplement 0
 1911 >> def
 1912 /CMapName /TeX-OT1IT-0 def
 1913 /CMapType 2 def
 1914 1 begincodespacerange
 1915 <00> <7F>
 1916 endcodespacerange
 1917 8 beginbfrange
 1918 <00> <01> <0393>
 1919 <09> <0A> <03A8>
 1920 <25> <26> <0025>
 1921 <28> <3B> <0028>
 1922 <3F> <5B> <003F>
 1923 <5D> <5E> <005D>
 1924 <61> <7A> <0061>
 1925 <7B> <7C> <2013>
 1926 endbfrange
 1927 42 beginbfchar
 1928 <02> <0398>
 1929 <03> <039B>
 1930 <04> <039E>
 1931 <05> <03A0>
 1932 <06> <03A3>
 1933 <07> <03D2>
 1934 <08> <03A6>
 1935 <0B> <00660066>
 1936 <0C> <00660069>
 1937 <0D> <0066006C>
 1938 <0E> <006600660069>
 1939 <0F> <00660066006C>
 1940 <10> <0131>
 1941 <11> <0237>
 1942 <12> <0060>
 1943 <13> <00B4>
 1944 <14> <02C7>
 1945 <15> <02D8>
 1946 <16> <00AF>
 1947 <17> <02DA>
 1948 <18> <00B8>
 1949 <19> <00DF>
 1950 <1A> <00E6>
 1951 <1B> <0153>
 1952 <1C> <00F8>
 1953 <1D> <00C6>
 1954 <1E> <0152>
 1955 <1F> <00D8>
 1956 <21> <0021>
 1957 <22> <201D>
 1958 <23> <0023>
 1959 <24> <00A3>
 1960 <27> <2019>
 1961 <3C> <00A1>
 1962 <3D> <003D>
 1963 <3E> <00BF>
 1964 <5C> <201C>
 1965 <5F> <02D9>
 1966 <60> <2018>
 1967 <7D> <02DD>
 1968 <7E> <007E>
 1969 <7F> <00A8>
 1970 endbfchar
 1971 endcmap
 1972 CMapName currentdict /CMap defineresource pop
 1973 end
 1974 end
 1975 %%EndResource
 1976 %%EOF
 1977     }\endgroup
 1978   \expandafter\edef\csname cmapOT1IT\endcsname#1{%
 1979     \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
 1980   }%
 1981 %
 1982 % \cmapOT1TT
 1983   \begingroup
 1984     \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
 1985     \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
 1986 %%DocumentNeededResources: ProcSet (CIDInit)
 1987 %%IncludeResource: ProcSet (CIDInit)
 1988 %%BeginResource: CMap (TeX-OT1TT-0)
 1989 %%Title: (TeX-OT1TT-0 TeX OT1TT 0)
 1990 %%Version: 1.000
 1991 %%EndComments
 1992 /CIDInit /ProcSet findresource begin
 1993 12 dict begin
 1994 begincmap
 1995 /CIDSystemInfo
 1996 << /Registry (TeX)
 1997 /Ordering (OT1TT)
 1998 /Supplement 0
 1999 >> def
 2000 /CMapName /TeX-OT1TT-0 def
 2001 /CMapType 2 def
 2002 1 begincodespacerange
 2003 <00> <7F>
 2004 endcodespacerange
 2005 5 beginbfrange
 2006 <00> <01> <0393>
 2007 <09> <0A> <03A8>
 2008 <21> <26> <0021>
 2009 <28> <5F> <0028>
 2010 <61> <7E> <0061>
 2011 endbfrange
 2012 32 beginbfchar
 2013 <02> <0398>
 2014 <03> <039B>
 2015 <04> <039E>
 2016 <05> <03A0>
 2017 <06> <03A3>
 2018 <07> <03D2>
 2019 <08> <03A6>
 2020 <0B> <2191>
 2021 <0C> <2193>
 2022 <0D> <0027>
 2023 <0E> <00A1>
 2024 <0F> <00BF>
 2025 <10> <0131>
 2026 <11> <0237>
 2027 <12> <0060>
 2028 <13> <00B4>
 2029 <14> <02C7>
 2030 <15> <02D8>
 2031 <16> <00AF>
 2032 <17> <02DA>
 2033 <18> <00B8>
 2034 <19> <00DF>
 2035 <1A> <00E6>
 2036 <1B> <0153>
 2037 <1C> <00F8>
 2038 <1D> <00C6>
 2039 <1E> <0152>
 2040 <1F> <00D8>
 2041 <20> <2423>
 2042 <27> <2019>
 2043 <60> <2018>
 2044 <7F> <00A8>
 2045 endbfchar
 2046 endcmap
 2047 CMapName currentdict /CMap defineresource pop
 2048 end
 2049 end
 2050 %%EndResource
 2051 %%EOF
 2052     }\endgroup
 2053   \expandafter\edef\csname cmapOT1TT\endcsname#1{%
 2054     \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
 2055   }%
 2056 \fi\fi
 2057 
 2058 
 2059 % Set the font macro #1 to the font named \fontprefix#2.
 2060 % #3 is the font's design size, #4 is a scale factor, #5 is the CMap
 2061 % encoding (only OT1, OT1IT and OT1TT are allowed, or empty to omit).
 2062 % Example:
 2063 % #1 = \textrm
 2064 % #2 = \rmshape
 2065 % #3 = 10
 2066 % #4 = \mainmagstep
 2067 % #5 = OT1
 2068 %
 2069 \def\setfont#1#2#3#4#5{%
 2070   \font#1=\fontprefix#2#3 scaled #4
 2071   \csname cmap#5\endcsname#1%
 2072 }
 2073 % This is what gets called when #5 of \setfont is empty.
 2074 \let\cmap\gobble
 2075 %
 2076 % (end of cmaps)
 2077 
 2078 % Use cm as the default font prefix.
 2079 % To specify the font prefix, you must define \fontprefix
 2080 % before you read in texinfo.tex.
 2081 \ifx\fontprefix\thisisundefined
 2082 \def\fontprefix{cm}
 2083 \fi
 2084 % Support font families that don't use the same naming scheme as CM.
 2085 \def\rmshape{r}
 2086 \def\rmbshape{bx}               % where the normal face is bold
 2087 \def\bfshape{b}
 2088 \def\bxshape{bx}
 2089 \def\ttshape{tt}
 2090 \def\ttbshape{tt}
 2091 \def\ttslshape{sltt}
 2092 \def\itshape{ti}
 2093 \def\itbshape{bxti}
 2094 \def\slshape{sl}
 2095 \def\slbshape{bxsl}
 2096 \def\sfshape{ss}
 2097 \def\sfbshape{ss}
 2098 \def\scshape{csc}
 2099 \def\scbshape{csc}
 2100 
 2101 % Definitions for a main text size of 11pt.  (The default in Texinfo.)
 2102 %
 2103 \def\definetextfontsizexi{%
 2104 % Text fonts (11.2pt, magstep1).
 2105 \def\textnominalsize{11pt}
 2106 \edef\mainmagstep{\magstephalf}
 2107 \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
 2108 \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
 2109 \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
 2110 \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
 2111 \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
 2112 \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
 2113 \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
 2114 \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
 2115 \font\texti=cmmi10 scaled \mainmagstep
 2116 \font\textsy=cmsy10 scaled \mainmagstep
 2117 \def\textecsize{1095}
 2118 
 2119 % A few fonts for @defun names and args.
 2120 \setfont\defbf\bfshape{10}{\magstep1}{OT1}
 2121 \setfont\deftt\ttshape{10}{\magstep1}{OT1TT}
 2122 \setfont\defsl\slshape{10}{\magstep1}{OT1TT}
 2123 \setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT}
 2124 \def\df{\let\tentt=\deftt \let\tenbf = \defbf
 2125 \let\tenttsl=\defttsl \let\tensl=\defsl \bf}
 2126 
 2127 % Fonts for indices, footnotes, small examples (9pt).
 2128 \def\smallnominalsize{9pt}
 2129 \setfont\smallrm\rmshape{9}{1000}{OT1}
 2130 \setfont\smalltt\ttshape{9}{1000}{OT1TT}
 2131 \setfont\smallbf\bfshape{10}{900}{OT1}
 2132 \setfont\smallit\itshape{9}{1000}{OT1IT}
 2133 \setfont\smallsl\slshape{9}{1000}{OT1}
 2134 \setfont\smallsf\sfshape{9}{1000}{OT1}
 2135 \setfont\smallsc\scshape{10}{900}{OT1}
 2136 \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
 2137 \font\smalli=cmmi9
 2138 \font\smallsy=cmsy9
 2139 \def\smallecsize{0900}
 2140 
 2141 % Fonts for small examples (8pt).
 2142 \def\smallernominalsize{8pt}
 2143 \setfont\smallerrm\rmshape{8}{1000}{OT1}
 2144 \setfont\smallertt\ttshape{8}{1000}{OT1TT}
 2145 \setfont\smallerbf\bfshape{10}{800}{OT1}
 2146 \setfont\smallerit\itshape{8}{1000}{OT1IT}
 2147 \setfont\smallersl\slshape{8}{1000}{OT1}
 2148 \setfont\smallersf\sfshape{8}{1000}{OT1}
 2149 \setfont\smallersc\scshape{10}{800}{OT1}
 2150 \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
 2151 \font\smalleri=cmmi8
 2152 \font\smallersy=cmsy8
 2153 \def\smallerecsize{0800}
 2154 
 2155 % Fonts for title page (20.4pt):
 2156 \def\titlenominalsize{20pt}
 2157 \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
 2158 \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
 2159 \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
 2160 \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
 2161 \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
 2162 \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
 2163 \let\titlebf=\titlerm
 2164 \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
 2165 \font\titlei=cmmi12 scaled \magstep3
 2166 \font\titlesy=cmsy10 scaled \magstep4
 2167 \def\titleecsize{2074}
 2168 
 2169 % Chapter (and unnumbered) fonts (17.28pt).
 2170 \def\chapnominalsize{17pt}
 2171 \setfont\chaprm\rmbshape{12}{\magstep2}{OT1}
 2172 \setfont\chapit\itbshape{10}{\magstep3}{OT1IT}
 2173 \setfont\chapsl\slbshape{10}{\magstep3}{OT1}
 2174 \setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT}
 2175 \setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT}
 2176 \setfont\chapsf\sfbshape{17}{1000}{OT1}
 2177 \let\chapbf=\chaprm
 2178 \setfont\chapsc\scbshape{10}{\magstep3}{OT1}
 2179 \font\chapi=cmmi12 scaled \magstep2
 2180 \font\chapsy=cmsy10 scaled \magstep3
 2181 \def\chapecsize{1728}
 2182 
 2183 % Section fonts (14.4pt).
 2184 \def\secnominalsize{14pt}
 2185 \setfont\secrm\rmbshape{12}{\magstep1}{OT1}
 2186 \setfont\secrmnotbold\rmshape{12}{\magstep1}{OT1}
 2187 \setfont\secit\itbshape{10}{\magstep2}{OT1IT}
 2188 \setfont\secsl\slbshape{10}{\magstep2}{OT1}
 2189 \setfont\sectt\ttbshape{12}{\magstep1}{OT1TT}
 2190 \setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT}
 2191 \setfont\secsf\sfbshape{12}{\magstep1}{OT1}
 2192 \let\secbf\secrm
 2193 \setfont\secsc\scbshape{10}{\magstep2}{OT1}
 2194 \font\seci=cmmi12 scaled \magstep1
 2195 \font\secsy=cmsy10 scaled \magstep2
 2196 \def\sececsize{1440}
 2197 
 2198 % Subsection fonts (13.15pt).
 2199 \def\ssecnominalsize{13pt}
 2200 \setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1}
 2201 \setfont\ssecit\itbshape{10}{1315}{OT1IT}
 2202 \setfont\ssecsl\slbshape{10}{1315}{OT1}
 2203 \setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT}
 2204 \setfont\ssecttsl\ttslshape{10}{1315}{OT1TT}
 2205 \setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1}
 2206 \let\ssecbf\ssecrm
 2207 \setfont\ssecsc\scbshape{10}{1315}{OT1}
 2208 \font\sseci=cmmi12 scaled \magstephalf
 2209 \font\ssecsy=cmsy10 scaled 1315
 2210 \def\ssececsize{1200}
 2211 
 2212 % Reduced fonts for @acro in text (10pt).
 2213 \def\reducednominalsize{10pt}
 2214 \setfont\reducedrm\rmshape{10}{1000}{OT1}
 2215 \setfont\reducedtt\ttshape{10}{1000}{OT1TT}
 2216 \setfont\reducedbf\bfshape{10}{1000}{OT1}
 2217 \setfont\reducedit\itshape{10}{1000}{OT1IT}
 2218 \setfont\reducedsl\slshape{10}{1000}{OT1}
 2219 \setfont\reducedsf\sfshape{10}{1000}{OT1}
 2220 \setfont\reducedsc\scshape{10}{1000}{OT1}
 2221 \setfont\reducedttsl\ttslshape{10}{1000}{OT1TT}
 2222 \font\reducedi=cmmi10
 2223 \font\reducedsy=cmsy10
 2224 \def\reducedecsize{1000}
 2225 
 2226 \textleading = 13.2pt % line spacing for 11pt CM
 2227 \textfonts            % reset the current fonts
 2228 \rm
 2229 } % end of 11pt text font size definitions, \definetextfontsizexi
 2230 
 2231 
 2232 % Definitions to make the main text be 10pt Computer Modern, with
 2233 % section, chapter, etc., sizes following suit.  This is for the GNU
 2234 % Press printing of the Emacs 22 manual.  Maybe other manuals in the
 2235 % future.  Used with @smallbook, which sets the leading to 12pt.
 2236 %
 2237 \def\definetextfontsizex{%
 2238 % Text fonts (10pt).
 2239 \def\textnominalsize{10pt}
 2240 \edef\mainmagstep{1000}
 2241 \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
 2242 \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
 2243 \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
 2244 \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
 2245 \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
 2246 \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
 2247 \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
 2248 \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
 2249 \font\texti=cmmi10 scaled \mainmagstep
 2250 \font\textsy=cmsy10 scaled \mainmagstep
 2251 \def\textecsize{1000}
 2252 
 2253 % A few fonts for @defun names and args.
 2254 \setfont\defbf\bfshape{10}{\magstephalf}{OT1}
 2255 \setfont\deftt\ttshape{10}{\magstephalf}{OT1TT}
 2256 \setfont\defsl\slshape{10}{\magstephalf}{OT1TT}
 2257 \setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT}
 2258 \def\df{\let\tentt=\deftt \let\tenbf = \defbf
 2259 \let\tensl=\defsl \let\tenttsl=\defttsl \bf}
 2260 
 2261 % Fonts for indices, footnotes, small examples (9pt).
 2262 \def\smallnominalsize{9pt}
 2263 \setfont\smallrm\rmshape{9}{1000}{OT1}
 2264 \setfont\smalltt\ttshape{9}{1000}{OT1TT}
 2265 \setfont\smallbf\bfshape{10}{900}{OT1}
 2266 \setfont\smallit\itshape{9}{1000}{OT1IT}
 2267 \setfont\smallsl\slshape{9}{1000}{OT1}
 2268 \setfont\smallsf\sfshape{9}{1000}{OT1}
 2269 \setfont\smallsc\scshape{10}{900}{OT1}
 2270 \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
 2271 \font\smalli=cmmi9
 2272 \font\smallsy=cmsy9
 2273 \def\smallecsize{0900}
 2274 
 2275 % Fonts for small examples (8pt).
 2276 \def\smallernominalsize{8pt}
 2277 \setfont\smallerrm\rmshape{8}{1000}{OT1}
 2278 \setfont\smallertt\ttshape{8}{1000}{OT1TT}
 2279 \setfont\smallerbf\bfshape{10}{800}{OT1}
 2280 \setfont\smallerit\itshape{8}{1000}{OT1IT}
 2281 \setfont\smallersl\slshape{8}{1000}{OT1}
 2282 \setfont\smallersf\sfshape{8}{1000}{OT1}
 2283 \setfont\smallersc\scshape{10}{800}{OT1}
 2284 \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
 2285 \font\smalleri=cmmi8
 2286 \font\smallersy=cmsy8
 2287 \def\smallerecsize{0800}
 2288 
 2289 % Fonts for title page (20.4pt):
 2290 \def\titlenominalsize{20pt}
 2291 \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
 2292 \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
 2293 \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
 2294 \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
 2295 \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
 2296 \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
 2297 \let\titlebf=\titlerm
 2298 \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
 2299 \font\titlei=cmmi12 scaled \magstep3
 2300 \font\titlesy=cmsy10 scaled \magstep4
 2301 \def\titleecsize{2074}
 2302 
 2303 % Chapter fonts (14.4pt).
 2304 \def\chapnominalsize{14pt}
 2305 \setfont\chaprm\rmbshape{12}{\magstep1}{OT1}
 2306 \setfont\chapit\itbshape{10}{\magstep2}{OT1IT}
 2307 \setfont\chapsl\slbshape{10}{\magstep2}{OT1}
 2308 \setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT}
 2309 \setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT}
 2310 \setfont\chapsf\sfbshape{12}{\magstep1}{OT1}
 2311 \let\chapbf\chaprm
 2312 \setfont\chapsc\scbshape{10}{\magstep2}{OT1}
 2313 \font\chapi=cmmi12 scaled \magstep1
 2314 \font\chapsy=cmsy10 scaled \magstep2
 2315 \def\chapecsize{1440}
 2316 
 2317 % Section fonts (12pt).
 2318 \def\secnominalsize{12pt}
 2319 \setfont\secrm\rmbshape{12}{1000}{OT1}
 2320 \setfont\secit\itbshape{10}{\magstep1}{OT1IT}
 2321 \setfont\secsl\slbshape{10}{\magstep1}{OT1}
 2322 \setfont\sectt\ttbshape{12}{1000}{OT1TT}
 2323 \setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT}
 2324 \setfont\secsf\sfbshape{12}{1000}{OT1}
 2325 \let\secbf\secrm
 2326 \setfont\secsc\scbshape{10}{\magstep1}{OT1}
 2327 \font\seci=cmmi12
 2328 \font\secsy=cmsy10 scaled \magstep1
 2329 \def\sececsize{1200}
 2330 
 2331 % Subsection fonts (10pt).
 2332 \def\ssecnominalsize{10pt}
 2333 \setfont\ssecrm\rmbshape{10}{1000}{OT1}
 2334 \setfont\ssecit\itbshape{10}{1000}{OT1IT}
 2335 \setfont\ssecsl\slbshape{10}{1000}{OT1}
 2336 \setfont\ssectt\ttbshape{10}{1000}{OT1TT}
 2337 \setfont\ssecttsl\ttslshape{10}{1000}{OT1TT}
 2338 \setfont\ssecsf\sfbshape{10}{1000}{OT1}
 2339 \let\ssecbf\ssecrm
 2340 \setfont\ssecsc\scbshape{10}{1000}{OT1}
 2341 \font\sseci=cmmi10
 2342 \font\ssecsy=cmsy10
 2343 \def\ssececsize{1000}
 2344 
 2345 % Reduced fonts for @acro in text (9pt).
 2346 \def\reducednominalsize{9pt}
 2347 \setfont\reducedrm\rmshape{9}{1000}{OT1}
 2348 \setfont\reducedtt\ttshape{9}{1000}{OT1TT}
 2349 \setfont\reducedbf\bfshape{10}{900}{OT1}
 2350 \setfont\reducedit\itshape{9}{1000}{OT1IT}
 2351 \setfont\reducedsl\slshape{9}{1000}{OT1}
 2352 \setfont\reducedsf\sfshape{9}{1000}{OT1}
 2353 \setfont\reducedsc\scshape{10}{900}{OT1}
 2354 \setfont\reducedttsl\ttslshape{10}{900}{OT1TT}
 2355 \font\reducedi=cmmi9
 2356 \font\reducedsy=cmsy9
 2357 \def\reducedecsize{0900}
 2358 
 2359 \divide\parskip by 2  % reduce space between paragraphs
 2360 \textleading = 12pt   % line spacing for 10pt CM
 2361 \textfonts            % reset the current fonts
 2362 \rm
 2363 } % end of 10pt text font size definitions, \definetextfontsizex
 2364 
 2365 
 2366 % We provide the user-level command
 2367 %   @fonttextsize 10
 2368 % (or 11) to redefine the text font size.  pt is assumed.
 2369 %
 2370 \def\xiword{11}
 2371 \def\xword{10}
 2372 \def\xwordpt{10pt}
 2373 %
 2374 \parseargdef\fonttextsize{%
 2375   \def\textsizearg{#1}%
 2376   %\wlog{doing @fonttextsize \textsizearg}%
 2377   %
 2378   % Set \globaldefs so that documents can use this inside @tex, since
 2379   % makeinfo 4.8 does not support it, but we need it nonetheless.
 2380   %
 2381  \begingroup \globaldefs=1
 2382   \ifx\textsizearg\xword \definetextfontsizex
 2383   \else \ifx\textsizearg\xiword \definetextfontsizexi
 2384   \else
 2385     \errhelp=\EMsimple
 2386     \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'}
 2387   \fi\fi
 2388  \endgroup
 2389 }
 2390 
 2391 % In order for the font changes to affect most math symbols and letters,
 2392 % we have to define the \textfont of the standard families.  We don't
 2393 % bother to reset \scriptfont and \scriptscriptfont; awaiting user need.
 2394 %
 2395 \def\resetmathfonts{%
 2396   \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy
 2397   \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf
 2398   \textfont\ttfam=\tentt \textfont\sffam=\tensf
 2399 }
 2400 
 2401 % The font-changing commands redefine the meanings of \tenSTYLE, instead
 2402 % of just \STYLE.  We do this because \STYLE needs to also set the
 2403 % current \fam for math mode.  Our \STYLE (e.g., \rm) commands hardwire
 2404 % \tenSTYLE to set the current font.
 2405 %
 2406 % Each font-changing command also sets the names \lsize (one size lower)
 2407 % and \lllsize (three sizes lower).  These relative commands are used
 2408 % in, e.g., the LaTeX logo and acronyms.
 2409 %
 2410 % This all needs generalizing, badly.
 2411 %
 2412 \def\textfonts{%
 2413   \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
 2414   \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
 2415   \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy
 2416   \let\tenttsl=\textttsl
 2417   \def\curfontsize{text}%
 2418   \def\lsize{reduced}\def\lllsize{smaller}%
 2419   \resetmathfonts \setleading{\textleading}}
 2420 \def\titlefonts{%
 2421   \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl
 2422   \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc
 2423   \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
 2424   \let\tenttsl=\titlettsl
 2425   \def\curfontsize{title}%
 2426   \def\lsize{chap}\def\lllsize{subsec}%
 2427   \resetmathfonts \setleading{27pt}}
 2428 \def\titlefont#1{{\titlefonts\rmisbold #1}}
 2429 \def\chapfonts{%
 2430   \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
 2431   \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
 2432   \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy
 2433   \let\tenttsl=\chapttsl
 2434   \def\curfontsize{chap}%
 2435   \def\lsize{sec}\def\lllsize{text}%
 2436   \resetmathfonts \setleading{19pt}}
 2437 \def\secfonts{%
 2438   \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
 2439   \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
 2440   \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy
 2441   \let\tenttsl=\secttsl
 2442   \def\curfontsize{sec}%
 2443   \def\lsize{subsec}\def\lllsize{reduced}%
 2444   \resetmathfonts \setleading{17pt}}
 2445 \def\subsecfonts{%
 2446   \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
 2447   \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
 2448   \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy
 2449   \let\tenttsl=\ssecttsl
 2450   \def\curfontsize{ssec}%
 2451   \def\lsize{text}\def\lllsize{small}%
 2452   \resetmathfonts \setleading{15pt}}
 2453 \let\subsubsecfonts = \subsecfonts
 2454 \def\reducedfonts{%
 2455   \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl
 2456   \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc
 2457   \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy
 2458   \let\tenttsl=\reducedttsl
 2459   \def\curfontsize{reduced}%
 2460   \def\lsize{small}\def\lllsize{smaller}%
 2461   \resetmathfonts \setleading{10.5pt}}
 2462 \def\smallfonts{%
 2463   \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl
 2464   \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc
 2465   \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy
 2466   \let\tenttsl=\smallttsl
 2467   \def\curfontsize{small}%
 2468   \def\lsize{smaller}\def\lllsize{smaller}%
 2469   \resetmathfonts \setleading{10.5pt}}
 2470 \def\smallerfonts{%
 2471   \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl
 2472   \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc
 2473   \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy
 2474   \let\tenttsl=\smallerttsl
 2475   \def\curfontsize{smaller}%
 2476   \def\lsize{smaller}\def\lllsize{smaller}%
 2477   \resetmathfonts \setleading{9.5pt}}
 2478 
 2479 % Fonts for short table of contents.
 2480 \setfont\shortcontrm\rmshape{12}{1000}{OT1}
 2481 \setfont\shortcontbf\bfshape{10}{\magstep1}{OT1}  % no cmb12
 2482 \setfont\shortcontsl\slshape{12}{1000}{OT1}
 2483 \setfont\shortconttt\ttshape{12}{1000}{OT1TT}
 2484 
 2485 % Define these just so they can be easily changed for other fonts.
 2486 \def\angleleft{$\langle$}
 2487 \def\angleright{$\rangle$}
 2488 
 2489 % Set the fonts to use with the @small... environments.
 2490 \let\smallexamplefonts = \smallfonts
 2491 
 2492 % About \smallexamplefonts.  If we use \smallfonts (9pt), @smallexample
 2493 % can fit this many characters:
 2494 %   8.5x11=86   smallbook=72  a4=90  a5=69
 2495 % If we use \scriptfonts (8pt), then we can fit this many characters:
 2496 %   8.5x11=90+  smallbook=80  a4=90+  a5=77
 2497 % For me, subjectively, the few extra characters that fit aren't worth
 2498 % the additional smallness of 8pt.  So I'm making the default 9pt.
 2499 %
 2500 % By the way, for comparison, here's what fits with @example (10pt):
 2501 %   8.5x11=71  smallbook=60  a4=75  a5=58
 2502 % --karl, 24jan03.
 2503 
 2504 % Set up the default fonts, so we can use them for creating boxes.
 2505 %
 2506 \definetextfontsizexi
 2507 
 2508 
 2509 \message{markup,}
 2510 
 2511 % Check if we are currently using a typewriter font.  Since all the
 2512 % Computer Modern typewriter fonts have zero interword stretch (and
 2513 % shrink), and it is reasonable to expect all typewriter fonts to have
 2514 % this property, we can check that font parameter.
 2515 %
 2516 \def\ifmonospace{\ifdim\fontdimen3\font=0pt }
 2517 
 2518 % Markup style infrastructure.  \defmarkupstylesetup\INITMACRO will
 2519 % define and register \INITMACRO to be called on markup style changes.
 2520 % \INITMACRO can check \currentmarkupstyle for the innermost
 2521 % style and the set of \ifmarkupSTYLE switches for all styles
 2522 % currently in effect.
 2523 \newif\ifmarkupvar
 2524 \newif\ifmarkupsamp
 2525 \newif\ifmarkupkey
 2526 %\newif\ifmarkupfile % @file == @samp.
 2527 %\newif\ifmarkupoption % @option == @samp.
 2528 \newif\ifmarkupcode
 2529 \newif\ifmarkupkbd
 2530 %\newif\ifmarkupenv % @env == @code.
 2531 %\newif\ifmarkupcommand % @command == @code.
 2532 \newif\ifmarkuptex % @tex (and part of @math, for now).
 2533 \newif\ifmarkupexample
 2534 \newif\ifmarkupverb
 2535 \newif\ifmarkupverbatim
 2536 
 2537 \let\currentmarkupstyle\empty
 2538 
 2539 \def\setupmarkupstyle#1{%
 2540   \csname markup#1true\endcsname
 2541   \def\currentmarkupstyle{#1}%
 2542   \markupstylesetup
 2543 }
 2544 
 2545 \let\markupstylesetup\empty
 2546 
 2547 \def\defmarkupstylesetup#1{%
 2548   \expandafter\def\expandafter\markupstylesetup
 2549     \expandafter{\markupstylesetup #1}%
 2550   \def#1%
 2551 }
 2552 
 2553 % Markup style setup for left and right quotes.
 2554 \defmarkupstylesetup\markupsetuplq{%
 2555   \expandafter\let\expandafter \temp
 2556     \csname markupsetuplq\currentmarkupstyle\endcsname
 2557   \ifx\temp\relax \markupsetuplqdefault \else \temp \fi
 2558 }
 2559 
 2560 \defmarkupstylesetup\markupsetuprq{%
 2561   \expandafter\let\expandafter \temp
 2562     \csname markupsetuprq\currentmarkupstyle\endcsname
 2563   \ifx\temp\relax \markupsetuprqdefault \else \temp \fi
 2564 }
 2565 
 2566 {
 2567 \catcode`\'=\active
 2568 \catcode`\`=\active
 2569 
 2570 \gdef\markupsetuplqdefault{\let`\lq}
 2571 \gdef\markupsetuprqdefault{\let'\rq}
 2572 
 2573 \gdef\markupsetcodequoteleft{\let`\codequoteleft}
 2574 \gdef\markupsetcodequoteright{\let'\codequoteright}
 2575 }
 2576 
 2577 \let\markupsetuplqcode \markupsetcodequoteleft
 2578 \let\markupsetuprqcode \markupsetcodequoteright
 2579 %
 2580 \let\markupsetuplqexample \markupsetcodequoteleft
 2581 \let\markupsetuprqexample \markupsetcodequoteright
 2582 %
 2583 \let\markupsetuplqkbd     \markupsetcodequoteleft
 2584 \let\markupsetuprqkbd     \markupsetcodequoteright
 2585 %
 2586 \let\markupsetuplqsamp \markupsetcodequoteleft
 2587 \let\markupsetuprqsamp \markupsetcodequoteright
 2588 %
 2589 \let\markupsetuplqverb \markupsetcodequoteleft
 2590 \let\markupsetuprqverb \markupsetcodequoteright
 2591 %
 2592 \let\markupsetuplqverbatim \markupsetcodequoteleft
 2593 \let\markupsetuprqverbatim \markupsetcodequoteright
 2594 
 2595 % Allow an option to not use regular directed right quote/apostrophe
 2596 % (char 0x27), but instead the undirected quote from cmtt (char 0x0d).
 2597 % The undirected quote is ugly, so don't make it the default, but it
 2598 % works for pasting with more pdf viewers (at least evince), the
 2599 % lilypond developers report.  xpdf does work with the regular 0x27.
 2600 %
 2601 \def\codequoteright{%
 2602   \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax
 2603     \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax
 2604       '%
 2605     \else \char'15 \fi
 2606   \else \char'15 \fi
 2607 }
 2608 %
 2609 % and a similar option for the left quote char vs. a grave accent.
 2610 % Modern fonts display ASCII 0x60 as a grave accent, so some people like
 2611 % the code environments to do likewise.
 2612 %
 2613 \def\codequoteleft{%
 2614   \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax
 2615     \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax
 2616       % [Knuth] pp. 380,381,391
 2617       % \relax disables Spanish ligatures ?` and !` of \tt font.
 2618       \relax`%
 2619     \else \char'22 \fi
 2620   \else \char'22 \fi
 2621 }
 2622 
 2623 % Commands to set the quote options.
 2624 % 
 2625 \parseargdef\codequoteundirected{%
 2626   \def\temp{#1}%
 2627   \ifx\temp\onword
 2628     \expandafter\let\csname SETtxicodequoteundirected\endcsname
 2629       = t%
 2630   \else\ifx\temp\offword
 2631     \expandafter\let\csname SETtxicodequoteundirected\endcsname
 2632       = \relax
 2633   \else
 2634     \errhelp = \EMsimple
 2635     \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}%
 2636   \fi\fi
 2637 }
 2638 %
 2639 \parseargdef\codequotebacktick{%
 2640   \def\temp{#1}%
 2641   \ifx\temp\onword
 2642     \expandafter\let\csname SETtxicodequotebacktick\endcsname
 2643       = t%
 2644   \else\ifx\temp\offword
 2645     \expandafter\let\csname SETtxicodequotebacktick\endcsname
 2646       = \relax
 2647   \else
 2648     \errhelp = \EMsimple
 2649     \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}%
 2650   \fi\fi
 2651 }
 2652 
 2653 % [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font.
 2654 \def\noligaturesquoteleft{\relax\lq}
 2655 
 2656 % Count depth in font-changes, for error checks
 2657 \newcount\fontdepth \fontdepth=0
 2658 
 2659 % Font commands.
 2660 
 2661 % #1 is the font command (\sl or \it), #2 is the text to slant.
 2662 % If we are in a monospaced environment, however, 1) always use \ttsl,
 2663 % and 2) do not add an italic correction.
 2664 \def\dosmartslant#1#2{%
 2665   \ifusingtt 
 2666     {{\ttsl #2}\let\next=\relax}%
 2667     {\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}%
 2668   \next
 2669 }
 2670 \def\smartslanted{\dosmartslant\sl}
 2671 \def\smartitalic{\dosmartslant\it}
 2672 
 2673 % Output an italic correction unless \next (presumed to be the following
 2674 % character) is such as not to need one.
 2675 \def\smartitaliccorrection{%
 2676   \ifx\next,%
 2677   \else\ifx\next-%
 2678   \else\ifx\next.%
 2679   \else\ifx\next\.%
 2680   \else\ifx\next\comma%
 2681   \else\ptexslash
 2682   \fi\fi\fi\fi\fi
 2683   \aftersmartic
 2684 }
 2685 
 2686 % Unconditional use \ttsl, and no ic.  @var is set to this for defuns.
 2687 \def\ttslanted#1{{\ttsl #1}}
 2688 
 2689 % @cite is like \smartslanted except unconditionally use \sl.  We never want
 2690 % ttsl for book titles, do we?
 2691 \def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection}
 2692 
 2693 \def\aftersmartic{}
 2694 \def\var#1{%
 2695   \let\saveaftersmartic = \aftersmartic
 2696   \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}%
 2697   \smartslanted{#1}%
 2698 }
 2699 
 2700 \let\i=\smartitalic
 2701 \let\slanted=\smartslanted
 2702 \let\dfn=\smartslanted
 2703 \let\emph=\smartitalic
 2704 
 2705 % Explicit font changes: @r, @sc, undocumented @ii.
 2706 \def\r#1{{\rm #1}}              % roman font
 2707 \def\sc#1{{\smallcaps#1}}       % smallcaps font
 2708 \def\ii#1{{\it #1}}             % italic font
 2709 
 2710 % @b, explicit bold.  Also @strong.
 2711 \def\b#1{{\bf #1}}
 2712 \let\strong=\b
 2713 
 2714 % @sansserif, explicit sans.
 2715 \def\sansserif#1{{\sf #1}}
 2716 
 2717 % We can't just use \exhyphenpenalty, because that only has effect at
 2718 % the end of a paragraph.  Restore normal hyphenation at the end of the
 2719 % group within which \nohyphenation is presumably called.
 2720 %
 2721 \def\nohyphenation{\hyphenchar\font = -1  \aftergroup\restorehyphenation}
 2722 \def\restorehyphenation{\hyphenchar\font = `- }
 2723 
 2724 % Set sfcode to normal for the chars that usually have another value.
 2725 % Can't use plain's \frenchspacing because it uses the `\x notation, and
 2726 % sometimes \x has an active definition that messes things up.
 2727 %
 2728 \catcode`@=11
 2729   \def\plainfrenchspacing{%
 2730     \sfcode`\.=\@m \sfcode`\?=\@m \sfcode`\!=\@m
 2731     \sfcode`\:=\@m \sfcode`\;=\@m \sfcode`\,=\@m
 2732     \def\endofsentencespacefactor{1000}% for @. and friends
 2733   }
 2734   \def\plainnonfrenchspacing{%
 2735     \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000
 2736     \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250
 2737     \def\endofsentencespacefactor{3000}% for @. and friends
 2738   }
 2739 \catcode`@=\other
 2740 \def\endofsentencespacefactor{3000}% default
 2741 
 2742 % @t, explicit typewriter.
 2743 \def\t#1{%
 2744   {\tt \rawbackslash \plainfrenchspacing #1}%
 2745   \null
 2746 }
 2747 
 2748 % @samp.
 2749 \def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}}
 2750 
 2751 % @indicateurl is \samp, that is, with quotes.
 2752 \let\indicateurl=\samp
 2753 
 2754 % @code (and similar) prints in typewriter, but with spaces the same
 2755 % size as normal in the surrounding text, without hyphenation, etc.
 2756 % This is a subroutine for that.
 2757 \def\tclose#1{%
 2758   {%
 2759     % Change normal interword space to be same as for the current font.
 2760     \spaceskip = \fontdimen2\font
 2761     %
 2762     % Switch to typewriter.
 2763     \tt
 2764     %
 2765     % But `\ ' produces the large typewriter interword space.
 2766     \def\ {{\spaceskip = 0pt{} }}%
 2767     %
 2768     % Turn off hyphenation.
 2769     \nohyphenation
 2770     %
 2771     \rawbackslash
 2772     \plainfrenchspacing
 2773     #1%
 2774   }%
 2775   \null % reset spacefactor to 1000
 2776 }
 2777 
 2778 % We *must* turn on hyphenation at `-' and `_' in @code.
 2779 % (But see \codedashfinish below.)
 2780 % Otherwise, it is too hard to avoid overfull hboxes
 2781 % in the Emacs manual, the Library manual, etc.
 2782 %
 2783 % Unfortunately, TeX uses one parameter (\hyphenchar) to control
 2784 % both hyphenation at - and hyphenation within words.
 2785 % We must therefore turn them both off (\tclose does that)
 2786 % and arrange explicitly to hyphenate at a dash. -- rms.
 2787 {
 2788   \catcode`\-=\active \catcode`\_=\active
 2789   \catcode`\'=\active \catcode`\`=\active
 2790   \global\let'=\rq \global\let`=\lq  % default definitions
 2791   %
 2792   \global\def\code{\begingroup
 2793     \setupmarkupstyle{code}%
 2794     % The following should really be moved into \setupmarkupstyle handlers.
 2795     \catcode\dashChar=\active  \catcode\underChar=\active
 2796     \ifallowcodebreaks
 2797      \let-\codedash
 2798      \let_\codeunder
 2799     \else
 2800      \let-\normaldash
 2801      \let_\realunder
 2802     \fi
 2803     % Given -foo (with a single dash), we do not want to allow a break
 2804     % after the hyphen.
 2805     \global\let\codedashprev=\codedash
 2806     %
 2807     \codex
 2808   }
 2809   %
 2810   \gdef\codedash{\futurelet\next\codedashfinish}
 2811   \gdef\codedashfinish{%
 2812     \normaldash % always output the dash character itself.
 2813     % 
 2814     % Now, output a discretionary to allow a line break, unless
 2815     % (a) the next character is a -, or
 2816     % (b) the preceding character is a -.
 2817     % E.g., given --posix, we do not want to allow a break after either -.
 2818     % Given --foo-bar, we do want to allow a break between the - and the b.
 2819     \ifx\next\codedash \else
 2820       \ifx\codedashprev\codedash 
 2821       \else \discretionary{}{}{}\fi
 2822     \fi
 2823     % we need the space after the = for the case when \next itself is a
 2824     % space token; it would get swallowed otherwise.  As in @code{- a}.
 2825     \global\let\codedashprev= \next
 2826   }
 2827 }
 2828 \def\normaldash{-}
 2829 %
 2830 \def\codex #1{\tclose{#1}\endgroup}
 2831 
 2832 \def\codeunder{%
 2833   % this is all so @math{@code{var_name}+1} can work.  In math mode, _
 2834   % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
 2835   % will therefore expand the active definition of _, which is us
 2836   % (inside @code that is), therefore an endless loop.
 2837   \ifusingtt{\ifmmode
 2838                \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_.
 2839              \else\normalunderscore \fi
 2840              \discretionary{}{}{}}%
 2841             {\_}%
 2842 }
 2843 
 2844 % An additional complication: the above will allow breaks after, e.g.,
 2845 % each of the four underscores in __typeof__.  This is bad.
 2846 % @allowcodebreaks provides a document-level way to turn breaking at -
 2847 % and _ on and off.
 2848 %
 2849 \newif\ifallowcodebreaks  \allowcodebreakstrue
 2850 
 2851 \def\keywordtrue{true}
 2852 \def\keywordfalse{false}
 2853 
 2854 \parseargdef\allowcodebreaks{%
 2855   \def\txiarg{#1}%
 2856   \ifx\txiarg\keywordtrue
 2857     \allowcodebreakstrue
 2858   \else\ifx\txiarg\keywordfalse
 2859     \allowcodebreaksfalse
 2860   \else
 2861     \errhelp = \EMsimple
 2862     \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}%
 2863   \fi\fi
 2864 }
 2865 
 2866 % For @command, @env, @file, @option quotes seem unnecessary,
 2867 % so use \code rather than \samp.
 2868 \let\command=\code
 2869 \let\env=\code
 2870 \let\file=\code
 2871 \let\option=\code
 2872 
 2873 % @uref (abbreviation for `urlref') aka @url takes an optional
 2874 % (comma-separated) second argument specifying the text to display and
 2875 % an optional third arg as text to display instead of (rather than in
 2876 % addition to) the url itself.  First (mandatory) arg is the url.
 2877 
 2878 % TeX-only option to allow changing PDF output to show only the second
 2879 % arg (if given), and not the url (which is then just the link target).
 2880 \newif\ifurefurlonlylink
 2881 
 2882 % The main macro is \urefbreak, which allows breaking at expected
 2883 % places within the url.  (There used to be another version, which
 2884 % didn't support automatic breaking.)
 2885 \def\urefbreak{\begingroup \urefcatcodes \dourefbreak}
 2886 \let\uref=\urefbreak
 2887 %
 2888 \def\dourefbreak#1{\urefbreakfinish #1,,,\finish}
 2889 \def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example
 2890   \unsepspaces
 2891   \pdfurl{#1}%
 2892   \setbox0 = \hbox{\ignorespaces #3}%
 2893   \ifdim\wd0 > 0pt
 2894     \unhbox0 % third arg given, show only that
 2895   \else
 2896     \setbox0 = \hbox{\ignorespaces #2}% look for second arg
 2897     \ifdim\wd0 > 0pt
 2898       \ifpdf
 2899         % For pdfTeX and LuaTeX
 2900         \ifurefurlonlylink
 2901           % PDF plus option to not display url, show just arg
 2902           \unhbox0             
 2903         \else
 2904           % PDF, normally display both arg and url for consistency,
 2905           % visibility, if the pdf is eventually used to print, etc.
 2906           \unhbox0\ (\urefcode{#1})%
 2907         \fi
 2908       \else
 2909         \ifx\XeTeXrevision\thisisundefined
 2910           \unhbox0\ (\urefcode{#1})% DVI, always show arg and url
 2911         \else
 2912           % For XeTeX
 2913           \ifurefurlonlylink
 2914             % PDF plus option to not display url, show just arg
 2915             \unhbox0             
 2916           \else
 2917             % PDF, normally display both arg and url for consistency,
 2918             % visibility, if the pdf is eventually used to print, etc.
 2919             \unhbox0\ (\urefcode{#1})%
 2920           \fi
 2921         \fi
 2922       \fi
 2923     \else
 2924       \urefcode{#1}% only url given, so show it
 2925     \fi
 2926   \fi
 2927   \endlink
 2928 \endgroup}
 2929 
 2930 % Allow line breaks around only a few characters (only).
 2931 \def\urefcatcodes{%
 2932   \catcode`\&=\active \catcode`\.=\active
 2933   \catcode`\#=\active \catcode`\?=\active
 2934   \catcode`\/=\active
 2935 }
 2936 {
 2937   \urefcatcodes
 2938   %
 2939   \global\def\urefcode{\begingroup
 2940     \setupmarkupstyle{code}%
 2941     \urefcatcodes
 2942     \let&\urefcodeamp
 2943     \let.\urefcodedot
 2944     \let#\urefcodehash
 2945     \let?\urefcodequest
 2946     \let/\urefcodeslash
 2947     \codex
 2948   }
 2949   %
 2950   % By default, they are just regular characters.
 2951   \global\def&{\normalamp}
 2952   \global\def.{\normaldot}
 2953   \global\def#{\normalhash}
 2954   \global\def?{\normalquest}
 2955   \global\def/{\normalslash}
 2956 }
 2957 
 2958 % we put a little stretch before and after the breakable chars, to help
 2959 % line breaking of long url's.  The unequal skips make look better in
 2960 % cmtt at least, especially for dots.
 2961 \def\urefprestretchamount{.13em}
 2962 \def\urefpoststretchamount{.1em}
 2963 \def\urefprestretch{\urefprebreak \hskip0pt plus\urefprestretchamount\relax}
 2964 \def\urefpoststretch{\urefpostbreak \hskip0pt plus\urefprestretchamount\relax}
 2965 %
 2966 \def\urefcodeamp{\urefprestretch \&\urefpoststretch}
 2967 \def\urefcodedot{\urefprestretch .\urefpoststretch}
 2968 \def\urefcodehash{\urefprestretch \#\urefpoststretch}
 2969 \def\urefcodequest{\urefprestretch ?\urefpoststretch}
 2970 \def\urefcodeslash{\futurelet\next\urefcodeslashfinish}
 2971 {
 2972   \catcode`\/=\active
 2973   \global\def\urefcodeslashfinish{%
 2974     \urefprestretch \slashChar
 2975     % Allow line break only after the final / in a sequence of
 2976     % slashes, to avoid line break between the slashes in http://.
 2977     \ifx\next/\else \urefpoststretch \fi
 2978   }
 2979 }
 2980 
 2981 % One more complication: by default we'll break after the special
 2982 % characters, but some people like to break before the special chars, so
 2983 % allow that.  Also allow no breaking at all, for manual control.
 2984 % 
 2985 \parseargdef\urefbreakstyle{%
 2986   \def\txiarg{#1}%
 2987   \ifx\txiarg\wordnone
 2988     \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak}
 2989   \else\ifx\txiarg\wordbefore
 2990     \def\urefprebreak{\allowbreak}\def\urefpostbreak{\nobreak}
 2991   \else\ifx\txiarg\wordafter
 2992     \def\urefprebreak{\nobreak}\def\urefpostbreak{\allowbreak}
 2993   \else
 2994     \errhelp = \EMsimple
 2995     \errmessage{Unknown @urefbreakstyle setting `\txiarg'}%
 2996   \fi\fi\fi
 2997 }
 2998 \def\wordafter{after}
 2999 \def\wordbefore{before}
 3000 \def\wordnone{none}
 3001 
 3002 \urefbreakstyle after
 3003 
 3004 % @url synonym for @uref, since that's how everyone uses it.
 3005 %
 3006 \let\url=\uref
 3007 
 3008 % rms does not like angle brackets --karl, 17may97.
 3009 % So now @email is just like @uref, unless we are pdf.
 3010 %
 3011 %\def\email#1{\angleleft{\tt #1}\angleright}
 3012 \ifpdf
 3013   \def\email#1{\doemail#1,,\finish}
 3014   \def\doemail#1,#2,#3\finish{\begingroup
 3015     \unsepspaces
 3016     \pdfurl{mailto:#1}%
 3017     \setbox0 = \hbox{\ignorespaces #2}%
 3018     \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
 3019     \endlink
 3020   \endgroup}
 3021 \else
 3022   \ifx\XeTeXrevision\thisisundefined
 3023     \let\email=\uref
 3024   \else
 3025     \def\email#1{\doemail#1,,\finish}
 3026     \def\doemail#1,#2,#3\finish{\begingroup
 3027       \unsepspaces
 3028       \pdfurl{mailto:#1}%
 3029       \setbox0 = \hbox{\ignorespaces #2}%
 3030       \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
 3031       \endlink
 3032     \endgroup}
 3033   \fi
 3034 \fi
 3035 
 3036 % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
 3037 %   `example' (@kbd uses ttsl only inside of @example and friends),
 3038 %   or `code' (@kbd uses normal tty font always).
 3039 \parseargdef\kbdinputstyle{%
 3040   \def\txiarg{#1}%
 3041   \ifx\txiarg\worddistinct
 3042     \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
 3043   \else\ifx\txiarg\wordexample
 3044     \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
 3045   \else\ifx\txiarg\wordcode
 3046     \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
 3047   \else
 3048     \errhelp = \EMsimple
 3049     \errmessage{Unknown @kbdinputstyle setting `\txiarg'}%
 3050   \fi\fi\fi
 3051 }
 3052 \def\worddistinct{distinct}
 3053 \def\wordexample{example}
 3054 \def\wordcode{code}
 3055 
 3056 % Default is `distinct'.
 3057 \kbdinputstyle distinct
 3058 
 3059 % @kbd is like @code, except that if the argument is just one @key command,
 3060 % then @kbd has no effect.
 3061 \def\kbd#1{{\def\look{#1}\expandafter\kbdsub\look??\par}}
 3062 
 3063 \def\xkey{\key}
 3064 \def\kbdsub#1#2#3\par{%
 3065   \def\one{#1}\def\three{#3}\def\threex{??}%
 3066   \ifx\one\xkey\ifx\threex\three \key{#2}%
 3067   \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
 3068   \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
 3069 }
 3070 
 3071 % definition of @key that produces a lozenge.  Doesn't adjust to text size.
 3072 %\setfont\keyrm\rmshape{8}{1000}{OT1}
 3073 %\font\keysy=cmsy9
 3074 %\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
 3075 %  \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
 3076 %    \vbox{\hrule\kern-0.4pt
 3077 %     \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
 3078 %    \kern-0.4pt\hrule}%
 3079 %  \kern-.06em\raise0.4pt\hbox{\angleright}}}}
 3080 
 3081 % definition of @key with no lozenge.  If the current font is already
 3082 % monospace, don't change it; that way, we respect @kbdinputstyle.  But
 3083 % if it isn't monospace, then use \tt.
 3084 %
 3085 \def\key#1{{\setupmarkupstyle{key}%
 3086   \nohyphenation
 3087   \ifmonospace\else\tt\fi
 3088   #1}\null}
 3089 
 3090 % @clicksequence{File @click{} Open ...}
 3091 \def\clicksequence#1{\begingroup #1\endgroup}
 3092 
 3093 % @clickstyle @arrow   (by default)
 3094 \parseargdef\clickstyle{\def\click{#1}}
 3095 \def\click{\arrow}
 3096 
 3097 % Typeset a dimension, e.g., `in' or `pt'.  The only reason for the
 3098 % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
 3099 %
 3100 \def\dmn#1{\thinspace #1}
 3101 
 3102 % @acronym for "FBI", "NATO", and the like.
 3103 % We print this one point size smaller, since it's intended for
 3104 % all-uppercase.
 3105 %
 3106 \def\acronym#1{\doacronym #1,,\finish}
 3107 \def\doacronym#1,#2,#3\finish{%
 3108   {\selectfonts\lsize #1}%
 3109   \def\temp{#2}%
 3110   \ifx\temp\empty \else
 3111     \space ({\unsepspaces \ignorespaces \temp \unskip})%
 3112   \fi
 3113   \null % reset \spacefactor=1000
 3114 }
 3115 
 3116 % @abbr for "Comput. J." and the like.
 3117 % No font change, but don't do end-of-sentence spacing.
 3118 %
 3119 \def\abbr#1{\doabbr #1,,\finish}
 3120 \def\doabbr#1,#2,#3\finish{%
 3121   {\plainfrenchspacing #1}%
 3122   \def\temp{#2}%
 3123   \ifx\temp\empty \else
 3124     \space ({\unsepspaces \ignorespaces \temp \unskip})%
 3125   \fi
 3126   \null % reset \spacefactor=1000
 3127 }
 3128 
 3129 % @asis just yields its argument.  Used with @table, for example.
 3130 %
 3131 \def\asis#1{#1}
 3132 
 3133 % @math outputs its argument in math mode.
 3134 %
 3135 % One complication: _ usually means subscripts, but it could also mean
 3136 % an actual _ character, as in @math{@var{some_variable} + 1}.  So make
 3137 % _ active, and distinguish by seeing if the current family is \slfam,
 3138 % which is what @var uses.
 3139 {
 3140   \catcode`\_ = \active
 3141   \gdef\mathunderscore{%
 3142     \catcode`\_=\active
 3143     \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
 3144   }
 3145 }
 3146 % Another complication: we want \\ (and @\) to output a math (or tt) \.
 3147 % FYI, plain.tex uses \\ as a temporary control sequence (for no
 3148 % particular reason), but this is not advertised and we don't care.
 3149 %
 3150 % The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
 3151 \def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
 3152 %
 3153 \def\math{%
 3154   \ifmmode\else % only go into math if not in math mode already
 3155     \tex
 3156     \mathunderscore
 3157     \let\\ = \mathbackslash
 3158     \mathactive
 3159     % make the texinfo accent commands work in math mode
 3160     \let\"=\ddot
 3161     \let\'=\acute
 3162     \let\==\bar
 3163     \let\^=\hat
 3164     \let\`=\grave
 3165     \let\u=\breve
 3166     \let\v=\check
 3167     \let\~=\tilde
 3168     \let\dotaccent=\dot
 3169     % have to provide another name for sup operator
 3170     \let\mathopsup=\sup
 3171   $\expandafter\finishmath\fi
 3172 }
 3173 \def\finishmath#1{#1$\endgroup}  % Close the group opened by \tex.
 3174 
 3175 % Some active characters (such as <) are spaced differently in math.
 3176 % We have to reset their definitions in case the @math was an argument
 3177 % to a command which sets the catcodes (such as @item or @section).
 3178 %
 3179 {
 3180   \catcode`^ = \active
 3181   \catcode`< = \active
 3182   \catcode`> = \active
 3183   \catcode`+ = \active
 3184   \catcode`' = \active
 3185   \gdef\mathactive{%
 3186     \let^ = \ptexhat
 3187     \let< = \ptexless
 3188     \let> = \ptexgtr
 3189     \let+ = \ptexplus
 3190     \let' = \ptexquoteright
 3191   }
 3192 }
 3193 
 3194 % for @sub and @sup, if in math mode, just do a normal sub/superscript.
 3195 % If in text, use math to place as sub/superscript, but switch
 3196 % into text mode, with smaller fonts.  This is a different font than the
 3197 % one used for real math sub/superscripts (8pt vs. 7pt), but let's not
 3198 % fix it (significant additions to font machinery) until someone notices.
 3199 %
 3200 \def\sub{\ifmmode \expandafter\sb \else \expandafter\finishsub\fi}
 3201 \def\finishsub#1{$\sb{\hbox{\selectfonts\lllsize #1}}$}%
 3202 %
 3203 \def\sup{\ifmmode \expandafter\ptexsp \else \expandafter\finishsup\fi}
 3204 \def\finishsup#1{$\ptexsp{\hbox{\selectfonts\lllsize #1}}$}%
 3205 
 3206 % @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}.
 3207 % Ignore unless FMTNAME == tex; then it is like @iftex and @tex,
 3208 % except specified as a normal braced arg, so no newlines to worry about.
 3209 % 
 3210 \def\outfmtnametex{tex}
 3211 %
 3212 \long\def\inlinefmt#1{\doinlinefmt #1,\finish}
 3213 \long\def\doinlinefmt#1,#2,\finish{%
 3214   \def\inlinefmtname{#1}%
 3215   \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi
 3216 }
 3217 % 
 3218 % @inlinefmtifelse{FMTNAME,THEN-TEXT,ELSE-TEXT} expands THEN-TEXT if
 3219 % FMTNAME is tex, else ELSE-TEXT.
 3220 \long\def\inlinefmtifelse#1{\doinlinefmtifelse #1,,,\finish}
 3221 \long\def\doinlinefmtifelse#1,#2,#3,#4,\finish{%
 3222   \def\inlinefmtname{#1}%
 3223   \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\else \ignorespaces #3\fi
 3224 }
 3225 %
 3226 % For raw, must switch into @tex before parsing the argument, to avoid
 3227 % setting catcodes prematurely.  Doing it this way means that, for
 3228 % example, @inlineraw{html, foo{bar} gets a parse error instead of being
 3229 % ignored.  But this isn't important because if people want a literal
 3230 % *right* brace they would have to use a command anyway, so they may as
 3231 % well use a command to get a left brace too.  We could re-use the
 3232 % delimiter character idea from \verb, but it seems like overkill.
 3233 % 
 3234 \long\def\inlineraw{\tex \doinlineraw}
 3235 \long\def\doinlineraw#1{\doinlinerawtwo #1,\finish}
 3236 \def\doinlinerawtwo#1,#2,\finish{%
 3237   \def\inlinerawname{#1}%
 3238   \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi
 3239   \endgroup % close group opened by \tex.
 3240 }
 3241 
 3242 % @inlineifset{VAR, TEXT} expands TEXT if VAR is @set.
 3243 %
 3244 \long\def\inlineifset#1{\doinlineifset #1,\finish}
 3245 \long\def\doinlineifset#1,#2,\finish{%
 3246   \def\inlinevarname{#1}%
 3247   \expandafter\ifx\csname SET\inlinevarname\endcsname\relax
 3248   \else\ignorespaces#2\fi
 3249 }
 3250 
 3251 % @inlineifclear{VAR, TEXT} expands TEXT if VAR is not @set.
 3252 %
 3253 \long\def\inlineifclear#1{\doinlineifclear #1,\finish}
 3254 \long\def\doinlineifclear#1,#2,\finish{%
 3255   \def\inlinevarname{#1}%
 3256   \expandafter\ifx\csname SET\inlinevarname\endcsname\relax \ignorespaces#2\fi
 3257 }
 3258 
 3259 
 3260 \message{glyphs,}
 3261 % and logos.
 3262 
 3263 % @@ prints an @, as does @atchar{}.
 3264 \def\@{\char64 }
 3265 \let\atchar=\@
 3266 
 3267 % @{ @} @lbracechar{} @rbracechar{} all generate brace characters.
 3268 % Unless we're in typewriter, use \ecfont because the CM text fonts do
 3269 % not have braces, and we don't want to switch into math.
 3270 \def\mylbrace{{\ifmonospace\else\ecfont\fi \char123}}
 3271 \def\myrbrace{{\ifmonospace\else\ecfont\fi \char125}}
 3272 \let\{=\mylbrace \let\lbracechar=\{
 3273 \let\}=\myrbrace \let\rbracechar=\}
 3274 \begingroup
 3275   % Definitions to produce \{ and \} commands for indices,
 3276   % and @{ and @} for the aux/toc files.
 3277   \catcode`\{ = \other \catcode`\} = \other
 3278   \catcode`\[ = 1 \catcode`\] = 2
 3279   \catcode`\! = 0 \catcode`\\ = \other
 3280   !gdef!lbracecmd[\{]%
 3281   !gdef!rbracecmd[\}]%
 3282   !gdef!lbraceatcmd[@{]%
 3283   !gdef!rbraceatcmd[@}]%
 3284 !endgroup
 3285 
 3286 % @comma{} to avoid , parsing problems.
 3287 \let\comma = ,
 3288 
 3289 % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
 3290 % Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
 3291 \let\, = \ptexc
 3292 \let\dotaccent = \ptexdot
 3293 \def\ringaccent#1{{\accent23 #1}}
 3294 \let\tieaccent = \ptext
 3295 \let\ubaraccent = \ptexb
 3296 \let\udotaccent = \d
 3297 
 3298 % Other special characters: @questiondown @exclamdown @ordf @ordm
 3299 % Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
 3300 \def\questiondown{?`}
 3301 \def\exclamdown{!`}
 3302 \def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}}
 3303 \def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}}
 3304 
 3305 % Dotless i and dotless j, used for accents.
 3306 \def\imacro{i}
 3307 \def\jmacro{j}
 3308 \def\dotless#1{%
 3309   \def\temp{#1}%
 3310   \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi
 3311   \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi
 3312   \else \errmessage{@dotless can be used only with i or j}%
 3313   \fi\fi
 3314 }
 3315 
 3316 % The \TeX{} logo, as in plain, but resetting the spacing so that a
 3317 % period following counts as ending a sentence.  (Idea found in latex.)
 3318 %
 3319 \edef\TeX{\TeX \spacefactor=1000 }
 3320 
 3321 % @LaTeX{} logo.  Not quite the same results as the definition in
 3322 % latex.ltx, since we use a different font for the raised A; it's most
 3323 % convenient for us to use an explicitly smaller font, rather than using
 3324 % the \scriptstyle font (since we don't reset \scriptstyle and
 3325 % \scriptscriptstyle).
 3326 %
 3327 \def\LaTeX{%
 3328   L\kern-.36em
 3329   {\setbox0=\hbox{T}%
 3330    \vbox to \ht0{\hbox{%
 3331      \ifx\textnominalsize\xwordpt
 3332        % for 10pt running text, \lllsize (8pt) is too small for the A in LaTeX.
 3333        % Revert to plain's \scriptsize, which is 7pt.
 3334        \count255=\the\fam $\fam\count255 \scriptstyle A$%
 3335      \else
 3336        % For 11pt, we can use our lllsize.
 3337        \selectfonts\lllsize A%
 3338      \fi
 3339      }%
 3340      \vss
 3341   }}%
 3342   \kern-.15em
 3343   \TeX
 3344 }
 3345 
 3346 % Some math mode symbols.  Define \ensuremath to switch into math mode
 3347 % unless we are already there.  Expansion tricks may not be needed here,
 3348 % but safer, and can't hurt.
 3349 \def\ensuremath{\ifmmode \expandafter\asis \else\expandafter\ensuredmath \fi}
 3350 \def\ensuredmath#1{$\relax#1$}
 3351 %
 3352 \def\bullet{\ensuremath\ptexbullet}
 3353 \def\geq{\ensuremath\ge}
 3354 \def\leq{\ensuremath\le}
 3355 \def\minus{\ensuremath-}
 3356 
 3357 % @dots{} outputs an ellipsis using the current font.
 3358 % We do .5em per period so that it has the same spacing in the cm
 3359 % typewriter fonts as three actual period characters; on the other hand,
 3360 % in other typewriter fonts three periods are wider than 1.5em.  So do
 3361 % whichever is larger.
 3362 %
 3363 \def\dots{%
 3364   \leavevmode
 3365   \setbox0=\hbox{...}% get width of three periods
 3366   \ifdim\wd0 > 1.5em
 3367     \dimen0 = \wd0
 3368   \else
 3369     \dimen0 = 1.5em
 3370   \fi
 3371   \hbox to \dimen0{%
 3372     \hskip 0pt plus.25fil
 3373     .\hskip 0pt plus1fil
 3374     .\hskip 0pt plus1fil
 3375     .\hskip 0pt plus.5fil
 3376   }%
 3377 }
 3378 
 3379 % @enddots{} is an end-of-sentence ellipsis.
 3380 %
 3381 \def\enddots{%
 3382   \dots
 3383   \spacefactor=\endofsentencespacefactor
 3384 }
 3385 
 3386 % @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
 3387 %
 3388 % Since these characters are used in examples, they should be an even number of
 3389 % \tt widths. Each \tt character is 1en, so two makes it 1em.
 3390 %
 3391 \def\point{$\star$}
 3392 \def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}}
 3393 \def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
 3394 \def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}}
 3395 \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
 3396 \def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}}
 3397 
 3398 % The @error{} command.
 3399 % Adapted from the TeXbook's \boxit.
 3400 %
 3401 \newbox\errorbox
 3402 %
 3403 {\tentt \global\dimen0 = 3em}% Width of the box.
 3404 \dimen2 = .55pt % Thickness of rules
 3405 % The text. (`r' is open on the right, `e' somewhat less so on the left.)
 3406 \setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt}
 3407 %
 3408 \setbox\errorbox=\hbox to \dimen0{\hfil
 3409    \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
 3410    \advance\hsize by -2\dimen2 % Rules.
 3411    \vbox{%
 3412       \hrule height\dimen2
 3413       \hbox{\vrule width\dimen2 \kern3pt          % Space to left of text.
 3414          \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
 3415          \kern3pt\vrule width\dimen2}% Space to right.
 3416       \hrule height\dimen2}
 3417     \hfil}
 3418 %
 3419 \def\error{\leavevmode\lower.7ex\copy\errorbox}
 3420 
 3421 % @pounds{} is a sterling sign, which Knuth put in the CM italic font.
 3422 %
 3423 \def\pounds{{\it\$}}
 3424 
 3425 % @euro{} comes from a separate font, depending on the current style.
 3426 % We use the free feym* fonts from the eurosym package by Henrik
 3427 % Theiling, which support regular, slanted, bold and bold slanted (and
 3428 % "outlined" (blackboard board, sort of) versions, which we don't need).
 3429 % It is available from http://www.ctan.org/tex-archive/fonts/eurosym.
 3430 %
 3431 % Although only regular is the truly official Euro symbol, we ignore
 3432 % that.  The Euro is designed to be slightly taller than the regular
 3433 % font height.
 3434 %
 3435 % feymr - regular
 3436 % feymo - slanted
 3437 % feybr - bold
 3438 % feybo - bold slanted
 3439 %
 3440 % There is no good (free) typewriter version, to my knowledge.
 3441 % A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide.
 3442 % Hmm.
 3443 %
 3444 % Also doesn't work in math.  Do we need to do math with euro symbols?
 3445 % Hope not.
 3446 %
 3447 %
 3448 \def\euro{{\eurofont e}}
 3449 \def\eurofont{%
 3450   % We set the font at each command, rather than predefining it in
 3451   % \textfonts and the other font-switching commands, so that
 3452   % installations which never need the symbol don't have to have the
 3453   % font installed.
 3454   %
 3455   % There is only one designed size (nominal 10pt), so we always scale
 3456   % that to the current nominal size.
 3457   %
 3458   % By the way, simply using "at 1em" works for cmr10 and the like, but
 3459   % does not work for cmbx10 and other extended/shrunken fonts.
 3460   %
 3461   \def\eurosize{\csname\curfontsize nominalsize\endcsname}%
 3462   %
 3463   \ifx\curfontstyle\bfstylename
 3464     % bold:
 3465     \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize
 3466   \else
 3467     % regular:
 3468     \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize
 3469   \fi
 3470   \thiseurofont
 3471 }
 3472 
 3473 % Glyphs from the EC fonts.  We don't use \let for the aliases, because
 3474 % sometimes we redefine the original macro, and the alias should reflect
 3475 % the redefinition.
 3476 %
 3477 % Use LaTeX names for the Icelandic letters.
 3478 \def\DH{{\ecfont \char"D0}} % Eth
 3479 \def\dh{{\ecfont \char"F0}} % eth
 3480 \def\TH{{\ecfont \char"DE}} % Thorn
 3481 \def\th{{\ecfont \char"FE}} % thorn
 3482 %
 3483 \def\guillemetleft{{\ecfont \char"13}}
 3484 \def\guillemotleft{\guillemetleft}
 3485 \def\guillemetright{{\ecfont \char"14}}
 3486 \def\guillemotright{\guillemetright}
 3487 \def\guilsinglleft{{\ecfont \char"0E}}
 3488 \def\guilsinglright{{\ecfont \char"0F}}
 3489 \def\quotedblbase{{\ecfont \char"12}}
 3490 \def\quotesinglbase{{\ecfont \char"0D}}
 3491 %
 3492 % This positioning is not perfect (see the ogonek LaTeX package), but
 3493 % we have the precomposed glyphs for the most common cases.  We put the
 3494 % tests to use those glyphs in the single \ogonek macro so we have fewer
 3495 % dummy definitions to worry about for index entries, etc.
 3496 %
 3497 % ogonek is also used with other letters in Lithuanian (IOU), but using
 3498 % the precomposed glyphs for those is not so easy since they aren't in
 3499 % the same EC font.
 3500 \def\ogonek#1{{%
 3501   \def\temp{#1}%
 3502   \ifx\temp\macrocharA\Aogonek
 3503   \else\ifx\temp\macrochara\aogonek
 3504   \else\ifx\temp\macrocharE\Eogonek
 3505   \else\ifx\temp\macrochare\eogonek
 3506   \else
 3507     \ecfont \setbox0=\hbox{#1}%
 3508     \ifdim\ht0=1ex\accent"0C #1%
 3509     \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}%
 3510     \fi
 3511   \fi\fi\fi\fi
 3512   }%
 3513 }
 3514 \def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A}
 3515 \def\aogonek{{\ecfont \char"A1}}\def\macrochara{a}
 3516 \def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E}
 3517 \def\eogonek{{\ecfont \char"A6}}\def\macrochare{e}
 3518 %
 3519 % Use the European Computer Modern fonts (cm-super in outline format)
 3520 % for non-CM glyphs.  That is ec* for regular text and tc* for the text
 3521 % companion symbols (LaTeX TS1 encoding).  Both are part of the ec
 3522 % package and follow the same conventions.
 3523 % 
 3524 \def\ecfont{\etcfont{e}}
 3525 \def\tcfont{\etcfont{t}}
 3526 %
 3527 \def\etcfont#1{%
 3528   % We can't distinguish serif/sans and italic/slanted, but this
 3529   % is used for crude hacks anyway (like adding French and German
 3530   % quotes to documents typeset with CM, where we lose kerning), so
 3531   % hopefully nobody will notice/care.
 3532   \edef\ecsize{\csname\curfontsize ecsize\endcsname}%
 3533   \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}%
 3534   \ifmonospace
 3535     % typewriter:
 3536     \font\thisecfont = #1ctt\ecsize \space at \nominalsize
 3537   \else
 3538     \ifx\curfontstyle\bfstylename
 3539       % bold:
 3540       \font\thisecfont = #1cb\ifusingit{i}{x}\ecsize \space at \nominalsize
 3541     \else
 3542       % regular:
 3543       \font\thisecfont = #1c\ifusingit{ti}{rm}\ecsize \space at \nominalsize
 3544     \fi
 3545   \fi
 3546   \thisecfont
 3547 }
 3548 
 3549 % @registeredsymbol - R in a circle.  The font for the R should really
 3550 % be smaller yet, but lllsize is the best we can do for now.
 3551 % Adapted from the plain.tex definition of \copyright.
 3552 %
 3553 \def\registeredsymbol{%
 3554   $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}%
 3555                \hfil\crcr\Orb}}%
 3556     }$%
 3557 }
 3558 
 3559 % @textdegree - the normal degrees sign.
 3560 %
 3561 \def\textdegree{$^\circ$}
 3562 
 3563 % Laurent Siebenmann reports \Orb undefined with:
 3564 %  Textures 1.7.7 (preloaded format=plain 93.10.14)  (68K)  16 APR 2004 02:38
 3565 % so we'll define it if necessary.
 3566 %
 3567 \ifx\Orb\thisisundefined
 3568 \def\Orb{\mathhexbox20D}
 3569 \fi
 3570 
 3571 % Quotes.
 3572 \chardef\quotedblleft="5C
 3573 \chardef\quotedblright=`\"
 3574 \chardef\quoteleft=`\`
 3575 \chardef\quoteright=`\'
 3576 
 3577 
 3578 \message{page headings,}
 3579 
 3580 \newskip\titlepagetopglue \titlepagetopglue = 1.5in
 3581 \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
 3582 
 3583 % First the title page.  Must do @settitle before @titlepage.
 3584 \newif\ifseenauthor
 3585 \newif\iffinishedtitlepage
 3586 
 3587 % @setcontentsaftertitlepage used to do an implicit @contents or
 3588 % @shortcontents after @end titlepage, but it is now obsolete.
 3589 \def\setcontentsaftertitlepage{%
 3590   \errmessage{@setcontentsaftertitlepage has been removed as a Texinfo
 3591               command; move your @contents command if you want the contents
 3592               after the title page.}}%
 3593 \def\setshortcontentsaftertitlepage{%
 3594   \errmessage{@setshortcontentsaftertitlepage has been removed as a Texinfo
 3595               command; move your @shortcontents and @contents commands if you 
 3596               want the contents after the title page.}}%
 3597 
 3598 \parseargdef\shorttitlepage{%
 3599   \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}%
 3600   \endgroup\page\hbox{}\page}
 3601 
 3602 \envdef\titlepage{%
 3603   % Open one extra group, as we want to close it in the middle of \Etitlepage.
 3604   \begingroup
 3605     \parindent=0pt \textfonts
 3606     % Leave some space at the very top of the page.
 3607     \vglue\titlepagetopglue
 3608     % No rule at page bottom unless we print one at the top with @title.
 3609     \finishedtitlepagetrue
 3610     %
 3611     % Most title ``pages'' are actually two pages long, with space
 3612     % at the top of the second.  We don't want the ragged left on the second.
 3613     \let\oldpage = \page
 3614     \def\page{%
 3615       \iffinishedtitlepage\else
 3616      \finishtitlepage
 3617       \fi
 3618       \let\page = \oldpage
 3619       \page
 3620       \null
 3621     }%
 3622 }
 3623 
 3624 \def\Etitlepage{%
 3625     \iffinishedtitlepage\else
 3626     \finishtitlepage
 3627     \fi
 3628     % It is important to do the page break before ending the group,
 3629     % because the headline and footline are only empty inside the group.
 3630     % If we use the new definition of \page, we always get a blank page
 3631     % after the title page, which we certainly don't want.
 3632     \oldpage
 3633   \endgroup
 3634   %
 3635   % Need this before the \...aftertitlepage checks so that if they are
 3636   % in effect the toc pages will come out with page numbers.
 3637   \HEADINGSon
 3638 }
 3639 
 3640 \def\finishtitlepage{%
 3641   \vskip4pt \hrule height 2pt width \hsize
 3642   \vskip\titlepagebottomglue
 3643   \finishedtitlepagetrue
 3644 }
 3645 
 3646 % Settings used for typesetting titles: no hyphenation, no indentation,
 3647 % don't worry much about spacing, ragged right.  This should be used
 3648 % inside a \vbox, and fonts need to be set appropriately first.  Because
 3649 % it is always used for titles, nothing else, we call \rmisbold.  \par
 3650 % should be specified before the end of the \vbox, since a vbox is a group.
 3651 % 
 3652 \def\raggedtitlesettings{%
 3653   \rmisbold
 3654   \hyphenpenalty=10000
 3655   \parindent=0pt
 3656   \tolerance=5000
 3657   \ptexraggedright
 3658 }
 3659 
 3660 % Macros to be used within @titlepage:
 3661 
 3662 \let\subtitlerm=\tenrm
 3663 \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}
 3664 
 3665 \parseargdef\title{%
 3666   \checkenv\titlepage
 3667   \vbox{\titlefonts \raggedtitlesettings #1\par}%
 3668   % print a rule at the page bottom also.
 3669   \finishedtitlepagefalse
 3670   \vskip4pt \hrule height 4pt width \hsize \vskip4pt
 3671 }
 3672 
 3673 \parseargdef\subtitle{%
 3674   \checkenv\titlepage
 3675   {\subtitlefont \rightline{#1}}%
 3676 }
 3677 
 3678 % @author should come last, but may come many times.
 3679 % It can also be used inside @quotation.
 3680 %
 3681 \parseargdef\author{%
 3682   \def\temp{\quotation}%
 3683   \ifx\thisenv\temp
 3684     \def\quotationauthor{#1}% printed in \Equotation.
 3685   \else
 3686     \checkenv\titlepage
 3687     \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi
 3688     {\secfonts\rmisbold \leftline{#1}}%
 3689   \fi
 3690 }
 3691 
 3692 
 3693 % Set up page headings and footings.
 3694 
 3695 \let\thispage=\folio
 3696 
 3697 \newtoks\evenheadline    % headline on even pages
 3698 \newtoks\oddheadline     % headline on odd pages
 3699 \newtoks\evenfootline    % footline on even pages
 3700 \newtoks\oddfootline     % footline on odd pages
 3701 
 3702 % Now make \makeheadline and \makefootline in Plain TeX use those variables
 3703 \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
 3704                             \else \the\evenheadline \fi}}
 3705 \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
 3706                             \else \the\evenfootline \fi}\HEADINGShook}
 3707 \let\HEADINGShook=\relax
 3708 
 3709 % Commands to set those variables.
 3710 % For example, this is what  @headings on  does
 3711 % @evenheading @thistitle|@thispage|@thischapter
 3712 % @oddheading @thischapter|@thispage|@thistitle
 3713 % @evenfooting @thisfile||
 3714 % @oddfooting ||@thisfile
 3715 
 3716 
 3717 \def\evenheading{\parsearg\evenheadingxxx}
 3718 \def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish}
 3719 \def\evenheadingyyy #1\|#2\|#3\|#4\finish{%
 3720 \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
 3721 
 3722 \def\oddheading{\parsearg\oddheadingxxx}
 3723 \def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish}
 3724 \def\oddheadingyyy #1\|#2\|#3\|#4\finish{%
 3725 \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
 3726 
 3727 \parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
 3728 
 3729 \def\evenfooting{\parsearg\evenfootingxxx}
 3730 \def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish}
 3731 \def\evenfootingyyy #1\|#2\|#3\|#4\finish{%
 3732 \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
 3733 
 3734 \def\oddfooting{\parsearg\oddfootingxxx}
 3735 \def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish}
 3736 \def\oddfootingyyy #1\|#2\|#3\|#4\finish{%
 3737   \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
 3738   %
 3739   % Leave some space for the footline.  Hopefully ok to assume
 3740   % @evenfooting will not be used by itself.
 3741   \global\advance\txipageheight by -12pt
 3742   \global\advance\vsize by -12pt
 3743 }
 3744 
 3745 \parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}}
 3746 
 3747 % @evenheadingmarks top     \thischapter <- chapter at the top of a page
 3748 % @evenheadingmarks bottom  \thischapter <- chapter at the bottom of a page
 3749 %
 3750 % The same set of arguments for:
 3751 %
 3752 % @oddheadingmarks
 3753 % @evenfootingmarks
 3754 % @oddfootingmarks
 3755 % @everyheadingmarks
 3756 % @everyfootingmarks
 3757 
 3758 % These define \getoddheadingmarks, \getevenheadingmarks,
 3759 % \getoddfootingmarks, and \getevenfootingmarks, each to one of
 3760 % \gettopheadingmarks, \getbottomheadingmarks.
 3761 %
 3762 \def\evenheadingmarks{\headingmarks{even}{heading}}
 3763 \def\oddheadingmarks{\headingmarks{odd}{heading}}
 3764 \def\evenfootingmarks{\headingmarks{even}{footing}}
 3765 \def\oddfootingmarks{\headingmarks{odd}{footing}}
 3766 \parseargdef\everyheadingmarks{\headingmarks{even}{heading}{#1}
 3767                           \headingmarks{odd}{heading}{#1} }
 3768 \parseargdef\everyfootingmarks{\headingmarks{even}{footing}{#1}
 3769                           \headingmarks{odd}{footing}{#1} }
 3770 % #1 = even/odd, #2 = heading/footing, #3 = top/bottom.
 3771 \def\headingmarks#1#2#3 {%
 3772   \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname
 3773   \global\expandafter\let\csname get#1#2marks\endcsname \temp
 3774 }
 3775 
 3776 \everyheadingmarks bottom
 3777 \everyfootingmarks bottom
 3778 
 3779 % @headings double      turns headings on for double-sided printing.
 3780 % @headings single      turns headings on for single-sided printing.
 3781 % @headings off         turns them off.
 3782 % @headings on          same as @headings double, retained for compatibility.
 3783 % @headings after       turns on double-sided headings after this page.
 3784 % @headings doubleafter turns on double-sided headings after this page.
 3785 % @headings singleafter turns on single-sided headings after this page.
 3786 % By default, they are off at the start of a document,
 3787 % and turned `on' after @end titlepage.
 3788 
 3789 \parseargdef\headings{\csname HEADINGS#1\endcsname}
 3790 
 3791 \def\headingsoff{% non-global headings elimination
 3792   \evenheadline={\hfil}\evenfootline={\hfil}%
 3793    \oddheadline={\hfil}\oddfootline={\hfil}%
 3794 }
 3795 
 3796 \def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting
 3797 \HEADINGSoff  % it's the default
 3798 
 3799 % When we turn headings on, set the page number to 1.
 3800 % For double-sided printing, put current file name in lower left corner,
 3801 % chapter name on inside top of right hand pages, document
 3802 % title on inside top of left hand pages, and page numbers on outside top
 3803 % edge of all pages.
 3804 \def\HEADINGSdouble{%
 3805 \global\pageno=1
 3806 \global\evenfootline={\hfil}
 3807 \global\oddfootline={\hfil}
 3808 \global\evenheadline={\line{\folio\hfil\thistitle}}
 3809 \global\oddheadline={\line{\thischapterheading\hfil\folio}}
 3810 \global\let\contentsalignmacro = \chapoddpage
 3811 }
 3812 \let\contentsalignmacro = \chappager
 3813 
 3814 % For single-sided printing, chapter title goes across top left of page,
 3815 % page number on top right.
 3816 \def\HEADINGSsingle{%
 3817 \global\pageno=1
 3818 \global\evenfootline={\hfil}
 3819 \global\oddfootline={\hfil}
 3820 \global\evenheadline={\line{\thischapterheading\hfil\folio}}
 3821 \global\oddheadline={\line{\thischapterheading\hfil\folio}}
 3822 \global\let\contentsalignmacro = \chappager
 3823 }
 3824 \def\HEADINGSon{\HEADINGSdouble}
 3825 
 3826 \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
 3827 \let\HEADINGSdoubleafter=\HEADINGSafter
 3828 \def\HEADINGSdoublex{%
 3829 \global\evenfootline={\hfil}
 3830 \global\oddfootline={\hfil}
 3831 \global\evenheadline={\line{\folio\hfil\thistitle}}
 3832 \global\oddheadline={\line{\thischapterheading\hfil\folio}}
 3833 \global\let\contentsalignmacro = \chapoddpage
 3834 }
 3835 
 3836 \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
 3837 \def\HEADINGSsinglex{%
 3838 \global\evenfootline={\hfil}
 3839 \global\oddfootline={\hfil}
 3840 \global\evenheadline={\line{\thischapterheading\hfil\folio}}
 3841 \global\oddheadline={\line{\thischapterheading\hfil\folio}}
 3842 \global\let\contentsalignmacro = \chappager
 3843 }
 3844 
 3845 % Subroutines used in generating headings
 3846 % This produces Day Month Year style of output.
 3847 % Only define if not already defined, in case a txi-??.tex file has set
 3848 % up a different format (e.g., txi-cs.tex does this).
 3849 \ifx\today\thisisundefined
 3850 \def\today{%
 3851   \number\day\space
 3852   \ifcase\month
 3853   \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
 3854   \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
 3855   \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
 3856   \fi
 3857   \space\number\year}
 3858 \fi
 3859 
 3860 % @settitle line...  specifies the title of the document, for headings.
 3861 % It generates no output of its own.
 3862 \def\thistitle{\putwordNoTitle}
 3863 \def\settitle{\parsearg{\gdef\thistitle}}
 3864 
 3865 
 3866 \message{tables,}
 3867 % Tables -- @table, @ftable, @vtable, @item(x).
 3868 
 3869 % default indentation of table text
 3870 \newdimen\tableindent \tableindent=.8in
 3871 % default indentation of @itemize and @enumerate text
 3872 \newdimen\itemindent  \itemindent=.3in
 3873 % margin between end of table item and start of table text.
 3874 \newdimen\itemmargin  \itemmargin=.1in
 3875 
 3876 % used internally for \itemindent minus \itemmargin
 3877 \newdimen\itemmax
 3878 
 3879 % Note @table, @ftable, and @vtable define @item, @itemx, etc., with
 3880 % these defs.
 3881 % They also define \itemindex
 3882 % to index the item name in whatever manner is desired (perhaps none).
 3883 
 3884 \newif\ifitemxneedsnegativevskip
 3885 
 3886 \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
 3887 
 3888 \def\internalBitem{\smallbreak \parsearg\itemzzz}
 3889 \def\internalBitemx{\itemxpar \parsearg\itemzzz}
 3890 
 3891 \def\itemzzz #1{\begingroup %
 3892   \advance\hsize by -\rightskip
 3893   \advance\hsize by -\tableindent
 3894   \setbox0=\hbox{\itemindicate{#1}}%
 3895   \itemindex{#1}%
 3896   \nobreak % This prevents a break before @itemx.
 3897   %
 3898   % If the item text does not fit in the space we have, put it on a line
 3899   % by itself, and do not allow a page break either before or after that
 3900   % line.  We do not start a paragraph here because then if the next
 3901   % command is, e.g., @kindex, the whatsit would get put into the
 3902   % horizontal list on a line by itself, resulting in extra blank space.
 3903   \ifdim \wd0>\itemmax
 3904     %
 3905     % Make this a paragraph so we get the \parskip glue and wrapping,
 3906     % but leave it ragged-right.
 3907     \begingroup
 3908       \advance\leftskip by-\tableindent
 3909       \advance\hsize by\tableindent
 3910       \advance\rightskip by0pt plus1fil\relax
 3911       \leavevmode\unhbox0\par
 3912     \endgroup
 3913     %
 3914     % We're going to be starting a paragraph, but we don't want the
 3915     % \parskip glue -- logically it's part of the @item we just started.
 3916     \nobreak \vskip-\parskip
 3917     %
 3918     % Stop a page break at the \parskip glue coming up.  However, if
 3919     % what follows is an environment such as @example, there will be no
 3920     % \parskip glue; then the negative vskip we just inserted would
 3921     % cause the example and the item to crash together.  So we use this
 3922     % bizarre value of 10001 as a signal to \aboveenvbreak to insert
 3923     % \parskip glue after all.  Section titles are handled this way also.
 3924     %
 3925     \penalty 10001
 3926     \endgroup
 3927     \itemxneedsnegativevskipfalse
 3928   \else
 3929     % The item text fits into the space.  Start a paragraph, so that the
 3930     % following text (if any) will end up on the same line.
 3931     \noindent
 3932     % Do this with kerns and \unhbox so that if there is a footnote in
 3933     % the item text, it can migrate to the main vertical list and
 3934     % eventually be printed.
 3935     \nobreak\kern-\tableindent
 3936     \dimen0 = \itemmax  \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
 3937     \unhbox0
 3938     \nobreak\kern\dimen0
 3939     \endgroup
 3940     \itemxneedsnegativevskiptrue
 3941   \fi
 3942 }
 3943 
 3944 \def\item{\errmessage{@item while not in a list environment}}
 3945 \def\itemx{\errmessage{@itemx while not in a list environment}}
 3946 
 3947 % @table, @ftable, @vtable.
 3948 \envdef\table{%
 3949   \let\itemindex\gobble
 3950   \tablecheck{table}%
 3951 }
 3952 \envdef\ftable{%
 3953   \def\itemindex ##1{\doind {fn}{\code{##1}}}%
 3954   \tablecheck{ftable}%
 3955 }
 3956 \envdef\vtable{%
 3957   \def\itemindex ##1{\doind {vr}{\code{##1}}}%
 3958   \tablecheck{vtable}%
 3959 }
 3960 \def\tablecheck#1{%
 3961   \ifnum \the\catcode`\^^M=\active
 3962     \endgroup
 3963     \errmessage{This command won't work in this context; perhaps the problem is
 3964       that we are \inenvironment\thisenv}%
 3965     \def\next{\doignore{#1}}%
 3966   \else
 3967     \let\next\tablex
 3968   \fi
 3969   \next
 3970 }
 3971 \def\tablex#1{%
 3972   \def\itemindicate{#1}%
 3973   \parsearg\tabley
 3974 }
 3975 \def\tabley#1{%
 3976   {%
 3977     \makevalueexpandable
 3978     \edef\temp{\noexpand\tablez #1\space\space\space}%
 3979     \expandafter
 3980   }\temp \endtablez
 3981 }
 3982 \def\tablez #1 #2 #3 #4\endtablez{%
 3983   \aboveenvbreak
 3984   \ifnum 0#1>0 \advance \leftskip by #1\mil \fi
 3985   \ifnum 0#2>0 \tableindent=#2\mil \fi
 3986   \ifnum 0#3>0 \advance \rightskip by #3\mil \fi
 3987   \itemmax=\tableindent
 3988   \advance \itemmax by -\itemmargin
 3989   \advance \leftskip by \tableindent
 3990   \exdentamount=\tableindent
 3991   \parindent = 0pt
 3992   \parskip = \smallskipamount
 3993   \ifdim \parskip=0pt \parskip=2pt \fi
 3994   \let\item = \internalBitem
 3995   \let\itemx = \internalBitemx
 3996 }
 3997 \def\Etable{\endgraf\afterenvbreak}
 3998 \let\Eftable\Etable
 3999 \let\Evtable\Etable
 4000 \let\Eitemize\Etable
 4001 \let\Eenumerate\Etable
 4002 
 4003 % This is the counter used by @enumerate, which is really @itemize
 4004 
 4005 \newcount \itemno
 4006 
 4007 \envdef\itemize{\parsearg\doitemize}
 4008 
 4009 \def\doitemize#1{%
 4010   \aboveenvbreak
 4011   \itemmax=\itemindent
 4012   \advance\itemmax by -\itemmargin
 4013   \advance\leftskip by \itemindent
 4014   \exdentamount=\itemindent
 4015   \parindent=0pt
 4016   \parskip=\smallskipamount
 4017   \ifdim\parskip=0pt \parskip=2pt \fi
 4018   %
 4019   % Try typesetting the item mark so that if the document erroneously says
 4020   % something like @itemize @samp (intending @table), there's an error
 4021   % right away at the @itemize.  It's not the best error message in the
 4022   % world, but it's better than leaving it to the @item.  This means if
 4023   % the user wants an empty mark, they have to say @w{} not just @w.
 4024   \def\itemcontents{#1}%
 4025   \setbox0 = \hbox{\itemcontents}%
 4026   %
 4027   % @itemize with no arg is equivalent to @itemize @bullet.
 4028   \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
 4029   %
 4030   \let\item=\itemizeitem
 4031 }
 4032 
 4033 % Definition of @item while inside @itemize and @enumerate.
 4034 %
 4035 \def\itemizeitem{%
 4036   \advance\itemno by 1  % for enumerations
 4037   {\let\par=\endgraf \smallbreak}% reasonable place to break
 4038   {%
 4039    % If the document has an @itemize directly after a section title, a
 4040    % \nobreak will be last on the list, and \sectionheading will have
 4041    % done a \vskip-\parskip.  In that case, we don't want to zero
 4042    % parskip, or the item text will crash with the heading.  On the
 4043    % other hand, when there is normal text preceding the item (as there
 4044    % usually is), we do want to zero parskip, or there would be too much
 4045    % space.  In that case, we won't have a \nobreak before.  At least
 4046    % that's the theory.
 4047    \ifnum\lastpenalty<10000 \parskip=0in \fi
 4048    \noindent
 4049    \hbox to 0pt{\hss \itemcontents \kern\itemmargin}%
 4050    %
 4051    \ifinner\else
 4052      \vadjust{\penalty 1200}% not good to break after first line of item.
 4053    \fi
 4054    % We can be in inner vertical mode in a footnote, although an
 4055    % @itemize looks awful there.
 4056   }%
 4057   \flushcr
 4058 }
 4059 
 4060 % \splitoff TOKENS\endmark defines \first to be the first token in
 4061 % TOKENS, and \rest to be the remainder.
 4062 %
 4063 \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
 4064 
 4065 % Allow an optional argument of an uppercase letter, lowercase letter,
 4066 % or number, to specify the first label in the enumerated list.  No
 4067 % argument is the same as `1'.
 4068 %
 4069 \envparseargdef\enumerate{\enumeratey #1  \endenumeratey}
 4070 \def\enumeratey #1 #2\endenumeratey{%
 4071   % If we were given no argument, pretend we were given `1'.
 4072   \def\thearg{#1}%
 4073   \ifx\thearg\empty \def\thearg{1}\fi
 4074   %
 4075   % Detect if the argument is a single token.  If so, it might be a
 4076   % letter.  Otherwise, the only valid thing it can be is a number.
 4077   % (We will always have one token, because of the test we just made.
 4078   % This is a good thing, since \splitoff doesn't work given nothing at
 4079   % all -- the first parameter is undelimited.)
 4080   \expandafter\splitoff\thearg\endmark
 4081   \ifx\rest\empty
 4082     % Only one token in the argument.  It could still be anything.
 4083     % A ``lowercase letter'' is one whose \lccode is nonzero.
 4084     % An ``uppercase letter'' is one whose \lccode is both nonzero, and
 4085     %   not equal to itself.
 4086     % Otherwise, we assume it's a number.
 4087     %
 4088     % We need the \relax at the end of the \ifnum lines to stop TeX from
 4089     % continuing to look for a <number>.
 4090     %
 4091     \ifnum\lccode\expandafter`\thearg=0\relax
 4092       \numericenumerate % a number (we hope)
 4093     \else
 4094       % It's a letter.
 4095       \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
 4096         \lowercaseenumerate % lowercase letter
 4097       \else
 4098         \uppercaseenumerate % uppercase letter
 4099       \fi
 4100     \fi
 4101   \else
 4102     % Multiple tokens in the argument.  We hope it's a number.
 4103     \numericenumerate
 4104   \fi
 4105 }
 4106 
 4107 % An @enumerate whose labels are integers.  The starting integer is
 4108 % given in \thearg.
 4109 %
 4110 \def\numericenumerate{%
 4111   \itemno = \thearg
 4112   \startenumeration{\the\itemno}%
 4113 }
 4114 
 4115 % The starting (lowercase) letter is in \thearg.
 4116 \def\lowercaseenumerate{%
 4117   \itemno = \expandafter`\thearg
 4118   \startenumeration{%
 4119     % Be sure we're not beyond the end of the alphabet.
 4120     \ifnum\itemno=0
 4121       \errmessage{No more lowercase letters in @enumerate; get a bigger
 4122                   alphabet}%
 4123     \fi
 4124     \char\lccode\itemno
 4125   }%
 4126 }
 4127 
 4128 % The starting (uppercase) letter is in \thearg.
 4129 \def\uppercaseenumerate{%
 4130   \itemno = \expandafter`\thearg
 4131   \startenumeration{%
 4132     % Be sure we're not beyond the end of the alphabet.
 4133     \ifnum\itemno=0
 4134       \errmessage{No more uppercase letters in @enumerate; get a bigger
 4135                   alphabet}
 4136     \fi
 4137     \char\uccode\itemno
 4138   }%
 4139 }
 4140 
 4141 % Call \doitemize, adding a period to the first argument and supplying the
 4142 % common last two arguments.  Also subtract one from the initial value in
 4143 % \itemno, since @item increments \itemno.
 4144 %
 4145 \def\startenumeration#1{%
 4146   \advance\itemno by -1
 4147   \doitemize{#1.}\flushcr
 4148 }
 4149 
 4150 % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
 4151 % to @enumerate.
 4152 %
 4153 \def\alphaenumerate{\enumerate{a}}
 4154 \def\capsenumerate{\enumerate{A}}
 4155 \def\Ealphaenumerate{\Eenumerate}
 4156 \def\Ecapsenumerate{\Eenumerate}
 4157 
 4158 
 4159 % @multitable macros
 4160 % Amy Hendrickson, 8/18/94, 3/6/96
 4161 %
 4162 % @multitable ... @end multitable will make as many columns as desired.
 4163 % Contents of each column will wrap at width given in preamble.  Width
 4164 % can be specified either with sample text given in a template line,
 4165 % or in percent of \hsize, the current width of text on page.
 4166 
 4167 % Table can continue over pages but will only break between lines.
 4168 
 4169 % To make preamble:
 4170 %
 4171 % Either define widths of columns in terms of percent of \hsize:
 4172 %   @multitable @columnfractions .25 .3 .45
 4173 %   @item ...
 4174 %
 4175 %   Numbers following @columnfractions are the percent of the total
 4176 %   current hsize to be used for each column. You may use as many
 4177 %   columns as desired.
 4178 
 4179 
 4180 % Or use a template:
 4181 %   @multitable {Column 1 template} {Column 2 template} {Column 3 template}
 4182 %   @item ...
 4183 %   using the widest term desired in each column.
 4184 
 4185 % Each new table line starts with @item, each subsequent new column
 4186 % starts with @tab. Empty columns may be produced by supplying @tab's
 4187 % with nothing between them for as many times as empty columns are needed,
 4188 % ie, @tab@tab@tab will produce two empty columns.
 4189 
 4190 % @item, @tab do not need to be on their own lines, but it will not hurt
 4191 % if they are.
 4192 
 4193 % Sample multitable:
 4194 
 4195 %   @multitable {Column 1 template} {Column 2 template} {Column 3 template}
 4196 %   @item first col stuff @tab second col stuff @tab third col
 4197 %   @item
 4198 %   first col stuff
 4199 %   @tab
 4200 %   second col stuff
 4201 %   @tab
 4202 %   third col
 4203 %   @item first col stuff @tab second col stuff
 4204 %   @tab Many paragraphs of text may be used in any column.
 4205 %
 4206 %         They will wrap at the width determined by the template.
 4207 %   @item@tab@tab This will be in third column.
 4208 %   @end multitable
 4209 
 4210 % Default dimensions may be reset by user.
 4211 % @multitableparskip is vertical space between paragraphs in table.
 4212 % @multitableparindent is paragraph indent in table.
 4213 % @multitablecolmargin is horizontal space to be left between columns.
 4214 % @multitablelinespace is space to leave between table items, baseline
 4215 %                                                            to baseline.
 4216 %   0pt means it depends on current normal line spacing.
 4217 %
 4218 \newskip\multitableparskip
 4219 \newskip\multitableparindent
 4220 \newdimen\multitablecolspace
 4221 \newskip\multitablelinespace
 4222 \multitableparskip=0pt
 4223 \multitableparindent=6pt
 4224 \multitablecolspace=12pt
 4225 \multitablelinespace=0pt
 4226 
 4227 % Macros used to set up halign preamble:
 4228 %
 4229 \let\endsetuptable\relax
 4230 \def\xendsetuptable{\endsetuptable}
 4231 \let\columnfractions\relax
 4232 \def\xcolumnfractions{\columnfractions}
 4233 \newif\ifsetpercent
 4234 
 4235 % #1 is the @columnfraction, usually a decimal number like .5, but might
 4236 % be just 1.  We just use it, whatever it is.
 4237 %
 4238 \def\pickupwholefraction#1 {%
 4239   \global\advance\colcount by 1
 4240   \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}%
 4241   \setuptable
 4242 }
 4243 
 4244 \newcount\colcount
 4245 \def\setuptable#1{%
 4246   \def\firstarg{#1}%
 4247   \ifx\firstarg\xendsetuptable
 4248     \let\go = \relax
 4249   \else
 4250     \ifx\firstarg\xcolumnfractions
 4251       \global\setpercenttrue
 4252     \else
 4253       \ifsetpercent
 4254          \let\go\pickupwholefraction
 4255       \else
 4256          \global\advance\colcount by 1
 4257          \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a
 4258                    % separator; typically that is always in the input, anyway.
 4259          \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
 4260       \fi
 4261     \fi
 4262     \ifx\go\pickupwholefraction
 4263       % Put the argument back for the \pickupwholefraction call, so
 4264       % we'll always have a period there to be parsed.
 4265       \def\go{\pickupwholefraction#1}%
 4266     \else
 4267       \let\go = \setuptable
 4268     \fi%
 4269   \fi
 4270   \go
 4271 }
 4272 
 4273 % multitable-only commands.
 4274 % 
 4275 % @headitem starts a heading row, which we typeset in bold.  Assignments
 4276 % have to be global since we are inside the implicit group of an
 4277 % alignment entry.  \everycr below resets \everytab so we don't have to
 4278 % undo it ourselves.
 4279 \def\headitemfont{\b}% for people to use in the template row; not changeable
 4280 \def\headitem{%
 4281   \checkenv\multitable
 4282   \crcr
 4283   \gdef\headitemcrhook{\nobreak}% attempt to avoid page break after headings
 4284   \global\everytab={\bf}% can't use \headitemfont since the parsing differs
 4285   \the\everytab % for the first item
 4286 }%
 4287 %
 4288 % default for tables with no headings.
 4289 \let\headitemcrhook=\relax
 4290 %
 4291 % A \tab used to include \hskip1sp.  But then the space in a template
 4292 % line is not enough.  That is bad.  So let's go back to just `&' until
 4293 % we again encounter the problem the 1sp was intended to solve.
 4294 %                   --karl, nathan@acm.org, 20apr99.
 4295 \def\tab{\checkenv\multitable &\the\everytab}%
 4296 
 4297 % @multitable ... @end multitable definitions:
 4298 %
 4299 \newtoks\everytab  % insert after every tab.
 4300 %
 4301 \envdef\multitable{%
 4302   \vskip\parskip
 4303   \startsavinginserts
 4304   %
 4305   % @item within a multitable starts a normal row.
 4306   % We use \def instead of \let so that if one of the multitable entries
 4307   % contains an @itemize, we don't choke on the \item (seen as \crcr aka
 4308   % \endtemplate) expanding \doitemize.
 4309   \def\item{\crcr}%
 4310   %
 4311   \tolerance=9500
 4312   \hbadness=9500
 4313   \setmultitablespacing
 4314   \parskip=\multitableparskip
 4315   \parindent=\multitableparindent
 4316   \overfullrule=0pt
 4317   \global\colcount=0
 4318   %
 4319   \everycr = {%
 4320     \noalign{%
 4321       \global\everytab={}% Reset from possible headitem.
 4322       \global\colcount=0 % Reset the column counter.
 4323       %
 4324       % Check for saved footnotes, etc.:
 4325       \checkinserts
 4326       %
 4327       % Perhaps a \nobreak, then reset:
 4328       \headitemcrhook
 4329       \global\let\headitemcrhook=\relax
 4330     }%
 4331   }%
 4332   %
 4333   \parsearg\domultitable
 4334 }
 4335 \def\domultitable#1{%
 4336   % To parse everything between @multitable and @item:
 4337   \setuptable#1 \endsetuptable
 4338   %
 4339   % This preamble sets up a generic column definition, which will
 4340   % be used as many times as user calls for columns.
 4341   % \vtop will set a single line and will also let text wrap and
 4342   % continue for many paragraphs if desired.
 4343   \halign\bgroup &%
 4344     \global\advance\colcount by 1
 4345     \multistrut
 4346     \vtop{%
 4347       % Use the current \colcount to find the correct column width:
 4348       \hsize=\expandafter\csname col\the\colcount\endcsname
 4349       %
 4350       % In order to keep entries from bumping into each other
 4351       % we will add a \leftskip of \multitablecolspace to all columns after
 4352       % the first one.
 4353       %
 4354       % If a template has been used, we will add \multitablecolspace
 4355       % to the width of each template entry.
 4356       %
 4357       % If the user has set preamble in terms of percent of \hsize we will
 4358       % use that dimension as the width of the column, and the \leftskip
 4359       % will keep entries from bumping into each other.  Table will start at
 4360       % left margin and final column will justify at right margin.
 4361       %
 4362       % Make sure we don't inherit \rightskip from the outer environment.
 4363       \rightskip=0pt
 4364       \ifnum\colcount=1
 4365     % The first column will be indented with the surrounding text.
 4366     \advance\hsize by\leftskip
 4367       \else
 4368     \ifsetpercent \else
 4369       % If user has not set preamble in terms of percent of \hsize
 4370       % we will advance \hsize by \multitablecolspace.
 4371       \advance\hsize by \multitablecolspace
 4372     \fi
 4373        % In either case we will make \leftskip=\multitablecolspace:
 4374       \leftskip=\multitablecolspace
 4375       \fi
 4376       % Ignoring space at the beginning and end avoids an occasional spurious
 4377       % blank line, when TeX decides to break the line at the space before the
 4378       % box from the multistrut, so the strut ends up on a line by itself.
 4379       % For example:
 4380       % @multitable @columnfractions .11 .89
 4381       % @item @code{#}
 4382       % @tab Legal holiday which is valid in major parts of the whole country.
 4383       % Is automatically provided with highlighting sequences respectively
 4384       % marking characters.
 4385       \noindent\ignorespaces##\unskip\multistrut
 4386     }\cr
 4387 }
 4388 \def\Emultitable{%
 4389   \crcr
 4390   \egroup % end the \halign
 4391   \global\setpercentfalse
 4392 }
 4393 
 4394 \def\setmultitablespacing{%
 4395   \def\multistrut{\strut}% just use the standard line spacing
 4396   %
 4397   % Compute \multitablelinespace (if not defined by user) for use in
 4398   % \multitableparskip calculation.  We used define \multistrut based on
 4399   % this, but (ironically) that caused the spacing to be off.
 4400   % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100.
 4401 \ifdim\multitablelinespace=0pt
 4402 \setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
 4403 \global\advance\multitablelinespace by-\ht0
 4404 \fi
 4405 % Test to see if parskip is larger than space between lines of
 4406 % table. If not, do nothing.
 4407 %        If so, set to same dimension as multitablelinespace.
 4408 \ifdim\multitableparskip>\multitablelinespace
 4409 \global\multitableparskip=\multitablelinespace
 4410 \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
 4411                                       % than skip between lines in the table.
 4412 \fi%
 4413 \ifdim\multitableparskip=0pt
 4414 \global\multitableparskip=\multitablelinespace
 4415 \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
 4416                                       % than skip between lines in the table.
 4417 \fi}
 4418 
 4419 
 4420 \message{conditionals,}
 4421 
 4422 % @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext,
 4423 % @ifnotxml always succeed.  They currently do nothing; we don't
 4424 % attempt to check whether the conditionals are properly nested.  But we
 4425 % have to remember that they are conditionals, so that @end doesn't
 4426 % attempt to close an environment group.
 4427 %
 4428 \def\makecond#1{%
 4429   \expandafter\let\csname #1\endcsname = \relax
 4430   \expandafter\let\csname iscond.#1\endcsname = 1
 4431 }
 4432 \makecond{iftex}
 4433 \makecond{ifnotdocbook}
 4434 \makecond{ifnothtml}
 4435 \makecond{ifnotinfo}
 4436 \makecond{ifnotplaintext}
 4437 \makecond{ifnotxml}
 4438 
 4439 % Ignore @ignore, @ifhtml, @ifinfo, and the like.
 4440 %
 4441 \def\direntry{\doignore{direntry}}
 4442 \def\documentdescription{\doignore{documentdescription}}
 4443 \def\docbook{\doignore{docbook}}
 4444 \def\html{\doignore{html}}
 4445 \def\ifdocbook{\doignore{ifdocbook}}
 4446 \def\ifhtml{\doignore{ifhtml}}
 4447 \def\ifinfo{\doignore{ifinfo}}
 4448 \def\ifnottex{\doignore{ifnottex}}
 4449 \def\ifplaintext{\doignore{ifplaintext}}
 4450 \def\ifxml{\doignore{ifxml}}
 4451 \def\ignore{\doignore{ignore}}
 4452 \def\menu{\doignore{menu}}
 4453 \def\xml{\doignore{xml}}
 4454 
 4455 % Ignore text until a line `@end #1', keeping track of nested conditionals.
 4456 %
 4457 % A count to remember the depth of nesting.
 4458 \newcount\doignorecount
 4459 
 4460 \def\doignore#1{\begingroup
 4461   % Scan in ``verbatim'' mode:
 4462   \obeylines
 4463   \catcode`\@ = \other
 4464   \catcode`\{ = \other
 4465   \catcode`\} = \other
 4466   %
 4467   % Make sure that spaces turn into tokens that match what \doignoretext wants.
 4468   \spaceisspace
 4469   %
 4470   % Count number of #1's that we've seen.
 4471   \doignorecount = 0
 4472   %
 4473   % Swallow text until we reach the matching `@end #1'.
 4474   \dodoignore{#1}%
 4475 }
 4476 
 4477 { \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source.
 4478   \obeylines %
 4479   %
 4480   \gdef\dodoignore#1{%
 4481     % #1 contains the command name as a string, e.g., `ifinfo'.
 4482     %
 4483     % Define a command to find the next `@end #1'.
 4484     \long\def\doignoretext##1^^M@end #1{%
 4485       \doignoretextyyy##1^^M@#1\_STOP_}%
 4486     %
 4487     % And this command to find another #1 command, at the beginning of a
 4488     % line.  (Otherwise, we would consider a line `@c @ifset', for
 4489     % example, to count as an @ifset for nesting.)
 4490     \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}%
 4491     %
 4492     % And now expand that command.
 4493     \doignoretext ^^M%
 4494   }%
 4495 }
 4496 
 4497 \def\doignoreyyy#1{%
 4498   \def\temp{#1}%
 4499   \ifx\temp\empty           % Nothing found.
 4500     \let\next\doignoretextzzz
 4501   \else                 % Found a nested condition, ...
 4502     \advance\doignorecount by 1
 4503     \let\next\doignoretextyyy       % ..., look for another.
 4504     % If we're here, #1 ends with ^^M\ifinfo (for example).
 4505   \fi
 4506   \next #1% the token \_STOP_ is present just after this macro.
 4507 }
 4508 
 4509 % We have to swallow the remaining "\_STOP_".
 4510 %
 4511 \def\doignoretextzzz#1{%
 4512   \ifnum\doignorecount = 0  % We have just found the outermost @end.
 4513     \let\next\enddoignore
 4514   \else             % Still inside a nested condition.
 4515     \advance\doignorecount by -1
 4516     \let\next\doignoretext      % Look for the next @end.
 4517   \fi
 4518   \next
 4519 }
 4520 
 4521 % Finish off ignored text.
 4522 { \obeylines%
 4523   % Ignore anything after the last `@end #1'; this matters in verbatim
 4524   % environments, where otherwise the newline after an ignored conditional
 4525   % would result in a blank line in the output.
 4526   \gdef\enddoignore#1^^M{\endgroup\ignorespaces}%
 4527 }
 4528 
 4529 
 4530 % @set VAR sets the variable VAR to an empty value.
 4531 % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
 4532 %
 4533 % Since we want to separate VAR from REST-OF-LINE (which might be
 4534 % empty), we can't just use \parsearg; we have to insert a space of our
 4535 % own to delimit the rest of the line, and then take it out again if we
 4536 % didn't need it.
 4537 % We rely on the fact that \parsearg sets \catcode`\ =10.
 4538 %
 4539 \parseargdef\set{\setyyy#1 \endsetyyy}
 4540 \def\setyyy#1 #2\endsetyyy{%
 4541   {%
 4542     \makevalueexpandable
 4543     \def\temp{#2}%
 4544     \edef\next{\gdef\makecsname{SET#1}}%
 4545     \ifx\temp\empty
 4546       \next{}%
 4547     \else
 4548       \setzzz#2\endsetzzz
 4549     \fi
 4550   }%
 4551 }
 4552 % Remove the trailing space \setxxx inserted.
 4553 \def\setzzz#1 \endsetzzz{\next{#1}}
 4554 
 4555 % @clear VAR clears (i.e., unsets) the variable VAR.
 4556 %
 4557 \parseargdef\clear{%
 4558   {%
 4559     \makevalueexpandable
 4560     \global\expandafter\let\csname SET#1\endcsname=\relax
 4561   }%
 4562 }
 4563 
 4564 % @value{foo} gets the text saved in variable foo.
 4565 \def\value{\begingroup\makevalueexpandable\valuexxx}
 4566 \def\valuexxx#1{\expandablevalue{#1}\endgroup}
 4567 {
 4568   \catcode`\-=\active \catcode`\_=\active
 4569   %
 4570   \gdef\makevalueexpandable{%
 4571     \let\value = \expandablevalue
 4572     % We don't want these characters active, ...
 4573     \catcode`\-=\other \catcode`\_=\other
 4574     % ..., but we might end up with active ones in the argument if
 4575     % we're called from @code, as @code{@value{foo-bar_}}, though.
 4576     % So \let them to their normal equivalents.
 4577     \let-\normaldash \let_\normalunderscore
 4578   }
 4579 }
 4580 
 4581 % We have this subroutine so that we can handle at least some @value's
 4582 % properly in indexes (we call \makevalueexpandable in \indexdummies).
 4583 % The command has to be fully expandable (if the variable is set), since
 4584 % the result winds up in the index file.  This means that if the
 4585 % variable's value contains other Texinfo commands, it's almost certain
 4586 % it will fail (although perhaps we could fix that with sufficient work
 4587 % to do a one-level expansion on the result, instead of complete).
 4588 % 
 4589 % Unfortunately, this has the consequence that when _ is in the *value*
 4590 % of an @set, it does not print properly in the roman fonts (get the cmr
 4591 % dot accent at position 126 instead).  No fix comes to mind, and it's
 4592 % been this way since 2003 or earlier, so just ignore it.
 4593 % 
 4594 \def\expandablevalue#1{%
 4595   \expandafter\ifx\csname SET#1\endcsname\relax
 4596     {[No value for ``#1'']}%
 4597     \message{Variable `#1', used in @value, is not set.}%
 4598   \else
 4599     \csname SET#1\endcsname
 4600   \fi
 4601 }
 4602 
 4603 % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
 4604 % with @set.
 4605 % 
 4606 % To get the special treatment we need for `@end ifset,' we call
 4607 % \makecond and then redefine.
 4608 %
 4609 \makecond{ifset}
 4610 \def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}}
 4611 \def\doifset#1#2{%
 4612   {%
 4613     \makevalueexpandable
 4614     \let\next=\empty
 4615     \expandafter\ifx\csname SET#2\endcsname\relax
 4616       #1% If not set, redefine \next.
 4617     \fi
 4618     \expandafter
 4619   }\next
 4620 }
 4621 \def\ifsetfail{\doignore{ifset}}
 4622 
 4623 % @ifclear VAR ... @end executes the `...' iff VAR has never been
 4624 % defined with @set, or has been undefined with @clear.
 4625 %
 4626 % The `\else' inside the `\doifset' parameter is a trick to reuse the
 4627 % above code: if the variable is not set, do nothing, if it is set,
 4628 % then redefine \next to \ifclearfail.
 4629 %
 4630 \makecond{ifclear}
 4631 \def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}}
 4632 \def\ifclearfail{\doignore{ifclear}}
 4633 
 4634 % @ifcommandisdefined CMD ... @end executes the `...' if CMD (written
 4635 % without the @) is in fact defined.  We can only feasibly check at the
 4636 % TeX level, so something like `mathcode' is going to considered
 4637 % defined even though it is not a Texinfo command.
 4638 % 
 4639 \makecond{ifcommanddefined}
 4640 \def\ifcommanddefined{\parsearg{\doifcmddefined{\let\next=\ifcmddefinedfail}}}
 4641 %
 4642 \def\doifcmddefined#1#2{{%
 4643     \makevalueexpandable
 4644     \let\next=\empty
 4645     \expandafter\ifx\csname #2\endcsname\relax
 4646       #1% If not defined, \let\next as above.
 4647     \fi
 4648     \expandafter
 4649   }\next
 4650 }
 4651 \def\ifcmddefinedfail{\doignore{ifcommanddefined}}
 4652 
 4653 % @ifcommandnotdefined CMD ... handled similar to @ifclear above.
 4654 \makecond{ifcommandnotdefined}
 4655 \def\ifcommandnotdefined{%
 4656   \parsearg{\doifcmddefined{\else \let\next=\ifcmdnotdefinedfail}}}
 4657 \def\ifcmdnotdefinedfail{\doignore{ifcommandnotdefined}}
 4658 
 4659 % Set the `txicommandconditionals' variable, so documents have a way to
 4660 % test if the @ifcommand...defined conditionals are available.
 4661 \set txicommandconditionals
 4662 
 4663 % @dircategory CATEGORY  -- specify a category of the dir file
 4664 % which this file should belong to.  Ignore this in TeX.
 4665 \let\dircategory=\comment
 4666 
 4667 % @defininfoenclose.
 4668 \let\definfoenclose=\comment
 4669 
 4670 
 4671 \message{indexing,}
 4672 % Index generation facilities
 4673 
 4674 % Define \newwrite to be identical to plain tex's \newwrite
 4675 % except not \outer, so it can be used within macros and \if's.
 4676 \edef\newwrite{\makecsname{ptexnewwrite}}
 4677 
 4678 % \newindex {foo} defines an index named IX.
 4679 % It automatically defines \IXindex such that
 4680 % \IXindex ...rest of line... puts an entry in the index IX.
 4681 % It also defines \IXindfile to be the number of the output channel for
 4682 % the file that accumulates this index.  The file's extension is IX.
 4683 % The name of an index should be no more than 2 characters long
 4684 % for the sake of vms.
 4685 %
 4686 \def\newindex#1{%
 4687   \expandafter\chardef\csname#1indfile\endcsname=0
 4688   \expandafter\xdef\csname#1index\endcsname{%     % Define @#1index
 4689     \noexpand\doindex{#1}}
 4690 }
 4691 
 4692 % @defindex foo  ==  \newindex{foo}
 4693 %
 4694 \def\defindex{\parsearg\newindex}
 4695 
 4696 % Define @defcodeindex, like @defindex except put all entries in @code.
 4697 %
 4698 \def\defcodeindex{\parsearg\newcodeindex}
 4699 %
 4700 \def\newcodeindex#1{%
 4701   \expandafter\chardef\csname#1indfile\endcsname=0
 4702   \expandafter\xdef\csname#1index\endcsname{%
 4703     \noexpand\docodeindex{#1}}%
 4704 }
 4705 
 4706 % The default indices:
 4707 \newindex{cp}%      concepts,
 4708 \newcodeindex{fn}%  functions,
 4709 \newcodeindex{vr}%  variables,
 4710 \newcodeindex{tp}%  types,
 4711 \newcodeindex{ky}%  keys
 4712 \newcodeindex{pg}%  and programs.
 4713 
 4714 
 4715 % @synindex foo bar    makes index foo feed into index bar.
 4716 % Do this instead of @defindex foo if you don't want it as a separate index.
 4717 %
 4718 % @syncodeindex foo bar   similar, but put all entries made for index foo
 4719 % inside @code.
 4720 %
 4721 \def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
 4722 \def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}
 4723 
 4724 % #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
 4725 % #3 the target index (bar).
 4726 \def\dosynindex#1#2#3{%
 4727   % Only do \closeout if we haven't already done it, else we'll end up
 4728   % closing the target index.
 4729   \expandafter \ifx\csname donesynindex#2\endcsname \relax
 4730     % The \closeout helps reduce unnecessary open files; the limit on the
 4731     % Acorn RISC OS is a mere 16 files.
 4732     \expandafter\closeout\csname#2indfile\endcsname
 4733     \expandafter\let\csname donesynindex#2\endcsname = 1
 4734   \fi
 4735   % redefine \fooindfile:
 4736   \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
 4737   \expandafter\let\csname#2indfile\endcsname=\temp
 4738   % redefine \fooindex:
 4739   \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
 4740 }
 4741 
 4742 % Define \doindex, the driver for all index macros.
 4743 % Argument #1 is generated by the calling \fooindex macro,
 4744 % and it the two-letter name of the index.
 4745 
 4746 \def\doindex#1{\edef\indexname{#1}\parsearg\doindexxxx}
 4747 \def\doindexxxx #1{\doind{\indexname}{#1}}
 4748 
 4749 % like the previous two, but they put @code around the argument.
 4750 \def\docodeindex#1{\edef\indexname{#1}\parsearg\docodeindexxxx}
 4751 \def\docodeindexxxx #1{\doind{\indexname}{\code{#1}}}
 4752 
 4753 % Used when writing an index entry out to an index file, to prevent
 4754 % expansion of Texinfo commands that can appear in an index entry.
 4755 %
 4756 \def\indexdummies{%
 4757   \escapechar = `\\     % use backslash in output files.
 4758   \def\@{@}% change to @@ when we switch to @ as escape char in index files.
 4759   \def\ {\realbackslash\space }%
 4760   %
 4761   % Need these unexpandable (because we define \tt as a dummy)
 4762   % definitions when @{ or @} appear in index entry text.  Also, more
 4763   % complicated, when \tex is in effect and \{ is a \delimiter again.
 4764   % We can't use \lbracecmd and \rbracecmd because texindex assumes
 4765   % braces and backslashes are used only as delimiters.  Perhaps we
 4766   % should use @lbracechar and @rbracechar?
 4767   \def\{{{\tt\char123}}%
 4768   \def\}{{\tt\char125}}%
 4769   %
 4770   % Do the redefinitions.
 4771   \commondummies
 4772 }
 4773 
 4774 % For the aux and toc files, @ is the escape character.  So we want to
 4775 % redefine everything using @ as the escape character (instead of
 4776 % \realbackslash, still used for index files).  When everything uses @,
 4777 % this will be simpler.
 4778 %
 4779 \def\atdummies{%
 4780   \def\@{@@}%
 4781   \def\ {@ }%
 4782   \let\{ = \lbraceatcmd
 4783   \let\} = \rbraceatcmd
 4784   %
 4785   % Do the redefinitions.
 4786   \commondummies
 4787   \otherbackslash
 4788 }
 4789 
 4790 % Called from \indexdummies and \atdummies.
 4791 %
 4792 \def\commondummies{%
 4793   % \definedummyword defines \#1 as \string\#1\space, thus effectively
 4794   % preventing its expansion.  This is used only for control words,
 4795   % not control letters, because the \space would be incorrect for
 4796   % control characters, but is needed to separate the control word
 4797   % from whatever follows.
 4798   %
 4799   % For control letters, we have \definedummyletter, which omits the
 4800   % space.
 4801   %
 4802   % These can be used both for control words that take an argument and
 4803   % those that do not.  If it is followed by {arg} in the input, then
 4804   % that will dutifully get written to the index (or wherever).
 4805   %
 4806   \def\definedummyword  ##1{\def##1{\string##1\space}}%
 4807   \def\definedummyletter##1{\def##1{\string##1}}%
 4808   \let\definedummyaccent\definedummyletter
 4809   %
 4810   \commondummiesnofonts
 4811   %
 4812   \definedummyletter\_%
 4813   \definedummyletter\-%
 4814   %
 4815   % Non-English letters.
 4816   \definedummyword\AA
 4817   \definedummyword\AE
 4818   \definedummyword\DH
 4819   \definedummyword\L
 4820   \definedummyword\O
 4821   \definedummyword\OE
 4822   \definedummyword\TH
 4823   \definedummyword\aa
 4824   \definedummyword\ae
 4825   \definedummyword\dh
 4826   \definedummyword\exclamdown
 4827   \definedummyword\l
 4828   \definedummyword\o
 4829   \definedummyword\oe
 4830   \definedummyword\ordf
 4831   \definedummyword\ordm
 4832   \definedummyword\questiondown
 4833   \definedummyword\ss
 4834   \definedummyword\th
 4835   %
 4836   % Although these internal commands shouldn't show up, sometimes they do.
 4837   \definedummyword\bf
 4838   \definedummyword\gtr
 4839   \definedummyword\hat
 4840   \definedummyword\less
 4841   \definedummyword\sf
 4842   \definedummyword\sl
 4843   \definedummyword\tclose
 4844   \definedummyword\tt
 4845   %
 4846   \definedummyword\LaTeX
 4847   \definedummyword\TeX
 4848   %
 4849   % Assorted special characters.
 4850   \definedummyword\arrow
 4851   \definedummyword\bullet
 4852   \definedummyword\comma
 4853   \definedummyword\copyright
 4854   \definedummyword\registeredsymbol
 4855   \definedummyword\dots
 4856   \definedummyword\enddots
 4857   \definedummyword\entrybreak
 4858   \definedummyword\equiv
 4859   \definedummyword\error
 4860   \definedummyword\euro
 4861   \definedummyword\expansion
 4862   \definedummyword\geq
 4863   \definedummyword\guillemetleft
 4864   \definedummyword\guillemetright
 4865   \definedummyword\guilsinglleft
 4866   \definedummyword\guilsinglright
 4867   \definedummyword\lbracechar
 4868   \definedummyword\leq
 4869   \definedummyword\mathopsup
 4870   \definedummyword\minus
 4871   \definedummyword\ogonek
 4872   \definedummyword\pounds
 4873   \definedummyword\point
 4874   \definedummyword\print
 4875   \definedummyword\quotedblbase
 4876   \definedummyword\quotedblleft
 4877   \definedummyword\quotedblright
 4878   \definedummyword\quoteleft
 4879   \definedummyword\quoteright
 4880   \definedummyword\quotesinglbase
 4881   \definedummyword\rbracechar
 4882   \definedummyword\result
 4883   \definedummyword\sub
 4884   \definedummyword\sup
 4885   \definedummyword\textdegree
 4886   %
 4887   % We want to disable all macros so that they are not expanded by \write.
 4888   \macrolist
 4889   %
 4890   \normalturnoffactive
 4891   %
 4892   % Handle some cases of @value -- where it does not contain any
 4893   % (non-fully-expandable) commands.
 4894   \makevalueexpandable
 4895 }
 4896 
 4897 % \commondummiesnofonts: common to \commondummies and \indexnofonts.
 4898 % Define \definedumyletter, \definedummyaccent and \definedummyword before
 4899 % using.
 4900 %
 4901 \def\commondummiesnofonts{%
 4902   % Control letters and accents.
 4903   \definedummyletter\!%
 4904   \definedummyaccent\"%
 4905   \definedummyaccent\'%
 4906   \definedummyletter\*%
 4907   \definedummyaccent\,%
 4908   \definedummyletter\.%
 4909   \definedummyletter\/%
 4910   \definedummyletter\:%
 4911   \definedummyaccent\=%
 4912   \definedummyletter\?%
 4913   \definedummyaccent\^%
 4914   \definedummyaccent\`%
 4915   \definedummyaccent\~%
 4916   \definedummyword\u
 4917   \definedummyword\v
 4918   \definedummyword\H
 4919   \definedummyword\dotaccent
 4920   \definedummyword\ogonek
 4921   \definedummyword\ringaccent
 4922   \definedummyword\tieaccent
 4923   \definedummyword\ubaraccent
 4924   \definedummyword\udotaccent
 4925   \definedummyword\dotless
 4926   %
 4927   % Texinfo font commands.
 4928   \definedummyword\b
 4929   \definedummyword\i
 4930   \definedummyword\r
 4931   \definedummyword\sansserif
 4932   \definedummyword\sc
 4933   \definedummyword\slanted
 4934   \definedummyword\t
 4935   %
 4936   % Commands that take arguments.
 4937   \definedummyword\abbr
 4938   \definedummyword\acronym
 4939   \definedummyword\anchor
 4940   \definedummyword\cite
 4941   \definedummyword\code
 4942   \definedummyword\command
 4943   \definedummyword\dfn
 4944   \definedummyword\dmn
 4945   \definedummyword\email
 4946   \definedummyword\emph
 4947   \definedummyword\env
 4948   \definedummyword\file
 4949   \definedummyword\image
 4950   \definedummyword\indicateurl
 4951   \definedummyword\inforef
 4952   \definedummyword\kbd
 4953   \definedummyword\key
 4954   \definedummyword\math
 4955   \definedummyword\option
 4956   \definedummyword\pxref
 4957   \definedummyword\ref
 4958   \definedummyword\samp
 4959   \definedummyword\strong
 4960   \definedummyword\tie
 4961   \definedummyword\U
 4962   \definedummyword\uref
 4963   \definedummyword\url
 4964   \definedummyword\var
 4965   \definedummyword\verb
 4966   \definedummyword\w
 4967   \definedummyword\xref
 4968 }
 4969 
 4970 % For testing: output @{ and @} in index sort strings as \{ and \}.
 4971 \newif\ifusebracesinindexes
 4972 
 4973 \let\indexlbrace\relax
 4974 \let\indexrbrace\relax
 4975 
 4976 {\catcode`\@=0
 4977 \catcode`\\=13
 4978   @gdef@backslashdisappear{@def\{}}
 4979 }
 4980 
 4981 {
 4982 \catcode`\<=13
 4983 \catcode`\-=13
 4984 \catcode`\`=13
 4985   \gdef\indexnonalnumdisappear{%
 4986     \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax\else
 4987       % @set txiindexlquoteignore makes us ignore left quotes in the sort term.
 4988       % (Introduced for FSFS 2nd ed.)
 4989       \let`=\empty
 4990     \fi
 4991     %
 4992     \expandafter\ifx\csname SETtxiindexbackslashignore\endcsname\relax\else
 4993       \backslashdisappear
 4994     \fi
 4995     %
 4996     \expandafter\ifx\csname SETtxiindexhyphenignore\endcsname\relax\else
 4997       \def-{}%
 4998     \fi
 4999     \expandafter\ifx\csname SETtxiindexlessthanignore\endcsname\relax\else
 5000       \def<{}%
 5001     \fi
 5002     \expandafter\ifx\csname SETtxiindexatsignignore\endcsname\relax\else
 5003       \def\@{}%
 5004     \fi
 5005   }
 5006 
 5007   \gdef\indexnonalnumreappear{%
 5008     \useindexbackslash
 5009     \let-\normaldash
 5010     \let<\normalless
 5011     \def\@{@}%
 5012   }
 5013 }
 5014 
 5015 
 5016 % \indexnofonts is used when outputting the strings to sort the index
 5017 % by, and when constructing control sequence names.  It eliminates all
 5018 % control sequences and just writes whatever the best ASCII sort string
 5019 % would be for a given command (usually its argument).
 5020 %
 5021 \def\indexnofonts{%
 5022   % Accent commands should become @asis.
 5023   \def\definedummyaccent##1{\let##1\asis}%
 5024   % We can just ignore other control letters.
 5025   \def\definedummyletter##1{\let##1\empty}%
 5026   % All control words become @asis by default; overrides below.
 5027   \let\definedummyword\definedummyaccent
 5028   \commondummiesnofonts
 5029   %
 5030   % Don't no-op \tt, since it isn't a user-level command
 5031   % and is used in the definitions of the active chars like <, >, |, etc.
 5032   % Likewise with the other plain tex font commands.
 5033   %\let\tt=\asis
 5034   %
 5035   \def\ { }%
 5036   \def\@{@}%
 5037   \def\_{\normalunderscore}%
 5038   \def\-{}% @- shouldn't affect sorting
 5039   %
 5040   \uccode`\1=`\{ \uppercase{\def\{{1}}%
 5041   \uccode`\1=`\} \uppercase{\def\}{1}}%
 5042   \let\lbracechar\{%
 5043   \let\rbracechar\}%
 5044   %
 5045   % Non-English letters.
 5046   \def\AA{AA}%
 5047   \def\AE{AE}%
 5048   \def\DH{DZZ}%
 5049   \def\L{L}%
 5050   \def\OE{OE}%
 5051   \def\O{O}%
 5052   \def\TH{TH}%
 5053   \def\aa{aa}%
 5054   \def\ae{ae}%
 5055   \def\dh{dzz}%
 5056   \def\exclamdown{!}%
 5057   \def\l{l}%
 5058   \def\oe{oe}%
 5059   \def\ordf{a}%
 5060   \def\ordm{o}%
 5061   \def\o{o}%
 5062   \def\questiondown{?}%
 5063   \def\ss{ss}%
 5064   \def\th{th}%
 5065   %
 5066   \def\LaTeX{LaTeX}%
 5067   \def\TeX{TeX}%
 5068   %
 5069   % Assorted special characters.
 5070   % (The following {} will end up in the sort string, but that's ok.)
 5071   \def\arrow{->}%
 5072   \def\bullet{bullet}%
 5073   \def\comma{,}%
 5074   \def\copyright{copyright}%
 5075   \def\dots{...}%
 5076   \def\enddots{...}%
 5077   \def\equiv{==}%
 5078   \def\error{error}%
 5079   \def\euro{euro}%
 5080   \def\expansion{==>}%
 5081   \def\geq{>=}%
 5082   \def\guillemetleft{<<}%
 5083   \def\guillemetright{>>}%
 5084   \def\guilsinglleft{<}%
 5085   \def\guilsinglright{>}%
 5086   \def\leq{<=}%
 5087   \def\minus{-}%
 5088   \def\point{.}%
 5089   \def\pounds{pounds}%
 5090   \def\print{-|}%
 5091   \def\quotedblbase{"}%
 5092   \def\quotedblleft{"}%
 5093   \def\quotedblright{"}%
 5094   \def\quoteleft{`}%
 5095   \def\quoteright{'}%
 5096   \def\quotesinglbase{,}%
 5097   \def\registeredsymbol{R}%
 5098   \def\result{=>}%
 5099   \def\textdegree{o}%
 5100   %
 5101   % We need to get rid of all macros, leaving only the arguments (if present).
 5102   % Of course this is not nearly correct, but it is the best we can do for now.
 5103   % makeinfo does not expand macros in the argument to @deffn, which ends up
 5104   % writing an index entry, and texindex isn't prepared for an index sort entry
 5105   % that starts with \.
 5106   %
 5107   % Since macro invocations are followed by braces, we can just redefine them
 5108   % to take a single TeX argument.  The case of a macro invocation that
 5109   % goes to end-of-line is not handled.
 5110   %
 5111   \macrolist
 5112 }
 5113 
 5114 
 5115 \let\SETmarginindex=\relax % put index entries in margin (undocumented)?
 5116 
 5117 % Most index entries go through here, but \dosubind is the general case.
 5118 % #1 is the index name, #2 is the entry text.
 5119 \def\doind#1#2{\dosubind{#1}{#2}{}}
 5120 
 5121 % There is also \dosubind {index}{topic}{subtopic}
 5122 % which makes an entry in a two-level index such as the operation index.
 5123 % TODO: Two-level index?  Operation index?
 5124 
 5125 % Workhorse for all indexes.
 5126 % #1 is name of index, #2 is stuff to put there, #3 is subentry --
 5127 % empty if called from \doind, as we usually are (the main exception
 5128 % is with most defuns, which call us directly).
 5129 %
 5130 \def\dosubind#1#2#3{%
 5131   \iflinks
 5132   {%
 5133     \requireopenindexfile{#1}%
 5134     % Store the main index entry text (including the third arg).
 5135     \toks0 = {#2}%
 5136     % If third arg is present, precede it with a space.
 5137     \def\thirdarg{#3}%
 5138     \ifx\thirdarg\empty \else
 5139       \toks0 = \expandafter{\the\toks0 \space #3}%
 5140     \fi
 5141     %
 5142     \edef\writeto{\csname#1indfile\endcsname}%
 5143     %
 5144     \safewhatsit\dosubindwrite
 5145   }%
 5146   \fi
 5147 }
 5148 
 5149 % Check if an index file has been opened, and if not, open it.
 5150 \def\requireopenindexfile#1{%
 5151 \ifnum\csname #1indfile\endcsname=0
 5152   \expandafter\newwrite \csname#1indfile\endcsname
 5153   \edef\suffix{#1}%
 5154   % A .fls suffix would conflict with the file extension for the output
 5155   % of -recorder, so use .f1s instead.
 5156   \ifx\suffix\indexisfl\def\suffix{f1}\fi
 5157   % Open the file
 5158   \immediate\openout\csname#1indfile\endcsname \jobname.\suffix
 5159   % Using \immediate here prevents an object entering into the current box,
 5160   % which could confound checks such as those in \safewhatsit for preceding
 5161   % skips.
 5162 \fi}
 5163 \def\indexisfl{fl}
 5164 
 5165 % Output \ as {\indexbackslash}, because \ is an escape character in
 5166 % the index files.
 5167 \let\indexbackslash=\relax
 5168 {\catcode`\@=0 \catcode`\\=\active
 5169   @gdef@useindexbackslash{@def\{{@indexbackslash}}}
 5170 }
 5171 
 5172 % Definition for writing index entry text.
 5173 \def\sortas#1{\ignorespaces}%
 5174 
 5175 % Definition for writing index entry sort key.  Should occur at the at
 5176 % the beginning of the index entry, like
 5177 %     @cindex @sortas{september} \september
 5178 % The \ignorespaces takes care of following space, but there's no way
 5179 % to remove space before it.
 5180 {
 5181 \catcode`\-=13
 5182 \gdef\indexwritesortas{%
 5183   \begingroup
 5184   \indexnonalnumreappear
 5185   \indexwritesortasxxx}
 5186 \gdef\indexwritesortasxxx#1{%
 5187   \xdef\indexsortkey{#1}\endgroup}
 5188 }
 5189 
 5190 
 5191 % Write the entry in \toks0 to the index file.
 5192 %
 5193 \def\dosubindwrite{%
 5194   % Put the index entry in the margin if desired.
 5195   \ifx\SETmarginindex\relax\else
 5196     \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}%
 5197   \fi
 5198   %
 5199   % Remember, we are within a group.
 5200   \indexdummies % Must do this here, since \bf, etc expand at this stage
 5201   \useindexbackslash % \indexbackslash isn't defined now so it will be output 
 5202                      % as is; and it will print as backslash.
 5203   % The braces around \indexbrace are recognized by texindex.
 5204   %
 5205   % Get the string to sort by, by processing the index entry with all
 5206   % font commands turned off.
 5207   {\indexnofonts
 5208    \def\lbracechar{{\indexlbrace}}%
 5209    \def\rbracechar{{\indexrbrace}}%
 5210    \let\{=\lbracechar
 5211    \let\}=\rbracechar
 5212    \indexnonalnumdisappear
 5213    \xdef\indexsortkey{}%
 5214    \let\sortas=\indexwritesortas
 5215    \edef\temp{\the\toks0}%
 5216    \setbox\dummybox = \hbox{\temp}% Make sure to execute any \sortas
 5217    \ifx\indexsortkey\empty
 5218      \xdef\indexsortkey{\temp}%
 5219      \ifx\indexsortkey\empty\xdef\indexsortkey{ }\fi
 5220    \fi
 5221   }%
 5222   %
 5223   % Set up the complete index entry, with both the sort key and
 5224   % the original text, including any font commands.  We write
 5225   % three arguments to \entry to the .?? file (four in the
 5226   % subentry case), texindex reduces to two when writing the .??s
 5227   % sorted result.
 5228   \edef\temp{%
 5229     \write\writeto{%
 5230       \string\entry{\indexsortkey}{\noexpand\folio}{\the\toks0}}%
 5231   }%
 5232   \temp
 5233 }
 5234 \newbox\dummybox % used above
 5235 
 5236 % Take care of unwanted page breaks/skips around a whatsit:
 5237 %
 5238 % If a skip is the last thing on the list now, preserve it
 5239 % by backing up by \lastskip, doing the \write, then inserting
 5240 % the skip again.  Otherwise, the whatsit generated by the
 5241 % \write or \pdfdest will make \lastskip zero.  The result is that
 5242 % sequences like this:
 5243 % @end defun
 5244 % @tindex whatever
 5245 % @defun ...
 5246 % will have extra space inserted, because the \medbreak in the
 5247 % start of the @defun won't see the skip inserted by the @end of
 5248 % the previous defun.
 5249 %
 5250 % But don't do any of this if we're not in vertical mode.  We
 5251 % don't want to do a \vskip and prematurely end a paragraph.
 5252 %
 5253 % Avoid page breaks due to these extra skips, too.
 5254 %
 5255 % But wait, there is a catch there:
 5256 % We'll have to check whether \lastskip is zero skip.  \ifdim is not
 5257 % sufficient for this purpose, as it ignores stretch and shrink parts
 5258 % of the skip.  The only way seems to be to check the textual
 5259 % representation of the skip.
 5260 %
 5261 % The following is almost like \def\zeroskipmacro{0.0pt} except that
 5262 % the ``p'' and ``t'' characters have catcode \other, not 11 (letter).
 5263 %
 5264 \edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname}
 5265 %
 5266 \newskip\whatsitskip
 5267 \newcount\whatsitpenalty
 5268 %
 5269 % ..., ready, GO:
 5270 %
 5271 \def\safewhatsit#1{\ifhmode
 5272   #1%
 5273  \else
 5274   % \lastskip and \lastpenalty cannot both be nonzero simultaneously.
 5275   \whatsitskip = \lastskip
 5276   \edef\lastskipmacro{\the\lastskip}%
 5277   \whatsitpenalty = \lastpenalty
 5278   %
 5279   % If \lastskip is nonzero, that means the last item was a
 5280   % skip.  And since a skip is discardable, that means this
 5281   % -\whatsitskip glue we're inserting is preceded by a
 5282   % non-discardable item, therefore it is not a potential
 5283   % breakpoint, therefore no \nobreak needed.
 5284   \ifx\lastskipmacro\zeroskipmacro
 5285   \else
 5286     \vskip-\whatsitskip
 5287   \fi
 5288   %
 5289   #1%
 5290   %
 5291   \ifx\lastskipmacro\zeroskipmacro
 5292     % If \lastskip was zero, perhaps the last item was a penalty, and
 5293     % perhaps it was >=10000, e.g., a \nobreak.  In that case, we want
 5294     % to re-insert the same penalty (values >10000 are used for various
 5295     % signals); since we just inserted a non-discardable item, any
 5296     % following glue (such as a \parskip) would be a breakpoint.  For example:
 5297     %   @deffn deffn-whatever
 5298     %   @vindex index-whatever
 5299     %   Description.
 5300     % would allow a break between the index-whatever whatsit
 5301     % and the "Description." paragraph.
 5302     \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi
 5303   \else
 5304     % On the other hand, if we had a nonzero \lastskip,
 5305     % this make-up glue would be preceded by a non-discardable item
 5306     % (the whatsit from the \write), so we must insert a \nobreak.
 5307     \nobreak\vskip\whatsitskip
 5308   \fi
 5309 \fi}
 5310 
 5311 % The index entry written in the file actually looks like
 5312 %  \entry {sortstring}{page}{topic}
 5313 % or
 5314 %  \entry {sortstring}{page}{topic}{subtopic}
 5315 % The texindex program reads in these files and writes files
 5316 % containing these kinds of lines:
 5317 %  \initial {c}
 5318 %     before the first topic whose initial is c
 5319 %  \entry {topic}{pagelist}
 5320 %     for a topic that is used without subtopics
 5321 %  \primary {topic}
 5322 %     for the beginning of a topic that is used with subtopics
 5323 %  \secondary {subtopic}{pagelist}
 5324 %     for each subtopic.
 5325 
 5326 % Define the user-accessible indexing commands
 5327 % @findex, @vindex, @kindex, @cindex.
 5328 
 5329 \def\findex {\fnindex}
 5330 \def\kindex {\kyindex}
 5331 \def\cindex {\cpindex}
 5332 \def\vindex {\vrindex}
 5333 \def\tindex {\tpindex}
 5334 \def\pindex {\pgindex}
 5335 
 5336 \def\cindexsub {\begingroup\obeylines\cindexsub}
 5337 {\obeylines %
 5338 \gdef\cindexsub "#1" #2^^M{\endgroup %
 5339 \dosubind{cp}{#2}{#1}}}
 5340 
 5341 % Define the macros used in formatting output of the sorted index material.
 5342 
 5343 % @printindex causes a particular index (the ??s file) to get printed.
 5344 % It does not print any chapter heading (usually an @unnumbered).
 5345 %
 5346 \parseargdef\printindex{\begingroup
 5347   \dobreak \chapheadingskip{10000}%
 5348   %
 5349   \smallfonts \rm
 5350   \tolerance = 9500
 5351   \plainfrenchspacing
 5352   \everypar = {}% don't want the \kern\-parindent from indentation suppression.
 5353   %
 5354   % See if the index file exists and is nonempty.
 5355   % Change catcode of @ here so that if the index file contains
 5356   % \initial {@}
 5357   % as its first line, TeX doesn't complain about mismatched braces
 5358   % (because it thinks @} is a control sequence).
 5359   \catcode`\@ = 11
 5360   % See comment in \requireopenindexfile.
 5361   \def\indexname{#1}\ifx\indexname\indexisfl\def\indexname{f1}\fi
 5362   \openin 1 \jobname.\indexname s
 5363   \ifeof 1
 5364     % \enddoublecolumns gets confused if there is no text in the index,
 5365     % and it loses the chapter title and the aux file entries for the
 5366     % index.  The easiest way to prevent this problem is to make sure
 5367     % there is some text.
 5368     \putwordIndexNonexistent
 5369   \else
 5370     \catcode`\\ = 0
 5371     %
 5372     % If the index file exists but is empty, then \openin leaves \ifeof
 5373     % false.  We have to make TeX try to read something from the file, so
 5374     % it can discover if there is anything in it.
 5375     \read 1 to \thisline
 5376     \ifeof 1
 5377       \putwordIndexIsEmpty
 5378     \else
 5379       % Index files are almost Texinfo source, but we use \ as the escape
 5380       % character.  It would be better to use @, but that's too big a change
 5381       % to make right now.
 5382       \def\indexbackslash{\ttbackslash}%
 5383       \let\indexlbrace\{   % Likewise, set these sequences for braces
 5384       \let\indexrbrace\}   % used in the sort key.
 5385       \begindoublecolumns
 5386       \let\entryorphanpenalty=\indexorphanpenalty
 5387       %
 5388       % Read input from the index file line by line.
 5389       \loopdo
 5390         \ifeof1
 5391           \let\firsttoken\relax
 5392         \else
 5393           \read 1 to \nextline
 5394           \edef\act{\gdef\noexpand\firsttoken{\getfirsttoken\nextline}}%
 5395           \act
 5396         \fi
 5397         \thisline
 5398         %
 5399         \ifeof1\else
 5400         \let\thisline\nextline
 5401       \repeat
 5402       %%
 5403       \enddoublecolumns
 5404     \fi
 5405   \fi
 5406   \closein 1
 5407 \endgroup}
 5408 
 5409 \def\getfirsttoken#1{\expandafter\getfirsttokenx#1\endfirsttoken}
 5410 \long\def\getfirsttokenx#1#2\endfirsttoken{\noexpand#1}
 5411 
 5412 \def\loopdo#1\repeat{\def\body{#1}\loopdoxxx}
 5413 \def\loopdoxxx{\let\next=\relax\body\let\next=\loopdoxxx\fi\next}
 5414 
 5415 % These macros are used by the sorted index file itself.
 5416 % Change them to control the appearance of the index.
 5417 
 5418 {\catcode`\/=13 \catcode`\-=13 \catcode`\^=13 \catcode`\~=13 \catcode`\_=13
 5419 \catcode`\|=13 \catcode`\<=13 \catcode`\>=13 \catcode`\+=13 \catcode`\"=13
 5420 \catcode`\$=3
 5421 \gdef\initialglyphs{%
 5422   % Some changes for non-alphabetic characters.  Using the glyphs from the
 5423   % math fonts looks more consistent than the typewriter font used elsewhere
 5424   % for these characters.
 5425   \def\indexbackslash{\math{\backslash}}%
 5426   \let\\=\indexbackslash
 5427   %
 5428   % Can't get bold backslash so don't use bold forward slash
 5429   \catcode`\/=13
 5430   \def/{{\secrmnotbold \normalslash}}%
 5431   \def-{{\normaldash\normaldash}}% en dash `--'
 5432   \def^{{\chapbf \normalcaret}}%
 5433   \def~{{\chapbf \normaltilde}}%
 5434   \def\_{%
 5435      \leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }%
 5436   \def|{$\vert$}%
 5437   \def<{$\less$}%
 5438   \def>{$\gtr$}%
 5439   \def+{$\normalplus$}%
 5440 }}
 5441 
 5442 \def\initial{%
 5443   \bgroup
 5444   \initialglyphs
 5445   \initialx
 5446 }
 5447 
 5448 \def\initialx#1{%
 5449   % Remove any glue we may have, we'll be inserting our own.
 5450   \removelastskip
 5451   %
 5452   % We like breaks before the index initials, so insert a bonus.
 5453   % The glue before the bonus allows a little bit of space at the
 5454   % bottom of a column to reduce an increase in inter-line spacing.
 5455   \nobreak
 5456   \vskip 0pt plus 5\baselineskip
 5457   \penalty -300 
 5458   \vskip 0pt plus -5\baselineskip
 5459   %
 5460   % Typeset the initial.  Making this add up to a whole number of
 5461   % baselineskips increases the chance of the dots lining up from column
 5462   % to column.  It still won't often be perfect, because of the stretch
 5463   % we need before each entry, but it's better.
 5464   %
 5465   % No shrink because it confuses \balancecolumns.
 5466   \vskip 1.67\baselineskip plus 1\baselineskip
 5467   \leftline{\secfonts \kern-0.05em \secbf #1}%
 5468   % \secfonts is inside the argument of \leftline so that the change of
 5469   % \baselineskip will not affect any glue inserted before the vbox that
 5470   % \leftline creates.
 5471   % Do our best not to break after the initial.
 5472   \nobreak
 5473   \vskip .33\baselineskip plus .1\baselineskip
 5474   \egroup % \initialglyphs
 5475 }
 5476 
 5477 \newdimen\entryrightmargin
 5478 \entryrightmargin=0pt
 5479 
 5480 % \entry typesets a paragraph consisting of the text (#1), dot leaders, and
 5481 % then page number (#2) flushed to the right margin.  It is used for index
 5482 % and table of contents entries.  The paragraph is indented by \leftskip.
 5483 %
 5484 \def\entry{%
 5485   \begingroup
 5486     %
 5487     % Start a new paragraph if necessary, so our assignments below can't
 5488     % affect previous text.
 5489     \par
 5490     %
 5491     % No extra space above this paragraph.
 5492     \parskip = 0in
 5493     %
 5494     % When reading the text of entry, convert explicit line breaks
 5495     % from @* into spaces.  The user might give these in long section
 5496     % titles, for instance.
 5497     \def\*{\unskip\space\ignorespaces}%
 5498     \def\entrybreak{\hfil\break}% An undocumented command
 5499     %
 5500     % A bit of stretch before each entry for the benefit of balancing
 5501     % columns.
 5502     \vskip 0pt plus0.5pt
 5503     %
 5504     % Swallow the left brace of the text (first parameter):
 5505     \afterassignment\doentry
 5506     \let\temp =
 5507 }
 5508 \def\entrybreak{\unskip\space\ignorespaces}%
 5509 \def\doentry{%
 5510     % Save the text of the entry
 5511     \global\setbox\boxA=\hbox\bgroup
 5512     \bgroup % Instead of the swallowed brace.
 5513       \noindent
 5514       \aftergroup\finishentry
 5515       % And now comes the text of the entry.
 5516       % Not absorbing as a macro argument reduces the chance of problems
 5517       % with catcodes occurring.
 5518 }
 5519 {\catcode`\@=11
 5520 \gdef\finishentry#1{%
 5521     \egroup % end box A
 5522     \dimen@ = \wd\boxA % Length of text of entry
 5523     \global\setbox\boxA=\hbox\bgroup\unhbox\boxA
 5524     % #1 is the page number.
 5525     %
 5526     % Get the width of the page numbers, and only use
 5527     % leaders if they are present.
 5528     \global\setbox\boxB = \hbox{#1}%
 5529     \ifdim\wd\boxB = 0pt
 5530       \null\nobreak\hfill\ %
 5531     \else
 5532       %
 5533       \null\nobreak\indexdotfill % Have leaders before the page number.
 5534       %
 5535       \ifpdf
 5536         \pdfgettoks#1.%
 5537         \bgroup\let\domark\relax
 5538           \hskip\skip\thinshrinkable\the\toksA
 5539         \egroup
 5540         % The redefinion of \domark stops marks being added in \pdflink to 
 5541         % preserve coloured links across page boundaries.  Otherwise the marks
 5542         % would get in the way of \lastbox in \insertindexentrybox.
 5543       \else
 5544         \ifx\XeTeXrevision\thisisundefined
 5545           \hskip\skip\thinshrinkable #1%
 5546         \else
 5547           \pdfgettoks#1.%
 5548           \bgroup\let\domark\relax
 5549             \hskip\skip\thinshrinkable\the\toksA
 5550           \egroup
 5551         \fi
 5552       \fi
 5553     \fi
 5554     \egroup % end \boxA
 5555     \ifdim\wd\boxB = 0pt
 5556       \global\setbox\entryindexbox=\vbox{\unhbox\boxA}%
 5557     \else
 5558     \global\setbox\entryindexbox=\vbox\bgroup
 5559       \prevdepth=\entrylinedepth
 5560       \noindent
 5561       % We want the text of the entries to be aligned to the left, and the
 5562       % page numbers to be aligned to the right.
 5563       %
 5564       \advance\leftskip by 0pt plus 1fil
 5565       \advance\leftskip by 0pt plus -1fill
 5566       \rightskip = 0pt plus -1fil
 5567       \advance\rightskip by 0pt plus 1fill
 5568       % Cause last line, which could consist of page numbers on their own
 5569       % if the list of page numbers is long, to be aligned to the right.
 5570       \parfillskip=0pt plus -1fill
 5571       %
 5572       \hangindent=1em
 5573       %
 5574       \advance\rightskip by \entryrightmargin
 5575       % Determine how far we can stretch into the margin.
 5576       % This allows, e.g., "Appendix H  GNU Free Documentation License" to
 5577       % fit on one line in @letterpaper format.
 5578       \ifdim\entryrightmargin>2.1em
 5579         \dimen@i=2.1em
 5580       \else
 5581         \dimen@i=0em
 5582       \fi
 5583       \advance \parfillskip by 0pt minus 1\dimen@i
 5584       %
 5585       \dimen@ii = \hsize
 5586       \advance\dimen@ii by -1\leftskip
 5587       \advance\dimen@ii by -1\entryrightmargin
 5588       \advance\dimen@ii by 1\dimen@i
 5589       \ifdim\wd\boxA > \dimen@ii % If the entry doesn't fit in one line
 5590       \ifdim\dimen@ > 0.8\dimen@ii   % due to long index text
 5591         \dimen@ = 0.7\dimen@ % Try to split the text roughly evenly
 5592         \dimen@ii = \hsize
 5593         \advance \dimen@ii by -1em
 5594         \ifnum\dimen@>\dimen@ii
 5595           % If the entry is too long, use the whole line
 5596           \dimen@ = \dimen@ii
 5597         \fi
 5598         \advance\leftskip by 0pt plus 1fill % ragged right
 5599         \advance \dimen@ by 1\rightskip
 5600         \parshape = 2 0pt \dimen@ 1em \dimen@ii
 5601         % Ideally we'd add a finite glue at the end of the first line only, but
 5602         % TeX doesn't seem to provide a way to do such a thing.
 5603       \fi\fi
 5604       \unhbox\boxA
 5605       %
 5606       % Do not prefer a separate line ending with a hyphen to fewer lines.
 5607       \finalhyphendemerits = 0
 5608       %
 5609       % Word spacing - no stretch
 5610       \spaceskip=\fontdimen2\font minus \fontdimen4\font
 5611       %
 5612       \linepenalty=1000  % Discourage line breaks.
 5613       \hyphenpenalty=5000  % Discourage hyphenation.
 5614       %
 5615       \par % format the paragraph
 5616     \egroup % The \vbox
 5617     \fi
 5618   \endgroup
 5619   % delay text of entry until after penalty
 5620   \bgroup\aftergroup\insertindexentrybox
 5621   \entryorphanpenalty
 5622 }}
 5623 
 5624 \newskip\thinshrinkable
 5625 \skip\thinshrinkable=.15em minus .15em
 5626 
 5627 \newbox\entryindexbox
 5628 \def\insertindexentrybox{%
 5629   \copy\entryindexbox
 5630   % The following gets the depth of the last box.  This is for even
 5631   % line spacing when entries span several lines.
 5632   \setbox\dummybox\vbox{%
 5633     \unvbox\entryindexbox
 5634     \nointerlineskip
 5635     \lastbox
 5636     \global\entrylinedepth=\prevdepth
 5637   }%
 5638   % Note that we couldn't simply \unvbox\entryindexbox followed by 
 5639   % \nointerlineskip\lastbox to remove the last box and then reinstate it, 
 5640   % because this resets how far the box has been \moveleft'ed to 0.  \unvbox
 5641   % doesn't affect \prevdepth either.
 5642 }
 5643 \newdimen\entrylinedepth
 5644 
 5645 % Default is no penalty
 5646 \let\entryorphanpenalty\egroup
 5647 
 5648 % Used from \printindex.  \firsttoken should be the first token
 5649 % after the \entry.  If it's not another \entry, we are at the last
 5650 % line of a group of index entries, so insert a penalty to discourage
 5651 % orphaned index entries.
 5652 \long\def\indexorphanpenalty{%
 5653   \def\isentry{\entry}%
 5654   \ifx\firsttoken\isentry
 5655   \else
 5656     \unskip\penalty 9000
 5657     % The \unskip here stops breaking before the glue.  It relies on the
 5658     % \vskip above being there, otherwise there is an error
 5659     % "You can't use `\unskip' in vertical mode".  There has to be glue
 5660     % in the current vertical list that hasn't been added to the
 5661     % "current page".  See Chapter 24 of the TeXbook.  This contradicts
 5662     % Section 8.3.7 in "TeX by Topic," though.
 5663   \fi
 5664   \egroup % now comes the box added with \aftergroup
 5665 }
 5666 
 5667 % Like plain.tex's \dotfill, except uses up at least 1 em.
 5668 % The filll stretch here overpowers both the fil and fill stretch to push
 5669 % the page number to the right.
 5670 \def\indexdotfill{\cleaders
 5671   \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1filll}
 5672 
 5673 
 5674 \def\primary #1{\line{#1\hfil}}
 5675 
 5676 \newskip\secondaryindent \secondaryindent=0.5cm
 5677 \def\secondary#1#2{{%
 5678   \parfillskip=0in
 5679   \parskip=0in
 5680   \hangindent=1in
 5681   \hangafter=1
 5682   \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill
 5683   \ifpdf
 5684     \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
 5685   \else
 5686     \ifx\XeTeXrevision\thisisundefined
 5687       #2
 5688     \else
 5689       \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
 5690     \fi
 5691   \fi
 5692   \par
 5693 }}
 5694 
 5695 % Define two-column mode, which we use to typeset indexes.
 5696 % Adapted from the TeXbook, page 416, which is to say,
 5697 % the manmac.tex format used to print the TeXbook itself.
 5698 \catcode`\@=11  % private names
 5699 
 5700 \newbox\partialpage
 5701 \newdimen\doublecolumnhsize
 5702 \newdimen\doublecolumntopgap
 5703 \doublecolumntopgap = 0pt
 5704 
 5705 % Use inside an output routine to save \topmark and \firstmark
 5706 \def\savemarks{%
 5707   \global\savedtopmark=\expandafter{\topmark }%
 5708   \global\savedfirstmark=\expandafter{\firstmark }%
 5709 }
 5710 \newtoks\savedtopmark
 5711 \newtoks\savedfirstmark
 5712 
 5713 % Set \topmark and \firstmark for next time \output runs.
 5714 % Can't be run from withinside \output (because any material
 5715 % added while an output routine is active, including 
 5716 % penalties, is saved for after it finishes).  The page so far
 5717 % should be empty, otherwise what's on it will be thrown away.
 5718 \def\restoremarks{%
 5719   \mark{\the\savedtopmark}%
 5720   \bgroup\output = {%
 5721     \setbox\dummybox=\box\PAGE
 5722   }abc\eject\egroup
 5723   % "abc" because output routine doesn't fire for a completely empty page.
 5724   \mark{\the\savedfirstmark}%
 5725 }
 5726 
 5727 \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
 5728   % If not much space left on page, start a new page.
 5729   \ifdim\pagetotal>0.8\vsize\vfill\eject\fi
 5730   %
 5731   % Grab any single-column material above us.
 5732   \output = {%
 5733     %
 5734     % Here is a possibility not foreseen in manmac: if we accumulate a
 5735     % whole lot of material, we might end up calling this \output
 5736     % routine twice in a row (see the doublecol-lose test, which is
 5737     % essentially a couple of indexes with @setchapternewpage off).  In
 5738     % that case we just ship out what is in \partialpage with the normal
 5739     % output routine.  Generally, \partialpage will be empty when this
 5740     % runs and this will be a no-op.  See the indexspread.tex test case.
 5741     \ifvoid\partialpage \else
 5742       \onepageout{\pagecontents\partialpage}%
 5743     \fi
 5744     %
 5745     \global\setbox\partialpage = \vbox{%
 5746       % Unvbox the main output page.
 5747       \unvbox\PAGE
 5748       \kern-\topskip \kern\baselineskip
 5749     }%
 5750     \savemarks
 5751   }%
 5752   \eject % run that output routine to set \partialpage
 5753   \restoremarks
 5754   %
 5755   % We recover the two marks that the last output routine saved in order
 5756   % to propagate the information in marks added around a chapter heading,
 5757   % which could be otherwise be lost by the time the final page is output.
 5758   %
 5759   %
 5760   % Use the double-column output routine for subsequent pages.
 5761   \output = {\doublecolumnout}%
 5762   %
 5763   % Change the page size parameters.  We could do this once outside this
 5764   % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
 5765   % format, but then we repeat the same computation.  Repeating a couple
 5766   % of assignments once per index is clearly meaningless for the
 5767   % execution time, so we may as well do it in one place.
 5768   %
 5769   % First we halve the line length, less a little for the gutter between
 5770   % the columns.  We compute the gutter based on the line length, so it
 5771   % changes automatically with the paper format.  The magic constant
 5772   % below is chosen so that the gutter has the same value (well, +-<1pt)
 5773   % as it did when we hard-coded it.
 5774   %
 5775   % We put the result in a separate register, \doublecolumhsize, so we
 5776   % can restore it in \pagesofar, after \hsize itself has (potentially)
 5777   % been clobbered.
 5778   %
 5779   \doublecolumnhsize = \hsize
 5780     \advance\doublecolumnhsize by -.04154\hsize
 5781     \divide\doublecolumnhsize by 2
 5782   \hsize = \doublecolumnhsize
 5783   %
 5784   % Double the \vsize as well.  (We don't need a separate register here,
 5785   % since nobody clobbers \vsize.)
 5786   \global\doublecolumntopgap = \topskip
 5787   \global\advance\doublecolumntopgap by -1\baselineskip
 5788   \advance\vsize by -1\doublecolumntopgap
 5789   \vsize = 2\vsize
 5790   \topskip=0pt
 5791   \global\entrylinedepth=0pt\relax
 5792 }
 5793 
 5794 % The double-column output routine for all double-column pages except
 5795 % the last, which is done by \balancecolumns.
 5796 %
 5797 \def\doublecolumnout{%
 5798   %
 5799   \splittopskip=\topskip \splitmaxdepth=\maxdepth
 5800   % Get the available space for the double columns -- the normal
 5801   % (undoubled) page height minus any material left over from the
 5802   % previous page.
 5803   \dimen@ = \vsize
 5804   \divide\dimen@ by 2
 5805   \advance\dimen@ by -\ht\partialpage
 5806   %
 5807   % box0 will be the left-hand column, box2 the right.
 5808   \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
 5809   \onepageout\pagesofar
 5810   \unvbox255
 5811   \penalty\outputpenalty
 5812 }
 5813 %
 5814 % Re-output the contents of the output page -- any previous material,
 5815 % followed by the two boxes we just split, in box0 and box2.
 5816 \def\pagesofar{%
 5817   \unvbox\partialpage
 5818   %
 5819   \hsize = \doublecolumnhsize
 5820   \wd0=\hsize \wd2=\hsize
 5821   \vbox{%
 5822     \vskip\doublecolumntopgap
 5823     \hbox to\txipagewidth{\box0\hfil\box2}}%
 5824 }
 5825 
 5826 
 5827 % Finished with with double columns.
 5828 \def\enddoublecolumns{%
 5829   % The following penalty ensures that the page builder is exercised
 5830   % _before_ we change the output routine.  This is necessary in the
 5831   % following situation:
 5832   %
 5833   % The last section of the index consists only of a single entry.
 5834   % Before this section, \pagetotal is less than \pagegoal, so no
 5835   % break occurs before the last section starts.  However, the last
 5836   % section, consisting of \initial and the single \entry, does not
 5837   % fit on the page and has to be broken off.  Without the following
 5838   % penalty the page builder will not be exercised until \eject
 5839   % below, and by that time we'll already have changed the output
 5840   % routine to the \balancecolumns version, so the next-to-last
 5841   % double-column page will be processed with \balancecolumns, which
 5842   % is wrong:  The two columns will go to the main vertical list, with
 5843   % the broken-off section in the recent contributions.  As soon as
 5844   % the output routine finishes, TeX starts reconsidering the page
 5845   % break.  The two columns and the broken-off section both fit on the
 5846   % page, because the two columns now take up only half of the page
 5847   % goal.  When TeX sees \eject from below which follows the final
 5848   % section, it invokes the new output routine that we've set after
 5849   % \balancecolumns below; \onepageout will try to fit the two columns
 5850   % and the final section into the vbox of \txipageheight (see
 5851   % \pagebody), causing an overfull box.
 5852   %
 5853   % Note that glue won't work here, because glue does not exercise the
 5854   % page builder, unlike penalties (see The TeXbook, pp. 280-281).
 5855   \penalty0
 5856   %
 5857   \output = {%
 5858     % Split the last of the double-column material.
 5859     \savemarks
 5860     \balancecolumns
 5861     %
 5862     % Having called \balancecolumns once, we do not
 5863     % want to call it again.  Therefore, reset \output to its normal
 5864     % definition right away.
 5865     \global\output = {\onepageout{\pagecontents\PAGE}}%
 5866   }%
 5867   \eject
 5868   \endgroup % started in \begindoublecolumns
 5869   \restoremarks
 5870   % Leave the double-column material on the current page, no automatic
 5871   % page break.
 5872   \box\balancedcolumns
 5873   %
 5874   % \pagegoal was set to the doubled \vsize above, since we restarted
 5875   % the current page.  We're now back to normal single-column
 5876   % typesetting, so reset \pagegoal to the normal \vsize (after the
 5877   % \endgroup where \vsize got restored).
 5878   \pagegoal = \vsize
 5879 }
 5880 \newbox\balancedcolumns
 5881 \setbox\balancedcolumns=\vbox{shouldnt see this}%
 5882 %
 5883 % Only called for the last of the double column material.  \doublecolumnout 
 5884 % does the others.
 5885 \def\balancecolumns{%
 5886   \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120.
 5887   \dimen@ = \ht0
 5888   \advance\dimen@ by \topskip
 5889   \advance\dimen@ by-\baselineskip
 5890   \ifdim\dimen@<14\baselineskip
 5891     % Don't split a short final column in two.
 5892     \setbox2=\vbox{}%
 5893   \else
 5894     \divide\dimen@ by 2 % target to split to
 5895     \dimen@ii = \dimen@
 5896     \splittopskip = \topskip
 5897     % Loop until the second column is no higher than the first
 5898     {%
 5899       \vbadness = 10000
 5900       \loop
 5901         \global\setbox3 = \copy0
 5902         \global\setbox1 = \vsplit3 to \dimen@
 5903         % Remove glue from bottom of first column to
 5904         % make sure it is higher than the second.
 5905         \global\setbox1 = \vbox{\unvbox1\unpenalty\unskip}%
 5906       \ifdim\ht3>\ht1
 5907         \global\advance\dimen@ by 1pt
 5908       \repeat
 5909     }%
 5910     \multiply\dimen@ii by 4
 5911     \divide\dimen@ii by 5
 5912     \ifdim\ht3<\dimen@ii
 5913       % Column heights are too different, so don't make their bottoms
 5914       % flush with each other.  The glue at the end of the second column
 5915       % allows a second column to stretch, reducing the difference in
 5916       % height between the two.
 5917       \setbox0=\vbox to\dimen@{\unvbox1\vfill}%
 5918       \setbox2=\vbox to\dimen@{\unvbox3\vskip 0pt plus 0.3\ht0}%
 5919     \else
 5920       \setbox0=\vbox to\dimen@{\unvbox1}%
 5921       \setbox2=\vbox to\dimen@{\unvbox3}%
 5922     \fi
 5923   \fi
 5924   %
 5925   \global\setbox\balancedcolumns=\vbox{\pagesofar}%
 5926 }
 5927 \catcode`\@ = \other
 5928 
 5929 
 5930 \message{sectioning,}
 5931 % Chapters, sections, etc.
 5932 
 5933 % Let's start with @part.
 5934 \outer\parseargdef\part{\partzzz{#1}}
 5935 \def\partzzz#1{%
 5936   \chapoddpage
 5937   \null
 5938   \vskip.3\vsize  % move it down on the page a bit
 5939   \begingroup
 5940     \noindent \titlefonts\rmisbold #1\par % the text
 5941     \let\lastnode=\empty      % no node to associate with
 5942     \writetocentry{part}{#1}{}% but put it in the toc
 5943     \headingsoff              % no headline or footline on the part page
 5944     % This outputs a mark at the end of the page that clears \thischapter
 5945     % and \thissection, as is done in \startcontents.
 5946     \let\pchapsepmacro\relax
 5947     \chapmacro{}{Yomitfromtoc}{}%
 5948     \chapoddpage
 5949   \endgroup
 5950 }
 5951 
 5952 % \unnumberedno is an oxymoron.  But we count the unnumbered
 5953 % sections so that we can refer to them unambiguously in the pdf
 5954 % outlines by their "section number".  We avoid collisions with chapter
 5955 % numbers by starting them at 10000.  (If a document ever has 10000
 5956 % chapters, we're in trouble anyway, I'm sure.)
 5957 \newcount\unnumberedno \unnumberedno = 10000
 5958 \newcount\chapno
 5959 \newcount\secno        \secno=0
 5960 \newcount\subsecno     \subsecno=0
 5961 \newcount\subsubsecno  \subsubsecno=0
 5962 
 5963 % This counter is funny since it counts through charcodes of letters A, B, ...
 5964 \newcount\appendixno  \appendixno = `\@
 5965 %
 5966 % \def\appendixletter{\char\the\appendixno}
 5967 % We do the following ugly conditional instead of the above simple
 5968 % construct for the sake of pdftex, which needs the actual
 5969 % letter in the expansion, not just typeset.
 5970 %
 5971 \def\appendixletter{%
 5972   \ifnum\appendixno=`A A%
 5973   \else\ifnum\appendixno=`B B%
 5974   \else\ifnum\appendixno=`C C%
 5975   \else\ifnum\appendixno=`D D%
 5976   \else\ifnum\appendixno=`E E%
 5977   \else\ifnum\appendixno=`F F%
 5978   \else\ifnum\appendixno=`G G%
 5979   \else\ifnum\appendixno=`H H%
 5980   \else\ifnum\appendixno=`I I%
 5981   \else\ifnum\appendixno=`J J%
 5982   \else\ifnum\appendixno=`K K%
 5983   \else\ifnum\appendixno=`L L%
 5984   \else\ifnum\appendixno=`M M%
 5985   \else\ifnum\appendixno=`N N%
 5986   \else\ifnum\appendixno=`O O%
 5987   \else\ifnum\appendixno=`P P%
 5988   \else\ifnum\appendixno=`Q Q%
 5989   \else\ifnum\appendixno=`R R%
 5990   \else\ifnum\appendixno=`S S%
 5991   \else\ifnum\appendixno=`T T%
 5992   \else\ifnum\appendixno=`U U%
 5993   \else\ifnum\appendixno=`V V%
 5994   \else\ifnum\appendixno=`W W%
 5995   \else\ifnum\appendixno=`X X%
 5996   \else\ifnum\appendixno=`Y Y%
 5997   \else\ifnum\appendixno=`Z Z%
 5998   % The \the is necessary, despite appearances, because \appendixletter is
 5999   % expanded while writing the .toc file.  \char\appendixno is not
 6000   % expandable, thus it is written literally, thus all appendixes come out
 6001   % with the same letter (or @) in the toc without it.
 6002   \else\char\the\appendixno
 6003   \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
 6004   \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
 6005 
 6006 % Each @chapter defines these (using marks) as the number+name, number
 6007 % and name of the chapter.  Page headings and footings can use
 6008 % these.  @section does likewise.
 6009 \def\thischapter{}
 6010 \def\thischapternum{}
 6011 \def\thischaptername{}
 6012 \def\thissection{}
 6013 \def\thissectionnum{}
 6014 \def\thissectionname{}
 6015 
 6016 \newcount\absseclevel % used to calculate proper heading level
 6017 \newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count
 6018 
 6019 % @raisesections: treat @section as chapter, @subsection as section, etc.
 6020 \def\raisesections{\global\advance\secbase by -1}
 6021 \let\up=\raisesections % original BFox name
 6022 
 6023 % @lowersections: treat @chapter as section, @section as subsection, etc.
 6024 \def\lowersections{\global\advance\secbase by 1}
 6025 \let\down=\lowersections % original BFox name
 6026 
 6027 % we only have subsub.
 6028 \chardef\maxseclevel = 3
 6029 %
 6030 % A numbered section within an unnumbered changes to unnumbered too.
 6031 % To achieve this, remember the "biggest" unnum. sec. we are currently in:
 6032 \chardef\unnlevel = \maxseclevel
 6033 %
 6034 % Trace whether the current chapter is an appendix or not:
 6035 % \chapheadtype is "N" or "A", unnumbered chapters are ignored.
 6036 \def\chapheadtype{N}
 6037 
 6038 % Choose a heading macro
 6039 % #1 is heading type
 6040 % #2 is heading level
 6041 % #3 is text for heading
 6042 \def\genhead#1#2#3{%
 6043   % Compute the abs. sec. level:
 6044   \absseclevel=#2
 6045   \advance\absseclevel by \secbase
 6046   % Make sure \absseclevel doesn't fall outside the range:
 6047   \ifnum \absseclevel < 0
 6048     \absseclevel = 0
 6049   \else
 6050     \ifnum \absseclevel > 3
 6051       \absseclevel = 3
 6052     \fi
 6053   \fi
 6054   % The heading type:
 6055   \def\headtype{#1}%
 6056   \if \headtype U%
 6057     \ifnum \absseclevel < \unnlevel
 6058       \chardef\unnlevel = \absseclevel
 6059     \fi
 6060   \else
 6061     % Check for appendix sections:
 6062     \ifnum \absseclevel = 0
 6063       \edef\chapheadtype{\headtype}%
 6064     \else
 6065       \if \headtype A\if \chapheadtype N%
 6066     \errmessage{@appendix... within a non-appendix chapter}%
 6067       \fi\fi
 6068     \fi
 6069     % Check for numbered within unnumbered:
 6070     \ifnum \absseclevel > \unnlevel
 6071       \def\headtype{U}%
 6072     \else
 6073       \chardef\unnlevel = 3
 6074     \fi
 6075   \fi
 6076   % Now print the heading:
 6077   \if \headtype U%
 6078     \ifcase\absseclevel
 6079     \unnumberedzzz{#3}%
 6080     \or \unnumberedseczzz{#3}%
 6081     \or \unnumberedsubseczzz{#3}%
 6082     \or \unnumberedsubsubseczzz{#3}%
 6083     \fi
 6084   \else
 6085     \if \headtype A%
 6086       \ifcase\absseclevel
 6087       \appendixzzz{#3}%
 6088       \or \appendixsectionzzz{#3}%
 6089       \or \appendixsubseczzz{#3}%
 6090       \or \appendixsubsubseczzz{#3}%
 6091       \fi
 6092     \else
 6093       \ifcase\absseclevel
 6094       \chapterzzz{#3}%
 6095       \or \seczzz{#3}%
 6096       \or \numberedsubseczzz{#3}%
 6097       \or \numberedsubsubseczzz{#3}%
 6098       \fi
 6099     \fi
 6100   \fi
 6101   \suppressfirstparagraphindent
 6102 }
 6103 
 6104 % an interface:
 6105 \def\numhead{\genhead N}
 6106 \def\apphead{\genhead A}
 6107 \def\unnmhead{\genhead U}
 6108 
 6109 % @chapter, @appendix, @unnumbered.  Increment top-level counter, reset
 6110 % all lower-level sectioning counters to zero.
 6111 %
 6112 % Also set \chaplevelprefix, which we prepend to @float sequence numbers
 6113 % (e.g., figures), q.v.  By default (before any chapter), that is empty.
 6114 \let\chaplevelprefix = \empty
 6115 %
 6116 \outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz
 6117 \def\chapterzzz#1{%
 6118   % section resetting is \global in case the chapter is in a group, such
 6119   % as an @include file.
 6120   \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
 6121     \global\advance\chapno by 1
 6122   %
 6123   % Used for \float.
 6124   \gdef\chaplevelprefix{\the\chapno.}%
 6125   \resetallfloatnos
 6126   %
 6127   % \putwordChapter can contain complex things in translations.
 6128   \toks0=\expandafter{\putwordChapter}%
 6129   \message{\the\toks0 \space \the\chapno}%
 6130   %
 6131   % Write the actual heading.
 6132   \chapmacro{#1}{Ynumbered}{\the\chapno}%
 6133   %
 6134   % So @section and the like are numbered underneath this chapter.
 6135   \global\let\section = \numberedsec
 6136   \global\let\subsection = \numberedsubsec
 6137   \global\let\subsubsection = \numberedsubsubsec
 6138 }
 6139 
 6140 \outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz
 6141 %
 6142 \def\appendixzzz#1{%
 6143   \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
 6144     \global\advance\appendixno by 1
 6145   \gdef\chaplevelprefix{\appendixletter.}%
 6146   \resetallfloatnos
 6147   %
 6148   % \putwordAppendix can contain complex things in translations.
 6149   \toks0=\expandafter{\putwordAppendix}%
 6150   \message{\the\toks0 \space \appendixletter}%
 6151   %
 6152   \chapmacro{#1}{Yappendix}{\appendixletter}%
 6153   %
 6154   \global\let\section = \appendixsec
 6155   \global\let\subsection = \appendixsubsec
 6156   \global\let\subsubsection = \appendixsubsubsec
 6157 }
 6158 
 6159 % normally unnmhead0 calls unnumberedzzz:
 6160 \outer\parseargdef\unnumbered{\unnmhead0{#1}}
 6161 \def\unnumberedzzz#1{%
 6162   \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
 6163     \global\advance\unnumberedno by 1
 6164   %
 6165   % Since an unnumbered has no number, no prefix for figures.
 6166   \global\let\chaplevelprefix = \empty
 6167   \resetallfloatnos
 6168   %
 6169   % This used to be simply \message{#1}, but TeX fully expands the
 6170   % argument to \message.  Therefore, if #1 contained @-commands, TeX
 6171   % expanded them.  For example, in `@unnumbered The @cite{Book}', TeX
 6172   % expanded @cite (which turns out to cause errors because \cite is meant
 6173   % to be executed, not expanded).
 6174   %
 6175   % Anyway, we don't want the fully-expanded definition of @cite to appear
 6176   % as a result of the \message, we just want `@cite' itself.  We use
 6177   % \the<toks register> to achieve this: TeX expands \the<toks> only once,
 6178   % simply yielding the contents of <toks register>.  (We also do this for
 6179   % the toc entries.)
 6180   \toks0 = {#1}%
 6181   \message{(\the\toks0)}%
 6182   %
 6183   \chapmacro{#1}{Ynothing}{\the\unnumberedno}%
 6184   %
 6185   \global\let\section = \unnumberedsec
 6186   \global\let\subsection = \unnumberedsubsec
 6187   \global\let\subsubsection = \unnumberedsubsubsec
 6188 }
 6189 
 6190 % @centerchap is like @unnumbered, but the heading is centered.
 6191 \outer\parseargdef\centerchap{%
 6192   \let\centerparametersmaybe = \centerparameters
 6193   \unnmhead0{#1}%
 6194   \let\centerparametersmaybe = \relax
 6195 }
 6196 
 6197 % @top is like @unnumbered.
 6198 \let\top\unnumbered
 6199 
 6200 % Sections.
 6201 % 
 6202 \outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz
 6203 \def\seczzz#1{%
 6204   \global\subsecno=0 \global\subsubsecno=0  \global\advance\secno by 1
 6205   \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}%
 6206 }
 6207 
 6208 % normally calls appendixsectionzzz:
 6209 \outer\parseargdef\appendixsection{\apphead1{#1}}
 6210 \def\appendixsectionzzz#1{%
 6211   \global\subsecno=0 \global\subsubsecno=0  \global\advance\secno by 1
 6212   \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}%
 6213 }
 6214 \let\appendixsec\appendixsection
 6215 
 6216 % normally calls unnumberedseczzz:
 6217 \outer\parseargdef\unnumberedsec{\unnmhead1{#1}}
 6218 \def\unnumberedseczzz#1{%
 6219   \global\subsecno=0 \global\subsubsecno=0  \global\advance\secno by 1
 6220   \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}%
 6221 }
 6222 
 6223 % Subsections.
 6224 % 
 6225 % normally calls numberedsubseczzz:
 6226 \outer\parseargdef\numberedsubsec{\numhead2{#1}}
 6227 \def\numberedsubseczzz#1{%