"Fossies" - the Fresh Open Source Software Archive

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