Home | History | Annotate | Line # | Download | only in build-aux
texinfo.tex revision 1.1
      1  1.1  mrg % texinfo.tex -- TeX macros to handle Texinfo files.
      2  1.1  mrg %
      3  1.1  mrg % Load plain if necessary, i.e., if running under initex.
      4  1.1  mrg \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
      5  1.1  mrg %
      6  1.1  mrg \def\texinfoversion{2020-02-11.09}
      7  1.1  mrg %
      8  1.1  mrg % Copyright 1985, 1986, 1988, 1990-2019 Free Software Foundation, Inc.
      9  1.1  mrg %
     10  1.1  mrg % This texinfo.tex file is free software: you can redistribute it and/or
     11  1.1  mrg % modify it under the terms of the GNU General Public License as
     12  1.1  mrg % published by the Free Software Foundation, either version 3 of the
     13  1.1  mrg % License, or (at your option) any later version.
     14  1.1  mrg %
     15  1.1  mrg % This texinfo.tex file is distributed in the hope that it will be
     16  1.1  mrg % useful, but WITHOUT ANY WARRANTY; without even the implied warranty
     17  1.1  mrg % of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     18  1.1  mrg % General Public License for more details.
     19  1.1  mrg %
     20  1.1  mrg % You should have received a copy of the GNU General Public License
     21  1.1  mrg % along with this program.  If not, see <https://www.gnu.org/licenses/>.
     22  1.1  mrg %
     23  1.1  mrg % As a special exception, when this file is read by TeX when processing
     24  1.1  mrg % a Texinfo source document, you may use the result without
     25  1.1  mrg % restriction. This Exception is an additional permission under section 7
     26  1.1  mrg % of the GNU General Public License, version 3 ("GPLv3").
     27  1.1  mrg %
     28  1.1  mrg % Please try the latest version of texinfo.tex before submitting bug
     29  1.1  mrg % reports; you can get the latest version from:
     30  1.1  mrg %   https://ftp.gnu.org/gnu/texinfo/ (the Texinfo release area), or
     31  1.1  mrg %   https://ftpmirror.gnu.org/texinfo/ (same, via a mirror), or
     32  1.1  mrg %   https://www.gnu.org/software/texinfo/ (the Texinfo home page)
     33  1.1  mrg % The texinfo.tex in any given distribution could well be out
     34  1.1  mrg % of date, so if that's what you're using, please check.
     35  1.1  mrg %
     36  1.1  mrg % Send bug reports to bug-texinfo (a] gnu.org.  Please include including a
     37  1.1  mrg % complete document in each bug report with which we can reproduce the
     38  1.1  mrg % problem.  Patches are, of course, greatly appreciated.
     39  1.1  mrg %
     40  1.1  mrg % To process a Texinfo manual with TeX, it's most reliable to use the
     41  1.1  mrg % texi2dvi shell script that comes with the distribution.  For a simple
     42  1.1  mrg % manual foo.texi, however, you can get away with this:
     43  1.1  mrg %   tex foo.texi
     44  1.1  mrg %   texindex foo.??
     45  1.1  mrg %   tex foo.texi
     46  1.1  mrg %   tex foo.texi
     47  1.1  mrg %   dvips foo.dvi -o  # or whatever; this makes foo.ps.
     48  1.1  mrg % The extra TeX runs get the cross-reference information correct.
     49  1.1  mrg % Sometimes one run after texindex suffices, and sometimes you need more
     50  1.1  mrg % than two; texi2dvi does it as many times as necessary.
     51  1.1  mrg %
     52  1.1  mrg % It is possible to adapt texinfo.tex for other languages, to some
     53  1.1  mrg % extent.  You can get the existing language-specific files from the
     54  1.1  mrg % full Texinfo distribution.
     55  1.1  mrg %
     56  1.1  mrg % The GNU Texinfo home page is https://www.gnu.org/software/texinfo.
     57  1.1  mrg 
     58  1.1  mrg 
     59  1.1  mrg \message{Loading texinfo [version \texinfoversion]:}
     60  1.1  mrg 
     61  1.1  mrg % If in a .fmt file, print the version number
     62  1.1  mrg % and turn on active characters that we couldn't do earlier because
     63  1.1  mrg % they might have appeared in the input file name.
     64  1.1  mrg \everyjob{\message{[Texinfo version \texinfoversion]}%
     65  1.1  mrg   \catcode`+=\active \catcode`\_=\active}
     66  1.1  mrg 
     67  1.1  mrg % LaTeX's \typeout.  This ensures that the messages it is used for
     68  1.1  mrg % are identical in format to the corresponding ones from latex/pdflatex.
     69  1.1  mrg \def\typeout{\immediate\write17}%
     70  1.1  mrg 
     71  1.1  mrg \chardef\other=12
     72  1.1  mrg 
     73  1.1  mrg % We never want plain's \outer definition of \+ in Texinfo.
     74  1.1  mrg % For @tex, we can use \tabalign.
     75  1.1  mrg \let\+ = \relax
     76  1.1  mrg 
     77  1.1  mrg % Save some plain tex macros whose names we will redefine.
     78  1.1  mrg \let\ptexb=\b
     79  1.1  mrg \let\ptexbullet=\bullet
     80  1.1  mrg \let\ptexc=\c
     81  1.1  mrg \let\ptexcomma=\,
     82  1.1  mrg \let\ptexdot=\.
     83  1.1  mrg \let\ptexdots=\dots
     84  1.1  mrg \let\ptexend=\end
     85  1.1  mrg \let\ptexequiv=\equiv
     86  1.1  mrg \let\ptexexclam=\!
     87  1.1  mrg \let\ptexfootnote=\footnote
     88  1.1  mrg \let\ptexgtr=>
     89  1.1  mrg \let\ptexhat=^
     90  1.1  mrg \let\ptexi=\i
     91  1.1  mrg \let\ptexindent=\indent
     92  1.1  mrg \let\ptexinsert=\insert
     93  1.1  mrg \let\ptexlbrace=\{
     94  1.1  mrg \let\ptexless=<
     95  1.1  mrg \let\ptexnewwrite\newwrite
     96  1.1  mrg \let\ptexnoindent=\noindent
     97  1.1  mrg \let\ptexplus=+
     98  1.1  mrg \let\ptexraggedright=\raggedright
     99  1.1  mrg \let\ptexrbrace=\}
    100  1.1  mrg \let\ptexslash=\/
    101  1.1  mrg \let\ptexsp=\sp
    102  1.1  mrg \let\ptexstar=\*
    103  1.1  mrg \let\ptexsup=\sup
    104  1.1  mrg \let\ptext=\t
    105  1.1  mrg \let\ptextop=\top
    106  1.1  mrg {\catcode`\'=\active \global\let\ptexquoteright'}% active in plain's math mode
    107  1.1  mrg 
    108  1.1  mrg % If this character appears in an error message or help string, it
    109  1.1  mrg % starts a new line in the output.
    110  1.1  mrg \newlinechar = `^^J
    111  1.1  mrg 
    112  1.1  mrg % Use TeX 3.0's \inputlineno to get the line number, for better error
    113  1.1  mrg % messages, but if we're using an old version of TeX, don't do anything.
    114  1.1  mrg %
    115  1.1  mrg \ifx\inputlineno\thisisundefined
    116  1.1  mrg   \let\linenumber = \empty % Pre-3.0.
    117  1.1  mrg \else
    118  1.1  mrg   \def\linenumber{l.\the\inputlineno:\space}
    119  1.1  mrg \fi
    120  1.1  mrg 
    121  1.1  mrg % Set up fixed words for English if not already set.
    122  1.1  mrg \ifx\putwordAppendix\undefined  \gdef\putwordAppendix{Appendix}\fi
    123  1.1  mrg \ifx\putwordChapter\undefined   \gdef\putwordChapter{Chapter}\fi
    124  1.1  mrg \ifx\putworderror\undefined     \gdef\putworderror{error}\fi
    125  1.1  mrg \ifx\putwordfile\undefined      \gdef\putwordfile{file}\fi
    126  1.1  mrg \ifx\putwordin\undefined        \gdef\putwordin{in}\fi
    127  1.1  mrg \ifx\putwordIndexIsEmpty\undefined       \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
    128  1.1  mrg \ifx\putwordIndexNonexistent\undefined   \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
    129  1.1  mrg \ifx\putwordInfo\undefined      \gdef\putwordInfo{Info}\fi
    130  1.1  mrg \ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
    131  1.1  mrg \ifx\putwordMethodon\undefined  \gdef\putwordMethodon{Method on}\fi
    132  1.1  mrg \ifx\putwordNoTitle\undefined   \gdef\putwordNoTitle{No Title}\fi
    133  1.1  mrg \ifx\putwordof\undefined        \gdef\putwordof{of}\fi
    134  1.1  mrg \ifx\putwordon\undefined        \gdef\putwordon{on}\fi
    135  1.1  mrg \ifx\putwordpage\undefined      \gdef\putwordpage{page}\fi
    136  1.1  mrg \ifx\putwordsection\undefined   \gdef\putwordsection{section}\fi
    137  1.1  mrg \ifx\putwordSection\undefined   \gdef\putwordSection{Section}\fi
    138  1.1  mrg \ifx\putwordsee\undefined       \gdef\putwordsee{see}\fi
    139  1.1  mrg \ifx\putwordSee\undefined       \gdef\putwordSee{See}\fi
    140  1.1  mrg \ifx\putwordShortTOC\undefined  \gdef\putwordShortTOC{Short Contents}\fi
    141  1.1  mrg \ifx\putwordTOC\undefined       \gdef\putwordTOC{Table of Contents}\fi
    142  1.1  mrg %
    143  1.1  mrg \ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
    144  1.1  mrg \ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
    145  1.1  mrg \ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
    146  1.1  mrg \ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
    147  1.1  mrg \ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
    148  1.1  mrg \ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
    149  1.1  mrg \ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
    150  1.1  mrg \ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
    151  1.1  mrg \ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
    152  1.1  mrg \ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
    153  1.1  mrg \ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
    154  1.1  mrg \ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
    155  1.1  mrg %
    156  1.1  mrg \ifx\putwordDefmac\undefined    \gdef\putwordDefmac{Macro}\fi
    157  1.1  mrg \ifx\putwordDefspec\undefined   \gdef\putwordDefspec{Special Form}\fi
    158  1.1  mrg \ifx\putwordDefvar\undefined    \gdef\putwordDefvar{Variable}\fi
    159  1.1  mrg \ifx\putwordDefopt\undefined    \gdef\putwordDefopt{User Option}\fi
    160  1.1  mrg \ifx\putwordDeffunc\undefined   \gdef\putwordDeffunc{Function}\fi
    161  1.1  mrg 
    162  1.1  mrg % Give the space character the catcode for a space.
    163  1.1  mrg \def\spaceisspace{\catcode`\ =10\relax}
    164  1.1  mrg 
    165  1.1  mrg % Likewise for ^^M, the end of line character.
    166  1.1  mrg \def\endlineisspace{\catcode13=10\relax}
    167  1.1  mrg 
    168  1.1  mrg \chardef\dashChar  = `\-
    169  1.1  mrg \chardef\slashChar = `\/
    170  1.1  mrg \chardef\underChar = `\_
    171  1.1  mrg 
    172  1.1  mrg % Ignore a token.
    173  1.1  mrg %
    174  1.1  mrg \def\gobble#1{}
    175  1.1  mrg 
    176  1.1  mrg % The following is used inside several \edef's.
    177  1.1  mrg \def\makecsname#1{\expandafter\noexpand\csname#1\endcsname}
    178  1.1  mrg 
    179  1.1  mrg % Hyphenation fixes.
    180  1.1  mrg \hyphenation{
    181  1.1  mrg   Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script
    182  1.1  mrg   ap-pen-dix bit-map bit-maps
    183  1.1  mrg   data-base data-bases eshell fall-ing half-way long-est man-u-script
    184  1.1  mrg   man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm
    185  1.1  mrg   par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces
    186  1.1  mrg   spell-ing spell-ings
    187  1.1  mrg   stand-alone strong-est time-stamp time-stamps which-ever white-space
    188  1.1  mrg   wide-spread wrap-around
    189  1.1  mrg }
    190  1.1  mrg 
    191  1.1  mrg % Sometimes it is convenient to have everything in the transcript file
    192  1.1  mrg % and nothing on the terminal.  We don't just call \tracingall here,
    193  1.1  mrg % since that produces some useless output on the terminal.  We also make
    194  1.1  mrg % some effort to order the tracing commands to reduce output in the log
    195  1.1  mrg % file; cf. trace.sty in LaTeX.
    196  1.1  mrg %
    197  1.1  mrg \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
    198  1.1  mrg \def\loggingall{%
    199  1.1  mrg   \tracingstats2
    200  1.1  mrg   \tracingpages1
    201  1.1  mrg   \tracinglostchars2  % 2 gives us more in etex
    202  1.1  mrg   \tracingparagraphs1
    203  1.1  mrg   \tracingoutput1
    204  1.1  mrg   \tracingmacros2
    205  1.1  mrg   \tracingrestores1
    206  1.1  mrg   \showboxbreadth\maxdimen \showboxdepth\maxdimen
    207  1.1  mrg   \ifx\eTeXversion\thisisundefined\else % etex gives us more logging
    208  1.1  mrg     \tracingscantokens1
    209  1.1  mrg     \tracingifs1
    210  1.1  mrg     \tracinggroups1
    211  1.1  mrg     \tracingnesting2
    212  1.1  mrg     \tracingassigns1
    213  1.1  mrg   \fi
    214  1.1  mrg   \tracingcommands3  % 3 gives us more in etex
    215  1.1  mrg   \errorcontextlines16
    216  1.1  mrg }%
    217  1.1  mrg 
    218  1.1  mrg % @errormsg{MSG}.  Do the index-like expansions on MSG, but if things
    219  1.1  mrg % aren't perfect, it's not the end of the world, being an error message,
    220  1.1  mrg % after all.
    221  1.1  mrg %
    222  1.1  mrg \def\errormsg{\begingroup \indexnofonts \doerrormsg}
    223  1.1  mrg \def\doerrormsg#1{\errmessage{#1}}
    224  1.1  mrg 
    225  1.1  mrg % add check for \lastpenalty to plain's definitions.  If the last thing
    226  1.1  mrg % we did was a \nobreak, we don't want to insert more space.
    227  1.1  mrg %
    228  1.1  mrg \def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount
    229  1.1  mrg   \removelastskip\penalty-50\smallskip\fi\fi}
    230  1.1  mrg \def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount
    231  1.1  mrg   \removelastskip\penalty-100\medskip\fi\fi}
    232  1.1  mrg \def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
    233  1.1  mrg   \removelastskip\penalty-200\bigskip\fi\fi}
    234  1.1  mrg 
    235  1.1  mrg % Output routine
    237  1.1  mrg %
    238  1.1  mrg 
    239  1.1  mrg % For a final copy, take out the rectangles
    240  1.1  mrg % that mark overfull boxes (in case you have decided
    241  1.1  mrg % that the text looks ok even though it passes the margin).
    242  1.1  mrg %
    243  1.1  mrg \def\finalout{\overfullrule=0pt }
    244  1.1  mrg 
    245  1.1  mrg \newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
    246  1.1  mrg \newdimen\topandbottommargin \topandbottommargin=.75in
    247  1.1  mrg 
    248  1.1  mrg % Output a mark which sets \thischapter, \thissection and \thiscolor.
    249  1.1  mrg % We dump everything together because we only have one kind of mark.
    250  1.1  mrg % This works because we only use \botmark / \topmark, not \firstmark.
    251  1.1  mrg %
    252  1.1  mrg % A mark contains a subexpression of the \ifcase ... \fi construct.
    253  1.1  mrg % \get*marks macros below extract the needed part using \ifcase.
    254  1.1  mrg %
    255  1.1  mrg % Another complication is to let the user choose whether \thischapter
    256  1.1  mrg % (\thissection) refers to the chapter (section) in effect at the top
    257  1.1  mrg % of a page, or that at the bottom of a page.
    258  1.1  mrg 
    259  1.1  mrg % \domark is called twice inside \chapmacro, to add one
    260  1.1  mrg % mark before the section break, and one after.
    261  1.1  mrg %   In the second call \prevchapterdefs is the same as \currentchapterdefs,
    262  1.1  mrg % and \prevsectiondefs is the same as \currentsectiondefs.
    263  1.1  mrg %   Then if the page is not broken at the mark, some of the previous
    264  1.1  mrg % section appears on the page, and we can get the name of this section
    265  1.1  mrg % from \firstmark for @everyheadingmarks top.
    266  1.1  mrg %   @everyheadingmarks bottom uses \botmark.
    267  1.1  mrg %
    268  1.1  mrg % See page 260 of The TeXbook.
    269  1.1  mrg \def\domark{%
    270  1.1  mrg   \toks0=\expandafter{\currentchapterdefs}%
    271  1.1  mrg   \toks2=\expandafter{\currentsectiondefs}%
    272  1.1  mrg   \toks4=\expandafter{\prevchapterdefs}%
    273  1.1  mrg   \toks6=\expandafter{\prevsectiondefs}%
    274  1.1  mrg   \toks8=\expandafter{\currentcolordefs}%
    275  1.1  mrg   \mark{%
    276  1.1  mrg                    \the\toks0 \the\toks2  % 0: marks for @everyheadingmarks top
    277  1.1  mrg       \noexpand\or \the\toks4 \the\toks6  % 1: for @everyheadingmarks bottom
    278  1.1  mrg     \noexpand\else \the\toks8             % 2: color marks
    279  1.1  mrg   }%
    280  1.1  mrg }
    281  1.1  mrg 
    282  1.1  mrg % \gettopheadingmarks, \getbottomheadingmarks,
    283  1.1  mrg % \getcolormarks - extract needed part of mark.
    284  1.1  mrg %
    285  1.1  mrg % \topmark doesn't work for the very first chapter (after the title
    286  1.1  mrg % page or the contents), so we use \firstmark there -- this gets us
    287  1.1  mrg % the mark with the chapter defs, unless the user sneaks in, e.g.,
    288  1.1  mrg % @setcolor (or @url, or @link, etc.) between @contents and the very
    289  1.1  mrg % first @chapter.
    290  1.1  mrg \def\gettopheadingmarks{%
    291  1.1  mrg   \ifcase0\the\savedtopmark\fi
    292  1.1  mrg   \ifx\thischapter\empty \ifcase0\firstmark\fi \fi
    293  1.1  mrg }
    294  1.1  mrg \def\getbottomheadingmarks{\ifcase1\botmark\fi}
    295  1.1  mrg \def\getcolormarks{\ifcase2\the\savedtopmark\fi}
    296  1.1  mrg 
    297  1.1  mrg % Avoid "undefined control sequence" errors.
    298  1.1  mrg \def\currentchapterdefs{}
    299  1.1  mrg \def\currentsectiondefs{}
    300  1.1  mrg \def\currentsection{}
    301  1.1  mrg \def\prevchapterdefs{}
    302  1.1  mrg \def\prevsectiondefs{}
    303  1.1  mrg \def\currentcolordefs{}
    304  1.1  mrg 
    305  1.1  mrg % Margin to add to right of even pages, to left of odd pages.
    306  1.1  mrg \newdimen\bindingoffset
    307  1.1  mrg \newdimen\normaloffset
    308  1.1  mrg \newdimen\txipagewidth \newdimen\txipageheight
    309  1.1  mrg 
    310  1.1  mrg % Main output routine.
    311  1.1  mrg %
    312  1.1  mrg \chardef\PAGE = 255
    313  1.1  mrg \newtoks\defaultoutput
    314  1.1  mrg \defaultoutput = {\savetopmark\onepageout{\pagecontents\PAGE}}
    315  1.1  mrg \output=\expandafter{\the\defaultoutput}
    316  1.1  mrg 
    317  1.1  mrg \newbox\headlinebox
    318  1.1  mrg \newbox\footlinebox
    319  1.1  mrg 
    320  1.1  mrg % When outputting the double column layout for indices, an output routine
    321  1.1  mrg % is run several times, which hides the original value of \topmark.  This
    322  1.1  mrg % can lead to a page heading being output and duplicating the chapter heading
    323  1.1  mrg % of the index.  Hence, save the contents of \topmark at the beginning of
    324  1.1  mrg % the output routine.  The saved contents are valid until we actually
    325  1.1  mrg % \shipout a page.
    326  1.1  mrg %
    327  1.1  mrg % (We used to run a short output routine to actually set \topmark and
    328  1.1  mrg % \firstmark to the right values, but if this was called with an empty page
    329  1.1  mrg % containing whatsits for writing index entries, the whatsits would be thrown
    330  1.1  mrg % away and the index auxiliary file would remain empty.)
    331  1.1  mrg %
    332  1.1  mrg \newtoks\savedtopmark
    333  1.1  mrg \newif\iftopmarksaved
    334  1.1  mrg \topmarksavedtrue
    335  1.1  mrg \def\savetopmark{%
    336  1.1  mrg   \iftopmarksaved\else
    337  1.1  mrg     \global\savedtopmark=\expandafter{\topmark}%
    338  1.1  mrg     \global\topmarksavedtrue
    339  1.1  mrg   \fi
    340  1.1  mrg }
    341  1.1  mrg 
    342  1.1  mrg % \onepageout takes a vbox as an argument.
    343  1.1  mrg % \shipout a vbox for a single page, adding an optional header, footer
    344  1.1  mrg % and footnote.  This also causes index entries for this page to be written
    345  1.1  mrg % to the auxiliary files.
    346  1.1  mrg %
    347  1.1  mrg \def\onepageout#1{%
    348  1.1  mrg   \hoffset=\normaloffset
    349  1.1  mrg   %
    350  1.1  mrg   \ifodd\pageno  \advance\hoffset by \bindingoffset
    351  1.1  mrg   \else \advance\hoffset by -\bindingoffset\fi
    352  1.1  mrg   %
    353  1.1  mrg   % Retrieve the information for the headings from the marks in the page,
    354  1.1  mrg   % and call Plain TeX's \makeheadline and \makefootline, which use the
    355  1.1  mrg   % values in \headline and \footline.
    356  1.1  mrg   %
    357  1.1  mrg   % This is used to check if we are on the first page of a chapter.
    358  1.1  mrg   \ifcase1\the\savedtopmark\fi
    359  1.1  mrg   \let\prevchaptername\thischaptername
    360  1.1  mrg   \ifcase0\firstmark\fi
    361  1.1  mrg   \let\curchaptername\thischaptername
    362  1.1  mrg   %
    363  1.1  mrg   \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
    364  1.1  mrg   %
    365  1.1  mrg   \ifx\curchaptername\prevchaptername
    366  1.1  mrg     \let\thischapterheading\thischapter
    367  1.1  mrg   \else
    368  1.1  mrg     % \thischapterheading is the same as \thischapter except it is blank
    369  1.1  mrg     % for the first page of a chapter.  This is to prevent the chapter name
    370  1.1  mrg     % being shown twice.
    371  1.1  mrg     \def\thischapterheading{}%
    372  1.1  mrg   \fi
    373  1.1  mrg   %
    374  1.1  mrg   % Common context changes for both heading and footing.
    375  1.1  mrg   % Do this outside of the \shipout so @code etc. will be expanded in
    376  1.1  mrg   % the headline as they should be, not taken literally (outputting ''code).
    377  1.1  mrg   \def\commonheadfootline{\let\hsize=\txipagewidth \texinfochars}
    378  1.1  mrg   %
    379  1.1  mrg   \global\setbox\headlinebox = \vbox{\commonheadfootline \makeheadline}%
    380  1.1  mrg   %
    381  1.1  mrg   \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi
    382  1.1  mrg   \global\setbox\footlinebox = \vbox{\commonheadfootline \makefootline}%
    383  1.1  mrg   %
    384  1.1  mrg   {%
    385  1.1  mrg     % Set context for writing to auxiliary files like index files.
    386  1.1  mrg     % Have to do this stuff outside the \shipout because we want it to
    387  1.1  mrg     % take effect in \write's, yet the group defined by the \vbox ends
    388  1.1  mrg     % before the \shipout runs.
    389  1.1  mrg     %
    390  1.1  mrg     \atdummies         % don't expand commands in the output.
    391  1.1  mrg     \turnoffactive
    392  1.1  mrg     \shipout\vbox{%
    393  1.1  mrg       % Do this early so pdf references go to the beginning of the page.
    394  1.1  mrg       \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi
    395  1.1  mrg       %
    396  1.1  mrg       \unvbox\headlinebox
    397  1.1  mrg       \pagebody{#1}%
    398  1.1  mrg       \ifdim\ht\footlinebox > 0pt
    399  1.1  mrg         % Only leave this space if the footline is nonempty.
    400  1.1  mrg         % (We lessened \vsize for it in \oddfootingyyy.)
    401  1.1  mrg         % The \baselineskip=24pt in plain's \makefootline has no effect.
    402  1.1  mrg         \vskip 24pt
    403  1.1  mrg         \unvbox\footlinebox
    404  1.1  mrg       \fi
    405  1.1  mrg       %
    406  1.1  mrg     }%
    407  1.1  mrg   }%
    408  1.1  mrg   \global\topmarksavedfalse
    409  1.1  mrg   \advancepageno
    410  1.1  mrg   \ifnum\outputpenalty>-20000 \else\dosupereject\fi
    411  1.1  mrg }
    412  1.1  mrg 
    413  1.1  mrg \newinsert\margin \dimen\margin=\maxdimen
    414  1.1  mrg 
    415  1.1  mrg % Main part of page, including any footnotes
    416  1.1  mrg \def\pagebody#1{\vbox to\txipageheight{\boxmaxdepth=\maxdepth #1}}
    417  1.1  mrg {\catcode`\@ =11
    418  1.1  mrg \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
    419  1.1  mrg % marginal hacks, juha (a] viisa.uucp (Juha Takala)
    420  1.1  mrg \ifvoid\margin\else % marginal info is present
    421  1.1  mrg   \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
    422  1.1  mrg \dimen@=\dp#1\relax \unvbox#1\relax
    423  1.1  mrg \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
    424  1.1  mrg \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
    425  1.1  mrg }
    426  1.1  mrg 
    427  1.1  mrg 
    428  1.1  mrg % Argument parsing
    429  1.1  mrg 
    430  1.1  mrg % Parse an argument, then pass it to #1.  The argument is the rest of
    431  1.1  mrg % the input line (except we remove a trailing comment).  #1 should be a
    432  1.1  mrg % macro which expects an ordinary undelimited TeX argument.
    433  1.1  mrg % For example, \def\foo{\parsearg\fooxxx}.
    434  1.1  mrg %
    435  1.1  mrg \def\parsearg{\parseargusing{}}
    436  1.1  mrg \def\parseargusing#1#2{%
    437  1.1  mrg   \def\argtorun{#2}%
    438  1.1  mrg   \begingroup
    439  1.1  mrg     \obeylines
    440  1.1  mrg     \spaceisspace
    441  1.1  mrg     #1%
    442  1.1  mrg     \parseargline\empty% Insert the \empty token, see \finishparsearg below.
    443  1.1  mrg }
    444  1.1  mrg 
    445  1.1  mrg {\obeylines %
    446  1.1  mrg   \gdef\parseargline#1^^M{%
    447  1.1  mrg     \endgroup % End of the group started in \parsearg.
    448  1.1  mrg     \argremovecomment #1\comment\ArgTerm%
    449  1.1  mrg   }%
    450  1.1  mrg }
    451  1.1  mrg 
    452  1.1  mrg % First remove any @comment, then any @c comment.  Pass the result on to
    453  1.1  mrg % \argcheckspaces.
    454  1.1  mrg \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
    455  1.1  mrg \def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
    456  1.1  mrg 
    457  1.1  mrg % Each occurrence of `\^^M' or `<space>\^^M' is replaced by a single space.
    458  1.1  mrg %
    459  1.1  mrg % \argremovec might leave us with trailing space, e.g.,
    460  1.1  mrg %    @end itemize  @c foo
    461  1.1  mrg % This space token undergoes the same procedure and is eventually removed
    462  1.1  mrg % by \finishparsearg.
    463  1.1  mrg %
    464  1.1  mrg \def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M}
    465  1.1  mrg \def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M}
    466  1.1  mrg \def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{%
    467  1.1  mrg   \def\temp{#3}%
    468  1.1  mrg   \ifx\temp\empty
    469  1.1  mrg     % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp:
    470  1.1  mrg     \let\temp\finishparsearg
    471  1.1  mrg   \else
    472  1.1  mrg     \let\temp\argcheckspaces
    473  1.1  mrg   \fi
    474  1.1  mrg   % Put the space token in:
    475  1.1  mrg   \temp#1 #3\ArgTerm
    476  1.1  mrg }
    477  1.1  mrg 
    478  1.1  mrg % If a _delimited_ argument is enclosed in braces, they get stripped; so
    479  1.1  mrg % to get _exactly_ the rest of the line, we had to prevent such situation.
    480  1.1  mrg % We prepended an \empty token at the very beginning and we expand it now,
    481  1.1  mrg % just before passing the control to \argtorun.
    482  1.1  mrg % (Similarly, we have to think about #3 of \argcheckspacesY above: it is
    483  1.1  mrg % either the null string, or it ends with \^^M---thus there is no danger
    484  1.1  mrg % that a pair of braces would be stripped.
    485  1.1  mrg %
    486  1.1  mrg % But first, we have to remove the trailing space token.
    487  1.1  mrg %
    488  1.1  mrg \def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}}
    489  1.1  mrg 
    490  1.1  mrg 
    491  1.1  mrg % \parseargdef - define a command taking an argument on the line
    492  1.1  mrg %
    493  1.1  mrg % \parseargdef\foo{...}
    494  1.1  mrg %	is roughly equivalent to
    495  1.1  mrg % \def\foo{\parsearg\Xfoo}
    496  1.1  mrg % \def\Xfoo#1{...}
    497  1.1  mrg \def\parseargdef#1{%
    498  1.1  mrg   \expandafter \doparseargdef \csname\string#1\endcsname #1%
    499  1.1  mrg }
    500  1.1  mrg \def\doparseargdef#1#2{%
    501  1.1  mrg   \def#2{\parsearg#1}%
    502  1.1  mrg   \def#1##1%
    503  1.1  mrg }
    504  1.1  mrg 
    505  1.1  mrg % Several utility definitions with active space:
    506  1.1  mrg {
    507  1.1  mrg   \obeyspaces
    508  1.1  mrg   \gdef\obeyedspace{ }
    509  1.1  mrg 
    510  1.1  mrg   % Make each space character in the input produce a normal interword
    511  1.1  mrg   % space in the output.  Don't allow a line break at this space, as this
    512  1.1  mrg   % is used only in environments like @example, where each line of input
    513  1.1  mrg   % should produce a line of output anyway.
    514  1.1  mrg   %
    515  1.1  mrg   \gdef\sepspaces{\obeyspaces\let =\tie}
    516  1.1  mrg 
    517  1.1  mrg   % If an index command is used in an @example environment, any spaces
    518  1.1  mrg   % therein should become regular spaces in the raw index file, not the
    519  1.1  mrg   % expansion of \tie (\leavevmode \penalty \@M \ ).
    520  1.1  mrg   \gdef\unsepspaces{\let =\space}
    521  1.1  mrg }
    522  1.1  mrg 
    523  1.1  mrg 
    524  1.1  mrg \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
    525  1.1  mrg 
    526  1.1  mrg % Define the framework for environments in texinfo.tex.  It's used like this:
    527  1.1  mrg %
    528  1.1  mrg %   \envdef\foo{...}
    529  1.1  mrg %   \def\Efoo{...}
    530  1.1  mrg %
    531  1.1  mrg % It's the responsibility of \envdef to insert \begingroup before the
    532  1.1  mrg % actual body; @end closes the group after calling \Efoo.  \envdef also
    533  1.1  mrg % defines \thisenv, so the current environment is known; @end checks
    534  1.1  mrg % whether the environment name matches.  The \checkenv macro can also be
    535  1.1  mrg % used to check whether the current environment is the one expected.
    536  1.1  mrg %
    537  1.1  mrg % Non-false conditionals (@iftex, @ifset) don't fit into this, so they
    538  1.1  mrg % are not treated as environments; they don't open a group.  (The
    539  1.1  mrg % implementation of @end takes care not to call \endgroup in this
    540  1.1  mrg % special case.)
    541  1.1  mrg 
    542  1.1  mrg 
    543  1.1  mrg % At run-time, environments start with this:
    544  1.1  mrg \def\startenvironment#1{\begingroup\def\thisenv{#1}}
    545  1.1  mrg % initialize
    546  1.1  mrg \let\thisenv\empty
    547  1.1  mrg 
    548  1.1  mrg % ... but they get defined via ``\envdef\foo{...}'':
    549  1.1  mrg \long\def\envdef#1#2{\def#1{\startenvironment#1#2}}
    550  1.1  mrg \def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}}
    551  1.1  mrg 
    552  1.1  mrg % Check whether we're in the right environment:
    553  1.1  mrg \def\checkenv#1{%
    554  1.1  mrg   \def\temp{#1}%
    555  1.1  mrg   \ifx\thisenv\temp
    556  1.1  mrg   \else
    557  1.1  mrg     \badenverr
    558  1.1  mrg   \fi
    559  1.1  mrg }
    560  1.1  mrg 
    561  1.1  mrg % Environment mismatch, #1 expected:
    562  1.1  mrg \def\badenverr{%
    563  1.1  mrg   \errhelp = \EMsimple
    564  1.1  mrg   \errmessage{This command can appear only \inenvironment\temp,
    565  1.1  mrg     not \inenvironment\thisenv}%
    566  1.1  mrg }
    567  1.1  mrg \def\inenvironment#1{%
    568  1.1  mrg   \ifx#1\empty
    569  1.1  mrg     outside of any environment%
    570  1.1  mrg   \else
    571  1.1  mrg     in environment \expandafter\string#1%
    572  1.1  mrg   \fi
    573  1.1  mrg }
    574  1.1  mrg 
    575  1.1  mrg % @end foo executes the definition of \Efoo.
    576  1.1  mrg % But first, it executes a specialized version of \checkenv
    577  1.1  mrg %
    578  1.1  mrg \parseargdef\end{%
    579  1.1  mrg   \if 1\csname iscond.#1\endcsname
    580  1.1  mrg   \else
    581  1.1  mrg     % The general wording of \badenverr may not be ideal.
    582  1.1  mrg     \expandafter\checkenv\csname#1\endcsname
    583  1.1  mrg     \csname E#1\endcsname
    584  1.1  mrg     \endgroup
    585  1.1  mrg   \fi
    586  1.1  mrg }
    587  1.1  mrg 
    588  1.1  mrg \newhelp\EMsimple{Press RETURN to continue.}
    589  1.1  mrg 
    590  1.1  mrg 
    591  1.1  mrg % Be sure we're in horizontal mode when doing a tie, since we make space
    592  1.1  mrg % equivalent to this in @example-like environments. Otherwise, a space
    593  1.1  mrg % at the beginning of a line will start with \penalty -- and
    594  1.1  mrg % since \penalty is valid in vertical mode, we'd end up putting the
    595  1.1  mrg % penalty on the vertical list instead of in the new paragraph.
    596  1.1  mrg {\catcode`@ = 11
    597  1.1  mrg  % Avoid using \@M directly, because that causes trouble
    598  1.1  mrg  % if the definition is written into an index file.
    599  1.1  mrg  \global\let\tiepenalty = \@M
    600  1.1  mrg  \gdef\tie{\leavevmode\penalty\tiepenalty\ }
    601  1.1  mrg }
    602  1.1  mrg 
    603  1.1  mrg % @: forces normal size whitespace following.
    604  1.1  mrg \def\:{\spacefactor=1000 }
    605  1.1  mrg 
    606  1.1  mrg % @* forces a line break.
    607  1.1  mrg \def\*{\unskip\hfil\break\hbox{}\ignorespaces}
    608  1.1  mrg 
    609  1.1  mrg % @/ allows a line break.
    610  1.1  mrg \let\/=\allowbreak
    611  1.1  mrg 
    612  1.1  mrg % @. is an end-of-sentence period.
    613  1.1  mrg \def\.{.\spacefactor=\endofsentencespacefactor\space}
    614  1.1  mrg 
    615  1.1  mrg % @! is an end-of-sentence bang.
    616  1.1  mrg \def\!{!\spacefactor=\endofsentencespacefactor\space}
    617  1.1  mrg 
    618  1.1  mrg % @? is an end-of-sentence query.
    619  1.1  mrg \def\?{?\spacefactor=\endofsentencespacefactor\space}
    620  1.1  mrg 
    621  1.1  mrg % @frenchspacing on|off  says whether to put extra space after punctuation.
    622  1.1  mrg %
    623  1.1  mrg \def\onword{on}
    624  1.1  mrg \def\offword{off}
    625  1.1  mrg %
    626  1.1  mrg \parseargdef\frenchspacing{%
    627  1.1  mrg   \def\temp{#1}%
    628  1.1  mrg   \ifx\temp\onword \plainfrenchspacing
    629  1.1  mrg   \else\ifx\temp\offword \plainnonfrenchspacing
    630  1.1  mrg   \else
    631  1.1  mrg     \errhelp = \EMsimple
    632  1.1  mrg     \errmessage{Unknown @frenchspacing option `\temp', must be on|off}%
    633  1.1  mrg   \fi\fi
    634  1.1  mrg }
    635  1.1  mrg 
    636  1.1  mrg % @w prevents a word break.  Without the \leavevmode, @w at the
    637  1.1  mrg % beginning of a paragraph, when TeX is still in vertical mode, would
    638  1.1  mrg % produce a whole line of output instead of starting the paragraph.
    639  1.1  mrg \def\w#1{\leavevmode\hbox{#1}}
    640  1.1  mrg 
    641  1.1  mrg % @group ... @end group forces ... to be all on one page, by enclosing
    642  1.1  mrg % it in a TeX vbox.  We use \vtop instead of \vbox to construct the box
    643  1.1  mrg % to keep its height that of a normal line.  According to the rules for
    644  1.1  mrg % \topskip (p.114 of the TeXbook), the glue inserted is
    645  1.1  mrg % max (\topskip - \ht (first item), 0).  If that height is large,
    646  1.1  mrg % therefore, no glue is inserted, and the space between the headline and
    647  1.1  mrg % the text is small, which looks bad.
    648  1.1  mrg %
    649  1.1  mrg % Another complication is that the group might be very large.  This can
    650  1.1  mrg % cause the glue on the previous page to be unduly stretched, because it
    651  1.1  mrg % does not have much material.  In this case, it's better to add an
    652  1.1  mrg % explicit \vfill so that the extra space is at the bottom.  The
    653  1.1  mrg % threshold for doing this is if the group is more than \vfilllimit
    654  1.1  mrg % percent of a page (\vfilllimit can be changed inside of @tex).
    655  1.1  mrg %
    656  1.1  mrg \newbox\groupbox
    657  1.1  mrg \def\vfilllimit{0.7}
    658  1.1  mrg %
    659  1.1  mrg \envdef\group{%
    660  1.1  mrg   \ifnum\catcode`\^^M=\active \else
    661  1.1  mrg     \errhelp = \groupinvalidhelp
    662  1.1  mrg     \errmessage{@group invalid in context where filling is enabled}%
    663  1.1  mrg   \fi
    664  1.1  mrg   \startsavinginserts
    665  1.1  mrg   %
    666  1.1  mrg   \setbox\groupbox = \vtop\bgroup
    667  1.1  mrg     % Do @comment since we are called inside an environment such as
    668  1.1  mrg     % @example, where each end-of-line in the input causes an
    669  1.1  mrg     % end-of-line in the output.  We don't want the end-of-line after
    670  1.1  mrg     % the `@group' to put extra space in the output.  Since @group
    671  1.1  mrg     % should appear on a line by itself (according to the Texinfo
    672  1.1  mrg     % manual), we don't worry about eating any user text.
    673  1.1  mrg     \comment
    674  1.1  mrg }
    675  1.1  mrg %
    676  1.1  mrg % The \vtop produces a box with normal height and large depth; thus, TeX puts
    677  1.1  mrg % \baselineskip glue before it, and (when the next line of text is done)
    678  1.1  mrg % \lineskip glue after it.  Thus, space below is not quite equal to space
    679  1.1  mrg % above.  But it's pretty close.
    680  1.1  mrg \def\Egroup{%
    681  1.1  mrg     % To get correct interline space between the last line of the group
    682  1.1  mrg     % and the first line afterwards, we have to propagate \prevdepth.
    683  1.1  mrg     \endgraf % Not \par, as it may have been set to \lisppar.
    684  1.1  mrg     \global\dimen1 = \prevdepth
    685  1.1  mrg   \egroup           % End the \vtop.
    686  1.1  mrg   \addgroupbox
    687  1.1  mrg   \prevdepth = \dimen1
    688  1.1  mrg   \checkinserts
    689  1.1  mrg }
    690  1.1  mrg 
    691  1.1  mrg \def\addgroupbox{
    692  1.1  mrg   % \dimen0 is the vertical size of the group's box.
    693  1.1  mrg   \dimen0 = \ht\groupbox  \advance\dimen0 by \dp\groupbox
    694  1.1  mrg   % \dimen2 is how much space is left on the page (more or less).
    695  1.1  mrg   \dimen2 = \txipageheight   \advance\dimen2 by -\pagetotal
    696  1.1  mrg   % if the group doesn't fit on the current page, and it's a big big
    697  1.1  mrg   % group, force a page break.
    698  1.1  mrg   \ifdim \dimen0 > \dimen2
    699  1.1  mrg     \ifdim \pagetotal < \vfilllimit\txipageheight
    700  1.1  mrg       \page
    701  1.1  mrg     \fi
    702  1.1  mrg   \fi
    703  1.1  mrg   \box\groupbox
    704  1.1  mrg }
    705  1.1  mrg 
    706  1.1  mrg %
    707  1.1  mrg % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
    708  1.1  mrg % message, so this ends up printing `@group can only ...'.
    709  1.1  mrg %
    710  1.1  mrg \newhelp\groupinvalidhelp{%
    711  1.1  mrg group can only be used in environments such as @example,^^J%
    712  1.1  mrg where each line of input produces a line of output.}
    713  1.1  mrg 
    714  1.1  mrg % @need space-in-mils
    715  1.1  mrg % forces a page break if there is not space-in-mils remaining.
    716  1.1  mrg 
    717  1.1  mrg \newdimen\mil  \mil=0.001in
    718  1.1  mrg 
    719  1.1  mrg \parseargdef\need{%
    720  1.1  mrg   % Ensure vertical mode, so we don't make a big box in the middle of a
    721  1.1  mrg   % paragraph.
    722  1.1  mrg   \par
    723  1.1  mrg   %
    724  1.1  mrg   % If the @need value is less than one line space, it's useless.
    725  1.1  mrg   \dimen0 = #1\mil
    726  1.1  mrg   \dimen2 = \ht\strutbox
    727  1.1  mrg   \advance\dimen2 by \dp\strutbox
    728  1.1  mrg   \ifdim\dimen0 > \dimen2
    729  1.1  mrg     %
    730  1.1  mrg     % Do a \strut just to make the height of this box be normal, so the
    731  1.1  mrg     % normal leading is inserted relative to the preceding line.
    732  1.1  mrg     % And a page break here is fine.
    733  1.1  mrg     \vtop to #1\mil{\strut\vfil}%
    734  1.1  mrg     %
    735  1.1  mrg     % TeX does not even consider page breaks if a penalty added to the
    736  1.1  mrg     % main vertical list is 10000 or more.  But in order to see if the
    737  1.1  mrg     % empty box we just added fits on the page, we must make it consider
    738  1.1  mrg     % page breaks.  On the other hand, we don't want to actually break the
    739  1.1  mrg     % page after the empty box.  So we use a penalty of 9999.
    740  1.1  mrg     %
    741  1.1  mrg     % There is an extremely small chance that TeX will actually break the
    742  1.1  mrg     % page at this \penalty, if there are no other feasible breakpoints in
    743  1.1  mrg     % sight.  (If the user is using lots of big @group commands, which
    744  1.1  mrg     % almost-but-not-quite fill up a page, TeX will have a hard time doing
    745  1.1  mrg     % good page breaking, for example.)  However, I could not construct an
    746  1.1  mrg     % example where a page broke at this \penalty; if it happens in a real
    747  1.1  mrg     % document, then we can reconsider our strategy.
    748  1.1  mrg     \penalty9999
    749  1.1  mrg     %
    750  1.1  mrg     % Back up by the size of the box, whether we did a page break or not.
    751  1.1  mrg     \kern -#1\mil
    752  1.1  mrg     %
    753  1.1  mrg     % Do not allow a page break right after this kern.
    754  1.1  mrg     \nobreak
    755  1.1  mrg   \fi
    756  1.1  mrg }
    757  1.1  mrg 
    758  1.1  mrg % @br   forces paragraph break (and is undocumented).
    759  1.1  mrg 
    760  1.1  mrg \let\br = \par
    761  1.1  mrg 
    762  1.1  mrg % @page forces the start of a new page.
    763  1.1  mrg %
    764  1.1  mrg \def\page{\par\vfill\supereject}
    765  1.1  mrg 
    766  1.1  mrg % @exdent text....
    767  1.1  mrg % outputs text on separate line in roman font, starting at standard page margin
    768  1.1  mrg 
    769  1.1  mrg % This records the amount of indent in the innermost environment.
    770  1.1  mrg % That's how much \exdent should take out.
    771  1.1  mrg \newskip\exdentamount
    772  1.1  mrg 
    773  1.1  mrg % This defn is used inside fill environments such as @defun.
    774  1.1  mrg \parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}
    775  1.1  mrg 
    776  1.1  mrg % This defn is used inside nofill environments such as @example.
    777  1.1  mrg \parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount
    778  1.1  mrg   \leftline{\hskip\leftskip{\rm#1}}}}
    779  1.1  mrg 
    780  1.1  mrg % @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
    781  1.1  mrg % paragraph.  For more general purposes, use the \margin insertion
    782  1.1  mrg % class.  WHICH is `l' or `r'.  Not documented, written for gawk manual.
    783  1.1  mrg %
    784  1.1  mrg \newskip\inmarginspacing \inmarginspacing=1cm
    785  1.1  mrg \def\strutdepth{\dp\strutbox}
    786  1.1  mrg %
    787  1.1  mrg \def\doinmargin#1#2{\strut\vadjust{%
    788  1.1  mrg   \nobreak
    789  1.1  mrg   \kern-\strutdepth
    790  1.1  mrg   \vtop to \strutdepth{%
    791  1.1  mrg     \baselineskip=\strutdepth
    792  1.1  mrg     \vss
    793  1.1  mrg     % if you have multiple lines of stuff to put here, you'll need to
    794  1.1  mrg     % make the vbox yourself of the appropriate size.
    795  1.1  mrg     \ifx#1l%
    796  1.1  mrg       \llap{\ignorespaces #2\hskip\inmarginspacing}%
    797  1.1  mrg     \else
    798  1.1  mrg       \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
    799  1.1  mrg     \fi
    800  1.1  mrg     \null
    801  1.1  mrg   }%
    802  1.1  mrg }}
    803  1.1  mrg \def\inleftmargin{\doinmargin l}
    804  1.1  mrg \def\inrightmargin{\doinmargin r}
    805  1.1  mrg %
    806  1.1  mrg % @inmargin{TEXT [, RIGHT-TEXT]}
    807  1.1  mrg % (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
    808  1.1  mrg % else use TEXT for both).
    809  1.1  mrg %
    810  1.1  mrg \def\inmargin#1{\parseinmargin #1,,\finish}
    811  1.1  mrg \def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
    812  1.1  mrg   \setbox0 = \hbox{\ignorespaces #2}%
    813  1.1  mrg   \ifdim\wd0 > 0pt
    814  1.1  mrg     \def\lefttext{#1}%  have both texts
    815  1.1  mrg     \def\righttext{#2}%
    816  1.1  mrg   \else
    817  1.1  mrg     \def\lefttext{#1}%  have only one text
    818  1.1  mrg     \def\righttext{#1}%
    819  1.1  mrg   \fi
    820  1.1  mrg   %
    821  1.1  mrg   \ifodd\pageno
    822  1.1  mrg     \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
    823  1.1  mrg   \else
    824  1.1  mrg     \def\temp{\inleftmargin\lefttext}%
    825  1.1  mrg   \fi
    826  1.1  mrg   \temp
    827  1.1  mrg }
    828  1.1  mrg 
    829  1.1  mrg % @include FILE -- \input text of FILE.
    830  1.1  mrg %
    831  1.1  mrg \def\include{\parseargusing\filenamecatcodes\includezzz}
    832  1.1  mrg \def\includezzz#1{%
    833  1.1  mrg   \pushthisfilestack
    834  1.1  mrg   \def\thisfile{#1}%
    835  1.1  mrg   {%
    836  1.1  mrg     \makevalueexpandable  % we want to expand any @value in FILE.
    837  1.1  mrg     \turnoffactive        % and allow special characters in the expansion
    838  1.1  mrg     \indexnofonts         % Allow `@@' and other weird things in file names.
    839  1.1  mrg     \wlog{texinfo.tex: doing @include of #1^^J}%
    840  1.1  mrg     \edef\temp{\noexpand\input #1 }%
    841  1.1  mrg     %
    842  1.1  mrg     % This trickery is to read FILE outside of a group, in case it makes
    843  1.1  mrg     % definitions, etc.
    844  1.1  mrg     \expandafter
    845  1.1  mrg   }\temp
    846  1.1  mrg   \popthisfilestack
    847  1.1  mrg }
    848  1.1  mrg \def\filenamecatcodes{%
    849  1.1  mrg   \catcode`\\=\other
    850  1.1  mrg   \catcode`~=\other
    851  1.1  mrg   \catcode`^=\other
    852  1.1  mrg   \catcode`_=\other
    853  1.1  mrg   \catcode`|=\other
    854  1.1  mrg   \catcode`<=\other
    855  1.1  mrg   \catcode`>=\other
    856  1.1  mrg   \catcode`+=\other
    857  1.1  mrg   \catcode`-=\other
    858  1.1  mrg   \catcode`\`=\other
    859  1.1  mrg   \catcode`\'=\other
    860  1.1  mrg }
    861  1.1  mrg 
    862  1.1  mrg \def\pushthisfilestack{%
    863  1.1  mrg   \expandafter\pushthisfilestackX\popthisfilestack\StackTerm
    864  1.1  mrg }
    865  1.1  mrg \def\pushthisfilestackX{%
    866  1.1  mrg   \expandafter\pushthisfilestackY\thisfile\StackTerm
    867  1.1  mrg }
    868  1.1  mrg \def\pushthisfilestackY #1\StackTerm #2\StackTerm {%
    869  1.1  mrg   \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}%
    870  1.1  mrg }
    871  1.1  mrg 
    872  1.1  mrg \def\popthisfilestack{\errthisfilestackempty}
    873  1.1  mrg \def\errthisfilestackempty{\errmessage{Internal error:
    874  1.1  mrg   the stack of filenames is empty.}}
    875  1.1  mrg %
    876  1.1  mrg \def\thisfile{}
    877  1.1  mrg 
    878  1.1  mrg % @center line
    879  1.1  mrg % outputs that line, centered.
    880  1.1  mrg %
    881  1.1  mrg \parseargdef\center{%
    882  1.1  mrg   \ifhmode
    883  1.1  mrg     \let\centersub\centerH
    884  1.1  mrg   \else
    885  1.1  mrg     \let\centersub\centerV
    886  1.1  mrg   \fi
    887  1.1  mrg   \centersub{\hfil \ignorespaces#1\unskip \hfil}%
    888  1.1  mrg   \let\centersub\relax % don't let the definition persist, just in case
    889  1.1  mrg }
    890  1.1  mrg \def\centerH#1{{%
    891  1.1  mrg   \hfil\break
    892  1.1  mrg   \advance\hsize by -\leftskip
    893  1.1  mrg   \advance\hsize by -\rightskip
    894  1.1  mrg   \line{#1}%
    895  1.1  mrg   \break
    896  1.1  mrg }}
    897  1.1  mrg %
    898  1.1  mrg \newcount\centerpenalty
    899  1.1  mrg \def\centerV#1{%
    900  1.1  mrg   % The idea here is the same as in \startdefun, \cartouche, etc.: if
    901  1.1  mrg   % @center is the first thing after a section heading, we need to wipe
    902  1.1  mrg   % out the negative parskip inserted by \sectionheading, but still
    903  1.1  mrg   % prevent a page break here.
    904  1.1  mrg   \centerpenalty = \lastpenalty
    905  1.1  mrg   \ifnum\centerpenalty>10000 \vskip\parskip \fi
    906  1.1  mrg   \ifnum\centerpenalty>9999 \penalty\centerpenalty \fi
    907  1.1  mrg   \line{\kern\leftskip #1\kern\rightskip}%
    908  1.1  mrg }
    909  1.1  mrg 
    910  1.1  mrg % @sp n   outputs n lines of vertical space
    911  1.1  mrg %
    912  1.1  mrg \parseargdef\sp{\vskip #1\baselineskip}
    913  1.1  mrg 
    914  1.1  mrg % @comment ...line which is ignored...
    915  1.1  mrg % @c is the same as @comment
    916  1.1  mrg % @ignore ... @end ignore  is another way to write a comment
    917  1.1  mrg 
    918  1.1  mrg 
    919  1.1  mrg \def\c{\begingroup \catcode`\^^M=\active%
    920  1.1  mrg \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
    921  1.1  mrg \cxxx}
    922  1.1  mrg {\catcode`\^^M=\active \gdef\cxxx#1^^M{\endgroup}}
    923  1.1  mrg %
    924  1.1  mrg \let\comment\c
    925  1.1  mrg 
    926  1.1  mrg % @paragraphindent NCHARS
    927  1.1  mrg % We'll use ems for NCHARS, close enough.
    928  1.1  mrg % NCHARS can also be the word `asis' or `none'.
    929  1.1  mrg % We cannot feasibly implement @paragraphindent asis, though.
    930  1.1  mrg %
    931  1.1  mrg \def\asisword{asis} % no translation, these are keywords
    932  1.1  mrg \def\noneword{none}
    933  1.1  mrg %
    934  1.1  mrg \parseargdef\paragraphindent{%
    935  1.1  mrg   \def\temp{#1}%
    936  1.1  mrg   \ifx\temp\asisword
    937  1.1  mrg   \else
    938  1.1  mrg     \ifx\temp\noneword
    939  1.1  mrg       \defaultparindent = 0pt
    940  1.1  mrg     \else
    941  1.1  mrg       \defaultparindent = #1em
    942  1.1  mrg     \fi
    943  1.1  mrg   \fi
    944  1.1  mrg   \parindent = \defaultparindent
    945  1.1  mrg }
    946  1.1  mrg 
    947  1.1  mrg % @exampleindent NCHARS
    948  1.1  mrg % We'll use ems for NCHARS like @paragraphindent.
    949  1.1  mrg % It seems @exampleindent asis isn't necessary, but
    950  1.1  mrg % I preserve it to make it similar to @paragraphindent.
    951  1.1  mrg \parseargdef\exampleindent{%
    952  1.1  mrg   \def\temp{#1}%
    953  1.1  mrg   \ifx\temp\asisword
    954  1.1  mrg   \else
    955  1.1  mrg     \ifx\temp\noneword
    956  1.1  mrg       \lispnarrowing = 0pt
    957  1.1  mrg     \else
    958  1.1  mrg       \lispnarrowing = #1em
    959  1.1  mrg     \fi
    960  1.1  mrg   \fi
    961  1.1  mrg }
    962  1.1  mrg 
    963  1.1  mrg % @firstparagraphindent WORD
    964  1.1  mrg % If WORD is `none', then suppress indentation of the first paragraph
    965  1.1  mrg % after a section heading.  If WORD is `insert', then do indent at such
    966  1.1  mrg % paragraphs.
    967  1.1  mrg %
    968  1.1  mrg % The paragraph indentation is suppressed or not by calling
    969  1.1  mrg % \suppressfirstparagraphindent, which the sectioning commands do.
    970  1.1  mrg % We switch the definition of this back and forth according to WORD.
    971  1.1  mrg % By default, we suppress indentation.
    972  1.1  mrg %
    973  1.1  mrg \def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
    974  1.1  mrg \def\insertword{insert}
    975  1.1  mrg %
    976  1.1  mrg \parseargdef\firstparagraphindent{%
    977  1.1  mrg   \def\temp{#1}%
    978  1.1  mrg   \ifx\temp\noneword
    979  1.1  mrg     \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
    980  1.1  mrg   \else\ifx\temp\insertword
    981  1.1  mrg     \let\suppressfirstparagraphindent = \relax
    982  1.1  mrg   \else
    983  1.1  mrg     \errhelp = \EMsimple
    984  1.1  mrg     \errmessage{Unknown @firstparagraphindent option `\temp'}%
    985  1.1  mrg   \fi\fi
    986  1.1  mrg }
    987  1.1  mrg 
    988  1.1  mrg % Here is how we actually suppress indentation.  Redefine \everypar to
    989  1.1  mrg % \kern backwards by \parindent, and then reset itself to empty.
    990  1.1  mrg %
    991  1.1  mrg % We also make \indent itself not actually do anything until the next
    992  1.1  mrg % paragraph.
    993  1.1  mrg %
    994  1.1  mrg \gdef\dosuppressfirstparagraphindent{%
    995  1.1  mrg   \gdef\indent  {\restorefirstparagraphindent \indent}%
    996  1.1  mrg   \gdef\noindent{\restorefirstparagraphindent \noindent}%
    997  1.1  mrg   \global\everypar = {\kern -\parindent \restorefirstparagraphindent}%
    998  1.1  mrg }
    999  1.1  mrg %
   1000  1.1  mrg \gdef\restorefirstparagraphindent{%
   1001  1.1  mrg   \global\let\indent = \ptexindent
   1002  1.1  mrg   \global\let\noindent = \ptexnoindent
   1003  1.1  mrg   \global\everypar = {}%
   1004  1.1  mrg }
   1005  1.1  mrg 
   1006  1.1  mrg 
   1007  1.1  mrg % @refill is a no-op.
   1008  1.1  mrg \let\refill=\relax
   1009  1.1  mrg 
   1010  1.1  mrg % @setfilename INFO-FILENAME - ignored
   1011  1.1  mrg \let\setfilename=\comment
   1012  1.1  mrg 
   1013  1.1  mrg % @bye.
   1014  1.1  mrg \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
   1015  1.1  mrg 
   1016  1.1  mrg 
   1017  1.1  mrg \message{pdf,}
   1018  1.1  mrg % adobe `portable' document format
   1019  1.1  mrg \newcount\tempnum
   1020  1.1  mrg \newcount\lnkcount
   1021  1.1  mrg \newtoks\filename
   1022  1.1  mrg \newcount\filenamelength
   1023  1.1  mrg \newcount\pgn
   1024  1.1  mrg \newtoks\toksA
   1025  1.1  mrg \newtoks\toksB
   1026  1.1  mrg \newtoks\toksC
   1027  1.1  mrg \newtoks\toksD
   1028  1.1  mrg \newbox\boxA
   1029  1.1  mrg \newbox\boxB
   1030  1.1  mrg \newcount\countA
   1031  1.1  mrg \newif\ifpdf
   1032  1.1  mrg \newif\ifpdfmakepagedest
   1033  1.1  mrg 
   1034  1.1  mrg %
   1035  1.1  mrg % For LuaTeX
   1036  1.1  mrg %
   1037  1.1  mrg 
   1038  1.1  mrg \newif\iftxiuseunicodedestname
   1039  1.1  mrg \txiuseunicodedestnamefalse % For pdfTeX etc.
   1040  1.1  mrg 
   1041  1.1  mrg \ifx\luatexversion\thisisundefined
   1042  1.1  mrg \else
   1043  1.1  mrg   % Use Unicode destination names
   1044  1.1  mrg   \txiuseunicodedestnametrue
   1045  1.1  mrg   % Escape PDF strings with converting UTF-16 from UTF-8
   1046  1.1  mrg   \begingroup
   1047  1.1  mrg     \catcode`\%=12
   1048  1.1  mrg     \directlua{
   1049  1.1  mrg       function UTF16oct(str)
   1050  1.1  mrg         tex.sprint(string.char(0x5c) .. '376' .. string.char(0x5c) .. '377')
   1051  1.1  mrg         for c in string.utfvalues(str) do
   1052  1.1  mrg           if c < 0x10000 then
   1053  1.1  mrg             tex.sprint(
   1054  1.1  mrg               string.format(string.char(0x5c) .. string.char(0x25) .. '03o' ..
   1055  1.1  mrg                             string.char(0x5c) .. string.char(0x25) .. '03o',
   1056  1.1  mrg                             math.floor(c / 256), math.floor(c % 256)))
   1057  1.1  mrg           else
   1058  1.1  mrg             c = c - 0x10000
   1059  1.1  mrg             local c_hi = c / 1024 + 0xd800
   1060  1.1  mrg             local c_lo = c % 1024 + 0xdc00
   1061  1.1  mrg             tex.sprint(
   1062  1.1  mrg               string.format(string.char(0x5c) .. string.char(0x25) .. '03o' ..
   1063  1.1  mrg                             string.char(0x5c) .. string.char(0x25) .. '03o' ..
   1064  1.1  mrg                             string.char(0x5c) .. string.char(0x25) .. '03o' ..
   1065  1.1  mrg                             string.char(0x5c) .. string.char(0x25) .. '03o',
   1066  1.1  mrg                             math.floor(c_hi / 256), math.floor(c_hi % 256),
   1067  1.1  mrg                             math.floor(c_lo / 256), math.floor(c_lo % 256)))
   1068  1.1  mrg           end
   1069  1.1  mrg         end
   1070  1.1  mrg       end
   1071  1.1  mrg     }
   1072  1.1  mrg   \endgroup
   1073  1.1  mrg   \def\pdfescapestrutfsixteen#1{\directlua{UTF16oct('\luaescapestring{#1}')}}
   1074  1.1  mrg   % Escape PDF strings without converting
   1075  1.1  mrg   \begingroup
   1076  1.1  mrg     \directlua{
   1077  1.1  mrg       function PDFescstr(str)
   1078  1.1  mrg         for c in string.bytes(str) do
   1079  1.1  mrg           if c <= 0x20 or c >= 0x80 or c == 0x28 or c == 0x29 or c == 0x5c then
   1080  1.1  mrg             tex.sprint(-2,
   1081  1.1  mrg               string.format(string.char(0x5c) .. string.char(0x25) .. '03o',
   1082  1.1  mrg                             c))
   1083  1.1  mrg           else
   1084  1.1  mrg             tex.sprint(-2, string.char(c))
   1085  1.1  mrg           end
   1086  1.1  mrg         end
   1087  1.1  mrg       end
   1088  1.1  mrg     }
   1089  1.1  mrg     % The -2 in the arguments here gives all the input to TeX catcode 12
   1090  1.1  mrg     % (other) or 10 (space), preventing undefined control sequence errors. See
   1091  1.1  mrg     % https://lists.gnu.org/archive/html/bug-texinfo/2019-08/msg00031.html
   1092  1.1  mrg     %
   1093  1.1  mrg   \endgroup
   1094  1.1  mrg   \def\pdfescapestring#1{\directlua{PDFescstr('\luaescapestring{#1}')}}
   1095  1.1  mrg   \ifnum\luatexversion>84
   1096  1.1  mrg     % For LuaTeX >= 0.85
   1097  1.1  mrg     \def\pdfdest{\pdfextension dest}
   1098  1.1  mrg     \let\pdfoutput\outputmode
   1099  1.1  mrg     \def\pdfliteral{\pdfextension literal}
   1100  1.1  mrg     \def\pdfcatalog{\pdfextension catalog}
   1101  1.1  mrg     \def\pdftexversion{\numexpr\pdffeedback version\relax}
   1102  1.1  mrg     \let\pdfximage\saveimageresource
   1103  1.1  mrg     \let\pdfrefximage\useimageresource
   1104  1.1  mrg     \let\pdflastximage\lastsavedimageresourceindex
   1105  1.1  mrg     \def\pdfendlink{\pdfextension endlink\relax}
   1106  1.1  mrg     \def\pdfoutline{\pdfextension outline}
   1107  1.1  mrg     \def\pdfstartlink{\pdfextension startlink}
   1108  1.1  mrg     \def\pdffontattr{\pdfextension fontattr}
   1109  1.1  mrg     \def\pdfobj{\pdfextension obj}
   1110  1.1  mrg     \def\pdflastobj{\numexpr\pdffeedback lastobj\relax}
   1111  1.1  mrg     \let\pdfpagewidth\pagewidth
   1112  1.1  mrg     \let\pdfpageheight\pageheight
   1113  1.1  mrg     \edef\pdfhorigin{\pdfvariable horigin}
   1114  1.1  mrg     \edef\pdfvorigin{\pdfvariable vorigin}
   1115  1.1  mrg   \fi
   1116  1.1  mrg \fi
   1117  1.1  mrg 
   1118  1.1  mrg % when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
   1119  1.1  mrg % can be set).  So we test for \relax and 0 as well as being undefined.
   1120  1.1  mrg \ifx\pdfoutput\thisisundefined
   1121  1.1  mrg \else
   1122  1.1  mrg   \ifx\pdfoutput\relax
   1123  1.1  mrg   \else
   1124  1.1  mrg     \ifcase\pdfoutput
   1125  1.1  mrg     \else
   1126  1.1  mrg       \pdftrue
   1127  1.1  mrg     \fi
   1128  1.1  mrg   \fi
   1129  1.1  mrg \fi
   1130  1.1  mrg 
   1131  1.1  mrg \newif\ifpdforxetex
   1132  1.1  mrg \pdforxetexfalse
   1133  1.1  mrg \ifpdf
   1134  1.1  mrg   \pdforxetextrue
   1135  1.1  mrg \fi
   1136  1.1  mrg \ifx\XeTeXrevision\thisisundefined\else
   1137  1.1  mrg   \pdforxetextrue
   1138  1.1  mrg \fi
   1139  1.1  mrg 
   1140  1.1  mrg 
   1141  1.1  mrg % PDF uses PostScript string constants for the names of xref targets,
   1142  1.1  mrg % for display in the outlines, and in other places.  Thus, we have to
   1143  1.1  mrg % double any backslashes.  Otherwise, a name like "\node" will be
   1144  1.1  mrg % interpreted as a newline (\n), followed by o, d, e.  Not good.
   1145  1.1  mrg %
   1146  1.1  mrg % See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and
   1147  1.1  mrg % related messages.  The final outcome is that it is up to the TeX user
   1148  1.1  mrg % to double the backslashes and otherwise make the string valid, so
   1149  1.1  mrg % that's what we do.  pdftex 1.30.0 (ca.2005) introduced a primitive to
   1150  1.1  mrg % do this reliably, so we use it.
   1151  1.1  mrg 
   1152  1.1  mrg % #1 is a control sequence in which to do the replacements,
   1153  1.1  mrg % which we \xdef.
   1154  1.1  mrg \def\txiescapepdf#1{%
   1155  1.1  mrg   \ifx\pdfescapestring\thisisundefined
   1156  1.1  mrg     % No primitive available; should we give a warning or log?
   1157  1.1  mrg     % Many times it won't matter.
   1158  1.1  mrg     \xdef#1{#1}%
   1159  1.1  mrg   \else
   1160  1.1  mrg     % The expandable \pdfescapestring primitive escapes parentheses,
   1161  1.1  mrg     % backslashes, and other special chars.
   1162  1.1  mrg     \xdef#1{\pdfescapestring{#1}}%
   1163  1.1  mrg   \fi
   1164  1.1  mrg }
   1165  1.1  mrg \def\txiescapepdfutfsixteen#1{%
   1166  1.1  mrg   \ifx\pdfescapestrutfsixteen\thisisundefined
   1167  1.1  mrg     % No UTF-16 converting macro available.
   1168  1.1  mrg     \txiescapepdf{#1}%
   1169  1.1  mrg   \else
   1170  1.1  mrg     \xdef#1{\pdfescapestrutfsixteen{#1}}%
   1171  1.1  mrg   \fi
   1172  1.1  mrg }
   1173  1.1  mrg 
   1174  1.1  mrg \newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images
   1175  1.1  mrg with PDF output, and none of those formats could be found.  (.eps cannot
   1176  1.1  mrg be supported due to the design of the PDF format; use regular TeX (DVI
   1177  1.1  mrg output) for that.)}
   1178  1.1  mrg 
   1179  1.1  mrg \ifpdf
   1180  1.1  mrg   %
   1181  1.1  mrg   % Color manipulation macros using ideas from pdfcolor.tex,
   1182  1.1  mrg   % except using rgb instead of cmyk; the latter is said to render as a
   1183  1.1  mrg   % very dark gray on-screen and a very dark halftone in print, instead
   1184  1.1  mrg   % of actual black. The dark red here is dark enough to print on paper as
   1185  1.1  mrg   % nearly black, but still distinguishable for online viewing.  We use
   1186  1.1  mrg   % black by default, though.
   1187  1.1  mrg   \def\rgbDarkRed{0.50 0.09 0.12}
   1188  1.1  mrg   \def\rgbBlack{0 0 0}
   1189  1.1  mrg   %
   1190  1.1  mrg   % rg sets the color for filling (usual text, etc.);
   1191  1.1  mrg   % RG sets the color for stroking (thin rules, e.g., normal _'s).
   1192  1.1  mrg   \def\pdfsetcolor#1{\pdfliteral{#1 rg  #1 RG}}
   1193  1.1  mrg   %
   1194  1.1  mrg   % Set color, and create a mark which defines \thiscolor accordingly,
   1195  1.1  mrg   % so that \makeheadline knows which color to restore.
   1196  1.1  mrg   \def\setcolor#1{%
   1197  1.1  mrg     \xdef\currentcolordefs{\gdef\noexpand\thiscolor{#1}}%
   1198  1.1  mrg     \domark
   1199  1.1  mrg     \pdfsetcolor{#1}%
   1200  1.1  mrg   }
   1201  1.1  mrg   %
   1202  1.1  mrg   \def\maincolor{\rgbBlack}
   1203  1.1  mrg   \pdfsetcolor{\maincolor}
   1204  1.1  mrg   \edef\thiscolor{\maincolor}
   1205  1.1  mrg   \def\currentcolordefs{}
   1206  1.1  mrg   %
   1207  1.1  mrg   \def\makefootline{%
   1208  1.1  mrg     \baselineskip24pt
   1209  1.1  mrg     \line{\pdfsetcolor{\maincolor}\the\footline}%
   1210  1.1  mrg   }
   1211  1.1  mrg   %
   1212  1.1  mrg   \def\makeheadline{%
   1213  1.1  mrg     \vbox to 0pt{%
   1214  1.1  mrg       \vskip-22.5pt
   1215  1.1  mrg       \line{%
   1216  1.1  mrg         \vbox to8.5pt{}%
   1217  1.1  mrg         % Extract \thiscolor definition from the marks.
   1218  1.1  mrg         \getcolormarks
   1219  1.1  mrg         % Typeset the headline with \maincolor, then restore the color.
   1220  1.1  mrg         \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
   1221  1.1  mrg       }%
   1222  1.1  mrg       \vss
   1223  1.1  mrg     }%
   1224  1.1  mrg     \nointerlineskip
   1225  1.1  mrg   }
   1226  1.1  mrg   %
   1227  1.1  mrg   %
   1228  1.1  mrg   \pdfcatalog{/PageMode /UseOutlines}
   1229  1.1  mrg   %
   1230  1.1  mrg   % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
   1231  1.1  mrg   \def\dopdfimage#1#2#3{%
   1232  1.1  mrg     \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
   1233  1.1  mrg     \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
   1234  1.1  mrg     %
   1235  1.1  mrg     % pdftex (and the PDF format) support .pdf, .png, .jpg (among
   1236  1.1  mrg     % others).  Let's try in that order, PDF first since if
   1237  1.1  mrg     % someone has a scalable image, presumably better to use that than a
   1238  1.1  mrg     % bitmap.
   1239  1.1  mrg     \let\pdfimgext=\empty
   1240  1.1  mrg     \begingroup
   1241  1.1  mrg       \openin 1 #1.pdf \ifeof 1
   1242  1.1  mrg         \openin 1 #1.PDF \ifeof 1
   1243  1.1  mrg           \openin 1 #1.png \ifeof 1
   1244  1.1  mrg             \openin 1 #1.jpg \ifeof 1
   1245  1.1  mrg               \openin 1 #1.jpeg \ifeof 1
   1246  1.1  mrg                 \openin 1 #1.JPG \ifeof 1
   1247  1.1  mrg                   \errhelp = \nopdfimagehelp
   1248  1.1  mrg                   \errmessage{Could not find image file #1 for pdf}%
   1249  1.1  mrg                 \else \gdef\pdfimgext{JPG}%
   1250  1.1  mrg                 \fi
   1251  1.1  mrg               \else \gdef\pdfimgext{jpeg}%
   1252  1.1  mrg               \fi
   1253  1.1  mrg             \else \gdef\pdfimgext{jpg}%
   1254  1.1  mrg             \fi
   1255  1.1  mrg           \else \gdef\pdfimgext{png}%
   1256  1.1  mrg           \fi
   1257  1.1  mrg         \else \gdef\pdfimgext{PDF}%
   1258  1.1  mrg         \fi
   1259  1.1  mrg       \else \gdef\pdfimgext{pdf}%
   1260  1.1  mrg       \fi
   1261  1.1  mrg       \closein 1
   1262  1.1  mrg     \endgroup
   1263  1.1  mrg     %
   1264  1.1  mrg     % without \immediate, ancient pdftex seg faults when the same image is
   1265  1.1  mrg     % included twice.  (Version 3.14159-pre-1.0-unofficial-20010704.)
   1266  1.1  mrg     \ifnum\pdftexversion < 14
   1267  1.1  mrg       \immediate\pdfimage
   1268  1.1  mrg     \else
   1269  1.1  mrg       \immediate\pdfximage
   1270  1.1  mrg     \fi
   1271  1.1  mrg       \ifdim \wd0 >0pt width \pdfimagewidth \fi
   1272  1.1  mrg       \ifdim \wd2 >0pt height \pdfimageheight \fi
   1273  1.1  mrg       \ifnum\pdftexversion<13
   1274  1.1  mrg          #1.\pdfimgext
   1275  1.1  mrg        \else
   1276  1.1  mrg          {#1.\pdfimgext}%
   1277  1.1  mrg        \fi
   1278  1.1  mrg     \ifnum\pdftexversion < 14 \else
   1279  1.1  mrg       \pdfrefximage \pdflastximage
   1280  1.1  mrg     \fi}
   1281  1.1  mrg   %
   1282  1.1  mrg   \def\setpdfdestname#1{{%
   1283  1.1  mrg     % We have to set dummies so commands such as @code, and characters
   1284  1.1  mrg     % such as \, aren't expanded when present in a section title.
   1285  1.1  mrg     \indexnofonts
   1286  1.1  mrg     \makevalueexpandable
   1287  1.1  mrg     \turnoffactive
   1288  1.1  mrg     \iftxiuseunicodedestname
   1289  1.1  mrg       \ifx \declaredencoding \latone
   1290  1.1  mrg         % Pass through Latin-1 characters.
   1291  1.1  mrg         % LuaTeX with byte wise I/O converts Latin-1 characters to Unicode.
   1292  1.1  mrg       \else
   1293  1.1  mrg         \ifx \declaredencoding \utfeight
   1294  1.1  mrg           % Pass through Unicode characters.
   1295  1.1  mrg         \else
   1296  1.1  mrg           % Use ASCII approximations in destination names.
   1297  1.1  mrg           \passthroughcharsfalse
   1298  1.1  mrg         \fi
   1299  1.1  mrg       \fi
   1300  1.1  mrg     \else
   1301  1.1  mrg       % Use ASCII approximations in destination names.
   1302  1.1  mrg       \passthroughcharsfalse
   1303  1.1  mrg     \fi
   1304  1.1  mrg     \def\pdfdestname{#1}%
   1305  1.1  mrg     \txiescapepdf\pdfdestname
   1306  1.1  mrg   }}
   1307  1.1  mrg   %
   1308  1.1  mrg   \def\setpdfoutlinetext#1{{%
   1309  1.1  mrg     \indexnofonts
   1310  1.1  mrg     \makevalueexpandable
   1311  1.1  mrg     \turnoffactive
   1312  1.1  mrg     \ifx \declaredencoding \latone
   1313  1.1  mrg       % The PDF format can use an extended form of Latin-1 in bookmark
   1314  1.1  mrg       % strings.  See Appendix D of the PDF Reference, Sixth Edition, for
   1315  1.1  mrg       % the "PDFDocEncoding".
   1316  1.1  mrg       \passthroughcharstrue
   1317  1.1  mrg       % Pass through Latin-1 characters.
   1318  1.1  mrg       %   LuaTeX: Convert to Unicode
   1319  1.1  mrg       %   pdfTeX: Use Latin-1 as PDFDocEncoding
   1320  1.1  mrg       \def\pdfoutlinetext{#1}%
   1321  1.1  mrg     \else
   1322  1.1  mrg       \ifx \declaredencoding \utfeight
   1323  1.1  mrg         \ifx\luatexversion\thisisundefined
   1324  1.1  mrg           % For pdfTeX  with UTF-8.
   1325  1.1  mrg           % TODO: the PDF format can use UTF-16 in bookmark strings,
   1326  1.1  mrg           % but the code for this isn't done yet.
   1327  1.1  mrg           % Use ASCII approximations.
   1328  1.1  mrg           \passthroughcharsfalse
   1329  1.1  mrg           \def\pdfoutlinetext{#1}%
   1330  1.1  mrg         \else
   1331  1.1  mrg           % For LuaTeX with UTF-8.
   1332  1.1  mrg           % Pass through Unicode characters for title texts.
   1333  1.1  mrg           \passthroughcharstrue
   1334  1.1  mrg           \def\pdfoutlinetext{#1}%
   1335  1.1  mrg         \fi
   1336  1.1  mrg       \else
   1337  1.1  mrg         % For non-Latin-1 or non-UTF-8 encodings.
   1338  1.1  mrg         % Use ASCII approximations.
   1339  1.1  mrg         \passthroughcharsfalse
   1340  1.1  mrg         \def\pdfoutlinetext{#1}%
   1341  1.1  mrg       \fi
   1342  1.1  mrg     \fi
   1343  1.1  mrg     % LuaTeX: Convert to UTF-16
   1344  1.1  mrg     % pdfTeX: Use Latin-1 as PDFDocEncoding
   1345  1.1  mrg     \txiescapepdfutfsixteen\pdfoutlinetext
   1346  1.1  mrg   }}
   1347  1.1  mrg   %
   1348  1.1  mrg   \def\pdfmkdest#1{%
   1349  1.1  mrg     \setpdfdestname{#1}%
   1350  1.1  mrg     \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
   1351  1.1  mrg   }
   1352  1.1  mrg   %
   1353  1.1  mrg   % used to mark target names; must be expandable.
   1354  1.1  mrg   \def\pdfmkpgn#1{#1}
   1355  1.1  mrg   %
   1356  1.1  mrg   % by default, use black for everything.
   1357  1.1  mrg   \def\urlcolor{\rgbBlack}
   1358  1.1  mrg   \def\linkcolor{\rgbBlack}
   1359  1.1  mrg   \def\endlink{\setcolor{\maincolor}\pdfendlink}
   1360  1.1  mrg   %
   1361  1.1  mrg   % Adding outlines to PDF; macros for calculating structure of outlines
   1362  1.1  mrg   % come from Petr Olsak
   1363  1.1  mrg   \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
   1364  1.1  mrg     \else \csname#1\endcsname \fi}
   1365  1.1  mrg   \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
   1366  1.1  mrg     \advance\tempnum by 1
   1367  1.1  mrg     \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
   1368  1.1  mrg   %
   1369  1.1  mrg   % #1 is the section text, which is what will be displayed in the
   1370  1.1  mrg   % outline by the pdf viewer.  #2 is the pdf expression for the number
   1371  1.1  mrg   % of subentries (or empty, for subsubsections).  #3 is the node text,
   1372  1.1  mrg   % which might be empty if this toc entry had no corresponding node.
   1373  1.1  mrg   % #4 is the page number
   1374  1.1  mrg   %
   1375  1.1  mrg   \def\dopdfoutline#1#2#3#4{%
   1376  1.1  mrg     % Generate a link to the node text if that exists; else, use the
   1377  1.1  mrg     % page number.  We could generate a destination for the section
   1378  1.1  mrg     % text in the case where a section has no node, but it doesn't
   1379  1.1  mrg     % seem worth the trouble, since most documents are normally structured.
   1380  1.1  mrg     \setpdfoutlinetext{#1}
   1381  1.1  mrg     \setpdfdestname{#3}
   1382  1.1  mrg     \ifx\pdfdestname\empty
   1383  1.1  mrg       \def\pdfdestname{#4}%
   1384  1.1  mrg     \fi
   1385  1.1  mrg     %
   1386  1.1  mrg     \pdfoutline goto name{\pdfmkpgn{\pdfdestname}}#2{\pdfoutlinetext}%
   1387  1.1  mrg   }
   1388  1.1  mrg   %
   1389  1.1  mrg   \def\pdfmakeoutlines{%
   1390  1.1  mrg     \begingroup
   1391  1.1  mrg       % Read toc silently, to get counts of subentries for \pdfoutline.
   1392  1.1  mrg       \def\partentry##1##2##3##4{}% ignore parts in the outlines
   1393  1.1  mrg       \def\numchapentry##1##2##3##4{%
   1394  1.1  mrg 	\def\thischapnum{##2}%
   1395  1.1  mrg 	\def\thissecnum{0}%
   1396  1.1  mrg 	\def\thissubsecnum{0}%
   1397  1.1  mrg       }%
   1398  1.1  mrg       \def\numsecentry##1##2##3##4{%
   1399  1.1  mrg 	\advancenumber{chap\thischapnum}%
   1400  1.1  mrg 	\def\thissecnum{##2}%
   1401  1.1  mrg 	\def\thissubsecnum{0}%
   1402  1.1  mrg       }%
   1403  1.1  mrg       \def\numsubsecentry##1##2##3##4{%
   1404  1.1  mrg 	\advancenumber{sec\thissecnum}%
   1405  1.1  mrg 	\def\thissubsecnum{##2}%
   1406  1.1  mrg       }%
   1407  1.1  mrg       \def\numsubsubsecentry##1##2##3##4{%
   1408  1.1  mrg 	\advancenumber{subsec\thissubsecnum}%
   1409  1.1  mrg       }%
   1410  1.1  mrg       \def\thischapnum{0}%
   1411  1.1  mrg       \def\thissecnum{0}%
   1412  1.1  mrg       \def\thissubsecnum{0}%
   1413  1.1  mrg       %
   1414  1.1  mrg       % use \def rather than \let here because we redefine \chapentry et
   1415  1.1  mrg       % al. a second time, below.
   1416  1.1  mrg       \def\appentry{\numchapentry}%
   1417  1.1  mrg       \def\appsecentry{\numsecentry}%
   1418  1.1  mrg       \def\appsubsecentry{\numsubsecentry}%
   1419  1.1  mrg       \def\appsubsubsecentry{\numsubsubsecentry}%
   1420  1.1  mrg       \def\unnchapentry{\numchapentry}%
   1421  1.1  mrg       \def\unnsecentry{\numsecentry}%
   1422  1.1  mrg       \def\unnsubsecentry{\numsubsecentry}%
   1423  1.1  mrg       \def\unnsubsubsecentry{\numsubsubsecentry}%
   1424  1.1  mrg       \readdatafile{toc}%
   1425  1.1  mrg       %
   1426  1.1  mrg       % Read toc second time, this time actually producing the outlines.
   1427  1.1  mrg       % The `-' means take the \expnumber as the absolute number of
   1428  1.1  mrg       % subentries, which we calculated on our first read of the .toc above.
   1429  1.1  mrg       %
   1430  1.1  mrg       % We use the node names as the destinations.
   1431  1.1  mrg       \def\numchapentry##1##2##3##4{%
   1432  1.1  mrg         \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}%
   1433  1.1  mrg       \def\numsecentry##1##2##3##4{%
   1434  1.1  mrg         \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}%
   1435  1.1  mrg       \def\numsubsecentry##1##2##3##4{%
   1436  1.1  mrg         \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}%
   1437  1.1  mrg       \def\numsubsubsecentry##1##2##3##4{% count is always zero
   1438  1.1  mrg         \dopdfoutline{##1}{}{##3}{##4}}%
   1439  1.1  mrg       %
   1440  1.1  mrg       % PDF outlines are displayed using system fonts, instead of
   1441  1.1  mrg       % document fonts.  Therefore we cannot use special characters,
   1442  1.1  mrg       % since the encoding is unknown.  For example, the eogonek from
   1443  1.1  mrg       % Latin 2 (0xea) gets translated to a | character.  Info from
   1444  1.1  mrg       % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
   1445  1.1  mrg       %
   1446  1.1  mrg       % TODO this right, we have to translate 8-bit characters to
   1447  1.1  mrg       % their "best" equivalent, based on the @documentencoding.  Too
   1448  1.1  mrg       % much work for too little return.  Just use the ASCII equivalents
   1449  1.1  mrg       % we use for the index sort strings.
   1450  1.1  mrg       %
   1451  1.1  mrg       \indexnofonts
   1452  1.1  mrg       \setupdatafile
   1453  1.1  mrg       % We can have normal brace characters in the PDF outlines, unlike
   1454  1.1  mrg       % Texinfo index files.  So set that up.
   1455  1.1  mrg       \def\{{\lbracecharliteral}%
   1456  1.1  mrg       \def\}{\rbracecharliteral}%
   1457  1.1  mrg       \catcode`\\=\active \otherbackslash
   1458  1.1  mrg       \input \tocreadfilename
   1459  1.1  mrg     \endgroup
   1460  1.1  mrg   }
   1461  1.1  mrg   {\catcode`[=1 \catcode`]=2
   1462  1.1  mrg    \catcode`{=\other \catcode`}=\other
   1463  1.1  mrg    \gdef\lbracecharliteral[{]%
   1464  1.1  mrg    \gdef\rbracecharliteral[}]%
   1465  1.1  mrg   ]
   1466  1.1  mrg   %
   1467  1.1  mrg   \def\skipspaces#1{\def\PP{#1}\def\D{|}%
   1468  1.1  mrg     \ifx\PP\D\let\nextsp\relax
   1469  1.1  mrg     \else\let\nextsp\skipspaces
   1470  1.1  mrg       \addtokens{\filename}{\PP}%
   1471  1.1  mrg       \advance\filenamelength by 1
   1472  1.1  mrg     \fi
   1473  1.1  mrg     \nextsp}
   1474  1.1  mrg   \def\getfilename#1{%
   1475  1.1  mrg     \filenamelength=0
   1476  1.1  mrg     % If we don't expand the argument now, \skipspaces will get
   1477  1.1  mrg     % snagged on things like "@value{foo}".
   1478  1.1  mrg     \edef\temp{#1}%
   1479  1.1  mrg     \expandafter\skipspaces\temp|\relax
   1480  1.1  mrg   }
   1481  1.1  mrg   \ifnum\pdftexversion < 14
   1482  1.1  mrg     \let \startlink \pdfannotlink
   1483  1.1  mrg   \else
   1484  1.1  mrg     \let \startlink \pdfstartlink
   1485  1.1  mrg   \fi
   1486  1.1  mrg   % make a live url in pdf output.
   1487  1.1  mrg   \def\pdfurl#1{%
   1488  1.1  mrg     \begingroup
   1489  1.1  mrg       % it seems we really need yet another set of dummies; have not
   1490  1.1  mrg       % tried to figure out what each command should do in the context
   1491  1.1  mrg       % of @url.  for now, just make @/ a no-op, that's the only one
   1492  1.1  mrg       % people have actually reported a problem with.
   1493  1.1  mrg       %
   1494  1.1  mrg       \normalturnoffactive
   1495  1.1  mrg       \def\@{@}%
   1496  1.1  mrg       \let\/=\empty
   1497  1.1  mrg       \makevalueexpandable
   1498  1.1  mrg       % do we want to go so far as to use \indexnofonts instead of just
   1499  1.1  mrg       % special-casing \var here?
   1500  1.1  mrg       \def\var##1{##1}%
   1501  1.1  mrg       %
   1502  1.1  mrg       \leavevmode\setcolor{\urlcolor}%
   1503  1.1  mrg       \startlink attr{/Border [0 0 0]}%
   1504  1.1  mrg         user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
   1505  1.1  mrg     \endgroup}
   1506  1.1  mrg   % \pdfgettoks - Surround page numbers in #1 with @pdflink.  #1 may
   1507  1.1  mrg   % be a simple number, or a list of numbers in the case of an index
   1508  1.1  mrg   % entry.
   1509  1.1  mrg   \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
   1510  1.1  mrg   \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
   1511  1.1  mrg   \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
   1512  1.1  mrg   \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
   1513  1.1  mrg   \def\maketoks{%
   1514  1.1  mrg     \expandafter\poptoks\the\toksA|ENDTOKS|\relax
   1515  1.1  mrg     \ifx\first0\adn0
   1516  1.1  mrg     \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
   1517  1.1  mrg     \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
   1518  1.1  mrg     \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
   1519  1.1  mrg     \else
   1520  1.1  mrg       \ifnum0=\countA\else\makelink\fi
   1521  1.1  mrg       \ifx\first.\let\next=\done\else
   1522  1.1  mrg         \let\next=\maketoks
   1523  1.1  mrg         \addtokens{\toksB}{\the\toksD}
   1524  1.1  mrg         \ifx\first,\addtokens{\toksB}{\space}\fi
   1525  1.1  mrg       \fi
   1526  1.1  mrg     \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
   1527  1.1  mrg     \next}
   1528  1.1  mrg   \def\makelink{\addtokens{\toksB}%
   1529  1.1  mrg     {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
   1530  1.1  mrg   \def\pdflink#1{%
   1531  1.1  mrg     \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
   1532  1.1  mrg     \setcolor{\linkcolor}#1\endlink}
   1533  1.1  mrg   \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
   1534  1.1  mrg \else
   1535  1.1  mrg   % non-pdf mode
   1536  1.1  mrg   \let\pdfmkdest = \gobble
   1537  1.1  mrg   \let\pdfurl = \gobble
   1538  1.1  mrg   \let\endlink = \relax
   1539  1.1  mrg   \let\setcolor = \gobble
   1540  1.1  mrg   \let\pdfsetcolor = \gobble
   1541  1.1  mrg   \let\pdfmakeoutlines = \relax
   1542  1.1  mrg \fi  % \ifx\pdfoutput
   1543  1.1  mrg 
   1544  1.1  mrg %
   1545  1.1  mrg % For XeTeX
   1546  1.1  mrg %
   1547  1.1  mrg \ifx\XeTeXrevision\thisisundefined
   1548  1.1  mrg \else
   1549  1.1  mrg   %
   1550  1.1  mrg   % XeTeX version check
   1551  1.1  mrg   %
   1552  1.1  mrg   \ifnum\strcmp{\the\XeTeXversion\XeTeXrevision}{0.99996}>-1
   1553  1.1  mrg     % TeX Live 2016 contains XeTeX 0.99996 and xdvipdfmx 20160307.
   1554  1.1  mrg     % It can use the `dvipdfmx:config' special (from TeX Live SVN r40941).
   1555  1.1  mrg     % For avoiding PDF destination name replacement, we use this special
   1556  1.1  mrg     % instead of xdvipdfmx's command line option `-C 0x0010'.
   1557  1.1  mrg     \special{dvipdfmx:config C 0x0010}
   1558  1.1  mrg     % XeTeX 0.99995+ comes with xdvipdfmx 20160307+.
   1559  1.1  mrg     % It can handle Unicode destination names for PDF.
   1560  1.1  mrg     \txiuseunicodedestnametrue
   1561  1.1  mrg   \else
   1562  1.1  mrg     % XeTeX < 0.99996 (TeX Live < 2016) cannot use the
   1563  1.1  mrg     % `dvipdfmx:config' special.
   1564  1.1  mrg     % So for avoiding PDF destination name replacement,
   1565  1.1  mrg     % xdvipdfmx's command line option `-C 0x0010' is necessary.
   1566  1.1  mrg     %
   1567  1.1  mrg     % XeTeX < 0.99995 can not handle Unicode destination names for PDF
   1568  1.1  mrg     % because xdvipdfmx 20150315 has a UTF-16 conversion issue.
   1569  1.1  mrg     % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753).
   1570  1.1  mrg     \txiuseunicodedestnamefalse
   1571  1.1  mrg   \fi
   1572  1.1  mrg   %
   1573  1.1  mrg   % Color support
   1574  1.1  mrg   %
   1575  1.1  mrg   \def\rgbDarkRed{0.50 0.09 0.12}
   1576  1.1  mrg   \def\rgbBlack{0 0 0}
   1577  1.1  mrg   %
   1578  1.1  mrg   \def\pdfsetcolor#1{\special{pdf:scolor [#1]}}
   1579  1.1  mrg   %
   1580  1.1  mrg   % Set color, and create a mark which defines \thiscolor accordingly,
   1581  1.1  mrg   % so that \makeheadline knows which color to restore.
   1582  1.1  mrg   \def\setcolor#1{%
   1583  1.1  mrg     \xdef\currentcolordefs{\gdef\noexpand\thiscolor{#1}}%
   1584  1.1  mrg     \domark
   1585  1.1  mrg     \pdfsetcolor{#1}%
   1586  1.1  mrg   }
   1587  1.1  mrg   %
   1588  1.1  mrg   \def\maincolor{\rgbBlack}
   1589  1.1  mrg   \pdfsetcolor{\maincolor}
   1590  1.1  mrg   \edef\thiscolor{\maincolor}
   1591  1.1  mrg   \def\currentcolordefs{}
   1592  1.1  mrg   %
   1593  1.1  mrg   \def\makefootline{%
   1594  1.1  mrg     \baselineskip24pt
   1595  1.1  mrg     \line{\pdfsetcolor{\maincolor}\the\footline}%
   1596  1.1  mrg   }
   1597  1.1  mrg   %
   1598  1.1  mrg   \def\makeheadline{%
   1599  1.1  mrg     \vbox to 0pt{%
   1600  1.1  mrg       \vskip-22.5pt
   1601  1.1  mrg       \line{%
   1602  1.1  mrg         \vbox to8.5pt{}%
   1603  1.1  mrg         % Extract \thiscolor definition from the marks.
   1604  1.1  mrg         \getcolormarks
   1605  1.1  mrg         % Typeset the headline with \maincolor, then restore the color.
   1606  1.1  mrg         \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
   1607  1.1  mrg       }%
   1608  1.1  mrg       \vss
   1609  1.1  mrg     }%
   1610  1.1  mrg     \nointerlineskip
   1611  1.1  mrg   }
   1612  1.1  mrg   %
   1613  1.1  mrg   % PDF outline support
   1614  1.1  mrg   %
   1615  1.1  mrg   % Emulate pdfTeX primitive
   1616  1.1  mrg   \def\pdfdest name#1 xyz{%
   1617  1.1  mrg     \special{pdf:dest (#1) [@thispage /XYZ @xpos @ypos null]}%
   1618  1.1  mrg   }
   1619  1.1  mrg   %
   1620  1.1  mrg   \def\setpdfdestname#1{{%
   1621  1.1  mrg     % We have to set dummies so commands such as @code, and characters
   1622  1.1  mrg     % such as \, aren't expanded when present in a section title.
   1623  1.1  mrg     \indexnofonts
   1624  1.1  mrg     \makevalueexpandable
   1625  1.1  mrg     \turnoffactive
   1626  1.1  mrg     \iftxiuseunicodedestname
   1627  1.1  mrg       % Pass through Unicode characters.
   1628  1.1  mrg     \else
   1629  1.1  mrg       % Use ASCII approximations in destination names.
   1630  1.1  mrg       \passthroughcharsfalse
   1631  1.1  mrg     \fi
   1632  1.1  mrg     \def\pdfdestname{#1}%
   1633  1.1  mrg     \txiescapepdf\pdfdestname
   1634  1.1  mrg   }}
   1635  1.1  mrg   %
   1636  1.1  mrg   \def\setpdfoutlinetext#1{{%
   1637  1.1  mrg     \turnoffactive
   1638  1.1  mrg     % Always use Unicode characters in title texts.
   1639  1.1  mrg     \def\pdfoutlinetext{#1}%
   1640  1.1  mrg     % For XeTeX, xdvipdfmx converts to UTF-16.
   1641  1.1  mrg     % So we do not convert.
   1642  1.1  mrg     \txiescapepdf\pdfoutlinetext
   1643  1.1  mrg   }}
   1644  1.1  mrg   %
   1645  1.1  mrg   \def\pdfmkdest#1{%
   1646  1.1  mrg     \setpdfdestname{#1}%
   1647  1.1  mrg     \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
   1648  1.1  mrg   }
   1649  1.1  mrg   %
   1650  1.1  mrg   % by default, use black for everything.
   1651  1.1  mrg   \def\urlcolor{\rgbBlack}
   1652  1.1  mrg   \def\linkcolor{\rgbBlack}
   1653  1.1  mrg   \def\endlink{\setcolor{\maincolor}\pdfendlink}
   1654  1.1  mrg   %
   1655  1.1  mrg   \def\dopdfoutline#1#2#3#4{%
   1656  1.1  mrg     \setpdfoutlinetext{#1}
   1657  1.1  mrg     \setpdfdestname{#3}
   1658  1.1  mrg     \ifx\pdfdestname\empty
   1659  1.1  mrg       \def\pdfdestname{#4}%
   1660  1.1  mrg     \fi
   1661  1.1  mrg     %
   1662  1.1  mrg     \special{pdf:out [-] #2 << /Title (\pdfoutlinetext) /A
   1663  1.1  mrg       << /S /GoTo /D (\pdfdestname) >> >> }%
   1664  1.1  mrg   }
   1665  1.1  mrg   %
   1666  1.1  mrg   \def\pdfmakeoutlines{%
   1667  1.1  mrg     \begingroup
   1668  1.1  mrg       %
   1669  1.1  mrg       % For XeTeX, counts of subentries are not necessary.
   1670  1.1  mrg       % Therefore, we read toc only once.
   1671  1.1  mrg       %
   1672  1.1  mrg       % We use node names as destinations.
   1673  1.1  mrg       \def\partentry##1##2##3##4{}% ignore parts in the outlines
   1674  1.1  mrg       \def\numchapentry##1##2##3##4{%
   1675  1.1  mrg         \dopdfoutline{##1}{1}{##3}{##4}}%
   1676  1.1  mrg       \def\numsecentry##1##2##3##4{%
   1677  1.1  mrg         \dopdfoutline{##1}{2}{##3}{##4}}%
   1678  1.1  mrg       \def\numsubsecentry##1##2##3##4{%
   1679  1.1  mrg         \dopdfoutline{##1}{3}{##3}{##4}}%
   1680  1.1  mrg       \def\numsubsubsecentry##1##2##3##4{%
   1681  1.1  mrg         \dopdfoutline{##1}{4}{##3}{##4}}%
   1682  1.1  mrg       %
   1683  1.1  mrg       \let\appentry\numchapentry%
   1684  1.1  mrg       \let\appsecentry\numsecentry%
   1685  1.1  mrg       \let\appsubsecentry\numsubsecentry%
   1686  1.1  mrg       \let\appsubsubsecentry\numsubsubsecentry%
   1687  1.1  mrg       \let\unnchapentry\numchapentry%
   1688  1.1  mrg       \let\unnsecentry\numsecentry%
   1689  1.1  mrg       \let\unnsubsecentry\numsubsecentry%
   1690  1.1  mrg       \let\unnsubsubsecentry\numsubsubsecentry%
   1691  1.1  mrg       %
   1692  1.1  mrg       % For XeTeX, xdvipdfmx converts strings to UTF-16.
   1693  1.1  mrg       % Therefore, the encoding and the language may not be considered.
   1694  1.1  mrg       %
   1695  1.1  mrg       \indexnofonts
   1696  1.1  mrg       \setupdatafile
   1697  1.1  mrg       % We can have normal brace characters in the PDF outlines, unlike
   1698  1.1  mrg       % Texinfo index files.  So set that up.
   1699  1.1  mrg       \def\{{\lbracecharliteral}%
   1700  1.1  mrg       \def\}{\rbracecharliteral}%
   1701  1.1  mrg       \catcode`\\=\active \otherbackslash
   1702  1.1  mrg       \input \tocreadfilename
   1703  1.1  mrg     \endgroup
   1704  1.1  mrg   }
   1705  1.1  mrg   {\catcode`[=1 \catcode`]=2
   1706  1.1  mrg    \catcode`{=\other \catcode`}=\other
   1707  1.1  mrg    \gdef\lbracecharliteral[{]%
   1708  1.1  mrg    \gdef\rbracecharliteral[}]%
   1709  1.1  mrg   ]
   1710  1.1  mrg 
   1711  1.1  mrg   \special{pdf:docview << /PageMode /UseOutlines >> }
   1712  1.1  mrg   % ``\special{pdf:tounicode ...}'' is not necessary
   1713  1.1  mrg   % because xdvipdfmx converts strings from UTF-8 to UTF-16 without it.
   1714  1.1  mrg   % However, due to a UTF-16 conversion issue of xdvipdfmx 20150315,
   1715  1.1  mrg   % ``\special{pdf:dest ...}'' cannot handle non-ASCII strings.
   1716  1.1  mrg   % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753).
   1717  1.1  mrg %
   1718  1.1  mrg   \def\skipspaces#1{\def\PP{#1}\def\D{|}%
   1719  1.1  mrg     \ifx\PP\D\let\nextsp\relax
   1720  1.1  mrg     \else\let\nextsp\skipspaces
   1721  1.1  mrg       \addtokens{\filename}{\PP}%
   1722  1.1  mrg       \advance\filenamelength by 1
   1723  1.1  mrg     \fi
   1724  1.1  mrg     \nextsp}
   1725  1.1  mrg   \def\getfilename#1{%
   1726  1.1  mrg     \filenamelength=0
   1727  1.1  mrg     % If we don't expand the argument now, \skipspaces will get
   1728  1.1  mrg     % snagged on things like "@value{foo}".
   1729  1.1  mrg     \edef\temp{#1}%
   1730  1.1  mrg     \expandafter\skipspaces\temp|\relax
   1731  1.1  mrg   }
   1732  1.1  mrg   % make a live url in pdf output.
   1733  1.1  mrg   \def\pdfurl#1{%
   1734  1.1  mrg     \begingroup
   1735  1.1  mrg       % it seems we really need yet another set of dummies; have not
   1736  1.1  mrg       % tried to figure out what each command should do in the context
   1737  1.1  mrg       % of @url.  for now, just make @/ a no-op, that's the only one
   1738  1.1  mrg       % people have actually reported a problem with.
   1739  1.1  mrg       %
   1740  1.1  mrg       \normalturnoffactive
   1741  1.1  mrg       \def\@{@}%
   1742  1.1  mrg       \let\/=\empty
   1743  1.1  mrg       \makevalueexpandable
   1744  1.1  mrg       % do we want to go so far as to use \indexnofonts instead of just
   1745  1.1  mrg       % special-casing \var here?
   1746  1.1  mrg       \def\var##1{##1}%
   1747  1.1  mrg       %
   1748  1.1  mrg       \leavevmode\setcolor{\urlcolor}%
   1749  1.1  mrg       \special{pdf:bann << /Border [0 0 0]
   1750  1.1  mrg         /Subtype /Link /A << /S /URI /URI (#1) >> >>}%
   1751  1.1  mrg     \endgroup}
   1752  1.1  mrg   \def\endlink{\setcolor{\maincolor}\special{pdf:eann}}
   1753  1.1  mrg   \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
   1754  1.1  mrg   \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
   1755  1.1  mrg   \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
   1756  1.1  mrg   \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
   1757  1.1  mrg   \def\maketoks{%
   1758  1.1  mrg     \expandafter\poptoks\the\toksA|ENDTOKS|\relax
   1759  1.1  mrg     \ifx\first0\adn0
   1760  1.1  mrg     \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
   1761  1.1  mrg     \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
   1762  1.1  mrg     \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
   1763  1.1  mrg     \else
   1764  1.1  mrg       \ifnum0=\countA\else\makelink\fi
   1765  1.1  mrg       \ifx\first.\let\next=\done\else
   1766  1.1  mrg         \let\next=\maketoks
   1767  1.1  mrg         \addtokens{\toksB}{\the\toksD}
   1768  1.1  mrg         \ifx\first,\addtokens{\toksB}{\space}\fi
   1769  1.1  mrg       \fi
   1770  1.1  mrg     \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
   1771  1.1  mrg     \next}
   1772  1.1  mrg   \def\makelink{\addtokens{\toksB}%
   1773  1.1  mrg     {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
   1774  1.1  mrg   \def\pdflink#1{%
   1775  1.1  mrg     \special{pdf:bann << /Border [0 0 0]
   1776  1.1  mrg       /Type /Annot /Subtype /Link /A << /S /GoTo /D (#1) >> >>}%
   1777  1.1  mrg     \setcolor{\linkcolor}#1\endlink}
   1778  1.1  mrg   \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
   1779  1.1  mrg %
   1780  1.1  mrg   %
   1781  1.1  mrg   % @image support
   1782  1.1  mrg   %
   1783  1.1  mrg   % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
   1784  1.1  mrg   \def\doxeteximage#1#2#3{%
   1785  1.1  mrg     \def\xeteximagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
   1786  1.1  mrg     \def\xeteximageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
   1787  1.1  mrg     %
   1788  1.1  mrg     % XeTeX (and the PDF format) supports .pdf, .png, .jpg (among
   1789  1.1  mrg     % others).  Let's try in that order, PDF first since if
   1790  1.1  mrg     % someone has a scalable image, presumably better to use that than a
   1791  1.1  mrg     % bitmap.
   1792  1.1  mrg     \let\xeteximgext=\empty
   1793  1.1  mrg     \begingroup
   1794  1.1  mrg       \openin 1 #1.pdf \ifeof 1
   1795  1.1  mrg         \openin 1 #1.PDF \ifeof 1
   1796  1.1  mrg           \openin 1 #1.png \ifeof 1
   1797  1.1  mrg             \openin 1 #1.jpg \ifeof 1
   1798  1.1  mrg               \openin 1 #1.jpeg \ifeof 1
   1799  1.1  mrg                 \openin 1 #1.JPG \ifeof 1
   1800  1.1  mrg                   \errmessage{Could not find image file #1 for XeTeX}%
   1801  1.1  mrg                 \else \gdef\xeteximgext{JPG}%
   1802  1.1  mrg                 \fi
   1803  1.1  mrg               \else \gdef\xeteximgext{jpeg}%
   1804  1.1  mrg               \fi
   1805  1.1  mrg             \else \gdef\xeteximgext{jpg}%
   1806  1.1  mrg             \fi
   1807  1.1  mrg           \else \gdef\xeteximgext{png}%
   1808  1.1  mrg           \fi
   1809  1.1  mrg         \else \gdef\xeteximgext{PDF}%
   1810  1.1  mrg         \fi
   1811  1.1  mrg       \else \gdef\xeteximgext{pdf}%
   1812  1.1  mrg       \fi
   1813  1.1  mrg       \closein 1
   1814  1.1  mrg     \endgroup
   1815  1.1  mrg     %
   1816  1.1  mrg     \def\xetexpdfext{pdf}%
   1817  1.1  mrg     \ifx\xeteximgext\xetexpdfext
   1818  1.1  mrg       \XeTeXpdffile "#1".\xeteximgext ""
   1819  1.1  mrg     \else
   1820  1.1  mrg       \def\xetexpdfext{PDF}%
   1821  1.1  mrg       \ifx\xeteximgext\xetexpdfext
   1822  1.1  mrg         \XeTeXpdffile "#1".\xeteximgext ""
   1823  1.1  mrg       \else
   1824  1.1  mrg         \XeTeXpicfile "#1".\xeteximgext ""
   1825  1.1  mrg       \fi
   1826  1.1  mrg     \fi
   1827  1.1  mrg     \ifdim \wd0 >0pt width \xeteximagewidth \fi
   1828  1.1  mrg     \ifdim \wd2 >0pt height \xeteximageheight \fi \relax
   1829  1.1  mrg   }
   1830  1.1  mrg \fi
   1831  1.1  mrg 
   1832  1.1  mrg 
   1833  1.1  mrg %
   1834  1.1  mrg \message{fonts,}
   1835  1.1  mrg 
   1836  1.1  mrg % Set the baselineskip to #1, and the lineskip and strut size
   1837  1.1  mrg % correspondingly.  There is no deep meaning behind these magic numbers
   1838  1.1  mrg % used as factors; they just match (closely enough) what Knuth defined.
   1839  1.1  mrg %
   1840  1.1  mrg \def\lineskipfactor{.08333}
   1841  1.1  mrg \def\strutheightpercent{.70833}
   1842  1.1  mrg \def\strutdepthpercent {.29167}
   1843  1.1  mrg %
   1844  1.1  mrg % can get a sort of poor man's double spacing by redefining this.
   1845  1.1  mrg \def\baselinefactor{1}
   1846  1.1  mrg %
   1847  1.1  mrg \newdimen\textleading
   1848  1.1  mrg \def\setleading#1{%
   1849  1.1  mrg   \dimen0 = #1\relax
   1850  1.1  mrg   \normalbaselineskip = \baselinefactor\dimen0
   1851  1.1  mrg   \normallineskip = \lineskipfactor\normalbaselineskip
   1852  1.1  mrg   \normalbaselines
   1853  1.1  mrg   \setbox\strutbox =\hbox{%
   1854  1.1  mrg     \vrule width0pt height\strutheightpercent\baselineskip
   1855  1.1  mrg                     depth \strutdepthpercent \baselineskip
   1856  1.1  mrg   }%
   1857  1.1  mrg }
   1858  1.1  mrg 
   1859  1.1  mrg % PDF CMaps.  See also LaTeX's t1.cmap.
   1860  1.1  mrg %
   1861  1.1  mrg % do nothing with this by default.
   1862  1.1  mrg \expandafter\let\csname cmapOT1\endcsname\gobble
   1863  1.1  mrg \expandafter\let\csname cmapOT1IT\endcsname\gobble
   1864  1.1  mrg \expandafter\let\csname cmapOT1TT\endcsname\gobble
   1865  1.1  mrg 
   1866  1.1  mrg % if we are producing pdf, and we have \pdffontattr, then define cmaps.
   1867  1.1  mrg % (\pdffontattr was introduced many years ago, but people still run
   1868  1.1  mrg % older pdftex's; it's easy to conditionalize, so we do.)
   1869  1.1  mrg \ifpdf \ifx\pdffontattr\thisisundefined \else
   1870  1.1  mrg   \begingroup
   1871  1.1  mrg     \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
   1872  1.1  mrg     \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
   1873  1.1  mrg %%DocumentNeededResources: ProcSet (CIDInit)
   1874  1.1  mrg %%IncludeResource: ProcSet (CIDInit)
   1875  1.1  mrg %%BeginResource: CMap (TeX-OT1-0)
   1876  1.1  mrg %%Title: (TeX-OT1-0 TeX OT1 0)
   1877  1.1  mrg %%Version: 1.000
   1878  1.1  mrg %%EndComments
   1879  1.1  mrg /CIDInit /ProcSet findresource begin
   1880  1.1  mrg 12 dict begin
   1881  1.1  mrg begincmap
   1882  1.1  mrg /CIDSystemInfo
   1883  1.1  mrg << /Registry (TeX)
   1884  1.1  mrg /Ordering (OT1)
   1885  1.1  mrg /Supplement 0
   1886  1.1  mrg >> def
   1887  1.1  mrg /CMapName /TeX-OT1-0 def
   1888  1.1  mrg /CMapType 2 def
   1889  1.1  mrg 1 begincodespacerange
   1890  1.1  mrg <00> <7F>
   1891  1.1  mrg endcodespacerange
   1892  1.1  mrg 8 beginbfrange
   1893  1.1  mrg <00> <01> <0393>
   1894  1.1  mrg <09> <0A> <03A8>
   1895  1.1  mrg <23> <26> <0023>
   1896  1.1  mrg <28> <3B> <0028>
   1897  1.1  mrg <3F> <5B> <003F>
   1898  1.1  mrg <5D> <5E> <005D>
   1899  1.1  mrg <61> <7A> <0061>
   1900  1.1  mrg <7B> <7C> <2013>
   1901  1.1  mrg endbfrange
   1902  1.1  mrg 40 beginbfchar
   1903  1.1  mrg <02> <0398>
   1904  1.1  mrg <03> <039B>
   1905  1.1  mrg <04> <039E>
   1906  1.1  mrg <05> <03A0>
   1907  1.1  mrg <06> <03A3>
   1908  1.1  mrg <07> <03D2>
   1909  1.1  mrg <08> <03A6>
   1910  1.1  mrg <0B> <00660066>
   1911  1.1  mrg <0C> <00660069>
   1912  1.1  mrg <0D> <0066006C>
   1913  1.1  mrg <0E> <006600660069>
   1914  1.1  mrg <0F> <00660066006C>
   1915  1.1  mrg <10> <0131>
   1916  1.1  mrg <11> <0237>
   1917  1.1  mrg <12> <0060>
   1918  1.1  mrg <13> <00B4>
   1919  1.1  mrg <14> <02C7>
   1920  1.1  mrg <15> <02D8>
   1921  1.1  mrg <16> <00AF>
   1922  1.1  mrg <17> <02DA>
   1923  1.1  mrg <18> <00B8>
   1924  1.1  mrg <19> <00DF>
   1925  1.1  mrg <1A> <00E6>
   1926  1.1  mrg <1B> <0153>
   1927  1.1  mrg <1C> <00F8>
   1928  1.1  mrg <1D> <00C6>
   1929  1.1  mrg <1E> <0152>
   1930  1.1  mrg <1F> <00D8>
   1931  1.1  mrg <21> <0021>
   1932  1.1  mrg <22> <201D>
   1933  1.1  mrg <27> <2019>
   1934  1.1  mrg <3C> <00A1>
   1935  1.1  mrg <3D> <003D>
   1936  1.1  mrg <3E> <00BF>
   1937  1.1  mrg <5C> <201C>
   1938  1.1  mrg <5F> <02D9>
   1939  1.1  mrg <60> <2018>
   1940  1.1  mrg <7D> <02DD>
   1941  1.1  mrg <7E> <007E>
   1942  1.1  mrg <7F> <00A8>
   1943  1.1  mrg endbfchar
   1944  1.1  mrg endcmap
   1945  1.1  mrg CMapName currentdict /CMap defineresource pop
   1946  1.1  mrg end
   1947  1.1  mrg end
   1948  1.1  mrg %%EndResource
   1949  1.1  mrg %%EOF
   1950  1.1  mrg     }\endgroup
   1951  1.1  mrg   \expandafter\edef\csname cmapOT1\endcsname#1{%
   1952  1.1  mrg     \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
   1953  1.1  mrg   }%
   1954  1.1  mrg %
   1955  1.1  mrg % \cmapOT1IT
   1956  1.1  mrg   \begingroup
   1957  1.1  mrg     \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
   1958  1.1  mrg     \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
   1959  1.1  mrg %%DocumentNeededResources: ProcSet (CIDInit)
   1960  1.1  mrg %%IncludeResource: ProcSet (CIDInit)
   1961  1.1  mrg %%BeginResource: CMap (TeX-OT1IT-0)
   1962  1.1  mrg %%Title: (TeX-OT1IT-0 TeX OT1IT 0)
   1963  1.1  mrg %%Version: 1.000
   1964  1.1  mrg %%EndComments
   1965  1.1  mrg /CIDInit /ProcSet findresource begin
   1966  1.1  mrg 12 dict begin
   1967  1.1  mrg begincmap
   1968  1.1  mrg /CIDSystemInfo
   1969  1.1  mrg << /Registry (TeX)
   1970  1.1  mrg /Ordering (OT1IT)
   1971  1.1  mrg /Supplement 0
   1972  1.1  mrg >> def
   1973  1.1  mrg /CMapName /TeX-OT1IT-0 def
   1974  1.1  mrg /CMapType 2 def
   1975  1.1  mrg 1 begincodespacerange
   1976  1.1  mrg <00> <7F>
   1977  1.1  mrg endcodespacerange
   1978  1.1  mrg 8 beginbfrange
   1979  1.1  mrg <00> <01> <0393>
   1980  1.1  mrg <09> <0A> <03A8>
   1981  1.1  mrg <25> <26> <0025>
   1982  1.1  mrg <28> <3B> <0028>
   1983  1.1  mrg <3F> <5B> <003F>
   1984  1.1  mrg <5D> <5E> <005D>
   1985  1.1  mrg <61> <7A> <0061>
   1986  1.1  mrg <7B> <7C> <2013>
   1987  1.1  mrg endbfrange
   1988  1.1  mrg 42 beginbfchar
   1989  1.1  mrg <02> <0398>
   1990  1.1  mrg <03> <039B>
   1991  1.1  mrg <04> <039E>
   1992  1.1  mrg <05> <03A0>
   1993  1.1  mrg <06> <03A3>
   1994  1.1  mrg <07> <03D2>
   1995  1.1  mrg <08> <03A6>
   1996  1.1  mrg <0B> <00660066>
   1997  1.1  mrg <0C> <00660069>
   1998  1.1  mrg <0D> <0066006C>
   1999  1.1  mrg <0E> <006600660069>
   2000  1.1  mrg <0F> <00660066006C>
   2001  1.1  mrg <10> <0131>
   2002  1.1  mrg <11> <0237>
   2003  1.1  mrg <12> <0060>
   2004  1.1  mrg <13> <00B4>
   2005  1.1  mrg <14> <02C7>
   2006  1.1  mrg <15> <02D8>
   2007  1.1  mrg <16> <00AF>
   2008  1.1  mrg <17> <02DA>
   2009  1.1  mrg <18> <00B8>
   2010  1.1  mrg <19> <00DF>
   2011  1.1  mrg <1A> <00E6>
   2012  1.1  mrg <1B> <0153>
   2013  1.1  mrg <1C> <00F8>
   2014  1.1  mrg <1D> <00C6>
   2015  1.1  mrg <1E> <0152>
   2016  1.1  mrg <1F> <00D8>
   2017  1.1  mrg <21> <0021>
   2018  1.1  mrg <22> <201D>
   2019  1.1  mrg <23> <0023>
   2020  1.1  mrg <24> <00A3>
   2021  1.1  mrg <27> <2019>
   2022  1.1  mrg <3C> <00A1>
   2023  1.1  mrg <3D> <003D>
   2024  1.1  mrg <3E> <00BF>
   2025  1.1  mrg <5C> <201C>
   2026  1.1  mrg <5F> <02D9>
   2027  1.1  mrg <60> <2018>
   2028  1.1  mrg <7D> <02DD>
   2029  1.1  mrg <7E> <007E>
   2030  1.1  mrg <7F> <00A8>
   2031  1.1  mrg endbfchar
   2032  1.1  mrg endcmap
   2033  1.1  mrg CMapName currentdict /CMap defineresource pop
   2034  1.1  mrg end
   2035  1.1  mrg end
   2036  1.1  mrg %%EndResource
   2037  1.1  mrg %%EOF
   2038  1.1  mrg     }\endgroup
   2039  1.1  mrg   \expandafter\edef\csname cmapOT1IT\endcsname#1{%
   2040  1.1  mrg     \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
   2041  1.1  mrg   }%
   2042  1.1  mrg %
   2043  1.1  mrg % \cmapOT1TT
   2044  1.1  mrg   \begingroup
   2045  1.1  mrg     \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
   2046  1.1  mrg     \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
   2047  1.1  mrg %%DocumentNeededResources: ProcSet (CIDInit)
   2048  1.1  mrg %%IncludeResource: ProcSet (CIDInit)
   2049  1.1  mrg %%BeginResource: CMap (TeX-OT1TT-0)
   2050  1.1  mrg %%Title: (TeX-OT1TT-0 TeX OT1TT 0)
   2051  1.1  mrg %%Version: 1.000
   2052  1.1  mrg %%EndComments
   2053  1.1  mrg /CIDInit /ProcSet findresource begin
   2054  1.1  mrg 12 dict begin
   2055  1.1  mrg begincmap
   2056  1.1  mrg /CIDSystemInfo
   2057  1.1  mrg << /Registry (TeX)
   2058  1.1  mrg /Ordering (OT1TT)
   2059  1.1  mrg /Supplement 0
   2060  1.1  mrg >> def
   2061  1.1  mrg /CMapName /TeX-OT1TT-0 def
   2062  1.1  mrg /CMapType 2 def
   2063  1.1  mrg 1 begincodespacerange
   2064  1.1  mrg <00> <7F>
   2065  1.1  mrg endcodespacerange
   2066  1.1  mrg 5 beginbfrange
   2067  1.1  mrg <00> <01> <0393>
   2068  1.1  mrg <09> <0A> <03A8>
   2069  1.1  mrg <21> <26> <0021>
   2070  1.1  mrg <28> <5F> <0028>
   2071  1.1  mrg <61> <7E> <0061>
   2072  1.1  mrg endbfrange
   2073  1.1  mrg 32 beginbfchar
   2074  1.1  mrg <02> <0398>
   2075  1.1  mrg <03> <039B>
   2076  1.1  mrg <04> <039E>
   2077  1.1  mrg <05> <03A0>
   2078  1.1  mrg <06> <03A3>
   2079  1.1  mrg <07> <03D2>
   2080  1.1  mrg <08> <03A6>
   2081  1.1  mrg <0B> <2191>
   2082  1.1  mrg <0C> <2193>
   2083  1.1  mrg <0D> <0027>
   2084  1.1  mrg <0E> <00A1>
   2085  1.1  mrg <0F> <00BF>
   2086  1.1  mrg <10> <0131>
   2087  1.1  mrg <11> <0237>
   2088  1.1  mrg <12> <0060>
   2089  1.1  mrg <13> <00B4>
   2090  1.1  mrg <14> <02C7>
   2091  1.1  mrg <15> <02D8>
   2092  1.1  mrg <16> <00AF>
   2093  1.1  mrg <17> <02DA>
   2094  1.1  mrg <18> <00B8>
   2095  1.1  mrg <19> <00DF>
   2096  1.1  mrg <1A> <00E6>
   2097  1.1  mrg <1B> <0153>
   2098  1.1  mrg <1C> <00F8>
   2099  1.1  mrg <1D> <00C6>
   2100  1.1  mrg <1E> <0152>
   2101  1.1  mrg <1F> <00D8>
   2102  1.1  mrg <20> <2423>
   2103  1.1  mrg <27> <2019>
   2104  1.1  mrg <60> <2018>
   2105  1.1  mrg <7F> <00A8>
   2106  1.1  mrg endbfchar
   2107  1.1  mrg endcmap
   2108  1.1  mrg CMapName currentdict /CMap defineresource pop
   2109  1.1  mrg end
   2110  1.1  mrg end
   2111  1.1  mrg %%EndResource
   2112  1.1  mrg %%EOF
   2113  1.1  mrg     }\endgroup
   2114  1.1  mrg   \expandafter\edef\csname cmapOT1TT\endcsname#1{%
   2115  1.1  mrg     \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
   2116  1.1  mrg   }%
   2117  1.1  mrg \fi\fi
   2118  1.1  mrg 
   2119  1.1  mrg 
   2120  1.1  mrg % Set the font macro #1 to the font named \fontprefix#2.
   2121  1.1  mrg % #3 is the font's design size, #4 is a scale factor, #5 is the CMap
   2122  1.1  mrg % encoding (only OT1, OT1IT and OT1TT are allowed, or empty to omit).
   2123  1.1  mrg % Example:
   2124  1.1  mrg % #1 = \textrm
   2125  1.1  mrg % #2 = \rmshape
   2126  1.1  mrg % #3 = 10
   2127  1.1  mrg % #4 = \mainmagstep
   2128  1.1  mrg % #5 = OT1
   2129  1.1  mrg %
   2130  1.1  mrg \def\setfont#1#2#3#4#5{%
   2131  1.1  mrg   \font#1=\fontprefix#2#3 scaled #4
   2132  1.1  mrg   \csname cmap#5\endcsname#1%
   2133  1.1  mrg }
   2134  1.1  mrg % This is what gets called when #5 of \setfont is empty.
   2135  1.1  mrg \let\cmap\gobble
   2136  1.1  mrg %
   2137  1.1  mrg % (end of cmaps)
   2138  1.1  mrg 
   2139  1.1  mrg % Use cm as the default font prefix.
   2140  1.1  mrg % To specify the font prefix, you must define \fontprefix
   2141  1.1  mrg % before you read in texinfo.tex.
   2142  1.1  mrg \ifx\fontprefix\thisisundefined
   2143  1.1  mrg \def\fontprefix{cm}
   2144  1.1  mrg \fi
   2145  1.1  mrg % Support font families that don't use the same naming scheme as CM.
   2146  1.1  mrg \def\rmshape{r}
   2147  1.1  mrg \def\rmbshape{bx}               % where the normal face is bold
   2148  1.1  mrg \def\bfshape{b}
   2149  1.1  mrg \def\bxshape{bx}
   2150  1.1  mrg \def\ttshape{tt}
   2151  1.1  mrg \def\ttbshape{tt}
   2152  1.1  mrg \def\ttslshape{sltt}
   2153  1.1  mrg \def\itshape{ti}
   2154  1.1  mrg \def\itbshape{bxti}
   2155  1.1  mrg \def\slshape{sl}
   2156  1.1  mrg \def\slbshape{bxsl}
   2157  1.1  mrg \def\sfshape{ss}
   2158  1.1  mrg \def\sfbshape{ss}
   2159  1.1  mrg \def\scshape{csc}
   2160  1.1  mrg \def\scbshape{csc}
   2161  1.1  mrg 
   2162  1.1  mrg % Definitions for a main text size of 11pt.  (The default in Texinfo.)
   2163  1.1  mrg %
   2164  1.1  mrg \def\definetextfontsizexi{%
   2165  1.1  mrg % Text fonts (11.2pt, magstep1).
   2166  1.1  mrg \def\textnominalsize{11pt}
   2167  1.1  mrg \edef\mainmagstep{\magstephalf}
   2168  1.1  mrg \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
   2169  1.1  mrg \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
   2170  1.1  mrg \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
   2171  1.1  mrg \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
   2172  1.1  mrg \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
   2173  1.1  mrg \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
   2174  1.1  mrg \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
   2175  1.1  mrg \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
   2176  1.1  mrg \font\texti=cmmi10 scaled \mainmagstep
   2177  1.1  mrg \font\textsy=cmsy10 scaled \mainmagstep
   2178  1.1  mrg \def\textecsize{1095}
   2179  1.1  mrg 
   2180  1.1  mrg % A few fonts for @defun names and args.
   2181  1.1  mrg \setfont\defbf\bfshape{10}{\magstep1}{OT1}
   2182  1.1  mrg \setfont\deftt\ttshape{10}{\magstep1}{OT1TT}
   2183  1.1  mrg \setfont\defsl\slshape{10}{\magstep1}{OT1}
   2184  1.1  mrg \setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT}
   2185  1.1  mrg \def\df{\let\ttfont=\deftt \let\bffont = \defbf
   2186  1.1  mrg \let\ttslfont=\defttsl \let\slfont=\defsl \bf}
   2187  1.1  mrg 
   2188  1.1  mrg % Fonts for indices, footnotes, small examples (9pt).
   2189  1.1  mrg \def\smallnominalsize{9pt}
   2190  1.1  mrg \setfont\smallrm\rmshape{9}{1000}{OT1}
   2191  1.1  mrg \setfont\smalltt\ttshape{9}{1000}{OT1TT}
   2192  1.1  mrg \setfont\smallbf\bfshape{10}{900}{OT1}
   2193  1.1  mrg \setfont\smallit\itshape{9}{1000}{OT1IT}
   2194  1.1  mrg \setfont\smallsl\slshape{9}{1000}{OT1}
   2195  1.1  mrg \setfont\smallsf\sfshape{9}{1000}{OT1}
   2196  1.1  mrg \setfont\smallsc\scshape{10}{900}{OT1}
   2197  1.1  mrg \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
   2198  1.1  mrg \font\smalli=cmmi9
   2199  1.1  mrg \font\smallsy=cmsy9
   2200  1.1  mrg \def\smallecsize{0900}
   2201  1.1  mrg 
   2202  1.1  mrg % Fonts for small examples (8pt).
   2203  1.1  mrg \def\smallernominalsize{8pt}
   2204  1.1  mrg \setfont\smallerrm\rmshape{8}{1000}{OT1}
   2205  1.1  mrg \setfont\smallertt\ttshape{8}{1000}{OT1TT}
   2206  1.1  mrg \setfont\smallerbf\bfshape{10}{800}{OT1}
   2207  1.1  mrg \setfont\smallerit\itshape{8}{1000}{OT1IT}
   2208  1.1  mrg \setfont\smallersl\slshape{8}{1000}{OT1}
   2209  1.1  mrg \setfont\smallersf\sfshape{8}{1000}{OT1}
   2210  1.1  mrg \setfont\smallersc\scshape{10}{800}{OT1}
   2211  1.1  mrg \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
   2212  1.1  mrg \font\smalleri=cmmi8
   2213  1.1  mrg \font\smallersy=cmsy8
   2214  1.1  mrg \def\smallerecsize{0800}
   2215  1.1  mrg 
   2216  1.1  mrg % Fonts for math mode superscripts (7pt).
   2217  1.1  mrg \def\sevennominalsize{7pt}
   2218  1.1  mrg \setfont\sevenrm\rmshape{7}{1000}{OT1}
   2219  1.1  mrg \setfont\seventt\ttshape{10}{700}{OT1TT}
   2220  1.1  mrg \setfont\sevenbf\bfshape{10}{700}{OT1}
   2221  1.1  mrg \setfont\sevenit\itshape{7}{1000}{OT1IT}
   2222  1.1  mrg \setfont\sevensl\slshape{10}{700}{OT1}
   2223  1.1  mrg \setfont\sevensf\sfshape{10}{700}{OT1}
   2224  1.1  mrg \setfont\sevensc\scshape{10}{700}{OT1}
   2225  1.1  mrg \setfont\seventtsl\ttslshape{10}{700}{OT1TT}
   2226  1.1  mrg \font\seveni=cmmi7
   2227  1.1  mrg \font\sevensy=cmsy7
   2228  1.1  mrg \def\sevenecsize{0700}
   2229  1.1  mrg 
   2230  1.1  mrg % Fonts for title page (20.4pt):
   2231  1.1  mrg \def\titlenominalsize{20pt}
   2232  1.1  mrg \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
   2233  1.1  mrg \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
   2234  1.1  mrg \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
   2235  1.1  mrg \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
   2236  1.1  mrg \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
   2237  1.1  mrg \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
   2238  1.1  mrg \let\titlebf=\titlerm
   2239  1.1  mrg \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
   2240  1.1  mrg \font\titlei=cmmi12 scaled \magstep3
   2241  1.1  mrg \font\titlesy=cmsy10 scaled \magstep4
   2242  1.1  mrg \def\titleecsize{2074}
   2243  1.1  mrg 
   2244  1.1  mrg % Chapter (and unnumbered) fonts (17.28pt).
   2245  1.1  mrg \def\chapnominalsize{17pt}
   2246  1.1  mrg \setfont\chaprm\rmbshape{12}{\magstep2}{OT1}
   2247  1.1  mrg \setfont\chapit\itbshape{10}{\magstep3}{OT1IT}
   2248  1.1  mrg \setfont\chapsl\slbshape{10}{\magstep3}{OT1}
   2249  1.1  mrg \setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT}
   2250  1.1  mrg \setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT}
   2251  1.1  mrg \setfont\chapsf\sfbshape{17}{1000}{OT1}
   2252  1.1  mrg \let\chapbf=\chaprm
   2253  1.1  mrg \setfont\chapsc\scbshape{10}{\magstep3}{OT1}
   2254  1.1  mrg \font\chapi=cmmi12 scaled \magstep2
   2255  1.1  mrg \font\chapsy=cmsy10 scaled \magstep3
   2256  1.1  mrg \def\chapecsize{1728}
   2257  1.1  mrg 
   2258  1.1  mrg % Section fonts (14.4pt).
   2259  1.1  mrg \def\secnominalsize{14pt}
   2260  1.1  mrg \setfont\secrm\rmbshape{12}{\magstep1}{OT1}
   2261  1.1  mrg \setfont\secrmnotbold\rmshape{12}{\magstep1}{OT1}
   2262  1.1  mrg \setfont\secit\itbshape{10}{\magstep2}{OT1IT}
   2263  1.1  mrg \setfont\secsl\slbshape{10}{\magstep2}{OT1}
   2264  1.1  mrg \setfont\sectt\ttbshape{12}{\magstep1}{OT1TT}
   2265  1.1  mrg \setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT}
   2266  1.1  mrg \setfont\secsf\sfbshape{12}{\magstep1}{OT1}
   2267  1.1  mrg \let\secbf\secrm
   2268  1.1  mrg \setfont\secsc\scbshape{10}{\magstep2}{OT1}
   2269  1.1  mrg \font\seci=cmmi12 scaled \magstep1
   2270  1.1  mrg \font\secsy=cmsy10 scaled \magstep2
   2271  1.1  mrg \def\sececsize{1440}
   2272  1.1  mrg 
   2273  1.1  mrg % Subsection fonts (13.15pt).
   2274  1.1  mrg \def\ssecnominalsize{13pt}
   2275  1.1  mrg \setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1}
   2276  1.1  mrg \setfont\ssecit\itbshape{10}{1315}{OT1IT}
   2277  1.1  mrg \setfont\ssecsl\slbshape{10}{1315}{OT1}
   2278  1.1  mrg \setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT}
   2279  1.1  mrg \setfont\ssecttsl\ttslshape{10}{1315}{OT1TT}
   2280  1.1  mrg \setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1}
   2281  1.1  mrg \let\ssecbf\ssecrm
   2282  1.1  mrg \setfont\ssecsc\scbshape{10}{1315}{OT1}
   2283  1.1  mrg \font\sseci=cmmi12 scaled \magstephalf
   2284  1.1  mrg \font\ssecsy=cmsy10 scaled 1315
   2285  1.1  mrg \def\ssececsize{1200}
   2286  1.1  mrg 
   2287  1.1  mrg % Reduced fonts for @acronym in text (10pt).
   2288  1.1  mrg \def\reducednominalsize{10pt}
   2289  1.1  mrg \setfont\reducedrm\rmshape{10}{1000}{OT1}
   2290  1.1  mrg \setfont\reducedtt\ttshape{10}{1000}{OT1TT}
   2291  1.1  mrg \setfont\reducedbf\bfshape{10}{1000}{OT1}
   2292  1.1  mrg \setfont\reducedit\itshape{10}{1000}{OT1IT}
   2293  1.1  mrg \setfont\reducedsl\slshape{10}{1000}{OT1}
   2294  1.1  mrg \setfont\reducedsf\sfshape{10}{1000}{OT1}
   2295  1.1  mrg \setfont\reducedsc\scshape{10}{1000}{OT1}
   2296  1.1  mrg \setfont\reducedttsl\ttslshape{10}{1000}{OT1TT}
   2297  1.1  mrg \font\reducedi=cmmi10
   2298  1.1  mrg \font\reducedsy=cmsy10
   2299  1.1  mrg \def\reducedecsize{1000}
   2300  1.1  mrg 
   2301  1.1  mrg \textleading = 13.2pt % line spacing for 11pt CM
   2302  1.1  mrg \textfonts            % reset the current fonts
   2303  1.1  mrg \rm
   2304  1.1  mrg } % end of 11pt text font size definitions, \definetextfontsizexi
   2305  1.1  mrg 
   2306  1.1  mrg 
   2307  1.1  mrg % Definitions to make the main text be 10pt Computer Modern, with
   2308  1.1  mrg % section, chapter, etc., sizes following suit.  This is for the GNU
   2309  1.1  mrg % Press printing of the Emacs 22 manual.  Maybe other manuals in the
   2310  1.1  mrg % future.  Used with @smallbook, which sets the leading to 12pt.
   2311  1.1  mrg %
   2312  1.1  mrg \def\definetextfontsizex{%
   2313  1.1  mrg % Text fonts (10pt).
   2314  1.1  mrg \def\textnominalsize{10pt}
   2315  1.1  mrg \edef\mainmagstep{1000}
   2316  1.1  mrg \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
   2317  1.1  mrg \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
   2318  1.1  mrg \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
   2319  1.1  mrg \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
   2320  1.1  mrg \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
   2321  1.1  mrg \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
   2322  1.1  mrg \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
   2323  1.1  mrg \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
   2324  1.1  mrg \font\texti=cmmi10 scaled \mainmagstep
   2325  1.1  mrg \font\textsy=cmsy10 scaled \mainmagstep
   2326  1.1  mrg \def\textecsize{1000}
   2327  1.1  mrg 
   2328  1.1  mrg % A few fonts for @defun names and args.
   2329  1.1  mrg \setfont\defbf\bfshape{10}{\magstephalf}{OT1}
   2330  1.1  mrg \setfont\deftt\ttshape{10}{\magstephalf}{OT1TT}
   2331  1.1  mrg \setfont\defsl\slshape{10}{\magstephalf}{OT1}
   2332  1.1  mrg \setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT}
   2333  1.1  mrg \def\df{\let\ttfont=\deftt \let\bffont = \defbf
   2334  1.1  mrg \let\slfont=\defsl \let\ttslfont=\defttsl \bf}
   2335  1.1  mrg 
   2336  1.1  mrg % Fonts for indices, footnotes, small examples (9pt).
   2337  1.1  mrg \def\smallnominalsize{9pt}
   2338  1.1  mrg \setfont\smallrm\rmshape{9}{1000}{OT1}
   2339  1.1  mrg \setfont\smalltt\ttshape{9}{1000}{OT1TT}
   2340  1.1  mrg \setfont\smallbf\bfshape{10}{900}{OT1}
   2341  1.1  mrg \setfont\smallit\itshape{9}{1000}{OT1IT}
   2342  1.1  mrg \setfont\smallsl\slshape{9}{1000}{OT1}
   2343  1.1  mrg \setfont\smallsf\sfshape{9}{1000}{OT1}
   2344  1.1  mrg \setfont\smallsc\scshape{10}{900}{OT1}
   2345  1.1  mrg \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
   2346  1.1  mrg \font\smalli=cmmi9
   2347  1.1  mrg \font\smallsy=cmsy9
   2348  1.1  mrg \def\smallecsize{0900}
   2349  1.1  mrg 
   2350  1.1  mrg % Fonts for small examples (8pt).
   2351  1.1  mrg \def\smallernominalsize{8pt}
   2352  1.1  mrg \setfont\smallerrm\rmshape{8}{1000}{OT1}
   2353  1.1  mrg \setfont\smallertt\ttshape{8}{1000}{OT1TT}
   2354  1.1  mrg \setfont\smallerbf\bfshape{10}{800}{OT1}
   2355  1.1  mrg \setfont\smallerit\itshape{8}{1000}{OT1IT}
   2356  1.1  mrg \setfont\smallersl\slshape{8}{1000}{OT1}
   2357  1.1  mrg \setfont\smallersf\sfshape{8}{1000}{OT1}
   2358  1.1  mrg \setfont\smallersc\scshape{10}{800}{OT1}
   2359  1.1  mrg \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
   2360  1.1  mrg \font\smalleri=cmmi8
   2361  1.1  mrg \font\smallersy=cmsy8
   2362  1.1  mrg \def\smallerecsize{0800}
   2363  1.1  mrg 
   2364  1.1  mrg % Fonts for math mode superscripts (7pt).
   2365  1.1  mrg \def\sevennominalsize{7pt}
   2366  1.1  mrg \setfont\sevenrm\rmshape{7}{1000}{OT1}
   2367  1.1  mrg \setfont\seventt\ttshape{10}{700}{OT1TT}
   2368  1.1  mrg \setfont\sevenbf\bfshape{10}{700}{OT1}
   2369  1.1  mrg \setfont\sevenit\itshape{7}{1000}{OT1IT}
   2370  1.1  mrg \setfont\sevensl\slshape{10}{700}{OT1}
   2371  1.1  mrg \setfont\sevensf\sfshape{10}{700}{OT1}
   2372  1.1  mrg \setfont\sevensc\scshape{10}{700}{OT1}
   2373  1.1  mrg \setfont\seventtsl\ttslshape{10}{700}{OT1TT}
   2374  1.1  mrg \font\seveni=cmmi7
   2375  1.1  mrg \font\sevensy=cmsy7
   2376  1.1  mrg \def\sevenecsize{0700}
   2377  1.1  mrg 
   2378  1.1  mrg % Fonts for title page (20.4pt):
   2379  1.1  mrg \def\titlenominalsize{20pt}
   2380  1.1  mrg \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
   2381  1.1  mrg \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
   2382  1.1  mrg \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
   2383  1.1  mrg \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
   2384  1.1  mrg \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
   2385  1.1  mrg \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
   2386  1.1  mrg \let\titlebf=\titlerm
   2387  1.1  mrg \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
   2388  1.1  mrg \font\titlei=cmmi12 scaled \magstep3
   2389  1.1  mrg \font\titlesy=cmsy10 scaled \magstep4
   2390  1.1  mrg \def\titleecsize{2074}
   2391  1.1  mrg 
   2392  1.1  mrg % Chapter fonts (14.4pt).
   2393  1.1  mrg \def\chapnominalsize{14pt}
   2394  1.1  mrg \setfont\chaprm\rmbshape{12}{\magstep1}{OT1}
   2395  1.1  mrg \setfont\chapit\itbshape{10}{\magstep2}{OT1IT}
   2396  1.1  mrg \setfont\chapsl\slbshape{10}{\magstep2}{OT1}
   2397  1.1  mrg \setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT}
   2398  1.1  mrg \setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT}
   2399  1.1  mrg \setfont\chapsf\sfbshape{12}{\magstep1}{OT1}
   2400  1.1  mrg \let\chapbf\chaprm
   2401  1.1  mrg \setfont\chapsc\scbshape{10}{\magstep2}{OT1}
   2402  1.1  mrg \font\chapi=cmmi12 scaled \magstep1
   2403  1.1  mrg \font\chapsy=cmsy10 scaled \magstep2
   2404  1.1  mrg \def\chapecsize{1440}
   2405  1.1  mrg 
   2406  1.1  mrg % Section fonts (12pt).
   2407  1.1  mrg \def\secnominalsize{12pt}
   2408  1.1  mrg \setfont\secrm\rmbshape{12}{1000}{OT1}
   2409  1.1  mrg \setfont\secit\itbshape{10}{\magstep1}{OT1IT}
   2410  1.1  mrg \setfont\secsl\slbshape{10}{\magstep1}{OT1}
   2411  1.1  mrg \setfont\sectt\ttbshape{12}{1000}{OT1TT}
   2412  1.1  mrg \setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT}
   2413  1.1  mrg \setfont\secsf\sfbshape{12}{1000}{OT1}
   2414  1.1  mrg \let\secbf\secrm
   2415  1.1  mrg \setfont\secsc\scbshape{10}{\magstep1}{OT1}
   2416  1.1  mrg \font\seci=cmmi12
   2417  1.1  mrg \font\secsy=cmsy10 scaled \magstep1
   2418  1.1  mrg \def\sececsize{1200}
   2419  1.1  mrg 
   2420  1.1  mrg % Subsection fonts (10pt).
   2421  1.1  mrg \def\ssecnominalsize{10pt}
   2422  1.1  mrg \setfont\ssecrm\rmbshape{10}{1000}{OT1}
   2423  1.1  mrg \setfont\ssecit\itbshape{10}{1000}{OT1IT}
   2424  1.1  mrg \setfont\ssecsl\slbshape{10}{1000}{OT1}
   2425  1.1  mrg \setfont\ssectt\ttbshape{10}{1000}{OT1TT}
   2426  1.1  mrg \setfont\ssecttsl\ttslshape{10}{1000}{OT1TT}
   2427  1.1  mrg \setfont\ssecsf\sfbshape{10}{1000}{OT1}
   2428  1.1  mrg \let\ssecbf\ssecrm
   2429  1.1  mrg \setfont\ssecsc\scbshape{10}{1000}{OT1}
   2430  1.1  mrg \font\sseci=cmmi10
   2431  1.1  mrg \font\ssecsy=cmsy10
   2432  1.1  mrg \def\ssececsize{1000}
   2433  1.1  mrg 
   2434  1.1  mrg % Reduced fonts for @acronym in text (9pt).
   2435  1.1  mrg \def\reducednominalsize{9pt}
   2436  1.1  mrg \setfont\reducedrm\rmshape{9}{1000}{OT1}
   2437  1.1  mrg \setfont\reducedtt\ttshape{9}{1000}{OT1TT}
   2438  1.1  mrg \setfont\reducedbf\bfshape{10}{900}{OT1}
   2439  1.1  mrg \setfont\reducedit\itshape{9}{1000}{OT1IT}
   2440  1.1  mrg \setfont\reducedsl\slshape{9}{1000}{OT1}
   2441  1.1  mrg \setfont\reducedsf\sfshape{9}{1000}{OT1}
   2442  1.1  mrg \setfont\reducedsc\scshape{10}{900}{OT1}
   2443  1.1  mrg \setfont\reducedttsl\ttslshape{10}{900}{OT1TT}
   2444  1.1  mrg \font\reducedi=cmmi9
   2445  1.1  mrg \font\reducedsy=cmsy9
   2446  1.1  mrg \def\reducedecsize{0900}
   2447  1.1  mrg 
   2448  1.1  mrg \divide\parskip by 2  % reduce space between paragraphs
   2449  1.1  mrg \textleading = 12pt   % line spacing for 10pt CM
   2450  1.1  mrg \textfonts            % reset the current fonts
   2451  1.1  mrg \rm
   2452  1.1  mrg } % end of 10pt text font size definitions, \definetextfontsizex
   2453  1.1  mrg 
   2454  1.1  mrg % Fonts for short table of contents.
   2455  1.1  mrg \setfont\shortcontrm\rmshape{12}{1000}{OT1}
   2456  1.1  mrg \setfont\shortcontbf\bfshape{10}{\magstep1}{OT1}  % no cmb12
   2457  1.1  mrg \setfont\shortcontsl\slshape{12}{1000}{OT1}
   2458  1.1  mrg \setfont\shortconttt\ttshape{12}{1000}{OT1TT}
   2459  1.1  mrg 
   2460  1.1  mrg 
   2461  1.1  mrg % We provide the user-level command
   2462  1.1  mrg %   @fonttextsize 10
   2463  1.1  mrg % (or 11) to redefine the text font size.  pt is assumed.
   2464  1.1  mrg %
   2465  1.1  mrg \def\xiword{11}
   2466  1.1  mrg \def\xword{10}
   2467  1.1  mrg \def\xwordpt{10pt}
   2468  1.1  mrg %
   2469  1.1  mrg \parseargdef\fonttextsize{%
   2470  1.1  mrg   \def\textsizearg{#1}%
   2471  1.1  mrg   %\wlog{doing @fonttextsize \textsizearg}%
   2472  1.1  mrg   %
   2473  1.1  mrg   % Set \globaldefs so that documents can use this inside @tex, since
   2474  1.1  mrg   % makeinfo 4.8 does not support it, but we need it nonetheless.
   2475  1.1  mrg   %
   2476  1.1  mrg  \begingroup \globaldefs=1
   2477  1.1  mrg   \ifx\textsizearg\xword \definetextfontsizex
   2478  1.1  mrg   \else \ifx\textsizearg\xiword \definetextfontsizexi
   2479  1.1  mrg   \else
   2480  1.1  mrg     \errhelp=\EMsimple
   2481  1.1  mrg     \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'}
   2482  1.1  mrg   \fi\fi
   2483  1.1  mrg  \endgroup
   2484  1.1  mrg }
   2485  1.1  mrg 
   2486  1.1  mrg %
   2487  1.1  mrg % Change the current font style to #1, remembering it in \curfontstyle.
   2488  1.1  mrg % For now, we do not accumulate font styles: @b{@i{foo}} prints foo in
   2489  1.1  mrg % italics, not bold italics.
   2490  1.1  mrg %
   2491  1.1  mrg \def\setfontstyle#1{%
   2492  1.1  mrg   \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd.
   2493  1.1  mrg   \csname #1font\endcsname  % change the current font
   2494  1.1  mrg }
   2495  1.1  mrg 
   2496  1.1  mrg \def\rm{\fam=0 \setfontstyle{rm}}
   2497  1.1  mrg \def\it{\fam=\itfam \setfontstyle{it}}
   2498  1.1  mrg \def\sl{\fam=\slfam \setfontstyle{sl}}
   2499  1.1  mrg \def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
   2500  1.1  mrg \def\tt{\fam=\ttfam \setfontstyle{tt}}
   2501  1.1  mrg 
   2502  1.1  mrg % Texinfo sort of supports the sans serif font style, which plain TeX does not.
   2503  1.1  mrg % So we set up a \sf.
   2504  1.1  mrg \newfam\sffam
   2505  1.1  mrg \def\sf{\fam=\sffam \setfontstyle{sf}}
   2506  1.1  mrg 
   2507  1.1  mrg % We don't need math for this font style.
   2508  1.1  mrg \def\ttsl{\setfontstyle{ttsl}}
   2509  1.1  mrg 
   2510  1.1  mrg 
   2511  1.1  mrg % In order for the font changes to affect most math symbols and letters,
   2512  1.1  mrg % we have to define the \textfont of the standard families.
   2513  1.1  mrg % We don't bother to reset \scriptscriptfont; awaiting user need.
   2514  1.1  mrg %
   2515  1.1  mrg \def\resetmathfonts{%
   2516  1.1  mrg   \textfont0=\rmfont \textfont1=\ifont \textfont2=\syfont
   2517  1.1  mrg   \textfont\itfam=\itfont \textfont\slfam=\slfont \textfont\bffam=\bffont
   2518  1.1  mrg   \textfont\ttfam=\ttfont \textfont\sffam=\sffont
   2519  1.1  mrg   %
   2520  1.1  mrg   % Fonts for superscript.  Note that the 7pt fonts are used regardless
   2521  1.1  mrg   % of the current font size.
   2522  1.1  mrg   \scriptfont0=\sevenrm \scriptfont1=\seveni \scriptfont2=\sevensy
   2523  1.1  mrg   \scriptfont\itfam=\sevenit \scriptfont\slfam=\sevensl
   2524  1.1  mrg   \scriptfont\bffam=\sevenbf \scriptfont\ttfam=\seventt
   2525  1.1  mrg   \scriptfont\sffam=\sevensf
   2526  1.1  mrg }
   2527  1.1  mrg 
   2528  1.1  mrg %
   2529  1.1  mrg 
   2530  1.1  mrg % The font-changing commands (all called \...fonts) redefine the meanings
   2531  1.1  mrg % of \STYLEfont, instead of just \STYLE.  We do this because \STYLE needs
   2532  1.1  mrg % to also set the current \fam for math mode.  Our \STYLE (e.g., \rm)
   2533  1.1  mrg % commands hardwire \STYLEfont to set the current font.
   2534  1.1  mrg %
   2535  1.1  mrg % The fonts used for \ifont are for "math italics"  (\itfont is for italics
   2536  1.1  mrg % in regular text).  \syfont is also used in math mode only.
   2537  1.1  mrg %
   2538  1.1  mrg % Each font-changing command also sets the names \lsize (one size lower)
   2539  1.1  mrg % and \lllsize (three sizes lower).  These relative commands are used
   2540  1.1  mrg % in, e.g., the LaTeX logo and acronyms.
   2541  1.1  mrg %
   2542  1.1  mrg % This all needs generalizing, badly.
   2543  1.1  mrg %
   2544  1.1  mrg 
   2545  1.1  mrg \def\assignfonts#1{%
   2546  1.1  mrg   \expandafter\let\expandafter\rmfont\csname #1rm\endcsname
   2547  1.1  mrg   \expandafter\let\expandafter\itfont\csname #1it\endcsname
   2548  1.1  mrg   \expandafter\let\expandafter\slfont\csname #1sl\endcsname
   2549  1.1  mrg   \expandafter\let\expandafter\bffont\csname #1bf\endcsname
   2550  1.1  mrg   \expandafter\let\expandafter\ttfont\csname #1tt\endcsname
   2551  1.1  mrg   \expandafter\let\expandafter\smallcaps\csname #1sc\endcsname
   2552  1.1  mrg   \expandafter\let\expandafter\sffont  \csname #1sf\endcsname
   2553  1.1  mrg   \expandafter\let\expandafter\ifont   \csname #1i\endcsname
   2554  1.1  mrg   \expandafter\let\expandafter\syfont  \csname #1sy\endcsname
   2555  1.1  mrg   \expandafter\let\expandafter\ttslfont\csname #1ttsl\endcsname
   2556  1.1  mrg }
   2557  1.1  mrg 
   2558  1.1  mrg \newif\ifrmisbold
   2559  1.1  mrg 
   2560  1.1  mrg % Select smaller font size with the current style.  Used to change font size
   2561  1.1  mrg % in, e.g., the LaTeX logo and acronyms.  If we are using bold fonts for
   2562  1.1  mrg % normal roman text, also use bold fonts for roman text in the smaller size.
   2563  1.1  mrg \def\switchtolllsize{%
   2564  1.1  mrg    \expandafter\assignfonts\expandafter{\lllsize}%
   2565  1.1  mrg    \ifrmisbold
   2566  1.1  mrg      \let\rmfont\bffont
   2567  1.1  mrg    \fi
   2568  1.1  mrg    \csname\curfontstyle\endcsname
   2569  1.1  mrg }%
   2570  1.1  mrg 
   2571  1.1  mrg \def\switchtolsize{%
   2572  1.1  mrg    \expandafter\assignfonts\expandafter{\lsize}%
   2573  1.1  mrg    \ifrmisbold
   2574  1.1  mrg      \let\rmfont\bffont
   2575  1.1  mrg    \fi
   2576  1.1  mrg    \csname\curfontstyle\endcsname
   2577  1.1  mrg }%
   2578  1.1  mrg 
   2579  1.1  mrg \def\definefontsetatsize#1#2#3#4#5{%
   2580  1.1  mrg \expandafter\def\csname #1fonts\endcsname{%
   2581  1.1  mrg   \def\curfontsize{#1}%
   2582  1.1  mrg   \def\lsize{#2}\def\lllsize{#3}%
   2583  1.1  mrg   \csname rmisbold#5\endcsname
   2584  1.1  mrg   \assignfonts{#1}%
   2585  1.1  mrg   \resetmathfonts
   2586  1.1  mrg   \setleading{#4}%
   2587  1.1  mrg }}
   2588  1.1  mrg 
   2589  1.1  mrg \definefontsetatsize{text}   {reduced}{smaller}{\textleading}{false}
   2590  1.1  mrg \definefontsetatsize{title}  {chap}   {subsec} {27pt}  {true}
   2591  1.1  mrg \definefontsetatsize{chap}   {sec}    {text}   {19pt}  {true}
   2592  1.1  mrg \definefontsetatsize{sec}    {subsec} {reduced}{17pt}  {true}
   2593  1.1  mrg \definefontsetatsize{ssec}   {text}   {small}  {15pt}  {true}
   2594  1.1  mrg \definefontsetatsize{reduced}{small}  {smaller}{10.5pt}{false}
   2595  1.1  mrg \definefontsetatsize{small}  {smaller}{smaller}{10.5pt}{false}
   2596  1.1  mrg \definefontsetatsize{smaller}{smaller}{smaller}{9.5pt} {false}
   2597  1.1  mrg 
   2598  1.1  mrg \def\titlefont#1{{\titlefonts\rm #1}}
   2599  1.1  mrg \let\subsecfonts = \ssecfonts
   2600  1.1  mrg \let\subsubsecfonts = \ssecfonts
   2601  1.1  mrg 
   2602  1.1  mrg % Define these just so they can be easily changed for other fonts.
   2603  1.1  mrg \def\angleleft{$\langle$}
   2604  1.1  mrg \def\angleright{$\rangle$}
   2605  1.1  mrg 
   2606  1.1  mrg % Set the fonts to use with the @small... environments.
   2607  1.1  mrg \let\smallexamplefonts = \smallfonts
   2608  1.1  mrg 
   2609  1.1  mrg % About \smallexamplefonts.  If we use \smallfonts (9pt), @smallexample
   2610  1.1  mrg % can fit this many characters:
   2611  1.1  mrg %   8.5x11=86   smallbook=72  a4=90  a5=69
   2612  1.1  mrg % If we use \scriptfonts (8pt), then we can fit this many characters:
   2613  1.1  mrg %   8.5x11=90+  smallbook=80  a4=90+  a5=77
   2614  1.1  mrg % For me, subjectively, the few extra characters that fit aren't worth
   2615  1.1  mrg % the additional smallness of 8pt.  So I'm making the default 9pt.
   2616  1.1  mrg %
   2617  1.1  mrg % By the way, for comparison, here's what fits with @example (10pt):
   2618  1.1  mrg %   8.5x11=71  smallbook=60  a4=75  a5=58
   2619  1.1  mrg % --karl, 24jan03.
   2620  1.1  mrg 
   2621  1.1  mrg % Set up the default fonts, so we can use them for creating boxes.
   2622  1.1  mrg %
   2623  1.1  mrg \definetextfontsizexi
   2624  1.1  mrg 
   2625  1.1  mrg 
   2626  1.1  mrg \message{markup,}
   2627  1.1  mrg 
   2628  1.1  mrg % Check if we are currently using a typewriter font.  Since all the
   2629  1.1  mrg % Computer Modern typewriter fonts have zero interword stretch (and
   2630  1.1  mrg % shrink), and it is reasonable to expect all typewriter fonts to have
   2631  1.1  mrg % this property, we can check that font parameter.
   2632  1.1  mrg %
   2633  1.1  mrg \def\ifmonospace{\ifdim\fontdimen3\font=0pt }
   2634  1.1  mrg 
   2635  1.1  mrg % Markup style infrastructure.  \defmarkupstylesetup\INITMACRO will
   2636  1.1  mrg % define and register \INITMACRO to be called on markup style changes.
   2637  1.1  mrg % \INITMACRO can check \currentmarkupstyle for the innermost
   2638  1.1  mrg % style.
   2639  1.1  mrg 
   2640  1.1  mrg \let\currentmarkupstyle\empty
   2641  1.1  mrg 
   2642  1.1  mrg \def\setupmarkupstyle#1{%
   2643  1.1  mrg   \def\currentmarkupstyle{#1}%
   2644  1.1  mrg   \markupstylesetup
   2645  1.1  mrg }
   2646  1.1  mrg 
   2647  1.1  mrg \let\markupstylesetup\empty
   2648  1.1  mrg 
   2649  1.1  mrg \def\defmarkupstylesetup#1{%
   2650  1.1  mrg   \expandafter\def\expandafter\markupstylesetup
   2651  1.1  mrg     \expandafter{\markupstylesetup #1}%
   2652  1.1  mrg   \def#1%
   2653  1.1  mrg }
   2654  1.1  mrg 
   2655  1.1  mrg % Markup style setup for left and right quotes.
   2656  1.1  mrg \defmarkupstylesetup\markupsetuplq{%
   2657  1.1  mrg   \expandafter\let\expandafter \temp
   2658  1.1  mrg     \csname markupsetuplq\currentmarkupstyle\endcsname
   2659  1.1  mrg   \ifx\temp\relax \markupsetuplqdefault \else \temp \fi
   2660  1.1  mrg }
   2661  1.1  mrg 
   2662  1.1  mrg \defmarkupstylesetup\markupsetuprq{%
   2663  1.1  mrg   \expandafter\let\expandafter \temp
   2664  1.1  mrg     \csname markupsetuprq\currentmarkupstyle\endcsname
   2665  1.1  mrg   \ifx\temp\relax \markupsetuprqdefault \else \temp \fi
   2666  1.1  mrg }
   2667  1.1  mrg 
   2668  1.1  mrg {
   2669  1.1  mrg \catcode`\'=\active
   2670  1.1  mrg \catcode`\`=\active
   2671  1.1  mrg 
   2672  1.1  mrg \gdef\markupsetuplqdefault{\let`\lq}
   2673  1.1  mrg \gdef\markupsetuprqdefault{\let'\rq}
   2674  1.1  mrg 
   2675  1.1  mrg \gdef\markupsetcodequoteleft{\let`\codequoteleft}
   2676  1.1  mrg \gdef\markupsetcodequoteright{\let'\codequoteright}
   2677  1.1  mrg }
   2678  1.1  mrg 
   2679  1.1  mrg \let\markupsetuplqcode \markupsetcodequoteleft
   2680  1.1  mrg \let\markupsetuprqcode \markupsetcodequoteright
   2681  1.1  mrg %
   2682  1.1  mrg \let\markupsetuplqexample \markupsetcodequoteleft
   2683  1.1  mrg \let\markupsetuprqexample \markupsetcodequoteright
   2684  1.1  mrg %
   2685  1.1  mrg \let\markupsetuplqkbd     \markupsetcodequoteleft
   2686  1.1  mrg \let\markupsetuprqkbd     \markupsetcodequoteright
   2687  1.1  mrg %
   2688  1.1  mrg \let\markupsetuplqsamp \markupsetcodequoteleft
   2689  1.1  mrg \let\markupsetuprqsamp \markupsetcodequoteright
   2690  1.1  mrg %
   2691  1.1  mrg \let\markupsetuplqverb \markupsetcodequoteleft
   2692  1.1  mrg \let\markupsetuprqverb \markupsetcodequoteright
   2693  1.1  mrg %
   2694  1.1  mrg \let\markupsetuplqverbatim \markupsetcodequoteleft
   2695  1.1  mrg \let\markupsetuprqverbatim \markupsetcodequoteright
   2696  1.1  mrg 
   2697  1.1  mrg % Allow an option to not use regular directed right quote/apostrophe
   2698  1.1  mrg % (char 0x27), but instead the undirected quote from cmtt (char 0x0d).
   2699  1.1  mrg % The undirected quote is ugly, so don't make it the default, but it
   2700  1.1  mrg % works for pasting with more pdf viewers (at least evince), the
   2701  1.1  mrg % lilypond developers report.  xpdf does work with the regular 0x27.
   2702  1.1  mrg %
   2703  1.1  mrg \def\codequoteright{%
   2704  1.1  mrg   \ifmonospace
   2705  1.1  mrg     \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax
   2706  1.1  mrg       \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax
   2707  1.1  mrg         '%
   2708  1.1  mrg       \else \char'15 \fi
   2709  1.1  mrg     \else \char'15 \fi
   2710  1.1  mrg    \else
   2711  1.1  mrg      '%
   2712  1.1  mrg    \fi
   2713  1.1  mrg }
   2714  1.1  mrg %
   2715  1.1  mrg % and a similar option for the left quote char vs. a grave accent.
   2716  1.1  mrg % Modern fonts display ASCII 0x60 as a grave accent, so some people like
   2717  1.1  mrg % the code environments to do likewise.
   2718  1.1  mrg %
   2719  1.1  mrg \def\codequoteleft{%
   2720  1.1  mrg   \ifmonospace
   2721  1.1  mrg     \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax
   2722  1.1  mrg       \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax
   2723  1.1  mrg         % [Knuth] pp. 380,381,391
   2724  1.1  mrg         % \relax disables Spanish ligatures ?` and !` of \tt font.
   2725  1.1  mrg         \relax`%
   2726  1.1  mrg       \else \char'22 \fi
   2727  1.1  mrg     \else \char'22 \fi
   2728  1.1  mrg    \else
   2729  1.1  mrg      \relax`%
   2730  1.1  mrg    \fi
   2731  1.1  mrg }
   2732  1.1  mrg 
   2733  1.1  mrg % Commands to set the quote options.
   2734  1.1  mrg %
   2735  1.1  mrg \parseargdef\codequoteundirected{%
   2736  1.1  mrg   \def\temp{#1}%
   2737  1.1  mrg   \ifx\temp\onword
   2738  1.1  mrg     \expandafter\let\csname SETtxicodequoteundirected\endcsname
   2739  1.1  mrg       = t%
   2740  1.1  mrg   \else\ifx\temp\offword
   2741  1.1  mrg     \expandafter\let\csname SETtxicodequoteundirected\endcsname
   2742  1.1  mrg       = \relax
   2743  1.1  mrg   \else
   2744  1.1  mrg     \errhelp = \EMsimple
   2745  1.1  mrg     \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}%
   2746  1.1  mrg   \fi\fi
   2747  1.1  mrg }
   2748  1.1  mrg %
   2749  1.1  mrg \parseargdef\codequotebacktick{%
   2750  1.1  mrg   \def\temp{#1}%
   2751  1.1  mrg   \ifx\temp\onword
   2752  1.1  mrg     \expandafter\let\csname SETtxicodequotebacktick\endcsname
   2753  1.1  mrg       = t%
   2754  1.1  mrg   \else\ifx\temp\offword
   2755  1.1  mrg     \expandafter\let\csname SETtxicodequotebacktick\endcsname
   2756  1.1  mrg       = \relax
   2757  1.1  mrg   \else
   2758  1.1  mrg     \errhelp = \EMsimple
   2759  1.1  mrg     \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}%
   2760  1.1  mrg   \fi\fi
   2761  1.1  mrg }
   2762  1.1  mrg 
   2763  1.1  mrg % [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font.
   2764  1.1  mrg \def\noligaturesquoteleft{\relax\lq}
   2765  1.1  mrg 
   2766  1.1  mrg % Count depth in font-changes, for error checks
   2767  1.1  mrg \newcount\fontdepth \fontdepth=0
   2768  1.1  mrg 
   2769  1.1  mrg % Font commands.
   2770  1.1  mrg 
   2771  1.1  mrg % #1 is the font command (\sl or \it), #2 is the text to slant.
   2772  1.1  mrg % If we are in a monospaced environment, however, 1) always use \ttsl,
   2773  1.1  mrg % and 2) do not add an italic correction.
   2774  1.1  mrg \def\dosmartslant#1#2{%
   2775  1.1  mrg   \ifusingtt
   2776  1.1  mrg     {{\ttsl #2}\let\next=\relax}%
   2777  1.1  mrg     {\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}%
   2778  1.1  mrg   \next
   2779  1.1  mrg }
   2780  1.1  mrg \def\smartslanted{\dosmartslant\sl}
   2781  1.1  mrg \def\smartitalic{\dosmartslant\it}
   2782  1.1  mrg 
   2783  1.1  mrg % Output an italic correction unless \next (presumed to be the following
   2784  1.1  mrg % character) is such as not to need one.
   2785  1.1  mrg \def\smartitaliccorrection{%
   2786  1.1  mrg   \ifx\next,%
   2787  1.1  mrg   \else\ifx\next-%
   2788  1.1  mrg   \else\ifx\next.%
   2789  1.1  mrg   \else\ifx\next\.%
   2790  1.1  mrg   \else\ifx\next\comma%
   2791  1.1  mrg   \else\ptexslash
   2792  1.1  mrg   \fi\fi\fi\fi\fi
   2793  1.1  mrg   \aftersmartic
   2794  1.1  mrg }
   2795  1.1  mrg 
   2796  1.1  mrg % Unconditional use \ttsl, and no ic.  @var is set to this for defuns.
   2797  1.1  mrg \def\ttslanted#1{{\ttsl #1}}
   2798  1.1  mrg 
   2799  1.1  mrg % @cite is like \smartslanted except unconditionally use \sl.  We never want
   2800  1.1  mrg % ttsl for book titles, do we?
   2801  1.1  mrg \def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection}
   2802  1.1  mrg 
   2803  1.1  mrg \def\aftersmartic{}
   2804  1.1  mrg \def\var#1{%
   2805  1.1  mrg   \let\saveaftersmartic = \aftersmartic
   2806  1.1  mrg   \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}%
   2807  1.1  mrg   \smartslanted{#1}%
   2808  1.1  mrg }
   2809  1.1  mrg 
   2810  1.1  mrg \let\i=\smartitalic
   2811  1.1  mrg \let\slanted=\smartslanted
   2812  1.1  mrg \let\dfn=\smartslanted
   2813  1.1  mrg \let\emph=\smartitalic
   2814  1.1  mrg 
   2815  1.1  mrg % Explicit font changes: @r, @sc, undocumented @ii.
   2816  1.1  mrg \def\r#1{{\rm #1}}              % roman font
   2817  1.1  mrg \def\sc#1{{\smallcaps#1}}       % smallcaps font
   2818  1.1  mrg \def\ii#1{{\it #1}}             % italic font
   2819  1.1  mrg 
   2820  1.1  mrg % @b, explicit bold.  Also @strong.
   2821  1.1  mrg \def\b#1{{\bf #1}}
   2822  1.1  mrg \let\strong=\b
   2823  1.1  mrg 
   2824  1.1  mrg % @sansserif, explicit sans.
   2825  1.1  mrg \def\sansserif#1{{\sf #1}}
   2826  1.1  mrg 
   2827  1.1  mrg % We can't just use \exhyphenpenalty, because that only has effect at
   2828  1.1  mrg % the end of a paragraph.  Restore normal hyphenation at the end of the
   2829  1.1  mrg % group within which \nohyphenation is presumably called.
   2830  1.1  mrg %
   2831  1.1  mrg \def\nohyphenation{\hyphenchar\font = -1  \aftergroup\restorehyphenation}
   2832  1.1  mrg \def\restorehyphenation{\hyphenchar\font = `- }
   2833  1.1  mrg 
   2834  1.1  mrg % Set sfcode to normal for the chars that usually have another value.
   2835  1.1  mrg % Can't use plain's \frenchspacing because it uses the `\x notation, and
   2836  1.1  mrg % sometimes \x has an active definition that messes things up.
   2837  1.1  mrg %
   2838  1.1  mrg \catcode`@=11
   2839  1.1  mrg   \def\plainfrenchspacing{%
   2840  1.1  mrg     \sfcode`\.=\@m \sfcode`\?=\@m \sfcode`\!=\@m
   2841  1.1  mrg     \sfcode`\:=\@m \sfcode`\;=\@m \sfcode`\,=\@m
   2842  1.1  mrg     \def\endofsentencespacefactor{1000}% for @. and friends
   2843  1.1  mrg   }
   2844  1.1  mrg   \def\plainnonfrenchspacing{%
   2845  1.1  mrg     \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000
   2846  1.1  mrg     \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250
   2847  1.1  mrg     \def\endofsentencespacefactor{3000}% for @. and friends
   2848  1.1  mrg   }
   2849  1.1  mrg \catcode`@=\other
   2850  1.1  mrg \def\endofsentencespacefactor{3000}% default
   2851  1.1  mrg 
   2852  1.1  mrg % @t, explicit typewriter.
   2853  1.1  mrg \def\t#1{%
   2854  1.1  mrg   {\tt \plainfrenchspacing #1}%
   2855  1.1  mrg   \null
   2856  1.1  mrg }
   2857  1.1  mrg 
   2858  1.1  mrg % @samp.
   2859  1.1  mrg \def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}}
   2860  1.1  mrg 
   2861  1.1  mrg % @indicateurl is \samp, that is, with quotes.
   2862  1.1  mrg \let\indicateurl=\samp
   2863  1.1  mrg 
   2864  1.1  mrg % @code (and similar) prints in typewriter, but with spaces the same
   2865  1.1  mrg % size as normal in the surrounding text, without hyphenation, etc.
   2866  1.1  mrg % This is a subroutine for that.
   2867  1.1  mrg \def\tclose#1{%
   2868  1.1  mrg   {%
   2869  1.1  mrg     % Change normal interword space to be same as for the current font.
   2870  1.1  mrg     \spaceskip = \fontdimen2\font
   2871  1.1  mrg     %
   2872  1.1  mrg     % Switch to typewriter.
   2873  1.1  mrg     \tt
   2874  1.1  mrg     %
   2875  1.1  mrg     % But `\ ' produces the large typewriter interword space.
   2876  1.1  mrg     \def\ {{\spaceskip = 0pt{} }}%
   2877  1.1  mrg     %
   2878  1.1  mrg     % Turn off hyphenation.
   2879  1.1  mrg     \nohyphenation
   2880  1.1  mrg     %
   2881  1.1  mrg     \plainfrenchspacing
   2882  1.1  mrg     #1%
   2883  1.1  mrg   }%
   2884  1.1  mrg   \null % reset spacefactor to 1000
   2885  1.1  mrg }
   2886  1.1  mrg 
   2887  1.1  mrg % We *must* turn on hyphenation at `-' and `_' in @code.
   2888  1.1  mrg % (But see \codedashfinish below.)
   2889  1.1  mrg % Otherwise, it is too hard to avoid overfull hboxes
   2890  1.1  mrg % in the Emacs manual, the Library manual, etc.
   2891  1.1  mrg %
   2892  1.1  mrg % Unfortunately, TeX uses one parameter (\hyphenchar) to control
   2893  1.1  mrg % both hyphenation at - and hyphenation within words.
   2894  1.1  mrg % We must therefore turn them both off (\tclose does that)
   2895  1.1  mrg % and arrange explicitly to hyphenate at a dash. -- rms.
   2896  1.1  mrg {
   2897  1.1  mrg   \catcode`\-=\active \catcode`\_=\active
   2898  1.1  mrg   \catcode`\'=\active \catcode`\`=\active
   2899  1.1  mrg   \global\let'=\rq \global\let`=\lq  % default definitions
   2900  1.1  mrg   %
   2901  1.1  mrg   \global\def\code{\begingroup
   2902  1.1  mrg     \setupmarkupstyle{code}%
   2903  1.1  mrg     % The following should really be moved into \setupmarkupstyle handlers.
   2904  1.1  mrg     \catcode\dashChar=\active  \catcode\underChar=\active
   2905  1.1  mrg     \ifallowcodebreaks
   2906  1.1  mrg      \let-\codedash
   2907  1.1  mrg      \let_\codeunder
   2908  1.1  mrg     \else
   2909  1.1  mrg      \let-\normaldash
   2910  1.1  mrg      \let_\realunder
   2911  1.1  mrg     \fi
   2912  1.1  mrg     % Given -foo (with a single dash), we do not want to allow a break
   2913  1.1  mrg     % after the hyphen.
   2914  1.1  mrg     \global\let\codedashprev=\codedash
   2915  1.1  mrg     %
   2916  1.1  mrg     \codex
   2917  1.1  mrg   }
   2918  1.1  mrg   %
   2919  1.1  mrg   \gdef\codedash{\futurelet\next\codedashfinish}
   2920  1.1  mrg   \gdef\codedashfinish{%
   2921  1.1  mrg     \normaldash % always output the dash character itself.
   2922  1.1  mrg     %
   2923  1.1  mrg     % Now, output a discretionary to allow a line break, unless
   2924  1.1  mrg     % (a) the next character is a -, or
   2925  1.1  mrg     % (b) the preceding character is a -.
   2926  1.1  mrg     % E.g., given --posix, we do not want to allow a break after either -.
   2927  1.1  mrg     % Given --foo-bar, we do want to allow a break between the - and the b.
   2928  1.1  mrg     \ifx\next\codedash \else
   2929  1.1  mrg       \ifx\codedashprev\codedash
   2930  1.1  mrg       \else \discretionary{}{}{}\fi
   2931  1.1  mrg     \fi
   2932  1.1  mrg     % we need the space after the = for the case when \next itself is a
   2933  1.1  mrg     % space token; it would get swallowed otherwise.  As in @code{- a}.
   2934  1.1  mrg     \global\let\codedashprev= \next
   2935  1.1  mrg   }
   2936  1.1  mrg }
   2937  1.1  mrg \def\normaldash{-}
   2938  1.1  mrg %
   2939  1.1  mrg \def\codex #1{\tclose{#1}\endgroup}
   2940  1.1  mrg 
   2941  1.1  mrg \def\codeunder{%
   2942  1.1  mrg   % this is all so @math{@code{var_name}+1} can work.  In math mode, _
   2943  1.1  mrg   % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
   2944  1.1  mrg   % will therefore expand the active definition of _, which is us
   2945  1.1  mrg   % (inside @code that is), therefore an endless loop.
   2946  1.1  mrg   \ifusingtt{\ifmmode
   2947  1.1  mrg                \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_.
   2948  1.1  mrg              \else\normalunderscore \fi
   2949  1.1  mrg              \discretionary{}{}{}}%
   2950  1.1  mrg             {\_}%
   2951  1.1  mrg }
   2952  1.1  mrg 
   2953  1.1  mrg % An additional complication: the above will allow breaks after, e.g.,
   2954  1.1  mrg % each of the four underscores in __typeof__.  This is bad.
   2955  1.1  mrg % @allowcodebreaks provides a document-level way to turn breaking at -
   2956  1.1  mrg % and _ on and off.
   2957  1.1  mrg %
   2958  1.1  mrg \newif\ifallowcodebreaks  \allowcodebreakstrue
   2959  1.1  mrg 
   2960  1.1  mrg \def\keywordtrue{true}
   2961  1.1  mrg \def\keywordfalse{false}
   2962  1.1  mrg 
   2963  1.1  mrg \parseargdef\allowcodebreaks{%
   2964  1.1  mrg   \def\txiarg{#1}%
   2965  1.1  mrg   \ifx\txiarg\keywordtrue
   2966  1.1  mrg     \allowcodebreakstrue
   2967  1.1  mrg   \else\ifx\txiarg\keywordfalse
   2968  1.1  mrg     \allowcodebreaksfalse
   2969  1.1  mrg   \else
   2970  1.1  mrg     \errhelp = \EMsimple
   2971  1.1  mrg     \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}%
   2972  1.1  mrg   \fi\fi
   2973  1.1  mrg }
   2974  1.1  mrg 
   2975  1.1  mrg % For @command, @env, @file, @option quotes seem unnecessary,
   2976  1.1  mrg % so use \code rather than \samp.
   2977  1.1  mrg \let\command=\code
   2978  1.1  mrg \let\env=\code
   2979  1.1  mrg \let\file=\code
   2980  1.1  mrg \let\option=\code
   2981  1.1  mrg 
   2982  1.1  mrg % @uref (abbreviation for `urlref') aka @url takes an optional
   2983  1.1  mrg % (comma-separated) second argument specifying the text to display and
   2984  1.1  mrg % an optional third arg as text to display instead of (rather than in
   2985  1.1  mrg % addition to) the url itself.  First (mandatory) arg is the url.
   2986  1.1  mrg 
   2987  1.1  mrg % TeX-only option to allow changing PDF output to show only the second
   2988  1.1  mrg % arg (if given), and not the url (which is then just the link target).
   2989  1.1  mrg \newif\ifurefurlonlylink
   2990  1.1  mrg 
   2991  1.1  mrg % The main macro is \urefbreak, which allows breaking at expected
   2992  1.1  mrg % places within the url.  (There used to be another version, which
   2993  1.1  mrg % didn't support automatic breaking.)
   2994  1.1  mrg \def\urefbreak{\begingroup \urefcatcodes \dourefbreak}
   2995  1.1  mrg \let\uref=\urefbreak
   2996  1.1  mrg %
   2997  1.1  mrg \def\dourefbreak#1{\urefbreakfinish #1,,,\finish}
   2998  1.1  mrg \def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example
   2999  1.1  mrg   \unsepspaces
   3000  1.1  mrg   \pdfurl{#1}%
   3001  1.1  mrg   \setbox0 = \hbox{\ignorespaces #3}%
   3002  1.1  mrg   \ifdim\wd0 > 0pt
   3003  1.1  mrg     \unhbox0 % third arg given, show only that
   3004  1.1  mrg   \else
   3005  1.1  mrg     \setbox0 = \hbox{\ignorespaces #2}% look for second arg
   3006  1.1  mrg     \ifdim\wd0 > 0pt
   3007  1.1  mrg       \ifpdf
   3008  1.1  mrg         % For pdfTeX and LuaTeX
   3009  1.1  mrg         \ifurefurlonlylink
   3010  1.1  mrg           % PDF plus option to not display url, show just arg
   3011  1.1  mrg           \unhbox0
   3012  1.1  mrg         \else
   3013  1.1  mrg           % PDF, normally display both arg and url for consistency,
   3014  1.1  mrg           % visibility, if the pdf is eventually used to print, etc.
   3015  1.1  mrg           \unhbox0\ (\urefcode{#1})%
   3016  1.1  mrg         \fi
   3017  1.1  mrg       \else
   3018  1.1  mrg         \ifx\XeTeXrevision\thisisundefined
   3019  1.1  mrg           \unhbox0\ (\urefcode{#1})% DVI, always show arg and url
   3020  1.1  mrg         \else
   3021  1.1  mrg           % For XeTeX
   3022  1.1  mrg           \ifurefurlonlylink
   3023  1.1  mrg             % PDF plus option to not display url, show just arg
   3024  1.1  mrg             \unhbox0
   3025  1.1  mrg           \else
   3026  1.1  mrg             % PDF, normally display both arg and url for consistency,
   3027  1.1  mrg             % visibility, if the pdf is eventually used to print, etc.
   3028  1.1  mrg             \unhbox0\ (\urefcode{#1})%
   3029  1.1  mrg           \fi
   3030  1.1  mrg         \fi
   3031  1.1  mrg       \fi
   3032  1.1  mrg     \else
   3033  1.1  mrg       \urefcode{#1}% only url given, so show it
   3034  1.1  mrg     \fi
   3035  1.1  mrg   \fi
   3036  1.1  mrg   \endlink
   3037  1.1  mrg \endgroup}
   3038  1.1  mrg 
   3039  1.1  mrg % Allow line breaks around only a few characters (only).
   3040  1.1  mrg \def\urefcatcodes{%
   3041  1.1  mrg   \catcode`\&=\active \catcode`\.=\active
   3042  1.1  mrg   \catcode`\#=\active \catcode`\?=\active
   3043  1.1  mrg   \catcode`\/=\active
   3044  1.1  mrg }
   3045  1.1  mrg {
   3046  1.1  mrg   \urefcatcodes
   3047  1.1  mrg   %
   3048  1.1  mrg   \global\def\urefcode{\begingroup
   3049  1.1  mrg     \setupmarkupstyle{code}%
   3050  1.1  mrg     \urefcatcodes
   3051  1.1  mrg     \let&\urefcodeamp
   3052  1.1  mrg     \let.\urefcodedot
   3053  1.1  mrg     \let#\urefcodehash
   3054  1.1  mrg     \let?\urefcodequest
   3055  1.1  mrg     \let/\urefcodeslash
   3056  1.1  mrg     \codex
   3057  1.1  mrg   }
   3058  1.1  mrg   %
   3059  1.1  mrg   % By default, they are just regular characters.
   3060  1.1  mrg   \global\def&{\normalamp}
   3061  1.1  mrg   \global\def.{\normaldot}
   3062  1.1  mrg   \global\def#{\normalhash}
   3063  1.1  mrg   \global\def?{\normalquest}
   3064  1.1  mrg   \global\def/{\normalslash}
   3065  1.1  mrg }
   3066  1.1  mrg 
   3067  1.1  mrg \def\urefcodeamp{\urefprebreak \&\urefpostbreak}
   3068  1.1  mrg \def\urefcodedot{\urefprebreak .\urefpostbreak}
   3069  1.1  mrg \def\urefcodehash{\urefprebreak \#\urefpostbreak}
   3070  1.1  mrg \def\urefcodequest{\urefprebreak ?\urefpostbreak}
   3071  1.1  mrg \def\urefcodeslash{\futurelet\next\urefcodeslashfinish}
   3072  1.1  mrg {
   3073  1.1  mrg   \catcode`\/=\active
   3074  1.1  mrg   \global\def\urefcodeslashfinish{%
   3075  1.1  mrg     \urefprebreak \slashChar
   3076  1.1  mrg     % Allow line break only after the final / in a sequence of
   3077  1.1  mrg     % slashes, to avoid line break between the slashes in http://.
   3078  1.1  mrg     \ifx\next/\else \urefpostbreak \fi
   3079  1.1  mrg   }
   3080  1.1  mrg }
   3081  1.1  mrg 
   3082  1.1  mrg % By default we'll break after the special characters, but some people like to
   3083  1.1  mrg % break before the special chars, so allow that.  Also allow no breaking at
   3084  1.1  mrg % all, for manual control.
   3085  1.1  mrg %
   3086  1.1  mrg \parseargdef\urefbreakstyle{%
   3087  1.1  mrg   \def\txiarg{#1}%
   3088  1.1  mrg   \ifx\txiarg\wordnone
   3089  1.1  mrg     \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak}
   3090  1.1  mrg   \else\ifx\txiarg\wordbefore
   3091  1.1  mrg     \def\urefprebreak{\urefallowbreak}\def\urefpostbreak{\nobreak}
   3092  1.1  mrg   \else\ifx\txiarg\wordafter
   3093  1.1  mrg     \def\urefprebreak{\nobreak}\def\urefpostbreak{\urefallowbreak}
   3094  1.1  mrg   \else
   3095  1.1  mrg     \errhelp = \EMsimple
   3096  1.1  mrg     \errmessage{Unknown @urefbreakstyle setting `\txiarg'}%
   3097  1.1  mrg   \fi\fi\fi
   3098  1.1  mrg }
   3099  1.1  mrg \def\wordafter{after}
   3100  1.1  mrg \def\wordbefore{before}
   3101  1.1  mrg \def\wordnone{none}
   3102  1.1  mrg 
   3103  1.1  mrg % Allow a ragged right output to aid breaking long URL's.  There can
   3104  1.1  mrg % be a break at the \allowbreak with no extra glue (if the existing stretch in
   3105  1.1  mrg % the line is sufficent), a break at the \penalty100 with extra glue added
   3106  1.1  mrg % at the end of the line, or no break at all here.
   3107  1.1  mrg %   Changing the value of the penalty and/or the amount of stretch affects how
   3108  1.1  mrg % preferrable one choice is over the other.
   3109  1.1  mrg \def\urefallowbreak{%
   3110  1.1  mrg   \allowbreak
   3111  1.1  mrg   \hskip 0pt plus 2 em\relax
   3112  1.1  mrg   \penalty300
   3113  1.1  mrg   \hskip 0pt plus -2 em\relax
   3114  1.1  mrg }
   3115  1.1  mrg 
   3116  1.1  mrg \urefbreakstyle after
   3117  1.1  mrg 
   3118  1.1  mrg % @url synonym for @uref, since that's how everyone uses it.
   3119  1.1  mrg %
   3120  1.1  mrg \let\url=\uref
   3121  1.1  mrg 
   3122  1.1  mrg % rms does not like angle brackets --karl, 17may97.
   3123  1.1  mrg % So now @email is just like @uref, unless we are pdf.
   3124  1.1  mrg %
   3125  1.1  mrg %\def\email#1{\angleleft{\tt #1}\angleright}
   3126  1.1  mrg \ifpdforxetex
   3127  1.1  mrg   \def\email#1{\doemail#1,,\finish}
   3128  1.1  mrg   \def\doemail#1,#2,#3\finish{\begingroup
   3129  1.1  mrg     \unsepspaces
   3130  1.1  mrg     \pdfurl{mailto:#1}%
   3131  1.1  mrg     \setbox0 = \hbox{\ignorespaces #2}%
   3132  1.1  mrg     \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
   3133  1.1  mrg     \endlink
   3134  1.1  mrg   \endgroup}
   3135  1.1  mrg \else
   3136  1.1  mrg   \let\email=\uref
   3137  1.1  mrg \fi
   3138  1.1  mrg 
   3139  1.1  mrg % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
   3140  1.1  mrg %   `example' (@kbd uses ttsl only inside of @example and friends),
   3141  1.1  mrg %   or `code' (@kbd uses normal tty font always).
   3142  1.1  mrg \parseargdef\kbdinputstyle{%
   3143  1.1  mrg   \def\txiarg{#1}%
   3144  1.1  mrg   \ifx\txiarg\worddistinct
   3145  1.1  mrg     \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
   3146  1.1  mrg   \else\ifx\txiarg\wordexample
   3147  1.1  mrg     \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
   3148  1.1  mrg   \else\ifx\txiarg\wordcode
   3149  1.1  mrg     \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
   3150  1.1  mrg   \else
   3151  1.1  mrg     \errhelp = \EMsimple
   3152  1.1  mrg     \errmessage{Unknown @kbdinputstyle setting `\txiarg'}%
   3153  1.1  mrg   \fi\fi\fi
   3154  1.1  mrg }
   3155  1.1  mrg \def\worddistinct{distinct}
   3156  1.1  mrg \def\wordexample{example}
   3157  1.1  mrg \def\wordcode{code}
   3158  1.1  mrg 
   3159  1.1  mrg % Default is `distinct'.
   3160  1.1  mrg \kbdinputstyle distinct
   3161  1.1  mrg 
   3162  1.1  mrg % @kbd is like @code, except that if the argument is just one @key command,
   3163  1.1  mrg % then @kbd has no effect.
   3164  1.1  mrg \def\kbd#1{{\def\look{#1}\expandafter\kbdsub\look??\par}}
   3165  1.1  mrg 
   3166  1.1  mrg \def\xkey{\key}
   3167  1.1  mrg \def\kbdsub#1#2#3\par{%
   3168  1.1  mrg   \def\one{#1}\def\three{#3}\def\threex{??}%
   3169  1.1  mrg   \ifx\one\xkey\ifx\threex\three \key{#2}%
   3170  1.1  mrg   \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
   3171  1.1  mrg   \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
   3172  1.1  mrg }
   3173  1.1  mrg 
   3174  1.1  mrg % definition of @key that produces a lozenge.  Doesn't adjust to text size.
   3175  1.1  mrg %\setfont\keyrm\rmshape{8}{1000}{OT1}
   3176  1.1  mrg %\font\keysy=cmsy9
   3177  1.1  mrg %\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
   3178  1.1  mrg %  \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
   3179  1.1  mrg %    \vbox{\hrule\kern-0.4pt
   3180  1.1  mrg %     \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
   3181  1.1  mrg %    \kern-0.4pt\hrule}%
   3182  1.1  mrg %  \kern-.06em\raise0.4pt\hbox{\angleright}}}}
   3183  1.1  mrg 
   3184  1.1  mrg % definition of @key with no lozenge.  If the current font is already
   3185  1.1  mrg % monospace, don't change it; that way, we respect @kbdinputstyle.  But
   3186  1.1  mrg % if it isn't monospace, then use \tt.
   3187  1.1  mrg %
   3188  1.1  mrg \def\key#1{{\setupmarkupstyle{key}%
   3189  1.1  mrg   \nohyphenation
   3190  1.1  mrg   \ifmonospace\else\tt\fi
   3191  1.1  mrg   #1}\null}
   3192  1.1  mrg 
   3193  1.1  mrg % @clicksequence{File @click{} Open ...}
   3194  1.1  mrg \def\clicksequence#1{\begingroup #1\endgroup}
   3195  1.1  mrg 
   3196  1.1  mrg % @clickstyle @arrow   (by default)
   3197  1.1  mrg \parseargdef\clickstyle{\def\click{#1}}
   3198  1.1  mrg \def\click{\arrow}
   3199  1.1  mrg 
   3200  1.1  mrg % Typeset a dimension, e.g., `in' or `pt'.  The only reason for the
   3201  1.1  mrg % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
   3202  1.1  mrg %
   3203  1.1  mrg \def\dmn#1{\thinspace #1}
   3204  1.1  mrg 
   3205  1.1  mrg % @acronym for "FBI", "NATO", and the like.
   3206  1.1  mrg % We print this one point size smaller, since it's intended for
   3207  1.1  mrg % all-uppercase.
   3208  1.1  mrg %
   3209  1.1  mrg \def\acronym#1{\doacronym #1,,\finish}
   3210  1.1  mrg \def\doacronym#1,#2,#3\finish{%
   3211  1.1  mrg   {\switchtolsize #1}%
   3212  1.1  mrg   \def\temp{#2}%
   3213  1.1  mrg   \ifx\temp\empty \else
   3214  1.1  mrg     \space ({\unsepspaces \ignorespaces \temp \unskip})%
   3215  1.1  mrg   \fi
   3216  1.1  mrg   \null % reset \spacefactor=1000
   3217  1.1  mrg }
   3218  1.1  mrg 
   3219  1.1  mrg % @abbr for "Comput. J." and the like.
   3220  1.1  mrg % No font change, but don't do end-of-sentence spacing.
   3221  1.1  mrg %
   3222  1.1  mrg \def\abbr#1{\doabbr #1,,\finish}
   3223  1.1  mrg \def\doabbr#1,#2,#3\finish{%
   3224  1.1  mrg   {\plainfrenchspacing #1}%
   3225  1.1  mrg   \def\temp{#2}%
   3226  1.1  mrg   \ifx\temp\empty \else
   3227  1.1  mrg     \space ({\unsepspaces \ignorespaces \temp \unskip})%
   3228  1.1  mrg   \fi
   3229  1.1  mrg   \null % reset \spacefactor=1000
   3230  1.1  mrg }
   3231  1.1  mrg 
   3232  1.1  mrg % @asis just yields its argument.  Used with @table, for example.
   3233  1.1  mrg %
   3234  1.1  mrg \def\asis#1{#1}
   3235  1.1  mrg 
   3236  1.1  mrg % @math outputs its argument in math mode.
   3237  1.1  mrg %
   3238  1.1  mrg % One complication: _ usually means subscripts, but it could also mean
   3239  1.1  mrg % an actual _ character, as in @math{@var{some_variable} + 1}.  So make
   3240  1.1  mrg % _ active, and distinguish by seeing if the current family is \slfam,
   3241  1.1  mrg % which is what @var uses.
   3242  1.1  mrg {
   3243  1.1  mrg   \catcode`\_ = \active
   3244  1.1  mrg   \gdef\mathunderscore{%
   3245  1.1  mrg     \catcode`\_=\active
   3246  1.1  mrg     \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
   3247  1.1  mrg   }
   3248  1.1  mrg }
   3249  1.1  mrg % Another complication: we want \\ (and @\) to output a math (or tt) \.
   3250  1.1  mrg % FYI, plain.tex uses \\ as a temporary control sequence (for no
   3251  1.1  mrg % particular reason), but this is not advertised and we don't care.
   3252  1.1  mrg %
   3253  1.1  mrg % The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
   3254  1.1  mrg \def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
   3255  1.1  mrg %
   3256  1.1  mrg \def\math{%
   3257  1.1  mrg   \ifmmode\else % only go into math if not in math mode already
   3258  1.1  mrg     \tex
   3259  1.1  mrg     \mathunderscore
   3260  1.1  mrg     \let\\ = \mathbackslash
   3261  1.1  mrg     \mathactive
   3262  1.1  mrg     % make the texinfo accent commands work in math mode
   3263  1.1  mrg     \let\"=\ddot
   3264  1.1  mrg     \let\'=\acute
   3265  1.1  mrg     \let\==\bar
   3266  1.1  mrg     \let\^=\hat
   3267  1.1  mrg     \let\`=\grave
   3268  1.1  mrg     \let\u=\breve
   3269  1.1  mrg     \let\v=\check
   3270  1.1  mrg     \let\~=\tilde
   3271  1.1  mrg     \let\dotaccent=\dot
   3272  1.1  mrg     % have to provide another name for sup operator
   3273  1.1  mrg     \let\mathopsup=\sup
   3274  1.1  mrg   $\expandafter\finishmath\fi
   3275  1.1  mrg }
   3276  1.1  mrg \def\finishmath#1{#1$\endgroup}  % Close the group opened by \tex.
   3277  1.1  mrg 
   3278  1.1  mrg % Some active characters (such as <) are spaced differently in math.
   3279  1.1  mrg % We have to reset their definitions in case the @math was an argument
   3280  1.1  mrg % to a command which sets the catcodes (such as @item or @section).
   3281  1.1  mrg %
   3282  1.1  mrg {
   3283  1.1  mrg   \catcode`^ = \active
   3284  1.1  mrg   \catcode`< = \active
   3285  1.1  mrg   \catcode`> = \active
   3286  1.1  mrg   \catcode`+ = \active
   3287  1.1  mrg   \catcode`' = \active
   3288  1.1  mrg   \gdef\mathactive{%
   3289  1.1  mrg     \let^ = \ptexhat
   3290  1.1  mrg     \let< = \ptexless
   3291  1.1  mrg     \let> = \ptexgtr
   3292  1.1  mrg     \let+ = \ptexplus
   3293  1.1  mrg     \let' = \ptexquoteright
   3294  1.1  mrg   }
   3295  1.1  mrg }
   3296  1.1  mrg 
   3297  1.1  mrg % for @sub and @sup, if in math mode, just do a normal sub/superscript.
   3298  1.1  mrg % If in text, use math to place as sub/superscript, but switch
   3299  1.1  mrg % into text mode, with smaller fonts.  This is a different font than the
   3300  1.1  mrg % one used for real math sub/superscripts (8pt vs. 7pt), but let's not
   3301  1.1  mrg % fix it (significant additions to font machinery) until someone notices.
   3302  1.1  mrg %
   3303  1.1  mrg \def\sub{\ifmmode \expandafter\sb \else \expandafter\finishsub\fi}
   3304  1.1  mrg \def\finishsub#1{$\sb{\hbox{\switchtolllsize #1}}$}%
   3305  1.1  mrg %
   3306  1.1  mrg \def\sup{\ifmmode \expandafter\ptexsp \else \expandafter\finishsup\fi}
   3307  1.1  mrg \def\finishsup#1{$\ptexsp{\hbox{\switchtolllsize #1}}$}%
   3308  1.1  mrg 
   3309  1.1  mrg % @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}.
   3310  1.1  mrg % Ignore unless FMTNAME == tex; then it is like @iftex and @tex,
   3311  1.1  mrg % except specified as a normal braced arg, so no newlines to worry about.
   3312  1.1  mrg %
   3313  1.1  mrg \def\outfmtnametex{tex}
   3314  1.1  mrg %
   3315  1.1  mrg \long\def\inlinefmt#1{\doinlinefmt #1,\finish}
   3316  1.1  mrg \long\def\doinlinefmt#1,#2,\finish{%
   3317  1.1  mrg   \def\inlinefmtname{#1}%
   3318  1.1  mrg   \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi
   3319  1.1  mrg }
   3320  1.1  mrg %
   3321  1.1  mrg % @inlinefmtifelse{FMTNAME,THEN-TEXT,ELSE-TEXT} expands THEN-TEXT if
   3322  1.1  mrg % FMTNAME is tex, else ELSE-TEXT.
   3323  1.1  mrg \long\def\inlinefmtifelse#1{\doinlinefmtifelse #1,,,\finish}
   3324  1.1  mrg \long\def\doinlinefmtifelse#1,#2,#3,#4,\finish{%
   3325  1.1  mrg   \def\inlinefmtname{#1}%
   3326  1.1  mrg   \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\else \ignorespaces #3\fi
   3327  1.1  mrg }
   3328  1.1  mrg %
   3329  1.1  mrg % For raw, must switch into @tex before parsing the argument, to avoid
   3330  1.1  mrg % setting catcodes prematurely.  Doing it this way means that, for
   3331  1.1  mrg % example, @inlineraw{html, foo{bar} gets a parse error instead of being
   3332  1.1  mrg % ignored.  But this isn't important because if people want a literal
   3333  1.1  mrg % *right* brace they would have to use a command anyway, so they may as
   3334  1.1  mrg % well use a command to get a left brace too.  We could re-use the
   3335  1.1  mrg % delimiter character idea from \verb, but it seems like overkill.
   3336  1.1  mrg %
   3337  1.1  mrg \long\def\inlineraw{\tex \doinlineraw}
   3338  1.1  mrg \long\def\doinlineraw#1{\doinlinerawtwo #1,\finish}
   3339  1.1  mrg \def\doinlinerawtwo#1,#2,\finish{%
   3340  1.1  mrg   \def\inlinerawname{#1}%
   3341  1.1  mrg   \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi
   3342  1.1  mrg   \endgroup % close group opened by \tex.
   3343  1.1  mrg }
   3344  1.1  mrg 
   3345  1.1  mrg % @inlineifset{VAR, TEXT} expands TEXT if VAR is @set.
   3346  1.1  mrg %
   3347  1.1  mrg \long\def\inlineifset#1{\doinlineifset #1,\finish}
   3348  1.1  mrg \long\def\doinlineifset#1,#2,\finish{%
   3349  1.1  mrg   \def\inlinevarname{#1}%
   3350  1.1  mrg   \expandafter\ifx\csname SET\inlinevarname\endcsname\relax
   3351  1.1  mrg   \else\ignorespaces#2\fi
   3352  1.1  mrg }
   3353  1.1  mrg 
   3354  1.1  mrg % @inlineifclear{VAR, TEXT} expands TEXT if VAR is not @set.
   3355  1.1  mrg %
   3356  1.1  mrg \long\def\inlineifclear#1{\doinlineifclear #1,\finish}
   3357  1.1  mrg \long\def\doinlineifclear#1,#2,\finish{%
   3358  1.1  mrg   \def\inlinevarname{#1}%
   3359  1.1  mrg   \expandafter\ifx\csname SET\inlinevarname\endcsname\relax \ignorespaces#2\fi
   3360  1.1  mrg }
   3361  1.1  mrg 
   3362  1.1  mrg 
   3363  1.1  mrg \message{glyphs,}
   3364  1.1  mrg % and logos.
   3365  1.1  mrg 
   3366  1.1  mrg % @@ prints an @, as does @atchar{}.
   3367  1.1  mrg \def\@{\char64 }
   3368  1.1  mrg \let\atchar=\@
   3369  1.1  mrg 
   3370  1.1  mrg % @{ @} @lbracechar{} @rbracechar{} all generate brace characters.
   3371  1.1  mrg \def\lbracechar{{\ifmonospace\char123\else\ensuremath\lbrace\fi}}
   3372  1.1  mrg \def\rbracechar{{\ifmonospace\char125\else\ensuremath\rbrace\fi}}
   3373  1.1  mrg \let\{=\lbracechar
   3374  1.1  mrg \let\}=\rbracechar
   3375  1.1  mrg 
   3376  1.1  mrg % @comma{} to avoid , parsing problems.
   3377  1.1  mrg \let\comma = ,
   3378  1.1  mrg 
   3379  1.1  mrg % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
   3380  1.1  mrg % Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
   3381  1.1  mrg \let\, = \ptexc
   3382  1.1  mrg \let\dotaccent = \ptexdot
   3383  1.1  mrg \def\ringaccent#1{{\accent23 #1}}
   3384  1.1  mrg \let\tieaccent = \ptext
   3385  1.1  mrg \let\ubaraccent = \ptexb
   3386  1.1  mrg \let\udotaccent = \d
   3387  1.1  mrg 
   3388  1.1  mrg % Other special characters: @questiondown @exclamdown @ordf @ordm
   3389  1.1  mrg % Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
   3390  1.1  mrg \def\questiondown{?`}
   3391  1.1  mrg \def\exclamdown{!`}
   3392  1.1  mrg \def\ordf{\leavevmode\raise1ex\hbox{\switchtolllsize \underbar{a}}}
   3393  1.1  mrg \def\ordm{\leavevmode\raise1ex\hbox{\switchtolllsize \underbar{o}}}
   3394  1.1  mrg 
   3395  1.1  mrg % Dotless i and dotless j, used for accents.
   3396  1.1  mrg \def\imacro{i}
   3397  1.1  mrg \def\jmacro{j}
   3398  1.1  mrg \def\dotless#1{%
   3399  1.1  mrg   \def\temp{#1}%
   3400  1.1  mrg   \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi
   3401  1.1  mrg   \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi
   3402  1.1  mrg   \else \errmessage{@dotless can be used only with i or j}%
   3403  1.1  mrg   \fi\fi
   3404  1.1  mrg }
   3405  1.1  mrg 
   3406  1.1  mrg % The \TeX{} logo, as in plain, but resetting the spacing so that a
   3407  1.1  mrg % period following counts as ending a sentence.  (Idea found in latex.)
   3408  1.1  mrg %
   3409  1.1  mrg \edef\TeX{\TeX \spacefactor=1000 }
   3410  1.1  mrg 
   3411  1.1  mrg % @LaTeX{} logo.  Not quite the same results as the definition in
   3412  1.1  mrg % latex.ltx, since we use a different font for the raised A; it's most
   3413  1.1  mrg % convenient for us to use an explicitly smaller font, rather than using
   3414  1.1  mrg % the \scriptstyle font (since we don't reset \scriptstyle and
   3415  1.1  mrg % \scriptscriptstyle).
   3416  1.1  mrg %
   3417  1.1  mrg \def\LaTeX{%
   3418  1.1  mrg   L\kern-.36em
   3419  1.1  mrg   {\setbox0=\hbox{T}%
   3420  1.1  mrg    \vbox to \ht0{\hbox{%
   3421  1.1  mrg      \ifx\textnominalsize\xwordpt
   3422  1.1  mrg        % for 10pt running text, lllsize (8pt) is too small for the A in LaTeX.
   3423  1.1  mrg        % Revert to plain's \scriptsize, which is 7pt.
   3424  1.1  mrg        \count255=\the\fam $\fam\count255 \scriptstyle A$%
   3425  1.1  mrg      \else
   3426  1.1  mrg        % For 11pt, we can use our lllsize.
   3427  1.1  mrg        \switchtolllsize A%
   3428  1.1  mrg      \fi
   3429  1.1  mrg      }%
   3430  1.1  mrg      \vss
   3431  1.1  mrg   }}%
   3432  1.1  mrg   \kern-.15em
   3433  1.1  mrg   \TeX
   3434  1.1  mrg }
   3435  1.1  mrg 
   3436  1.1  mrg % Some math mode symbols.  Define \ensuremath to switch into math mode
   3437  1.1  mrg % unless we are already there.  Expansion tricks may not be needed here,
   3438  1.1  mrg % but safer, and can't hurt.
   3439  1.1  mrg \def\ensuremath{\ifmmode \expandafter\asis \else\expandafter\ensuredmath \fi}
   3440  1.1  mrg \def\ensuredmath#1{$\relax#1$}
   3441  1.1  mrg %
   3442  1.1  mrg \def\bullet{\ensuremath\ptexbullet}
   3443  1.1  mrg \def\geq{\ensuremath\ge}
   3444  1.1  mrg \def\leq{\ensuremath\le}
   3445  1.1  mrg \def\minus{\ensuremath-}
   3446  1.1  mrg 
   3447  1.1  mrg % @dots{} outputs an ellipsis using the current font.
   3448  1.1  mrg % We do .5em per period so that it has the same spacing in the cm
   3449  1.1  mrg % typewriter fonts as three actual period characters; on the other hand,
   3450  1.1  mrg % in other typewriter fonts three periods are wider than 1.5em.  So do
   3451  1.1  mrg % whichever is larger.
   3452  1.1  mrg %
   3453  1.1  mrg \def\dots{%
   3454  1.1  mrg   \leavevmode
   3455  1.1  mrg   \setbox0=\hbox{...}% get width of three periods
   3456  1.1  mrg   \ifdim\wd0 > 1.5em
   3457  1.1  mrg     \dimen0 = \wd0
   3458  1.1  mrg   \else
   3459  1.1  mrg     \dimen0 = 1.5em
   3460  1.1  mrg   \fi
   3461  1.1  mrg   \hbox to \dimen0{%
   3462  1.1  mrg     \hskip 0pt plus.25fil
   3463  1.1  mrg     .\hskip 0pt plus1fil
   3464  1.1  mrg     .\hskip 0pt plus1fil
   3465  1.1  mrg     .\hskip 0pt plus.5fil
   3466  1.1  mrg   }%
   3467  1.1  mrg }
   3468  1.1  mrg 
   3469  1.1  mrg % @enddots{} is an end-of-sentence ellipsis.
   3470  1.1  mrg %
   3471  1.1  mrg \def\enddots{%
   3472  1.1  mrg   \dots
   3473  1.1  mrg   \spacefactor=\endofsentencespacefactor
   3474  1.1  mrg }
   3475  1.1  mrg 
   3476  1.1  mrg % @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
   3477  1.1  mrg %
   3478  1.1  mrg % Since these characters are used in examples, they should be an even number of
   3479  1.1  mrg % \tt widths. Each \tt character is 1en, so two makes it 1em.
   3480  1.1  mrg %
   3481  1.1  mrg \def\point{$\star$}
   3482  1.1  mrg \def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}}
   3483  1.1  mrg \def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
   3484  1.1  mrg \def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}}
   3485  1.1  mrg \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
   3486  1.1  mrg \def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}}
   3487  1.1  mrg 
   3488  1.1  mrg % The @error{} command.
   3489  1.1  mrg % Adapted from the TeXbook's \boxit.
   3490  1.1  mrg %
   3491  1.1  mrg \newbox\errorbox
   3492  1.1  mrg %
   3493  1.1  mrg {\ttfont \global\dimen0 = 3em}% Width of the box.
   3494  1.1  mrg \dimen2 = .55pt % Thickness of rules
   3495  1.1  mrg % The text. (`r' is open on the right, `e' somewhat less so on the left.)
   3496  1.1  mrg \setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt}
   3497  1.1  mrg %
   3498  1.1  mrg \setbox\errorbox=\hbox to \dimen0{\hfil
   3499  1.1  mrg    \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
   3500  1.1  mrg    \advance\hsize by -2\dimen2 % Rules.
   3501  1.1  mrg    \vbox{%
   3502  1.1  mrg       \hrule height\dimen2
   3503  1.1  mrg       \hbox{\vrule width\dimen2 \kern3pt          % Space to left of text.
   3504  1.1  mrg          \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
   3505  1.1  mrg          \kern3pt\vrule width\dimen2}% Space to right.
   3506  1.1  mrg       \hrule height\dimen2}
   3507  1.1  mrg     \hfil}
   3508  1.1  mrg %
   3509  1.1  mrg \def\error{\leavevmode\lower.7ex\copy\errorbox}
   3510  1.1  mrg 
   3511  1.1  mrg % @pounds{} is a sterling sign, which Knuth put in the CM italic font.
   3512  1.1  mrg %
   3513  1.1  mrg \def\pounds{{\it\$}}
   3514  1.1  mrg 
   3515  1.1  mrg % @euro{} comes from a separate font, depending on the current style.
   3516  1.1  mrg % We use the free feym* fonts from the eurosym package by Henrik
   3517  1.1  mrg % Theiling, which support regular, slanted, bold and bold slanted (and
   3518  1.1  mrg % "outlined" (blackboard board, sort of) versions, which we don't need).
   3519  1.1  mrg % It is available from http://www.ctan.org/tex-archive/fonts/eurosym.
   3520  1.1  mrg %
   3521  1.1  mrg % Although only regular is the truly official Euro symbol, we ignore
   3522  1.1  mrg % that.  The Euro is designed to be slightly taller than the regular
   3523  1.1  mrg % font height.
   3524  1.1  mrg %
   3525  1.1  mrg % feymr - regular
   3526  1.1  mrg % feymo - slanted
   3527  1.1  mrg % feybr - bold
   3528  1.1  mrg % feybo - bold slanted
   3529  1.1  mrg %
   3530  1.1  mrg % There is no good (free) typewriter version, to my knowledge.
   3531  1.1  mrg % A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide.
   3532  1.1  mrg % Hmm.
   3533  1.1  mrg %
   3534  1.1  mrg % Also doesn't work in math.  Do we need to do math with euro symbols?
   3535  1.1  mrg % Hope not.
   3536  1.1  mrg %
   3537  1.1  mrg %
   3538  1.1  mrg \def\euro{{\eurofont e}}
   3539  1.1  mrg \def\eurofont{%
   3540  1.1  mrg   % We set the font at each command, rather than predefining it in
   3541  1.1  mrg   % \textfonts and the other font-switching commands, so that
   3542  1.1  mrg   % installations which never need the symbol don't have to have the
   3543  1.1  mrg   % font installed.
   3544  1.1  mrg   %
   3545  1.1  mrg   % There is only one designed size (nominal 10pt), so we always scale
   3546  1.1  mrg   % that to the current nominal size.
   3547  1.1  mrg   %
   3548  1.1  mrg   % By the way, simply using "at 1em" works for cmr10 and the like, but
   3549  1.1  mrg   % does not work for cmbx10 and other extended/shrunken fonts.
   3550  1.1  mrg   %
   3551  1.1  mrg   \def\eurosize{\csname\curfontsize nominalsize\endcsname}%
   3552  1.1  mrg   %
   3553  1.1  mrg   \ifx\curfontstyle\bfstylename
   3554  1.1  mrg     % bold:
   3555  1.1  mrg     \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize
   3556  1.1  mrg   \else
   3557  1.1  mrg     % regular:
   3558  1.1  mrg     \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize
   3559  1.1  mrg   \fi
   3560  1.1  mrg   \thiseurofont
   3561  1.1  mrg }
   3562  1.1  mrg 
   3563  1.1  mrg % Glyphs from the EC fonts.  We don't use \let for the aliases, because
   3564  1.1  mrg % sometimes we redefine the original macro, and the alias should reflect
   3565  1.1  mrg % the redefinition.
   3566  1.1  mrg %
   3567  1.1  mrg % Use LaTeX names for the Icelandic letters.
   3568  1.1  mrg \def\DH{{\ecfont \char"D0}} % Eth
   3569  1.1  mrg \def\dh{{\ecfont \char"F0}} % eth
   3570  1.1  mrg \def\TH{{\ecfont \char"DE}} % Thorn
   3571  1.1  mrg \def\th{{\ecfont \char"FE}} % thorn
   3572  1.1  mrg %
   3573  1.1  mrg \def\guillemetleft{{\ecfont \char"13}}
   3574  1.1  mrg \def\guillemotleft{\guillemetleft}
   3575  1.1  mrg \def\guillemetright{{\ecfont \char"14}}
   3576  1.1  mrg \def\guillemotright{\guillemetright}
   3577  1.1  mrg \def\guilsinglleft{{\ecfont \char"0E}}
   3578  1.1  mrg \def\guilsinglright{{\ecfont \char"0F}}
   3579  1.1  mrg \def\quotedblbase{{\ecfont \char"12}}
   3580  1.1  mrg \def\quotesinglbase{{\ecfont \char"0D}}
   3581  1.1  mrg %
   3582  1.1  mrg % This positioning is not perfect (see the ogonek LaTeX package), but
   3583  1.1  mrg % we have the precomposed glyphs for the most common cases.  We put the
   3584  1.1  mrg % tests to use those glyphs in the single \ogonek macro so we have fewer
   3585  1.1  mrg % dummy definitions to worry about for index entries, etc.
   3586  1.1  mrg %
   3587  1.1  mrg % ogonek is also used with other letters in Lithuanian (IOU), but using
   3588  1.1  mrg % the precomposed glyphs for those is not so easy since they aren't in
   3589  1.1  mrg % the same EC font.
   3590  1.1  mrg \def\ogonek#1{{%
   3591  1.1  mrg   \def\temp{#1}%
   3592  1.1  mrg   \ifx\temp\macrocharA\Aogonek
   3593  1.1  mrg   \else\ifx\temp\macrochara\aogonek
   3594  1.1  mrg   \else\ifx\temp\macrocharE\Eogonek
   3595  1.1  mrg   \else\ifx\temp\macrochare\eogonek
   3596  1.1  mrg   \else
   3597  1.1  mrg     \ecfont \setbox0=\hbox{#1}%
   3598  1.1  mrg     \ifdim\ht0=1ex\accent"0C #1%
   3599  1.1  mrg     \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}%
   3600  1.1  mrg     \fi
   3601  1.1  mrg   \fi\fi\fi\fi
   3602  1.1  mrg   }%
   3603  1.1  mrg }
   3604  1.1  mrg \def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A}
   3605  1.1  mrg \def\aogonek{{\ecfont \char"A1}}\def\macrochara{a}
   3606  1.1  mrg \def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E}
   3607  1.1  mrg \def\eogonek{{\ecfont \char"A6}}\def\macrochare{e}
   3608  1.1  mrg %
   3609  1.1  mrg % Use the European Computer Modern fonts (cm-super in outline format)
   3610  1.1  mrg % for non-CM glyphs.  That is ec* for regular text and tc* for the text
   3611  1.1  mrg % companion symbols (LaTeX TS1 encoding).  Both are part of the ec
   3612  1.1  mrg % package and follow the same conventions.
   3613  1.1  mrg %
   3614  1.1  mrg \def\ecfont{\etcfont{e}}
   3615  1.1  mrg \def\tcfont{\etcfont{t}}
   3616  1.1  mrg %
   3617  1.1  mrg \def\etcfont#1{%
   3618  1.1  mrg   % We can't distinguish serif/sans and italic/slanted, but this
   3619  1.1  mrg   % is used for crude hacks anyway (like adding French and German
   3620  1.1  mrg   % quotes to documents typeset with CM, where we lose kerning), so
   3621  1.1  mrg   % hopefully nobody will notice/care.
   3622  1.1  mrg   \edef\ecsize{\csname\curfontsize ecsize\endcsname}%
   3623  1.1  mrg   \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}%
   3624  1.1  mrg   \ifmonospace
   3625  1.1  mrg     % typewriter:
   3626  1.1  mrg     \font\thisecfont = #1ctt\ecsize \space at \nominalsize
   3627  1.1  mrg   \else
   3628  1.1  mrg     \ifx\curfontstyle\bfstylename
   3629  1.1  mrg       % bold:
   3630  1.1  mrg       \font\thisecfont = #1cb\ifusingit{i}{x}\ecsize \space at \nominalsize
   3631  1.1  mrg     \else
   3632  1.1  mrg       % regular:
   3633  1.1  mrg       \font\thisecfont = #1c\ifusingit{ti}{rm}\ecsize \space at \nominalsize
   3634  1.1  mrg     \fi
   3635  1.1  mrg   \fi
   3636  1.1  mrg   \thisecfont
   3637  1.1  mrg }
   3638  1.1  mrg 
   3639  1.1  mrg % @registeredsymbol - R in a circle.  The font for the R should really
   3640  1.1  mrg % be smaller yet, but lllsize is the best we can do for now.
   3641  1.1  mrg % Adapted from the plain.tex definition of \copyright.
   3642  1.1  mrg %
   3643  1.1  mrg \def\registeredsymbol{%
   3644  1.1  mrg   $^{{\ooalign{\hfil\raise.07ex\hbox{\switchtolllsize R}%
   3645  1.1  mrg                \hfil\crcr\Orb}}%
   3646  1.1  mrg     }$%
   3647  1.1  mrg }
   3648  1.1  mrg 
   3649  1.1  mrg % @textdegree - the normal degrees sign.
   3650  1.1  mrg %
   3651  1.1  mrg \def\textdegree{$^\circ$}
   3652  1.1  mrg 
   3653  1.1  mrg % Laurent Siebenmann reports \Orb undefined with:
   3654  1.1  mrg %  Textures 1.7.7 (preloaded format=plain 93.10.14)  (68K)  16 APR 2004 02:38
   3655  1.1  mrg % so we'll define it if necessary.
   3656  1.1  mrg %
   3657  1.1  mrg \ifx\Orb\thisisundefined
   3658  1.1  mrg \def\Orb{\mathhexbox20D}
   3659  1.1  mrg \fi
   3660  1.1  mrg 
   3661  1.1  mrg % Quotes.
   3662  1.1  mrg \chardef\quotedblleft="5C
   3663  1.1  mrg \chardef\quotedblright=`\"
   3664  1.1  mrg \chardef\quoteleft=`\`
   3665  1.1  mrg \chardef\quoteright=`\'
   3666  1.1  mrg 
   3667  1.1  mrg 
   3668  1.1  mrg \message{page headings,}
   3669  1.1  mrg 
   3670  1.1  mrg \newskip\titlepagetopglue \titlepagetopglue = 1.5in
   3671  1.1  mrg \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
   3672  1.1  mrg 
   3673  1.1  mrg % First the title page.  Must do @settitle before @titlepage.
   3674  1.1  mrg \newif\ifseenauthor
   3675  1.1  mrg \newif\iffinishedtitlepage
   3676  1.1  mrg 
   3677  1.1  mrg % @setcontentsaftertitlepage used to do an implicit @contents or
   3678  1.1  mrg % @shortcontents after @end titlepage, but it is now obsolete.
   3679  1.1  mrg \def\setcontentsaftertitlepage{%
   3680  1.1  mrg   \errmessage{@setcontentsaftertitlepage has been removed as a Texinfo
   3681  1.1  mrg               command; move your @contents command if you want the contents
   3682  1.1  mrg               after the title page.}}%
   3683  1.1  mrg \def\setshortcontentsaftertitlepage{%
   3684  1.1  mrg   \errmessage{@setshortcontentsaftertitlepage has been removed as a Texinfo
   3685  1.1  mrg               command; move your @shortcontents and @contents commands if you
   3686  1.1  mrg               want the contents after the title page.}}%
   3687  1.1  mrg 
   3688  1.1  mrg \parseargdef\shorttitlepage{%
   3689  1.1  mrg   \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}%
   3690  1.1  mrg   \endgroup\page\hbox{}\page}
   3691  1.1  mrg 
   3692  1.1  mrg \envdef\titlepage{%
   3693  1.1  mrg   % Open one extra group, as we want to close it in the middle of \Etitlepage.
   3694  1.1  mrg   \begingroup
   3695  1.1  mrg     \parindent=0pt \textfonts
   3696  1.1  mrg     % Leave some space at the very top of the page.
   3697  1.1  mrg     \vglue\titlepagetopglue
   3698  1.1  mrg     % No rule at page bottom unless we print one at the top with @title.
   3699  1.1  mrg     \finishedtitlepagetrue
   3700  1.1  mrg     %
   3701  1.1  mrg     % Most title ``pages'' are actually two pages long, with space
   3702  1.1  mrg     % at the top of the second.  We don't want the ragged left on the second.
   3703  1.1  mrg     \let\oldpage = \page
   3704  1.1  mrg     \def\page{%
   3705  1.1  mrg       \iffinishedtitlepage\else
   3706  1.1  mrg 	 \finishtitlepage
   3707  1.1  mrg       \fi
   3708  1.1  mrg       \let\page = \oldpage
   3709  1.1  mrg       \page
   3710  1.1  mrg       \null
   3711  1.1  mrg     }%
   3712  1.1  mrg }
   3713  1.1  mrg 
   3714  1.1  mrg \def\Etitlepage{%
   3715  1.1  mrg     \iffinishedtitlepage\else
   3716  1.1  mrg 	\finishtitlepage
   3717  1.1  mrg     \fi
   3718  1.1  mrg     % It is important to do the page break before ending the group,
   3719  1.1  mrg     % because the headline and footline are only empty inside the group.
   3720  1.1  mrg     % If we use the new definition of \page, we always get a blank page
   3721  1.1  mrg     % after the title page, which we certainly don't want.
   3722  1.1  mrg     \oldpage
   3723  1.1  mrg   \endgroup
   3724  1.1  mrg   %
   3725  1.1  mrg   % Need this before the \...aftertitlepage checks so that if they are
   3726  1.1  mrg   % in effect the toc pages will come out with page numbers.
   3727  1.1  mrg   \HEADINGSon
   3728  1.1  mrg }
   3729  1.1  mrg 
   3730  1.1  mrg \def\finishtitlepage{%
   3731  1.1  mrg   \vskip4pt \hrule height 2pt width \hsize
   3732  1.1  mrg   \vskip\titlepagebottomglue
   3733  1.1  mrg   \finishedtitlepagetrue
   3734  1.1  mrg }
   3735  1.1  mrg 
   3736  1.1  mrg % Settings used for typesetting titles: no hyphenation, no indentation,
   3737  1.1  mrg % don't worry much about spacing, ragged right.  This should be used
   3738  1.1  mrg % inside a \vbox, and fonts need to be set appropriately first. \par should
   3739  1.1  mrg % be specified before the end of the \vbox, since a vbox is a group.
   3740  1.1  mrg %
   3741  1.1  mrg \def\raggedtitlesettings{%
   3742  1.1  mrg   \rm
   3743  1.1  mrg   \hyphenpenalty=10000
   3744  1.1  mrg   \parindent=0pt
   3745  1.1  mrg   \tolerance=5000
   3746  1.1  mrg   \ptexraggedright
   3747  1.1  mrg }
   3748  1.1  mrg 
   3749  1.1  mrg % Macros to be used within @titlepage:
   3750  1.1  mrg 
   3751  1.1  mrg \let\subtitlerm=\rmfont
   3752  1.1  mrg \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}
   3753  1.1  mrg 
   3754  1.1  mrg \parseargdef\title{%
   3755  1.1  mrg   \checkenv\titlepage
   3756  1.1  mrg   \vbox{\titlefonts \raggedtitlesettings #1\par}%
   3757  1.1  mrg   % print a rule at the page bottom also.
   3758  1.1  mrg   \finishedtitlepagefalse
   3759  1.1  mrg   \vskip4pt \hrule height 4pt width \hsize \vskip4pt
   3760  1.1  mrg }
   3761  1.1  mrg 
   3762  1.1  mrg \parseargdef\subtitle{%
   3763  1.1  mrg   \checkenv\titlepage
   3764  1.1  mrg   {\subtitlefont \rightline{#1}}%
   3765  1.1  mrg }
   3766  1.1  mrg 
   3767  1.1  mrg % @author should come last, but may come many times.
   3768  1.1  mrg % It can also be used inside @quotation.
   3769  1.1  mrg %
   3770  1.1  mrg \parseargdef\author{%
   3771  1.1  mrg   \def\temp{\quotation}%
   3772  1.1  mrg   \ifx\thisenv\temp
   3773  1.1  mrg     \def\quotationauthor{#1}% printed in \Equotation.
   3774  1.1  mrg   \else
   3775  1.1  mrg     \checkenv\titlepage
   3776  1.1  mrg     \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi
   3777  1.1  mrg     {\secfonts\rm \leftline{#1}}%
   3778  1.1  mrg   \fi
   3779  1.1  mrg }
   3780  1.1  mrg 
   3781  1.1  mrg 
   3782  1.1  mrg % Set up page headings and footings.
   3783  1.1  mrg 
   3784  1.1  mrg \let\thispage=\folio
   3785  1.1  mrg 
   3786  1.1  mrg \newtoks\evenheadline    % headline on even pages
   3787  1.1  mrg \newtoks\oddheadline     % headline on odd pages
   3788  1.1  mrg \newtoks\evenfootline    % footline on even pages
   3789  1.1  mrg \newtoks\oddfootline     % footline on odd pages
   3790  1.1  mrg 
   3791  1.1  mrg % Now make \makeheadline and \makefootline in Plain TeX use those variables
   3792  1.1  mrg \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
   3793  1.1  mrg                             \else \the\evenheadline \fi}}
   3794  1.1  mrg \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
   3795  1.1  mrg                             \else \the\evenfootline \fi}\HEADINGShook}
   3796  1.1  mrg \let\HEADINGShook=\relax
   3797  1.1  mrg 
   3798  1.1  mrg % Commands to set those variables.
   3799  1.1  mrg % For example, this is what  @headings on  does
   3800  1.1  mrg % @evenheading @thistitle|@thispage|@thischapter
   3801  1.1  mrg % @oddheading @thischapter|@thispage|@thistitle
   3802  1.1  mrg % @evenfooting @thisfile||
   3803  1.1  mrg % @oddfooting ||@thisfile
   3804  1.1  mrg 
   3805  1.1  mrg 
   3806  1.1  mrg \def\evenheading{\parsearg\evenheadingxxx}
   3807  1.1  mrg \def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish}
   3808  1.1  mrg \def\evenheadingyyy #1\|#2\|#3\|#4\finish{%
   3809  1.1  mrg \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
   3810  1.1  mrg 
   3811  1.1  mrg \def\oddheading{\parsearg\oddheadingxxx}
   3812  1.1  mrg \def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish}
   3813  1.1  mrg \def\oddheadingyyy #1\|#2\|#3\|#4\finish{%
   3814  1.1  mrg \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
   3815  1.1  mrg 
   3816  1.1  mrg \parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
   3817  1.1  mrg 
   3818  1.1  mrg \def\evenfooting{\parsearg\evenfootingxxx}
   3819  1.1  mrg \def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish}
   3820  1.1  mrg \def\evenfootingyyy #1\|#2\|#3\|#4\finish{%
   3821  1.1  mrg \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
   3822  1.1  mrg 
   3823  1.1  mrg \def\oddfooting{\parsearg\oddfootingxxx}
   3824  1.1  mrg \def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish}
   3825  1.1  mrg \def\oddfootingyyy #1\|#2\|#3\|#4\finish{%
   3826  1.1  mrg   \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
   3827  1.1  mrg   %
   3828  1.1  mrg   % Leave some space for the footline.  Hopefully ok to assume
   3829  1.1  mrg   % @evenfooting will not be used by itself.
   3830  1.1  mrg   \global\advance\txipageheight by -12pt
   3831  1.1  mrg   \global\advance\vsize by -12pt
   3832  1.1  mrg }
   3833  1.1  mrg 
   3834  1.1  mrg \parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}}
   3835  1.1  mrg 
   3836  1.1  mrg % @evenheadingmarks top     \thischapter <- chapter at the top of a page
   3837  1.1  mrg % @evenheadingmarks bottom  \thischapter <- chapter at the bottom of a page
   3838  1.1  mrg %
   3839  1.1  mrg % The same set of arguments for:
   3840  1.1  mrg %
   3841  1.1  mrg % @oddheadingmarks
   3842  1.1  mrg % @evenfootingmarks
   3843  1.1  mrg % @oddfootingmarks
   3844  1.1  mrg % @everyheadingmarks
   3845  1.1  mrg % @everyfootingmarks
   3846  1.1  mrg 
   3847  1.1  mrg % These define \getoddheadingmarks, \getevenheadingmarks,
   3848  1.1  mrg % \getoddfootingmarks, and \getevenfootingmarks, each to one of
   3849  1.1  mrg % \gettopheadingmarks, \getbottomheadingmarks.
   3850  1.1  mrg %
   3851  1.1  mrg \def\evenheadingmarks{\headingmarks{even}{heading}}
   3852  1.1  mrg \def\oddheadingmarks{\headingmarks{odd}{heading}}
   3853  1.1  mrg \def\evenfootingmarks{\headingmarks{even}{footing}}
   3854  1.1  mrg \def\oddfootingmarks{\headingmarks{odd}{footing}}
   3855  1.1  mrg \parseargdef\everyheadingmarks{\headingmarks{even}{heading}{#1}
   3856  1.1  mrg                           \headingmarks{odd}{heading}{#1} }
   3857  1.1  mrg \parseargdef\everyfootingmarks{\headingmarks{even}{footing}{#1}
   3858  1.1  mrg                           \headingmarks{odd}{footing}{#1} }
   3859  1.1  mrg % #1 = even/odd, #2 = heading/footing, #3 = top/bottom.
   3860  1.1  mrg \def\headingmarks#1#2#3 {%
   3861  1.1  mrg   \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname
   3862  1.1  mrg   \global\expandafter\let\csname get#1#2marks\endcsname \temp
   3863  1.1  mrg }
   3864  1.1  mrg 
   3865  1.1  mrg \everyheadingmarks bottom
   3866  1.1  mrg \everyfootingmarks bottom
   3867  1.1  mrg 
   3868  1.1  mrg % @headings double      turns headings on for double-sided printing.
   3869  1.1  mrg % @headings single      turns headings on for single-sided printing.
   3870  1.1  mrg % @headings off         turns them off.
   3871  1.1  mrg % @headings on          same as @headings double, retained for compatibility.
   3872  1.1  mrg % @headings after       turns on double-sided headings after this page.
   3873  1.1  mrg % @headings doubleafter turns on double-sided headings after this page.
   3874  1.1  mrg % @headings singleafter turns on single-sided headings after this page.
   3875  1.1  mrg % By default, they are off at the start of a document,
   3876  1.1  mrg % and turned `on' after @end titlepage.
   3877  1.1  mrg 
   3878  1.1  mrg \parseargdef\headings{\csname HEADINGS#1\endcsname}
   3879  1.1  mrg 
   3880  1.1  mrg \def\headingsoff{% non-global headings elimination
   3881  1.1  mrg   \evenheadline={\hfil}\evenfootline={\hfil}%
   3882  1.1  mrg    \oddheadline={\hfil}\oddfootline={\hfil}%
   3883  1.1  mrg }
   3884  1.1  mrg 
   3885  1.1  mrg \def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting
   3886  1.1  mrg \HEADINGSoff  % it's the default
   3887  1.1  mrg 
   3888  1.1  mrg % When we turn headings on, set the page number to 1.
   3889  1.1  mrg % For double-sided printing, put current file name in lower left corner,
   3890  1.1  mrg % chapter name on inside top of right hand pages, document
   3891  1.1  mrg % title on inside top of left hand pages, and page numbers on outside top
   3892  1.1  mrg % edge of all pages.
   3893  1.1  mrg \def\HEADINGSdouble{%
   3894  1.1  mrg \global\pageno=1
   3895  1.1  mrg \global\evenfootline={\hfil}
   3896  1.1  mrg \global\oddfootline={\hfil}
   3897  1.1  mrg \global\evenheadline={\line{\folio\hfil\thistitle}}
   3898  1.1  mrg \global\oddheadline={\line{\thischapterheading\hfil\folio}}
   3899  1.1  mrg \global\let\contentsalignmacro = \chapoddpage
   3900  1.1  mrg }
   3901  1.1  mrg \let\contentsalignmacro = \chappager
   3902  1.1  mrg 
   3903  1.1  mrg % For single-sided printing, chapter title goes across top left of page,
   3904  1.1  mrg % page number on top right.
   3905  1.1  mrg \def\HEADINGSsingle{%
   3906  1.1  mrg \global\pageno=1
   3907  1.1  mrg \global\evenfootline={\hfil}
   3908  1.1  mrg \global\oddfootline={\hfil}
   3909  1.1  mrg \global\evenheadline={\line{\thischapterheading\hfil\folio}}
   3910  1.1  mrg \global\oddheadline={\line{\thischapterheading\hfil\folio}}
   3911  1.1  mrg \global\let\contentsalignmacro = \chappager
   3912  1.1  mrg }
   3913  1.1  mrg \def\HEADINGSon{\HEADINGSdouble}
   3914  1.1  mrg 
   3915  1.1  mrg \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
   3916  1.1  mrg \let\HEADINGSdoubleafter=\HEADINGSafter
   3917  1.1  mrg \def\HEADINGSdoublex{%
   3918  1.1  mrg \global\evenfootline={\hfil}
   3919  1.1  mrg \global\oddfootline={\hfil}
   3920  1.1  mrg \global\evenheadline={\line{\folio\hfil\thistitle}}
   3921  1.1  mrg \global\oddheadline={\line{\thischapterheading\hfil\folio}}
   3922  1.1  mrg \global\let\contentsalignmacro = \chapoddpage
   3923  1.1  mrg }
   3924  1.1  mrg 
   3925  1.1  mrg \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
   3926  1.1  mrg \def\HEADINGSsinglex{%
   3927  1.1  mrg \global\evenfootline={\hfil}
   3928  1.1  mrg \global\oddfootline={\hfil}
   3929  1.1  mrg \global\evenheadline={\line{\thischapterheading\hfil\folio}}
   3930  1.1  mrg \global\oddheadline={\line{\thischapterheading\hfil\folio}}
   3931  1.1  mrg \global\let\contentsalignmacro = \chappager
   3932  1.1  mrg }
   3933  1.1  mrg 
   3934  1.1  mrg % Subroutines used in generating headings
   3935  1.1  mrg % This produces Day Month Year style of output.
   3936  1.1  mrg % Only define if not already defined, in case a txi-??.tex file has set
   3937  1.1  mrg % up a different format (e.g., txi-cs.tex does this).
   3938  1.1  mrg \ifx\today\thisisundefined
   3939  1.1  mrg \def\today{%
   3940  1.1  mrg   \number\day\space
   3941  1.1  mrg   \ifcase\month
   3942  1.1  mrg   \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
   3943  1.1  mrg   \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
   3944  1.1  mrg   \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
   3945  1.1  mrg   \fi
   3946  1.1  mrg   \space\number\year}
   3947  1.1  mrg \fi
   3948  1.1  mrg 
   3949  1.1  mrg % @settitle line...  specifies the title of the document, for headings.
   3950  1.1  mrg % It generates no output of its own.
   3951  1.1  mrg \def\thistitle{\putwordNoTitle}
   3952  1.1  mrg \def\settitle{\parsearg{\gdef\thistitle}}
   3953  1.1  mrg 
   3954  1.1  mrg 
   3955  1.1  mrg \message{tables,}
   3956  1.1  mrg % Tables -- @table, @ftable, @vtable, @item(x).
   3957  1.1  mrg 
   3958  1.1  mrg % default indentation of table text
   3959  1.1  mrg \newdimen\tableindent \tableindent=.8in
   3960  1.1  mrg % default indentation of @itemize and @enumerate text
   3961  1.1  mrg \newdimen\itemindent  \itemindent=.3in
   3962  1.1  mrg % margin between end of table item and start of table text.
   3963  1.1  mrg \newdimen\itemmargin  \itemmargin=.1in
   3964  1.1  mrg 
   3965  1.1  mrg % used internally for \itemindent minus \itemmargin
   3966  1.1  mrg \newdimen\itemmax
   3967  1.1  mrg 
   3968  1.1  mrg % Note @table, @ftable, and @vtable define @item, @itemx, etc., with
   3969  1.1  mrg % these defs.
   3970  1.1  mrg % They also define \itemindex
   3971  1.1  mrg % to index the item name in whatever manner is desired (perhaps none).
   3972  1.1  mrg 
   3973  1.1  mrg \newif\ifitemxneedsnegativevskip
   3974  1.1  mrg 
   3975  1.1  mrg \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
   3976  1.1  mrg 
   3977  1.1  mrg \def\internalBitem{\smallbreak \parsearg\itemzzz}
   3978  1.1  mrg \def\internalBitemx{\itemxpar \parsearg\itemzzz}
   3979  1.1  mrg 
   3980  1.1  mrg \def\itemzzz #1{\begingroup %
   3981  1.1  mrg   \advance\hsize by -\rightskip
   3982  1.1  mrg   \advance\hsize by -\tableindent
   3983  1.1  mrg   \setbox0=\hbox{\itemindicate{#1}}%
   3984  1.1  mrg   \itemindex{#1}%
   3985  1.1  mrg   \nobreak % This prevents a break before @itemx.
   3986  1.1  mrg   %
   3987  1.1  mrg   % If the item text does not fit in the space we have, put it on a line
   3988  1.1  mrg   % by itself, and do not allow a page break either before or after that
   3989  1.1  mrg   % line.  We do not start a paragraph here because then if the next
   3990  1.1  mrg   % command is, e.g., @kindex, the whatsit would get put into the
   3991  1.1  mrg   % horizontal list on a line by itself, resulting in extra blank space.
   3992  1.1  mrg   \ifdim \wd0>\itemmax
   3993  1.1  mrg     %
   3994  1.1  mrg     % Make this a paragraph so we get the \parskip glue and wrapping,
   3995  1.1  mrg     % but leave it ragged-right.
   3996  1.1  mrg     \begingroup
   3997  1.1  mrg       \advance\leftskip by-\tableindent
   3998  1.1  mrg       \advance\hsize by\tableindent
   3999  1.1  mrg       \advance\rightskip by0pt plus1fil\relax
   4000  1.1  mrg       \leavevmode\unhbox0\par
   4001  1.1  mrg     \endgroup
   4002  1.1  mrg     %
   4003  1.1  mrg     % We're going to be starting a paragraph, but we don't want the
   4004  1.1  mrg     % \parskip glue -- logically it's part of the @item we just started.
   4005  1.1  mrg     \nobreak \vskip-\parskip
   4006  1.1  mrg     %
   4007  1.1  mrg     % Stop a page break at the \parskip glue coming up.  However, if
   4008  1.1  mrg     % what follows is an environment such as @example, there will be no
   4009  1.1  mrg     % \parskip glue; then the negative vskip we just inserted would
   4010  1.1  mrg     % cause the example and the item to crash together.  So we use this
   4011  1.1  mrg     % bizarre value of 10001 as a signal to \aboveenvbreak to insert
   4012  1.1  mrg     % \parskip glue after all.  Section titles are handled this way also.
   4013  1.1  mrg     %
   4014  1.1  mrg     \penalty 10001
   4015  1.1  mrg     \endgroup
   4016  1.1  mrg     \itemxneedsnegativevskipfalse
   4017  1.1  mrg   \else
   4018  1.1  mrg     % The item text fits into the space.  Start a paragraph, so that the
   4019  1.1  mrg     % following text (if any) will end up on the same line.
   4020  1.1  mrg     \noindent
   4021  1.1  mrg     % Do this with kerns and \unhbox so that if there is a footnote in
   4022  1.1  mrg     % the item text, it can migrate to the main vertical list and
   4023  1.1  mrg     % eventually be printed.
   4024  1.1  mrg     \nobreak\kern-\tableindent
   4025  1.1  mrg     \dimen0 = \itemmax  \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
   4026  1.1  mrg     \unhbox0
   4027  1.1  mrg     \nobreak\kern\dimen0
   4028  1.1  mrg     \endgroup
   4029  1.1  mrg     \itemxneedsnegativevskiptrue
   4030  1.1  mrg   \fi
   4031  1.1  mrg }
   4032  1.1  mrg 
   4033  1.1  mrg \def\item{\errmessage{@item while not in a list environment}}
   4034  1.1  mrg \def\itemx{\errmessage{@itemx while not in a list environment}}
   4035  1.1  mrg 
   4036  1.1  mrg % @table, @ftable, @vtable.
   4037  1.1  mrg \envdef\table{%
   4038  1.1  mrg   \let\itemindex\gobble
   4039  1.1  mrg   \tablecheck{table}%
   4040  1.1  mrg }
   4041  1.1  mrg \envdef\ftable{%
   4042  1.1  mrg   \def\itemindex ##1{\doind {fn}{\code{##1}}}%
   4043  1.1  mrg   \tablecheck{ftable}%
   4044  1.1  mrg }
   4045  1.1  mrg \envdef\vtable{%
   4046  1.1  mrg   \def\itemindex ##1{\doind {vr}{\code{##1}}}%
   4047  1.1  mrg   \tablecheck{vtable}%
   4048  1.1  mrg }
   4049  1.1  mrg \def\tablecheck#1{%
   4050  1.1  mrg   \ifnum \the\catcode`\^^M=\active
   4051  1.1  mrg     \endgroup
   4052  1.1  mrg     \errmessage{This command won't work in this context; perhaps the problem is
   4053  1.1  mrg       that we are \inenvironment\thisenv}%
   4054  1.1  mrg     \def\next{\doignore{#1}}%
   4055  1.1  mrg   \else
   4056  1.1  mrg     \let\next\tablex
   4057  1.1  mrg   \fi
   4058  1.1  mrg   \next
   4059  1.1  mrg }
   4060  1.1  mrg \def\tablex#1{%
   4061  1.1  mrg   \def\itemindicate{#1}%
   4062  1.1  mrg   \parsearg\tabley
   4063  1.1  mrg }
   4064  1.1  mrg \def\tabley#1{%
   4065  1.1  mrg   {%
   4066  1.1  mrg     \makevalueexpandable
   4067  1.1  mrg     \edef\temp{\noexpand\tablez #1\space\space\space}%
   4068  1.1  mrg     \expandafter
   4069  1.1  mrg   }\temp \endtablez
   4070  1.1  mrg }
   4071  1.1  mrg \def\tablez #1 #2 #3 #4\endtablez{%
   4072  1.1  mrg   \aboveenvbreak
   4073  1.1  mrg   \ifnum 0#1>0 \advance \leftskip by #1\mil \fi
   4074  1.1  mrg   \ifnum 0#2>0 \tableindent=#2\mil \fi
   4075  1.1  mrg   \ifnum 0#3>0 \advance \rightskip by #3\mil \fi
   4076  1.1  mrg   \itemmax=\tableindent
   4077  1.1  mrg   \advance \itemmax by -\itemmargin
   4078  1.1  mrg   \advance \leftskip by \tableindent
   4079  1.1  mrg   \exdentamount=\tableindent
   4080  1.1  mrg   \parindent = 0pt
   4081  1.1  mrg   \parskip = \smallskipamount
   4082  1.1  mrg   \ifdim \parskip=0pt \parskip=2pt \fi
   4083  1.1  mrg   \let\item = \internalBitem
   4084  1.1  mrg   \let\itemx = \internalBitemx
   4085  1.1  mrg }
   4086  1.1  mrg \def\Etable{\endgraf\afterenvbreak}
   4087  1.1  mrg \let\Eftable\Etable
   4088  1.1  mrg \let\Evtable\Etable
   4089  1.1  mrg \let\Eitemize\Etable
   4090  1.1  mrg \let\Eenumerate\Etable
   4091  1.1  mrg 
   4092  1.1  mrg % This is the counter used by @enumerate, which is really @itemize
   4093  1.1  mrg 
   4094  1.1  mrg \newcount \itemno
   4095  1.1  mrg 
   4096  1.1  mrg \envdef\itemize{\parsearg\doitemize}
   4097  1.1  mrg 
   4098  1.1  mrg \def\doitemize#1{%
   4099  1.1  mrg   \aboveenvbreak
   4100  1.1  mrg   \itemmax=\itemindent
   4101  1.1  mrg   \advance\itemmax by -\itemmargin
   4102  1.1  mrg   \advance\leftskip by \itemindent
   4103  1.1  mrg   \exdentamount=\itemindent
   4104  1.1  mrg   \parindent=0pt
   4105  1.1  mrg   \parskip=\smallskipamount
   4106  1.1  mrg   \ifdim\parskip=0pt \parskip=2pt \fi
   4107  1.1  mrg   %
   4108  1.1  mrg   % Try typesetting the item mark so that if the document erroneously says
   4109  1.1  mrg   % something like @itemize @samp (intending @table), there's an error
   4110  1.1  mrg   % right away at the @itemize.  It's not the best error message in the
   4111  1.1  mrg   % world, but it's better than leaving it to the @item.  This means if
   4112  1.1  mrg   % the user wants an empty mark, they have to say @w{} not just @w.
   4113  1.1  mrg   \def\itemcontents{#1}%
   4114  1.1  mrg   \setbox0 = \hbox{\itemcontents}%
   4115  1.1  mrg   %
   4116  1.1  mrg   % @itemize with no arg is equivalent to @itemize @bullet.
   4117  1.1  mrg   \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
   4118  1.1  mrg   %
   4119  1.1  mrg   \let\item=\itemizeitem
   4120  1.1  mrg }
   4121  1.1  mrg 
   4122  1.1  mrg % Definition of @item while inside @itemize and @enumerate.
   4123  1.1  mrg %
   4124  1.1  mrg \def\itemizeitem{%
   4125  1.1  mrg   \advance\itemno by 1  % for enumerations
   4126  1.1  mrg   {\let\par=\endgraf \smallbreak}% reasonable place to break
   4127  1.1  mrg   {%
   4128  1.1  mrg    % If the document has an @itemize directly after a section title, a
   4129  1.1  mrg    % \nobreak will be last on the list, and \sectionheading will have
   4130  1.1  mrg    % done a \vskip-\parskip.  In that case, we don't want to zero
   4131  1.1  mrg    % parskip, or the item text will crash with the heading.  On the
   4132  1.1  mrg    % other hand, when there is normal text preceding the item (as there
   4133  1.1  mrg    % usually is), we do want to zero parskip, or there would be too much
   4134  1.1  mrg    % space.  In that case, we won't have a \nobreak before.  At least
   4135  1.1  mrg    % that's the theory.
   4136  1.1  mrg    \ifnum\lastpenalty<10000 \parskip=0in \fi
   4137  1.1  mrg    \noindent
   4138  1.1  mrg    \hbox to 0pt{\hss \itemcontents \kern\itemmargin}%
   4139  1.1  mrg    %
   4140  1.1  mrg    \ifinner\else
   4141  1.1  mrg      \vadjust{\penalty 1200}% not good to break after first line of item.
   4142  1.1  mrg    \fi
   4143  1.1  mrg    % We can be in inner vertical mode in a footnote, although an
   4144  1.1  mrg    % @itemize looks awful there.
   4145  1.1  mrg   }%
   4146  1.1  mrg   \flushcr
   4147  1.1  mrg }
   4148  1.1  mrg 
   4149  1.1  mrg % \splitoff TOKENS\endmark defines \first to be the first token in
   4150  1.1  mrg % TOKENS, and \rest to be the remainder.
   4151  1.1  mrg %
   4152  1.1  mrg \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
   4153  1.1  mrg 
   4154  1.1  mrg % Allow an optional argument of an uppercase letter, lowercase letter,
   4155  1.1  mrg % or number, to specify the first label in the enumerated list.  No
   4156  1.1  mrg % argument is the same as `1'.
   4157  1.1  mrg %
   4158  1.1  mrg \envparseargdef\enumerate{\enumeratey #1  \endenumeratey}
   4159  1.1  mrg \def\enumeratey #1 #2\endenumeratey{%
   4160  1.1  mrg   % If we were given no argument, pretend we were given `1'.
   4161  1.1  mrg   \def\thearg{#1}%
   4162  1.1  mrg   \ifx\thearg\empty \def\thearg{1}\fi
   4163  1.1  mrg   %
   4164  1.1  mrg   % Detect if the argument is a single token.  If so, it might be a
   4165  1.1  mrg   % letter.  Otherwise, the only valid thing it can be is a number.
   4166  1.1  mrg   % (We will always have one token, because of the test we just made.
   4167  1.1  mrg   % This is a good thing, since \splitoff doesn't work given nothing at
   4168  1.1  mrg   % all -- the first parameter is undelimited.)
   4169  1.1  mrg   \expandafter\splitoff\thearg\endmark
   4170  1.1  mrg   \ifx\rest\empty
   4171  1.1  mrg     % Only one token in the argument.  It could still be anything.
   4172  1.1  mrg     % A ``lowercase letter'' is one whose \lccode is nonzero.
   4173  1.1  mrg     % An ``uppercase letter'' is one whose \lccode is both nonzero, and
   4174  1.1  mrg     %   not equal to itself.
   4175  1.1  mrg     % Otherwise, we assume it's a number.
   4176  1.1  mrg     %
   4177  1.1  mrg     % We need the \relax at the end of the \ifnum lines to stop TeX from
   4178  1.1  mrg     % continuing to look for a <number>.
   4179  1.1  mrg     %
   4180  1.1  mrg     \ifnum\lccode\expandafter`\thearg=0\relax
   4181  1.1  mrg       \numericenumerate % a number (we hope)
   4182  1.1  mrg     \else
   4183  1.1  mrg       % It's a letter.
   4184  1.1  mrg       \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
   4185  1.1  mrg         \lowercaseenumerate % lowercase letter
   4186  1.1  mrg       \else
   4187  1.1  mrg         \uppercaseenumerate % uppercase letter
   4188  1.1  mrg       \fi
   4189  1.1  mrg     \fi
   4190  1.1  mrg   \else
   4191  1.1  mrg     % Multiple tokens in the argument.  We hope it's a number.
   4192  1.1  mrg     \numericenumerate
   4193  1.1  mrg   \fi
   4194  1.1  mrg }
   4195  1.1  mrg 
   4196  1.1  mrg % An @enumerate whose labels are integers.  The starting integer is
   4197  1.1  mrg % given in \thearg.
   4198  1.1  mrg %
   4199  1.1  mrg \def\numericenumerate{%
   4200  1.1  mrg   \itemno = \thearg
   4201  1.1  mrg   \startenumeration{\the\itemno}%
   4202  1.1  mrg }
   4203  1.1  mrg 
   4204  1.1  mrg % The starting (lowercase) letter is in \thearg.
   4205  1.1  mrg \def\lowercaseenumerate{%
   4206  1.1  mrg   \itemno = \expandafter`\thearg
   4207  1.1  mrg   \startenumeration{%
   4208  1.1  mrg     % Be sure we're not beyond the end of the alphabet.
   4209  1.1  mrg     \ifnum\itemno=0
   4210  1.1  mrg       \errmessage{No more lowercase letters in @enumerate; get a bigger
   4211  1.1  mrg                   alphabet}%
   4212  1.1  mrg     \fi
   4213  1.1  mrg     \char\lccode\itemno
   4214  1.1  mrg   }%
   4215  1.1  mrg }
   4216  1.1  mrg 
   4217  1.1  mrg % The starting (uppercase) letter is in \thearg.
   4218  1.1  mrg \def\uppercaseenumerate{%
   4219  1.1  mrg   \itemno = \expandafter`\thearg
   4220  1.1  mrg   \startenumeration{%
   4221  1.1  mrg     % Be sure we're not beyond the end of the alphabet.
   4222  1.1  mrg     \ifnum\itemno=0
   4223  1.1  mrg       \errmessage{No more uppercase letters in @enumerate; get a bigger
   4224  1.1  mrg                   alphabet}
   4225  1.1  mrg     \fi
   4226  1.1  mrg     \char\uccode\itemno
   4227  1.1  mrg   }%
   4228  1.1  mrg }
   4229  1.1  mrg 
   4230  1.1  mrg % Call \doitemize, adding a period to the first argument and supplying the
   4231  1.1  mrg % common last two arguments.  Also subtract one from the initial value in
   4232  1.1  mrg % \itemno, since @item increments \itemno.
   4233  1.1  mrg %
   4234  1.1  mrg \def\startenumeration#1{%
   4235  1.1  mrg   \advance\itemno by -1
   4236  1.1  mrg   \doitemize{#1.}\flushcr
   4237  1.1  mrg }
   4238  1.1  mrg 
   4239  1.1  mrg % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
   4240  1.1  mrg % to @enumerate.
   4241  1.1  mrg %
   4242  1.1  mrg \def\alphaenumerate{\enumerate{a}}
   4243  1.1  mrg \def\capsenumerate{\enumerate{A}}
   4244  1.1  mrg \def\Ealphaenumerate{\Eenumerate}
   4245  1.1  mrg \def\Ecapsenumerate{\Eenumerate}
   4246  1.1  mrg 
   4247  1.1  mrg 
   4248  1.1  mrg % @multitable macros
   4249  1.1  mrg % Amy Hendrickson, 8/18/94, 3/6/96
   4250  1.1  mrg %
   4251  1.1  mrg % @multitable ... @end multitable will make as many columns as desired.
   4252  1.1  mrg % Contents of each column will wrap at width given in preamble.  Width
   4253  1.1  mrg % can be specified either with sample text given in a template line,
   4254  1.1  mrg % or in percent of \hsize, the current width of text on page.
   4255  1.1  mrg 
   4256  1.1  mrg % Table can continue over pages but will only break between lines.
   4257  1.1  mrg 
   4258  1.1  mrg % To make preamble:
   4259  1.1  mrg %
   4260  1.1  mrg % Either define widths of columns in terms of percent of \hsize:
   4261  1.1  mrg %   @multitable @columnfractions .25 .3 .45
   4262  1.1  mrg %   @item ...
   4263  1.1  mrg %
   4264  1.1  mrg %   Numbers following @columnfractions are the percent of the total
   4265  1.1  mrg %   current hsize to be used for each column. You may use as many
   4266  1.1  mrg %   columns as desired.
   4267  1.1  mrg 
   4268  1.1  mrg 
   4269  1.1  mrg % Or use a template:
   4270  1.1  mrg %   @multitable {Column 1 template} {Column 2 template} {Column 3 template}
   4271  1.1  mrg %   @item ...
   4272  1.1  mrg %   using the widest term desired in each column.
   4273  1.1  mrg 
   4274  1.1  mrg % Each new table line starts with @item, each subsequent new column
   4275  1.1  mrg % starts with @tab. Empty columns may be produced by supplying @tab's
   4276  1.1  mrg % with nothing between them for as many times as empty columns are needed,
   4277  1.1  mrg % ie, @tab@tab@tab will produce two empty columns.
   4278  1.1  mrg 
   4279  1.1  mrg % @item, @tab do not need to be on their own lines, but it will not hurt
   4280  1.1  mrg % if they are.
   4281  1.1  mrg 
   4282  1.1  mrg % Sample multitable:
   4283  1.1  mrg 
   4284  1.1  mrg %   @multitable {Column 1 template} {Column 2 template} {Column 3 template}
   4285  1.1  mrg %   @item first col stuff @tab second col stuff @tab third col
   4286  1.1  mrg %   @item
   4287  1.1  mrg %   first col stuff
   4288  1.1  mrg %   @tab
   4289  1.1  mrg %   second col stuff
   4290  1.1  mrg %   @tab
   4291  1.1  mrg %   third col
   4292  1.1  mrg %   @item first col stuff @tab second col stuff
   4293  1.1  mrg %   @tab Many paragraphs of text may be used in any column.
   4294  1.1  mrg %
   4295  1.1  mrg %         They will wrap at the width determined by the template.
   4296  1.1  mrg %   @item@tab@tab This will be in third column.
   4297  1.1  mrg %   @end multitable
   4298  1.1  mrg 
   4299  1.1  mrg % Default dimensions may be reset by user.
   4300  1.1  mrg % @multitableparskip is vertical space between paragraphs in table.
   4301  1.1  mrg % @multitableparindent is paragraph indent in table.
   4302  1.1  mrg % @multitablecolmargin is horizontal space to be left between columns.
   4303  1.1  mrg % @multitablelinespace is space to leave between table items, baseline
   4304  1.1  mrg %                                                            to baseline.
   4305  1.1  mrg %   0pt means it depends on current normal line spacing.
   4306  1.1  mrg %
   4307  1.1  mrg \newskip\multitableparskip
   4308  1.1  mrg \newskip\multitableparindent
   4309  1.1  mrg \newdimen\multitablecolspace
   4310  1.1  mrg \newskip\multitablelinespace
   4311  1.1  mrg \multitableparskip=0pt
   4312  1.1  mrg \multitableparindent=6pt
   4313  1.1  mrg \multitablecolspace=12pt
   4314  1.1  mrg \multitablelinespace=0pt
   4315  1.1  mrg 
   4316  1.1  mrg % Macros used to set up halign preamble:
   4317  1.1  mrg %
   4318  1.1  mrg \let\endsetuptable\relax
   4319  1.1  mrg \def\xendsetuptable{\endsetuptable}
   4320  1.1  mrg \let\columnfractions\relax
   4321  1.1  mrg \def\xcolumnfractions{\columnfractions}
   4322  1.1  mrg \newif\ifsetpercent
   4323  1.1  mrg 
   4324  1.1  mrg % #1 is the @columnfraction, usually a decimal number like .5, but might
   4325  1.1  mrg % be just 1.  We just use it, whatever it is.
   4326  1.1  mrg %
   4327  1.1  mrg \def\pickupwholefraction#1 {%
   4328  1.1  mrg   \global\advance\colcount by 1
   4329  1.1  mrg   \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}%
   4330  1.1  mrg   \setuptable
   4331  1.1  mrg }
   4332  1.1  mrg 
   4333  1.1  mrg \newcount\colcount
   4334  1.1  mrg \def\setuptable#1{%
   4335  1.1  mrg   \def\firstarg{#1}%
   4336  1.1  mrg   \ifx\firstarg\xendsetuptable
   4337  1.1  mrg     \let\go = \relax
   4338  1.1  mrg   \else
   4339  1.1  mrg     \ifx\firstarg\xcolumnfractions
   4340  1.1  mrg       \global\setpercenttrue
   4341  1.1  mrg     \else
   4342  1.1  mrg       \ifsetpercent
   4343  1.1  mrg          \let\go\pickupwholefraction
   4344  1.1  mrg       \else
   4345  1.1  mrg          \global\advance\colcount by 1
   4346  1.1  mrg          \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a
   4347  1.1  mrg                    % separator; typically that is always in the input, anyway.
   4348  1.1  mrg          \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
   4349  1.1  mrg       \fi
   4350  1.1  mrg     \fi
   4351  1.1  mrg     \ifx\go\pickupwholefraction
   4352  1.1  mrg       % Put the argument back for the \pickupwholefraction call, so
   4353  1.1  mrg       % we'll always have a period there to be parsed.
   4354  1.1  mrg       \def\go{\pickupwholefraction#1}%
   4355  1.1  mrg     \else
   4356  1.1  mrg       \let\go = \setuptable
   4357  1.1  mrg     \fi%
   4358  1.1  mrg   \fi
   4359  1.1  mrg   \go
   4360  1.1  mrg }
   4361  1.1  mrg 
   4362  1.1  mrg % multitable-only commands.
   4363  1.1  mrg %
   4364  1.1  mrg % @headitem starts a heading row, which we typeset in bold.  Assignments
   4365  1.1  mrg % have to be global since we are inside the implicit group of an
   4366  1.1  mrg % alignment entry.  \everycr below resets \everytab so we don't have to
   4367  1.1  mrg % undo it ourselves.
   4368  1.1  mrg \def\headitemfont{\b}% for people to use in the template row; not changeable
   4369  1.1  mrg \def\headitem{%
   4370  1.1  mrg   \checkenv\multitable
   4371  1.1  mrg   \crcr
   4372  1.1  mrg   \gdef\headitemcrhook{\nobreak}% attempt to avoid page break after headings
   4373  1.1  mrg   \global\everytab={\bf}% can't use \headitemfont since the parsing differs
   4374  1.1  mrg   \the\everytab % for the first item
   4375  1.1  mrg }%
   4376  1.1  mrg %
   4377  1.1  mrg % default for tables with no headings.
   4378  1.1  mrg \let\headitemcrhook=\relax
   4379  1.1  mrg %
   4380  1.1  mrg % A \tab used to include \hskip1sp.  But then the space in a template
   4381  1.1  mrg % line is not enough.  That is bad.  So let's go back to just `&' until
   4382  1.1  mrg % we again encounter the problem the 1sp was intended to solve.
   4383  1.1  mrg %					--karl, nathan (a] acm.org, 20apr99.
   4384  1.1  mrg \def\tab{\checkenv\multitable &\the\everytab}%
   4385  1.1  mrg 
   4386  1.1  mrg % @multitable ... @end multitable definitions:
   4387  1.1  mrg %
   4388  1.1  mrg \newtoks\everytab  % insert after every tab.
   4389  1.1  mrg %
   4390  1.1  mrg \envdef\multitable{%
   4391  1.1  mrg   \vskip\parskip
   4392  1.1  mrg   \startsavinginserts
   4393  1.1  mrg   %
   4394  1.1  mrg   % @item within a multitable starts a normal row.
   4395  1.1  mrg   % We use \def instead of \let so that if one of the multitable entries
   4396  1.1  mrg   % contains an @itemize, we don't choke on the \item (seen as \crcr aka
   4397  1.1  mrg   % \endtemplate) expanding \doitemize.
   4398  1.1  mrg   \def\item{\crcr}%
   4399  1.1  mrg   %
   4400  1.1  mrg   \tolerance=9500
   4401  1.1  mrg   \hbadness=9500
   4402  1.1  mrg   \setmultitablespacing
   4403  1.1  mrg   \parskip=\multitableparskip
   4404  1.1  mrg   \parindent=\multitableparindent
   4405  1.1  mrg   \overfullrule=0pt
   4406  1.1  mrg   \global\colcount=0
   4407  1.1  mrg   %
   4408  1.1  mrg   \everycr = {%
   4409  1.1  mrg     \noalign{%
   4410  1.1  mrg       \global\everytab={}% Reset from possible headitem.
   4411  1.1  mrg       \global\colcount=0 % Reset the column counter.
   4412  1.1  mrg       %
   4413  1.1  mrg       % Check for saved footnotes, etc.:
   4414  1.1  mrg       \checkinserts
   4415  1.1  mrg       %
   4416  1.1  mrg       % Perhaps a \nobreak, then reset:
   4417  1.1  mrg       \headitemcrhook
   4418  1.1  mrg       \global\let\headitemcrhook=\relax
   4419  1.1  mrg     }%
   4420  1.1  mrg   }%
   4421  1.1  mrg   %
   4422  1.1  mrg   \parsearg\domultitable
   4423  1.1  mrg }
   4424  1.1  mrg \def\domultitable#1{%
   4425  1.1  mrg   % To parse everything between @multitable and @item:
   4426  1.1  mrg   \setuptable#1 \endsetuptable
   4427  1.1  mrg   %
   4428  1.1  mrg   % This preamble sets up a generic column definition, which will
   4429  1.1  mrg   % be used as many times as user calls for columns.
   4430  1.1  mrg   % \vtop will set a single line and will also let text wrap and
   4431  1.1  mrg   % continue for many paragraphs if desired.
   4432  1.1  mrg   \halign\bgroup &%
   4433  1.1  mrg     \global\advance\colcount by 1
   4434  1.1  mrg     \multistrut
   4435  1.1  mrg     \vtop{%
   4436  1.1  mrg       % Use the current \colcount to find the correct column width:
   4437  1.1  mrg       \hsize=\expandafter\csname col\the\colcount\endcsname
   4438  1.1  mrg       %
   4439  1.1  mrg       % In order to keep entries from bumping into each other
   4440  1.1  mrg       % we will add a \leftskip of \multitablecolspace to all columns after
   4441  1.1  mrg       % the first one.
   4442  1.1  mrg       %
   4443  1.1  mrg       % If a template has been used, we will add \multitablecolspace
   4444  1.1  mrg       % to the width of each template entry.
   4445  1.1  mrg       %
   4446  1.1  mrg       % If the user has set preamble in terms of percent of \hsize we will
   4447  1.1  mrg       % use that dimension as the width of the column, and the \leftskip
   4448  1.1  mrg       % will keep entries from bumping into each other.  Table will start at
   4449  1.1  mrg       % left margin and final column will justify at right margin.
   4450  1.1  mrg       %
   4451  1.1  mrg       % Make sure we don't inherit \rightskip from the outer environment.
   4452  1.1  mrg       \rightskip=0pt
   4453  1.1  mrg       \ifnum\colcount=1
   4454  1.1  mrg 	% The first column will be indented with the surrounding text.
   4455  1.1  mrg 	\advance\hsize by\leftskip
   4456  1.1  mrg       \else
   4457  1.1  mrg 	\ifsetpercent \else
   4458  1.1  mrg 	  % If user has not set preamble in terms of percent of \hsize
   4459  1.1  mrg 	  % we will advance \hsize by \multitablecolspace.
   4460  1.1  mrg 	  \advance\hsize by \multitablecolspace
   4461  1.1  mrg 	\fi
   4462  1.1  mrg        % In either case we will make \leftskip=\multitablecolspace:
   4463  1.1  mrg       \leftskip=\multitablecolspace
   4464  1.1  mrg       \fi
   4465  1.1  mrg       % Ignoring space at the beginning and end avoids an occasional spurious
   4466  1.1  mrg       % blank line, when TeX decides to break the line at the space before the
   4467  1.1  mrg       % box from the multistrut, so the strut ends up on a line by itself.
   4468  1.1  mrg       % For example:
   4469  1.1  mrg       % @multitable @columnfractions .11 .89
   4470  1.1  mrg       % @item @code{#}
   4471  1.1  mrg       % @tab Legal holiday which is valid in major parts of the whole country.
   4472  1.1  mrg       % Is automatically provided with highlighting sequences respectively
   4473  1.1  mrg       % marking characters.
   4474  1.1  mrg       \noindent\ignorespaces##\unskip\multistrut
   4475  1.1  mrg     }\cr
   4476  1.1  mrg }
   4477  1.1  mrg \def\Emultitable{%
   4478  1.1  mrg   \crcr
   4479  1.1  mrg   \egroup % end the \halign
   4480  1.1  mrg   \global\setpercentfalse
   4481  1.1  mrg }
   4482  1.1  mrg 
   4483  1.1  mrg \def\setmultitablespacing{%
   4484  1.1  mrg   \def\multistrut{\strut}% just use the standard line spacing
   4485  1.1  mrg   %
   4486  1.1  mrg   % Compute \multitablelinespace (if not defined by user) for use in
   4487  1.1  mrg   % \multitableparskip calculation.  We used define \multistrut based on
   4488  1.1  mrg   % this, but (ironically) that caused the spacing to be off.
   4489  1.1  mrg   % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100.
   4490  1.1  mrg \ifdim\multitablelinespace=0pt
   4491  1.1  mrg \setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
   4492  1.1  mrg \global\advance\multitablelinespace by-\ht0
   4493  1.1  mrg \fi
   4494  1.1  mrg % Test to see if parskip is larger than space between lines of
   4495  1.1  mrg % table. If not, do nothing.
   4496  1.1  mrg %        If so, set to same dimension as multitablelinespace.
   4497  1.1  mrg \ifdim\multitableparskip>\multitablelinespace
   4498  1.1  mrg \global\multitableparskip=\multitablelinespace
   4499  1.1  mrg \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
   4500  1.1  mrg                                       % than skip between lines in the table.
   4501  1.1  mrg \fi%
   4502  1.1  mrg \ifdim\multitableparskip=0pt
   4503  1.1  mrg \global\multitableparskip=\multitablelinespace
   4504  1.1  mrg \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
   4505  1.1  mrg                                       % than skip between lines in the table.
   4506  1.1  mrg \fi}
   4507  1.1  mrg 
   4508  1.1  mrg 
   4509  1.1  mrg \message{conditionals,}
   4510  1.1  mrg 
   4511  1.1  mrg % @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext,
   4512  1.1  mrg % @ifnotxml always succeed.  They currently do nothing; we don't
   4513  1.1  mrg % attempt to check whether the conditionals are properly nested.  But we
   4514  1.1  mrg % have to remember that they are conditionals, so that @end doesn't
   4515  1.1  mrg % attempt to close an environment group.
   4516  1.1  mrg %
   4517  1.1  mrg \def\makecond#1{%
   4518  1.1  mrg   \expandafter\let\csname #1\endcsname = \relax
   4519  1.1  mrg   \expandafter\let\csname iscond.#1\endcsname = 1
   4520  1.1  mrg }
   4521  1.1  mrg \makecond{iftex}
   4522  1.1  mrg \makecond{ifnotdocbook}
   4523  1.1  mrg \makecond{ifnothtml}
   4524  1.1  mrg \makecond{ifnotinfo}
   4525  1.1  mrg \makecond{ifnotplaintext}
   4526  1.1  mrg \makecond{ifnotxml}
   4527  1.1  mrg 
   4528  1.1  mrg % Ignore @ignore, @ifhtml, @ifinfo, and the like.
   4529  1.1  mrg %
   4530  1.1  mrg \def\direntry{\doignore{direntry}}
   4531  1.1  mrg \def\documentdescription{\doignore{documentdescription}}
   4532  1.1  mrg \def\docbook{\doignore{docbook}}
   4533  1.1  mrg \def\html{\doignore{html}}
   4534  1.1  mrg \def\ifdocbook{\doignore{ifdocbook}}
   4535  1.1  mrg \def\ifhtml{\doignore{ifhtml}}
   4536  1.1  mrg \def\ifinfo{\doignore{ifinfo}}
   4537  1.1  mrg \def\ifnottex{\doignore{ifnottex}}
   4538  1.1  mrg \def\ifplaintext{\doignore{ifplaintext}}
   4539  1.1  mrg \def\ifxml{\doignore{ifxml}}
   4540  1.1  mrg \def\ignore{\doignore{ignore}}
   4541  1.1  mrg \def\menu{\doignore{menu}}
   4542  1.1  mrg \def\xml{\doignore{xml}}
   4543  1.1  mrg 
   4544  1.1  mrg % Ignore text until a line `@end #1', keeping track of nested conditionals.
   4545  1.1  mrg %
   4546  1.1  mrg % A count to remember the depth of nesting.
   4547  1.1  mrg \newcount\doignorecount
   4548  1.1  mrg 
   4549  1.1  mrg \def\doignore#1{\begingroup
   4550  1.1  mrg   % Scan in ``verbatim'' mode:
   4551  1.1  mrg   \obeylines
   4552  1.1  mrg   \catcode`\@ = \other
   4553  1.1  mrg   \catcode`\{ = \other
   4554  1.1  mrg   \catcode`\} = \other
   4555  1.1  mrg   %
   4556  1.1  mrg   % Make sure that spaces turn into tokens that match what \doignoretext wants.
   4557  1.1  mrg   \spaceisspace
   4558  1.1  mrg   %
   4559  1.1  mrg   % Count number of #1's that we've seen.
   4560  1.1  mrg   \doignorecount = 0
   4561  1.1  mrg   %
   4562  1.1  mrg   % Swallow text until we reach the matching `@end #1'.
   4563  1.1  mrg   \dodoignore{#1}%
   4564  1.1  mrg }
   4565  1.1  mrg 
   4566  1.1  mrg { \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source.
   4567  1.1  mrg   \obeylines %
   4568  1.1  mrg   %
   4569  1.1  mrg   \gdef\dodoignore#1{%
   4570  1.1  mrg     % #1 contains the command name as a string, e.g., `ifinfo'.
   4571  1.1  mrg     %
   4572  1.1  mrg     % Define a command to find the next `@end #1'.
   4573  1.1  mrg     \long\def\doignoretext##1^^M@end #1{%
   4574  1.1  mrg       \doignoretextyyy##1^^M@#1\_STOP_}%
   4575  1.1  mrg     %
   4576  1.1  mrg     % And this command to find another #1 command, at the beginning of a
   4577  1.1  mrg     % line.  (Otherwise, we would consider a line `@c @ifset', for
   4578  1.1  mrg     % example, to count as an @ifset for nesting.)
   4579  1.1  mrg     \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}%
   4580  1.1  mrg     %
   4581  1.1  mrg     % And now expand that command.
   4582  1.1  mrg     \doignoretext ^^M%
   4583  1.1  mrg   }%
   4584  1.1  mrg }
   4585  1.1  mrg 
   4586  1.1  mrg \def\doignoreyyy#1{%
   4587  1.1  mrg   \def\temp{#1}%
   4588  1.1  mrg   \ifx\temp\empty			% Nothing found.
   4589  1.1  mrg     \let\next\doignoretextzzz
   4590  1.1  mrg   \else					% Found a nested condition, ...
   4591  1.1  mrg     \advance\doignorecount by 1
   4592  1.1  mrg     \let\next\doignoretextyyy		% ..., look for another.
   4593  1.1  mrg     % If we're here, #1 ends with ^^M\ifinfo (for example).
   4594  1.1  mrg   \fi
   4595  1.1  mrg   \next #1% the token \_STOP_ is present just after this macro.
   4596  1.1  mrg }
   4597  1.1  mrg 
   4598  1.1  mrg % We have to swallow the remaining "\_STOP_".
   4599  1.1  mrg %
   4600  1.1  mrg \def\doignoretextzzz#1{%
   4601  1.1  mrg   \ifnum\doignorecount = 0	% We have just found the outermost @end.
   4602  1.1  mrg     \let\next\enddoignore
   4603  1.1  mrg   \else				% Still inside a nested condition.
   4604  1.1  mrg     \advance\doignorecount by -1
   4605  1.1  mrg     \let\next\doignoretext      % Look for the next @end.
   4606  1.1  mrg   \fi
   4607  1.1  mrg   \next
   4608  1.1  mrg }
   4609  1.1  mrg 
   4610  1.1  mrg % Finish off ignored text.
   4611  1.1  mrg { \obeylines%
   4612  1.1  mrg   % Ignore anything after the last `@end #1'; this matters in verbatim
   4613  1.1  mrg   % environments, where otherwise the newline after an ignored conditional
   4614  1.1  mrg   % would result in a blank line in the output.
   4615  1.1  mrg   \gdef\enddoignore#1^^M{\endgroup\ignorespaces}%
   4616  1.1  mrg }
   4617  1.1  mrg 
   4618  1.1  mrg 
   4619  1.1  mrg % @set VAR sets the variable VAR to an empty value.
   4620  1.1  mrg % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
   4621  1.1  mrg %
   4622  1.1  mrg % Since we want to separate VAR from REST-OF-LINE (which might be
   4623  1.1  mrg % empty), we can't just use \parsearg; we have to insert a space of our
   4624  1.1  mrg % own to delimit the rest of the line, and then take it out again if we
   4625  1.1  mrg % didn't need it.
   4626  1.1  mrg % We rely on the fact that \parsearg sets \catcode`\ =10.
   4627  1.1  mrg %
   4628  1.1  mrg \parseargdef\set{\setyyy#1 \endsetyyy}
   4629  1.1  mrg \def\setyyy#1 #2\endsetyyy{%
   4630  1.1  mrg   {%
   4631  1.1  mrg     \makevalueexpandable
   4632  1.1  mrg     \def\temp{#2}%
   4633  1.1  mrg     \edef\next{\gdef\makecsname{SET#1}}%
   4634  1.1  mrg     \ifx\temp\empty
   4635  1.1  mrg       \next{}%
   4636  1.1  mrg     \else
   4637  1.1  mrg       \setzzz#2\endsetzzz
   4638  1.1  mrg     \fi
   4639  1.1  mrg   }%
   4640  1.1  mrg }
   4641  1.1  mrg % Remove the trailing space \setxxx inserted.
   4642  1.1  mrg \def\setzzz#1 \endsetzzz{\next{#1}}
   4643  1.1  mrg 
   4644  1.1  mrg % @clear VAR clears (i.e., unsets) the variable VAR.
   4645  1.1  mrg %
   4646  1.1  mrg \parseargdef\clear{%
   4647  1.1  mrg   {%
   4648  1.1  mrg     \makevalueexpandable
   4649  1.1  mrg     \global\expandafter\let\csname SET#1\endcsname=\relax
   4650  1.1  mrg   }%
   4651  1.1  mrg }
   4652  1.1  mrg 
   4653  1.1  mrg % @value{foo} gets the text saved in variable foo.
   4654  1.1  mrg \def\value{\begingroup\makevalueexpandable\valuexxx}
   4655  1.1  mrg \def\valuexxx#1{\expandablevalue{#1}\endgroup}
   4656  1.1  mrg {
   4657  1.1  mrg   \catcode`\-=\active \catcode`\_=\active
   4658  1.1  mrg   %
   4659  1.1  mrg   \gdef\makevalueexpandable{%
   4660  1.1  mrg     \let\value = \expandablevalue
   4661  1.1  mrg     % We don't want these characters active, ...
   4662  1.1  mrg     \catcode`\-=\other \catcode`\_=\other
   4663  1.1  mrg     % ..., but we might end up with active ones in the argument if
   4664  1.1  mrg     % we're called from @code, as @code{@value{foo-bar_}}, though.
   4665  1.1  mrg     % So \let them to their normal equivalents.
   4666  1.1  mrg     \let-\normaldash \let_\normalunderscore
   4667  1.1  mrg   }
   4668  1.1  mrg }
   4669  1.1  mrg 
   4670  1.1  mrg \def\expandablevalue#1{%
   4671  1.1  mrg   \expandafter\ifx\csname SET#1\endcsname\relax
   4672  1.1  mrg     {[No value for ``#1'']}%
   4673  1.1  mrg     \message{Variable `#1', used in @value, is not set.}%
   4674  1.1  mrg   \else
   4675  1.1  mrg     \csname SET#1\endcsname
   4676  1.1  mrg   \fi
   4677  1.1  mrg }
   4678  1.1  mrg 
   4679  1.1  mrg % Like \expandablevalue, but completely expandable (the \message in the
   4680  1.1  mrg % definition above operates at the execution level of TeX).  Used when
   4681  1.1  mrg % writing to auxiliary files, due to the expansion that \write does.
   4682  1.1  mrg % If flag is undefined, pass through an unexpanded @value command: maybe it
   4683  1.1  mrg % will be set by the time it is read back in.
   4684  1.1  mrg %
   4685  1.1  mrg % NB flag names containing - or _ may not work here.
   4686  1.1  mrg \def\dummyvalue#1{%
   4687  1.1  mrg   \expandafter\ifx\csname SET#1\endcsname\relax
   4688  1.1  mrg     \string\value{#1}%
   4689  1.1  mrg   \else
   4690  1.1  mrg     \csname SET#1\endcsname
   4691  1.1  mrg   \fi
   4692  1.1  mrg }
   4693  1.1  mrg 
   4694  1.1  mrg % Used for @value's in index entries to form the sort key: expand the @value
   4695  1.1  mrg % if possible, otherwise sort late.
   4696  1.1  mrg \def\indexnofontsvalue#1{%
   4697  1.1  mrg   \expandafter\ifx\csname SET#1\endcsname\relax
   4698  1.1  mrg     ZZZZZZZ%
   4699  1.1  mrg   \else
   4700  1.1  mrg     \csname SET#1\endcsname
   4701  1.1  mrg   \fi
   4702  1.1  mrg }
   4703  1.1  mrg 
   4704  1.1  mrg % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
   4705  1.1  mrg % with @set.
   4706  1.1  mrg %
   4707  1.1  mrg % To get the special treatment we need for `@end ifset,' we call
   4708  1.1  mrg % \makecond and then redefine.
   4709  1.1  mrg %
   4710  1.1  mrg \makecond{ifset}
   4711  1.1  mrg \def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}}
   4712  1.1  mrg \def\doifset#1#2{%
   4713  1.1  mrg   {%
   4714  1.1  mrg     \makevalueexpandable
   4715  1.1  mrg     \let\next=\empty
   4716  1.1  mrg     \expandafter\ifx\csname SET#2\endcsname\relax
   4717  1.1  mrg       #1% If not set, redefine \next.
   4718  1.1  mrg     \fi
   4719  1.1  mrg     \expandafter
   4720  1.1  mrg   }\next
   4721  1.1  mrg }
   4722  1.1  mrg \def\ifsetfail{\doignore{ifset}}
   4723  1.1  mrg 
   4724  1.1  mrg % @ifclear VAR ... @end executes the `...' iff VAR has never been
   4725  1.1  mrg % defined with @set, or has been undefined with @clear.
   4726  1.1  mrg %
   4727  1.1  mrg % The `\else' inside the `\doifset' parameter is a trick to reuse the
   4728  1.1  mrg % above code: if the variable is not set, do nothing, if it is set,
   4729  1.1  mrg % then redefine \next to \ifclearfail.
   4730  1.1  mrg %
   4731  1.1  mrg \makecond{ifclear}
   4732  1.1  mrg \def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}}
   4733  1.1  mrg \def\ifclearfail{\doignore{ifclear}}
   4734  1.1  mrg 
   4735  1.1  mrg % @ifcommandisdefined CMD ... @end executes the `...' if CMD (written
   4736  1.1  mrg % without the @) is in fact defined.  We can only feasibly check at the
   4737  1.1  mrg % TeX level, so something like `mathcode' is going to considered
   4738  1.1  mrg % defined even though it is not a Texinfo command.
   4739  1.1  mrg %
   4740  1.1  mrg \makecond{ifcommanddefined}
   4741  1.1  mrg \def\ifcommanddefined{\parsearg{\doifcmddefined{\let\next=\ifcmddefinedfail}}}
   4742  1.1  mrg %
   4743  1.1  mrg \def\doifcmddefined#1#2{{%
   4744  1.1  mrg     \makevalueexpandable
   4745  1.1  mrg     \let\next=\empty
   4746  1.1  mrg     \expandafter\ifx\csname #2\endcsname\relax
   4747  1.1  mrg       #1% If not defined, \let\next as above.
   4748  1.1  mrg     \fi
   4749  1.1  mrg     \expandafter
   4750  1.1  mrg   }\next
   4751  1.1  mrg }
   4752  1.1  mrg \def\ifcmddefinedfail{\doignore{ifcommanddefined}}
   4753  1.1  mrg 
   4754  1.1  mrg % @ifcommandnotdefined CMD ... handled similar to @ifclear above.
   4755  1.1  mrg \makecond{ifcommandnotdefined}
   4756  1.1  mrg \def\ifcommandnotdefined{%
   4757  1.1  mrg   \parsearg{\doifcmddefined{\else \let\next=\ifcmdnotdefinedfail}}}
   4758  1.1  mrg \def\ifcmdnotdefinedfail{\doignore{ifcommandnotdefined}}
   4759  1.1  mrg 
   4760  1.1  mrg % Set the `txicommandconditionals' variable, so documents have a way to
   4761  1.1  mrg % test if the @ifcommand...defined conditionals are available.
   4762  1.1  mrg \set txicommandconditionals
   4763  1.1  mrg 
   4764  1.1  mrg % @dircategory CATEGORY  -- specify a category of the dir file
   4765  1.1  mrg % which this file should belong to.  Ignore this in TeX.
   4766  1.1  mrg \let\dircategory=\comment
   4767  1.1  mrg 
   4768  1.1  mrg % @defininfoenclose.
   4769  1.1  mrg \let\definfoenclose=\comment
   4770  1.1  mrg 
   4771  1.1  mrg 
   4772  1.1  mrg \message{indexing,}
   4773  1.1  mrg % Index generation facilities
   4774  1.1  mrg 
   4775  1.1  mrg % Define \newwrite to be identical to plain tex's \newwrite
   4776  1.1  mrg % except not \outer, so it can be used within macros and \if's.
   4777  1.1  mrg \edef\newwrite{\makecsname{ptexnewwrite}}
   4778  1.1  mrg 
   4779  1.1  mrg % \newindex {foo} defines an index named IX.
   4780  1.1  mrg % It automatically defines \IXindex such that
   4781  1.1  mrg % \IXindex ...rest of line... puts an entry in the index IX.
   4782  1.1  mrg % It also defines \IXindfile to be the number of the output channel for
   4783  1.1  mrg % the file that accumulates this index.  The file's extension is IX.
   4784  1.1  mrg % The name of an index should be no more than 2 characters long
   4785  1.1  mrg % for the sake of vms.
   4786  1.1  mrg %
   4787  1.1  mrg \def\newindex#1{%
   4788  1.1  mrg   \expandafter\chardef\csname#1indfile\endcsname=0
   4789  1.1  mrg   \expandafter\xdef\csname#1index\endcsname{%     % Define @#1index
   4790  1.1  mrg     \noexpand\doindex{#1}}
   4791  1.1  mrg }
   4792  1.1  mrg 
   4793  1.1  mrg % @defindex foo  ==  \newindex{foo}
   4794  1.1  mrg %
   4795  1.1  mrg \def\defindex{\parsearg\newindex}
   4796  1.1  mrg 
   4797  1.1  mrg % Define @defcodeindex, like @defindex except put all entries in @code.
   4798  1.1  mrg %
   4799  1.1  mrg \def\defcodeindex{\parsearg\newcodeindex}
   4800  1.1  mrg %
   4801  1.1  mrg \def\newcodeindex#1{%
   4802  1.1  mrg   \expandafter\chardef\csname#1indfile\endcsname=0
   4803  1.1  mrg   \expandafter\xdef\csname#1index\endcsname{%
   4804  1.1  mrg     \noexpand\docodeindex{#1}}%
   4805  1.1  mrg }
   4806  1.1  mrg 
   4807  1.1  mrg % The default indices:
   4808  1.1  mrg \newindex{cp}%      concepts,
   4809  1.1  mrg \newcodeindex{fn}%  functions,
   4810  1.1  mrg \newcodeindex{vr}%  variables,
   4811  1.1  mrg \newcodeindex{tp}%  types,
   4812  1.1  mrg \newcodeindex{ky}%  keys
   4813  1.1  mrg \newcodeindex{pg}%  and programs.
   4814  1.1  mrg 
   4815  1.1  mrg 
   4816  1.1  mrg % @synindex foo bar    makes index foo feed into index bar.
   4817  1.1  mrg % Do this instead of @defindex foo if you don't want it as a separate index.
   4818  1.1  mrg %
   4819  1.1  mrg % @syncodeindex foo bar   similar, but put all entries made for index foo
   4820  1.1  mrg % inside @code.
   4821  1.1  mrg %
   4822  1.1  mrg \def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
   4823  1.1  mrg \def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}
   4824  1.1  mrg 
   4825  1.1  mrg % #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
   4826  1.1  mrg % #3 the target index (bar).
   4827  1.1  mrg \def\dosynindex#1#2#3{%
   4828  1.1  mrg   \requireopenindexfile{#3}%
   4829  1.1  mrg   % redefine \fooindfile:
   4830  1.1  mrg   \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
   4831  1.1  mrg   \expandafter\let\csname#2indfile\endcsname=\temp
   4832  1.1  mrg   % redefine \fooindex:
   4833  1.1  mrg   \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
   4834  1.1  mrg }
   4835  1.1  mrg 
   4836  1.1  mrg % Define \doindex, the driver for all index macros.
   4837  1.1  mrg % Argument #1 is generated by the calling \fooindex macro,
   4838  1.1  mrg % and it is the two-letter name of the index.
   4839  1.1  mrg 
   4840  1.1  mrg \def\doindex#1{\edef\indexname{#1}\parsearg\doindexxxx}
   4841  1.1  mrg \def\doindexxxx #1{\doind{\indexname}{#1}}
   4842  1.1  mrg 
   4843  1.1  mrg % like the previous two, but they put @code around the argument.
   4844  1.1  mrg \def\docodeindex#1{\edef\indexname{#1}\parsearg\docodeindexxxx}
   4845  1.1  mrg \def\docodeindexxxx #1{\doind{\indexname}{\code{#1}}}
   4846  1.1  mrg 
   4847  1.1  mrg 
   4848  1.1  mrg % Used for the aux, toc and index files to prevent expansion of Texinfo
   4849  1.1  mrg % commands.
   4850  1.1  mrg %
   4851  1.1  mrg \def\atdummies{%
   4852  1.1  mrg   \definedummyletter\@%
   4853  1.1  mrg   \definedummyletter\ %
   4854  1.1  mrg   \definedummyletter\{%
   4855  1.1  mrg   \definedummyletter\}%
   4856  1.1  mrg   \definedummyletter\&%
   4857  1.1  mrg   %
   4858  1.1  mrg   % Do the redefinitions.
   4859  1.1  mrg   \definedummies
   4860  1.1  mrg   \otherbackslash
   4861  1.1  mrg }
   4862  1.1  mrg 
   4863  1.1  mrg % \definedummyword defines \#1 as \string\#1\space, thus effectively
   4864  1.1  mrg % preventing its expansion.  This is used only for control words,
   4865  1.1  mrg % not control letters, because the \space would be incorrect for
   4866  1.1  mrg % control characters, but is needed to separate the control word
   4867  1.1  mrg % from whatever follows.
   4868  1.1  mrg %
   4869  1.1  mrg % These can be used both for control words that take an argument and
   4870  1.1  mrg % those that do not.  If it is followed by {arg} in the input, then
   4871  1.1  mrg % that will dutifully get written to the index (or wherever).
   4872  1.1  mrg %
   4873  1.1  mrg % For control letters, we have \definedummyletter, which omits the
   4874  1.1  mrg % space.
   4875  1.1  mrg %
   4876  1.1  mrg \def\definedummyword  #1{\def#1{\string#1\space}}%
   4877  1.1  mrg \def\definedummyletter#1{\def#1{\string#1}}%
   4878  1.1  mrg \let\definedummyaccent\definedummyletter
   4879  1.1  mrg 
   4880  1.1  mrg % Called from \atdummies to prevent the expansion of commands.
   4881  1.1  mrg %
   4882  1.1  mrg \def\definedummies{%
   4883  1.1  mrg   %
   4884  1.1  mrg   \let\commondummyword\definedummyword
   4885  1.1  mrg   \let\commondummyletter\definedummyletter
   4886  1.1  mrg   \let\commondummyaccent\definedummyaccent
   4887  1.1  mrg   \commondummiesnofonts
   4888  1.1  mrg   %
   4889  1.1  mrg   \definedummyletter\_%
   4890  1.1  mrg   \definedummyletter\-%
   4891  1.1  mrg   %
   4892  1.1  mrg   % Non-English letters.
   4893  1.1  mrg   \definedummyword\AA
   4894  1.1  mrg   \definedummyword\AE
   4895  1.1  mrg   \definedummyword\DH
   4896  1.1  mrg   \definedummyword\L
   4897  1.1  mrg   \definedummyword\O
   4898  1.1  mrg   \definedummyword\OE
   4899  1.1  mrg   \definedummyword\TH
   4900  1.1  mrg   \definedummyword\aa
   4901  1.1  mrg   \definedummyword\ae
   4902  1.1  mrg   \definedummyword\dh
   4903  1.1  mrg   \definedummyword\exclamdown
   4904  1.1  mrg   \definedummyword\l
   4905  1.1  mrg   \definedummyword\o
   4906  1.1  mrg   \definedummyword\oe
   4907  1.1  mrg   \definedummyword\ordf
   4908  1.1  mrg   \definedummyword\ordm
   4909  1.1  mrg   \definedummyword\questiondown
   4910  1.1  mrg   \definedummyword\ss
   4911  1.1  mrg   \definedummyword\th
   4912  1.1  mrg   %
   4913  1.1  mrg   % Although these internal commands shouldn't show up, sometimes they do.
   4914  1.1  mrg   \definedummyword\bf
   4915  1.1  mrg   \definedummyword\gtr
   4916  1.1  mrg   \definedummyword\hat
   4917  1.1  mrg   \definedummyword\less
   4918  1.1  mrg   \definedummyword\sf
   4919  1.1  mrg   \definedummyword\sl
   4920  1.1  mrg   \definedummyword\tclose
   4921  1.1  mrg   \definedummyword\tt
   4922  1.1  mrg   %
   4923  1.1  mrg   \definedummyword\LaTeX
   4924  1.1  mrg   \definedummyword\TeX
   4925  1.1  mrg   %
   4926  1.1  mrg   % Assorted special characters.
   4927  1.1  mrg   \definedummyword\ampchar
   4928  1.1  mrg   \definedummyword\atchar
   4929  1.1  mrg   \definedummyword\arrow
   4930  1.1  mrg   \definedummyword\backslashchar
   4931  1.1  mrg   \definedummyword\bullet
   4932  1.1  mrg   \definedummyword\comma
   4933  1.1  mrg   \definedummyword\copyright
   4934  1.1  mrg   \definedummyword\registeredsymbol
   4935  1.1  mrg   \definedummyword\dots
   4936  1.1  mrg   \definedummyword\enddots
   4937  1.1  mrg   \definedummyword\entrybreak
   4938  1.1  mrg   \definedummyword\equiv
   4939  1.1  mrg   \definedummyword\error
   4940  1.1  mrg   \definedummyword\euro
   4941  1.1  mrg   \definedummyword\expansion
   4942  1.1  mrg   \definedummyword\geq
   4943  1.1  mrg   \definedummyword\guillemetleft
   4944  1.1  mrg   \definedummyword\guillemetright
   4945  1.1  mrg   \definedummyword\guilsinglleft
   4946  1.1  mrg   \definedummyword\guilsinglright
   4947  1.1  mrg   \definedummyword\lbracechar
   4948  1.1  mrg   \definedummyword\leq
   4949  1.1  mrg   \definedummyword\mathopsup
   4950  1.1  mrg   \definedummyword\minus
   4951  1.1  mrg   \definedummyword\ogonek
   4952  1.1  mrg   \definedummyword\pounds
   4953  1.1  mrg   \definedummyword\point
   4954  1.1  mrg   \definedummyword\print
   4955  1.1  mrg   \definedummyword\quotedblbase
   4956  1.1  mrg   \definedummyword\quotedblleft
   4957  1.1  mrg   \definedummyword\quotedblright
   4958  1.1  mrg   \definedummyword\quoteleft
   4959  1.1  mrg   \definedummyword\quoteright
   4960  1.1  mrg   \definedummyword\quotesinglbase
   4961  1.1  mrg   \definedummyword\rbracechar
   4962  1.1  mrg   \definedummyword\result
   4963  1.1  mrg   \definedummyword\sub
   4964  1.1  mrg   \definedummyword\sup
   4965  1.1  mrg   \definedummyword\textdegree
   4966  1.1  mrg   %
   4967  1.1  mrg   \definedummyword\subentry
   4968  1.1  mrg   %
   4969  1.1  mrg   % We want to disable all macros so that they are not expanded by \write.
   4970  1.1  mrg   \macrolist
   4971  1.1  mrg   \let\value\dummyvalue
   4972  1.1  mrg   %
   4973  1.1  mrg   \normalturnoffactive
   4974  1.1  mrg }
   4975  1.1  mrg 
   4976  1.1  mrg % \commondummiesnofonts: common to \definedummies and \indexnofonts.
   4977  1.1  mrg % Define \commondummyletter, \commondummyaccent and \commondummyword before
   4978  1.1  mrg % using.  Used for accents, font commands, and various control letters.
   4979  1.1  mrg %
   4980  1.1  mrg \def\commondummiesnofonts{%
   4981  1.1  mrg   % Control letters and accents.
   4982  1.1  mrg   \commondummyletter\!%
   4983  1.1  mrg   \commondummyaccent\"%
   4984  1.1  mrg   \commondummyaccent\'%
   4985  1.1  mrg   \commondummyletter\*%
   4986  1.1  mrg   \commondummyaccent\,%
   4987  1.1  mrg   \commondummyletter\.%
   4988  1.1  mrg   \commondummyletter\/%
   4989  1.1  mrg   \commondummyletter\:%
   4990  1.1  mrg   \commondummyaccent\=%
   4991  1.1  mrg   \commondummyletter\?%
   4992  1.1  mrg   \commondummyaccent\^%
   4993  1.1  mrg   \commondummyaccent\`%
   4994  1.1  mrg   \commondummyaccent\~%
   4995  1.1  mrg   \commondummyword\u
   4996  1.1  mrg   \commondummyword\v
   4997  1.1  mrg   \commondummyword\H
   4998  1.1  mrg   \commondummyword\dotaccent
   4999  1.1  mrg   \commondummyword\ogonek
   5000  1.1  mrg   \commondummyword\ringaccent
   5001  1.1  mrg   \commondummyword\tieaccent
   5002  1.1  mrg   \commondummyword\ubaraccent
   5003  1.1  mrg   \commondummyword\udotaccent
   5004  1.1  mrg   \commondummyword\dotless
   5005  1.1  mrg   %
   5006  1.1  mrg   % Texinfo font commands.
   5007  1.1  mrg   \commondummyword\b
   5008  1.1  mrg   \commondummyword\i
   5009  1.1  mrg   \commondummyword\r
   5010  1.1  mrg   \commondummyword\sansserif
   5011  1.1  mrg   \commondummyword\sc
   5012  1.1  mrg   \commondummyword\slanted
   5013  1.1  mrg   \commondummyword\t
   5014  1.1  mrg   %
   5015  1.1  mrg   % Commands that take arguments.
   5016  1.1  mrg   \commondummyword\abbr
   5017  1.1  mrg   \commondummyword\acronym
   5018  1.1  mrg   \commondummyword\anchor
   5019  1.1  mrg   \commondummyword\cite
   5020  1.1  mrg   \commondummyword\code
   5021  1.1  mrg   \commondummyword\command
   5022  1.1  mrg   \commondummyword\dfn
   5023  1.1  mrg   \commondummyword\dmn
   5024  1.1  mrg   \commondummyword\email
   5025  1.1  mrg   \commondummyword\emph
   5026  1.1  mrg   \commondummyword\env
   5027  1.1  mrg   \commondummyword\file
   5028  1.1  mrg   \commondummyword\image
   5029  1.1  mrg   \commondummyword\indicateurl
   5030  1.1  mrg   \commondummyword\inforef
   5031  1.1  mrg   \commondummyword\kbd
   5032  1.1  mrg   \commondummyword\key
   5033  1.1  mrg   \commondummyword\math
   5034  1.1  mrg   \commondummyword\option
   5035  1.1  mrg   \commondummyword\pxref
   5036  1.1  mrg   \commondummyword\ref
   5037  1.1  mrg   \commondummyword\samp
   5038  1.1  mrg   \commondummyword\strong
   5039  1.1  mrg   \commondummyword\tie
   5040  1.1  mrg   \commondummyword\U
   5041  1.1  mrg   \commondummyword\uref
   5042  1.1  mrg   \commondummyword\url
   5043  1.1  mrg   \commondummyword\var
   5044  1.1  mrg   \commondummyword\verb
   5045  1.1  mrg   \commondummyword\w
   5046  1.1  mrg   \commondummyword\xref
   5047  1.1  mrg }
   5048  1.1  mrg 
   5049  1.1  mrg \let\indexlbrace\relax
   5050  1.1  mrg \let\indexrbrace\relax
   5051  1.1  mrg \let\indexatchar\relax
   5052  1.1  mrg \let\indexbackslash\relax
   5053  1.1  mrg 
   5054  1.1  mrg {\catcode`\@=0
   5055  1.1  mrg \catcode`\\=13
   5056  1.1  mrg   @gdef@backslashdisappear{@def\{}}
   5057  1.1  mrg }
   5058  1.1  mrg 
   5059  1.1  mrg {
   5060  1.1  mrg \catcode`\<=13
   5061  1.1  mrg \catcode`\-=13
   5062  1.1  mrg \catcode`\`=13
   5063  1.1  mrg   \gdef\indexnonalnumdisappear{%
   5064  1.1  mrg     \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax\else
   5065  1.1  mrg       % @set txiindexlquoteignore makes us ignore left quotes in the sort term.
   5066  1.1  mrg       % (Introduced for FSFS 2nd ed.)
   5067  1.1  mrg       \let`=\empty
   5068  1.1  mrg     \fi
   5069  1.1  mrg     %
   5070  1.1  mrg     \expandafter\ifx\csname SETtxiindexbackslashignore\endcsname\relax\else
   5071  1.1  mrg       \backslashdisappear
   5072  1.1  mrg     \fi
   5073  1.1  mrg     %
   5074  1.1  mrg     \expandafter\ifx\csname SETtxiindexhyphenignore\endcsname\relax\else
   5075  1.1  mrg       \def-{}%
   5076  1.1  mrg     \fi
   5077  1.1  mrg     \expandafter\ifx\csname SETtxiindexlessthanignore\endcsname\relax\else
   5078  1.1  mrg       \def<{}%
   5079  1.1  mrg     \fi
   5080  1.1  mrg     \expandafter\ifx\csname SETtxiindexatsignignore\endcsname\relax\else
   5081  1.1  mrg       \def\@{}%
   5082  1.1  mrg     \fi
   5083  1.1  mrg   }
   5084  1.1  mrg 
   5085  1.1  mrg   \gdef\indexnonalnumreappear{%
   5086  1.1  mrg     \let-\normaldash
   5087  1.1  mrg     \let<\normalless
   5088  1.1  mrg   }
   5089  1.1  mrg }
   5090  1.1  mrg 
   5091  1.1  mrg 
   5092  1.1  mrg % \indexnofonts is used when outputting the strings to sort the index
   5093  1.1  mrg % by, and when constructing control sequence names.  It eliminates all
   5094  1.1  mrg % control sequences and just writes whatever the best ASCII sort string
   5095  1.1  mrg % would be for a given command (usually its argument).
   5096  1.1  mrg %
   5097  1.1  mrg \def\indexnofonts{%
   5098  1.1  mrg   % Accent commands should become @asis.
   5099  1.1  mrg   \def\commondummyaccent##1{\let##1\asis}%
   5100  1.1  mrg   % We can just ignore other control letters.
   5101  1.1  mrg   \def\commondummyletter##1{\let##1\empty}%
   5102  1.1  mrg   % All control words become @asis by default; overrides below.
   5103  1.1  mrg   \let\commondummyword\commondummyaccent
   5104  1.1  mrg   \commondummiesnofonts
   5105  1.1  mrg   %
   5106  1.1  mrg   % Don't no-op \tt, since it isn't a user-level command
   5107  1.1  mrg   % and is used in the definitions of the active chars like <, >, |, etc.
   5108  1.1  mrg   % Likewise with the other plain tex font commands.
   5109  1.1  mrg   %\let\tt=\asis
   5110  1.1  mrg   %
   5111  1.1  mrg   \def\ { }%
   5112  1.1  mrg   \def\@{@}%
   5113  1.1  mrg   \def\_{\normalunderscore}%
   5114  1.1  mrg   \def\-{}% @- shouldn't affect sorting
   5115  1.1  mrg   %
   5116  1.1  mrg   \uccode`\1=`\{ \uppercase{\def\{{1}}%
   5117  1.1  mrg   \uccode`\1=`\} \uppercase{\def\}{1}}%
   5118  1.1  mrg   \let\lbracechar\{%
   5119  1.1  mrg   \let\rbracechar\}%
   5120  1.1  mrg   %
   5121  1.1  mrg   % Non-English letters.
   5122  1.1  mrg   \def\AA{AA}%
   5123  1.1  mrg   \def\AE{AE}%
   5124  1.1  mrg   \def\DH{DZZ}%
   5125  1.1  mrg   \def\L{L}%
   5126  1.1  mrg   \def\OE{OE}%
   5127  1.1  mrg   \def\O{O}%
   5128  1.1  mrg   \def\TH{TH}%
   5129  1.1  mrg   \def\aa{aa}%
   5130  1.1  mrg   \def\ae{ae}%
   5131  1.1  mrg   \def\dh{dzz}%
   5132  1.1  mrg   \def\exclamdown{!}%
   5133  1.1  mrg   \def\l{l}%
   5134  1.1  mrg   \def\oe{oe}%
   5135  1.1  mrg   \def\ordf{a}%
   5136  1.1  mrg   \def\ordm{o}%
   5137  1.1  mrg   \def\o{o}%
   5138  1.1  mrg   \def\questiondown{?}%
   5139  1.1  mrg   \def\ss{ss}%
   5140  1.1  mrg   \def\th{th}%
   5141  1.1  mrg   %
   5142  1.1  mrg   \def\LaTeX{LaTeX}%
   5143  1.1  mrg   \def\TeX{TeX}%
   5144  1.1  mrg   %
   5145  1.1  mrg   % Assorted special characters.  \defglyph gives the control sequence a
   5146  1.1  mrg   % definition that removes the {} that follows its use.
   5147  1.1  mrg   \defglyph\atchar{@}%
   5148  1.1  mrg   \defglyph\arrow{->}%
   5149  1.1  mrg   \defglyph\bullet{bullet}%
   5150  1.1  mrg   \defglyph\comma{,}%
   5151  1.1  mrg   \defglyph\copyright{copyright}%
   5152  1.1  mrg   \defglyph\dots{...}%
   5153  1.1  mrg   \defglyph\enddots{...}%
   5154  1.1  mrg   \defglyph\equiv{==}%
   5155  1.1  mrg   \defglyph\error{error}%
   5156  1.1  mrg   \defglyph\euro{euro}%
   5157  1.1  mrg   \defglyph\expansion{==>}%
   5158  1.1  mrg   \defglyph\geq{>=}%
   5159  1.1  mrg   \defglyph\guillemetleft{<<}%
   5160  1.1  mrg   \defglyph\guillemetright{>>}%
   5161  1.1  mrg   \defglyph\guilsinglleft{<}%
   5162  1.1  mrg   \defglyph\guilsinglright{>}%
   5163  1.1  mrg   \defglyph\leq{<=}%
   5164  1.1  mrg   \defglyph\lbracechar{\{}%
   5165  1.1  mrg   \defglyph\minus{-}%
   5166  1.1  mrg   \defglyph\point{.}%
   5167  1.1  mrg   \defglyph\pounds{pounds}%
   5168  1.1  mrg   \defglyph\print{-|}%
   5169  1.1  mrg   \defglyph\quotedblbase{"}%
   5170  1.1  mrg   \defglyph\quotedblleft{"}%
   5171  1.1  mrg   \defglyph\quotedblright{"}%
   5172  1.1  mrg   \defglyph\quoteleft{`}%
   5173  1.1  mrg   \defglyph\quoteright{'}%
   5174  1.1  mrg   \defglyph\quotesinglbase{,}%
   5175  1.1  mrg   \defglyph\rbracechar{\}}%
   5176  1.1  mrg   \defglyph\registeredsymbol{R}%
   5177  1.1  mrg   \defglyph\result{=>}%
   5178  1.1  mrg   \defglyph\textdegree{o}%
   5179  1.1  mrg   %
   5180  1.1  mrg   % We need to get rid of all macros, leaving only the arguments (if present).
   5181  1.1  mrg   % Of course this is not nearly correct, but it is the best we can do for now.
   5182  1.1  mrg   % makeinfo does not expand macros in the argument to @deffn, which ends up
   5183  1.1  mrg   % writing an index entry, and texindex isn't prepared for an index sort entry
   5184  1.1  mrg   % that starts with \.
   5185  1.1  mrg   %
   5186  1.1  mrg   % Since macro invocations are followed by braces, we can just redefine them
   5187  1.1  mrg   % to take a single TeX argument.  The case of a macro invocation that
   5188  1.1  mrg   % goes to end-of-line is not handled.
   5189  1.1  mrg   %
   5190  1.1  mrg   \macrolist
   5191  1.1  mrg   \let\value\indexnofontsvalue
   5192  1.1  mrg }
   5193  1.1  mrg \def\defglyph#1#2{\def#1##1{#2}} % see above
   5194  1.1  mrg 
   5195  1.1  mrg 
   5196  1.1  mrg 
   5197  1.1  mrg 
   5198  1.1  mrg % #1 is the index name, #2 is the entry text.
   5199  1.1  mrg \def\doind#1#2{%
   5200  1.1  mrg   \iflinks
   5201  1.1  mrg   {%
   5202  1.1  mrg     %
   5203  1.1  mrg     \requireopenindexfile{#1}%
   5204  1.1  mrg     \edef\writeto{\csname#1indfile\endcsname}%
   5205  1.1  mrg     %
   5206  1.1  mrg     \def\indextext{#2}%
   5207  1.1  mrg     \safewhatsit\doindwrite
   5208  1.1  mrg   }%
   5209  1.1  mrg   \fi
   5210  1.1  mrg }
   5211  1.1  mrg 
   5212  1.1  mrg % Check if an index file has been opened, and if not, open it.
   5213  1.1  mrg \def\requireopenindexfile#1{%
   5214  1.1  mrg \ifnum\csname #1indfile\endcsname=0
   5215  1.1  mrg   \expandafter\newwrite \csname#1indfile\endcsname
   5216  1.1  mrg   \edef\suffix{#1}%
   5217  1.1  mrg   % A .fls suffix would conflict with the file extension for the output
   5218  1.1  mrg   % of -recorder, so use .f1s instead.
   5219  1.1  mrg   \ifx\suffix\indexisfl\def\suffix{f1}\fi
   5220  1.1  mrg   % Open the file
   5221  1.1  mrg   \immediate\openout\csname#1indfile\endcsname \jobname.\suffix
   5222  1.1  mrg   % Using \immediate above here prevents an object entering into the current
   5223  1.1  mrg   % box, which could confound checks such as those in \safewhatsit for
   5224  1.1  mrg   % preceding skips.
   5225  1.1  mrg   \typeout{Writing index file \jobname.\suffix}%
   5226  1.1  mrg \fi}
   5227  1.1  mrg \def\indexisfl{fl}
   5228  1.1  mrg 
   5229  1.1  mrg % Definition for writing index entry sort key.
   5230  1.1  mrg {
   5231  1.1  mrg \catcode`\-=13
   5232  1.1  mrg \gdef\indexwritesortas{%
   5233  1.1  mrg   \begingroup
   5234  1.1  mrg   \indexnonalnumreappear
   5235  1.1  mrg   \indexwritesortasxxx}
   5236  1.1  mrg \gdef\indexwritesortasxxx#1{%
   5237  1.1  mrg   \xdef\indexsortkey{#1}\endgroup}
   5238  1.1  mrg }
   5239  1.1  mrg 
   5240  1.1  mrg \def\indexwriteseealso#1{
   5241  1.1  mrg   \gdef\pagenumbertext{\string\seealso{#1}}%
   5242  1.1  mrg }
   5243  1.1  mrg \def\indexwriteseeentry#1{
   5244  1.1  mrg   \gdef\pagenumbertext{\string\seeentry{#1}}%
   5245  1.1  mrg }
   5246  1.1  mrg 
   5247  1.1  mrg % The default definitions
   5248  1.1  mrg \def\sortas#1{}%
   5249  1.1  mrg \def\seealso#1{\i{\putwordSeeAlso}\ #1}% for sorted index file only
   5250  1.1  mrg \def\putwordSeeAlso{See also}
   5251  1.1  mrg \def\seeentry#1{\i{\putwordSee}\ #1}% for sorted index file only
   5252  1.1  mrg 
   5253  1.1  mrg 
   5254  1.1  mrg % Given index entry text like "aaa @subentry bbb @sortas{ZZZ}":
   5255  1.1  mrg %   * Set \bracedtext to "{aaa}{bbb}"
   5256  1.1  mrg %   * Set \fullindexsortkey to "aaa @subentry ZZZ"
   5257  1.1  mrg %   * If @seealso occurs, set \pagenumbertext
   5258  1.1  mrg %
   5259  1.1  mrg \def\splitindexentry#1{%
   5260  1.1  mrg   \gdef\fullindexsortkey{}%
   5261  1.1  mrg   \xdef\bracedtext{}%
   5262  1.1  mrg   \def\sep{}%
   5263  1.1  mrg   \def\seealso##1{}%
   5264  1.1  mrg   \def\seeentry##1{}%
   5265  1.1  mrg   \expandafter\doindexsegment#1\subentry\finish\subentry
   5266  1.1  mrg }
   5267  1.1  mrg 
   5268  1.1  mrg % append the results from the next segment
   5269  1.1  mrg \def\doindexsegment#1\subentry{%
   5270  1.1  mrg   \def\segment{#1}%
   5271  1.1  mrg   \ifx\segment\isfinish
   5272  1.1  mrg   \else
   5273  1.1  mrg     %
   5274  1.1  mrg     % Fully expand the segment, throwing away any @sortas directives, and
   5275  1.1  mrg     % trim spaces.
   5276  1.1  mrg     \edef\trimmed{\segment}%
   5277  1.1  mrg     \edef\trimmed{\expandafter\eatspaces\expandafter{\trimmed}}%
   5278  1.1  mrg     %
   5279  1.1  mrg     \xdef\bracedtext{\bracedtext{\trimmed}}%
   5280  1.1  mrg     %
   5281  1.1  mrg     % Get the string to sort by.  Process the segment with all
   5282  1.1  mrg     % font commands turned off.
   5283  1.1  mrg     \bgroup
   5284  1.1  mrg       \let\sortas\indexwritesortas
   5285  1.1  mrg       \let\seealso\indexwriteseealso
   5286  1.1  mrg       \let\seeentry\indexwriteseeentry
   5287  1.1  mrg       \indexnofonts
   5288  1.1  mrg       % The braces around the commands are recognized by texindex.
   5289  1.1  mrg       \def\lbracechar{{\string\indexlbrace}}%
   5290  1.1  mrg       \def\rbracechar{{\string\indexrbrace}}%
   5291  1.1  mrg       \let\{=\lbracechar
   5292  1.1  mrg       \let\}=\rbracechar
   5293  1.1  mrg       \def\@{{\string\indexatchar}}%
   5294  1.1  mrg       \def\atchar##1{\@}%
   5295  1.1  mrg       \def\backslashchar{{\string\indexbackslash}}%
   5296  1.1  mrg       \uccode`\~=`\\ \uppercase{\let~\backslashchar}%
   5297  1.1  mrg       %
   5298  1.1  mrg       \let\indexsortkey\empty
   5299  1.1  mrg       \global\let\pagenumbertext\empty
   5300  1.1  mrg       % Execute the segment and throw away the typeset output.  This executes
   5301  1.1  mrg       % any @sortas or @seealso commands in this segment.
   5302  1.1  mrg       \setbox\dummybox = \hbox{\segment}%
   5303  1.1  mrg       \ifx\indexsortkey\empty{%
   5304  1.1  mrg         \indexnonalnumdisappear
   5305  1.1  mrg         \xdef\trimmed{\segment}%
   5306  1.1  mrg         \xdef\trimmed{\expandafter\eatspaces\expandafter{\trimmed}}%
   5307  1.1  mrg         \xdef\indexsortkey{\trimmed}%
   5308  1.1  mrg         \ifx\indexsortkey\empty\xdef\indexsortkey{ }\fi
   5309  1.1  mrg       }\fi
   5310  1.1  mrg       %
   5311  1.1  mrg       % Append to \fullindexsortkey.
   5312  1.1  mrg       \edef\tmp{\gdef\noexpand\fullindexsortkey{%
   5313  1.1  mrg                   \fullindexsortkey\sep\indexsortkey}}%
   5314  1.1  mrg       \tmp
   5315  1.1  mrg     \egroup
   5316  1.1  mrg     \def\sep{\subentry}%
   5317  1.1  mrg     %
   5318  1.1  mrg     \expandafter\doindexsegment
   5319  1.1  mrg   \fi
   5320  1.1  mrg }
   5321  1.1  mrg \def\isfinish{\finish}%
   5322  1.1  mrg \newbox\dummybox % used above
   5323  1.1  mrg 
   5324  1.1  mrg \let\subentry\relax
   5325  1.1  mrg 
   5326  1.1  mrg % Use \ instead of @ in index files.  To support old texi2dvi and texindex.
   5327  1.1  mrg % This works without changing the escape character used in the toc or aux
   5328  1.1  mrg % files because the index entries are fully expanded here, and \string uses
   5329  1.1  mrg % the current value of \escapechar.
   5330  1.1  mrg \def\escapeisbackslash{\escapechar=`\\}
   5331  1.1  mrg 
   5332  1.1  mrg % Use \ in index files by default.  texi2dvi didn't support @ as the escape
   5333  1.1  mrg % character (as it checked for "\entry" in the files, and not "@entry").  When
   5334  1.1  mrg % the new version of texi2dvi has had a chance to become more prevalent, then
   5335  1.1  mrg % the escape character can change back to @ again.  This should be an easy
   5336  1.1  mrg % change to make now because both @ and \ are only used as escape characters in
   5337  1.1  mrg % index files, never standing for themselves.
   5338  1.1  mrg %
   5339  1.1  mrg \set txiindexescapeisbackslash
   5340  1.1  mrg 
   5341  1.1  mrg % Write the entry in \indextext to the index file.
   5342  1.1  mrg %
   5343  1.1  mrg \def\doindwrite{%
   5344  1.1  mrg   \maybemarginindex
   5345  1.1  mrg   %
   5346  1.1  mrg   \atdummies
   5347  1.1  mrg   %
   5348  1.1  mrg   \expandafter\ifx\csname SETtxiindexescapeisbackslash\endcsname\relax\else
   5349  1.1  mrg     \escapeisbackslash
   5350  1.1  mrg   \fi
   5351  1.1  mrg   %
   5352  1.1  mrg   % For texindex which always views { and } as separators.
   5353  1.1  mrg   \def\{{\lbracechar{}}%
   5354  1.1  mrg   \def\}{\rbracechar{}}%
   5355  1.1  mrg   \uccode`\~=`\\ \uppercase{\def~{\backslashchar{}}}%
   5356  1.1  mrg   %
   5357  1.1  mrg   % Split the entry into primary entry and any subentries, and get the index
   5358  1.1  mrg   % sort key.
   5359  1.1  mrg   \splitindexentry\indextext
   5360  1.1  mrg   %
   5361  1.1  mrg   % Set up the complete index entry, with both the sort key and
   5362  1.1  mrg   % the original text, including any font commands.  We write
   5363  1.1  mrg   % three arguments to \entry to the .?? file (four in the
   5364  1.1  mrg   % subentry case), texindex reduces to two when writing the .??s
   5365  1.1  mrg   % sorted result.
   5366  1.1  mrg   %
   5367  1.1  mrg   \edef\temp{%
   5368  1.1  mrg     \write\writeto{%
   5369  1.1  mrg       \string\entry{\fullindexsortkey}%
   5370  1.1  mrg         {\ifx\pagenumbertext\empty\noexpand\folio\else\pagenumbertext\fi}%
   5371  1.1  mrg         \bracedtext}%
   5372  1.1  mrg   }%
   5373  1.1  mrg   \temp
   5374  1.1  mrg }
   5375  1.1  mrg 
   5376  1.1  mrg % Put the index entry in the margin if desired (undocumented).
   5377  1.1  mrg \def\maybemarginindex{%
   5378  1.1  mrg   \ifx\SETmarginindex\relax\else
   5379  1.1  mrg     \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \relax\indextext}}%
   5380  1.1  mrg   \fi
   5381  1.1  mrg }
   5382  1.1  mrg \let\SETmarginindex=\relax
   5383  1.1  mrg 
   5384  1.1  mrg 
   5385  1.1  mrg % Take care of unwanted page breaks/skips around a whatsit:
   5386  1.1  mrg %
   5387  1.1  mrg % If a skip is the last thing on the list now, preserve it
   5388  1.1  mrg % by backing up by \lastskip, doing the \write, then inserting
   5389  1.1  mrg % the skip again.  Otherwise, the whatsit generated by the
   5390  1.1  mrg % \write or \pdfdest will make \lastskip zero.  The result is that
   5391  1.1  mrg % sequences like this:
   5392  1.1  mrg % @end defun
   5393  1.1  mrg % @tindex whatever
   5394  1.1  mrg % @defun ...
   5395  1.1  mrg % will have extra space inserted, because the \medbreak in the
   5396  1.1  mrg % start of the @defun won't see the skip inserted by the @end of
   5397  1.1  mrg % the previous defun.
   5398  1.1  mrg %
   5399  1.1  mrg % But don't do any of this if we're not in vertical mode.  We
   5400  1.1  mrg % don't want to do a \vskip and prematurely end a paragraph.
   5401  1.1  mrg %
   5402  1.1  mrg % Avoid page breaks due to these extra skips, too.
   5403  1.1  mrg %
   5404  1.1  mrg % But wait, there is a catch there:
   5405  1.1  mrg % We'll have to check whether \lastskip is zero skip.  \ifdim is not
   5406  1.1  mrg % sufficient for this purpose, as it ignores stretch and shrink parts
   5407  1.1  mrg % of the skip.  The only way seems to be to check the textual
   5408  1.1  mrg % representation of the skip.
   5409  1.1  mrg %
   5410  1.1  mrg % The following is almost like \def\zeroskipmacro{0.0pt} except that
   5411  1.1  mrg % the ``p'' and ``t'' characters have catcode \other, not 11 (letter).
   5412  1.1  mrg %
   5413  1.1  mrg \edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname}
   5414  1.1  mrg %
   5415  1.1  mrg \newskip\whatsitskip
   5416  1.1  mrg \newcount\whatsitpenalty
   5417  1.1  mrg %
   5418  1.1  mrg % ..., ready, GO:
   5419  1.1  mrg %
   5420  1.1  mrg \def\safewhatsit#1{\ifhmode
   5421  1.1  mrg   #1%
   5422  1.1  mrg  \else
   5423  1.1  mrg   % \lastskip and \lastpenalty cannot both be nonzero simultaneously.
   5424  1.1  mrg   \whatsitskip = \lastskip
   5425  1.1  mrg   \edef\lastskipmacro{\the\lastskip}%
   5426  1.1  mrg   \whatsitpenalty = \lastpenalty
   5427  1.1  mrg   %
   5428  1.1  mrg   % If \lastskip is nonzero, that means the last item was a
   5429  1.1  mrg   % skip.  And since a skip is discardable, that means this
   5430  1.1  mrg   % -\whatsitskip glue we're inserting is preceded by a
   5431  1.1  mrg   % non-discardable item, therefore it is not a potential
   5432  1.1  mrg   % breakpoint, therefore no \nobreak needed.
   5433  1.1  mrg   \ifx\lastskipmacro\zeroskipmacro
   5434  1.1  mrg   \else
   5435  1.1  mrg     \vskip-\whatsitskip
   5436  1.1  mrg   \fi
   5437  1.1  mrg   %
   5438  1.1  mrg   #1%
   5439  1.1  mrg   %
   5440  1.1  mrg   \ifx\lastskipmacro\zeroskipmacro
   5441  1.1  mrg     % If \lastskip was zero, perhaps the last item was a penalty, and
   5442  1.1  mrg     % perhaps it was >=10000, e.g., a \nobreak.  In that case, we want
   5443  1.1  mrg     % to re-insert the same penalty (values >10000 are used for various
   5444  1.1  mrg     % signals); since we just inserted a non-discardable item, any
   5445  1.1  mrg     % following glue (such as a \parskip) would be a breakpoint.  For example:
   5446  1.1  mrg     %   @deffn deffn-whatever
   5447  1.1  mrg     %   @vindex index-whatever
   5448  1.1  mrg     %   Description.
   5449  1.1  mrg     % would allow a break between the index-whatever whatsit
   5450  1.1  mrg     % and the "Description." paragraph.
   5451  1.1  mrg     \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi
   5452  1.1  mrg   \else
   5453  1.1  mrg     % On the other hand, if we had a nonzero \lastskip,
   5454  1.1  mrg     % this make-up glue would be preceded by a non-discardable item
   5455  1.1  mrg     % (the whatsit from the \write), so we must insert a \nobreak.
   5456  1.1  mrg     \nobreak\vskip\whatsitskip
   5457  1.1  mrg   \fi
   5458  1.1  mrg \fi}
   5459  1.1  mrg 
   5460  1.1  mrg % The index entry written in the file actually looks like
   5461  1.1  mrg %  \entry {sortstring}{page}{topic}
   5462  1.1  mrg % or
   5463  1.1  mrg %  \entry {sortstring}{page}{topic}{subtopic}
   5464  1.1  mrg % The texindex program reads in these files and writes files
   5465  1.1  mrg % containing these kinds of lines:
   5466  1.1  mrg %  \initial {c}
   5467  1.1  mrg %     before the first topic whose initial is c
   5468  1.1  mrg %  \entry {topic}{pagelist}
   5469  1.1  mrg %     for a topic that is used without subtopics
   5470  1.1  mrg %  \primary {topic}
   5471  1.1  mrg %  \entry {topic}{}
   5472  1.1  mrg %     for the beginning of a topic that is used with subtopics
   5473  1.1  mrg %  \secondary {subtopic}{pagelist}
   5474  1.1  mrg %     for each subtopic.
   5475  1.1  mrg %  \secondary {subtopic}{}
   5476  1.1  mrg %     for a subtopic with sub-subtopics
   5477  1.1  mrg %  \tertiary {subtopic}{subsubtopic}{pagelist}
   5478  1.1  mrg %     for each sub-subtopic.
   5479  1.1  mrg 
   5480  1.1  mrg % Define the user-accessible indexing commands
   5481  1.1  mrg % @findex, @vindex, @kindex, @cindex.
   5482  1.1  mrg 
   5483  1.1  mrg \def\findex {\fnindex}
   5484  1.1  mrg \def\kindex {\kyindex}
   5485  1.1  mrg \def\cindex {\cpindex}
   5486  1.1  mrg \def\vindex {\vrindex}
   5487  1.1  mrg \def\tindex {\tpindex}
   5488  1.1  mrg \def\pindex {\pgindex}
   5489  1.1  mrg 
   5490  1.1  mrg % Define the macros used in formatting output of the sorted index material.
   5491  1.1  mrg 
   5492  1.1  mrg % @printindex causes a particular index (the ??s file) to get printed.
   5493  1.1  mrg % It does not print any chapter heading (usually an @unnumbered).
   5494  1.1  mrg %
   5495  1.1  mrg \parseargdef\printindex{\begingroup
   5496  1.1  mrg   \dobreak \chapheadingskip{10000}%
   5497  1.1  mrg   %
   5498  1.1  mrg   \smallfonts \rm
   5499  1.1  mrg   \tolerance = 9500
   5500  1.1  mrg   \plainfrenchspacing
   5501  1.1  mrg   \everypar = {}% don't want the \kern\-parindent from indentation suppression.
   5502  1.1  mrg   %
   5503  1.1  mrg   % See comment in \requireopenindexfile.
   5504  1.1  mrg   \def\indexname{#1}\ifx\indexname\indexisfl\def\indexname{f1}\fi
   5505  1.1  mrg   %
   5506  1.1  mrg   % See if the index file exists and is nonempty.
   5507  1.1  mrg   \openin 1 \jobname.\indexname s
   5508  1.1  mrg   \ifeof 1
   5509  1.1  mrg     % \enddoublecolumns gets confused if there is no text in the index,
   5510  1.1  mrg     % and it loses the chapter title and the aux file entries for the
   5511  1.1  mrg     % index.  The easiest way to prevent this problem is to make sure
   5512  1.1  mrg     % there is some text.
   5513  1.1  mrg     \putwordIndexNonexistent
   5514  1.1  mrg     \typeout{No file \jobname.\indexname s.}%
   5515  1.1  mrg   \else
   5516  1.1  mrg     % If the index file exists but is empty, then \openin leaves \ifeof
   5517  1.1  mrg     % false.  We have to make TeX try to read something from the file, so
   5518  1.1  mrg     % it can discover if there is anything in it.
   5519  1.1  mrg     \read 1 to \thisline
   5520  1.1  mrg     \ifeof 1
   5521  1.1  mrg       \putwordIndexIsEmpty
   5522  1.1  mrg     \else
   5523  1.1  mrg       \expandafter\printindexzz\thisline\relax\relax\finish%
   5524  1.1  mrg     \fi
   5525  1.1  mrg   \fi
   5526  1.1  mrg   \closein 1
   5527  1.1  mrg \endgroup}
   5528  1.1  mrg 
   5529  1.1  mrg % If the index file starts with a backslash, forgo reading the index
   5530  1.1  mrg % file altogether.  If somebody upgrades texinfo.tex they may still have
   5531  1.1  mrg % old index files using \ as the escape character.  Reading this would
   5532  1.1  mrg % at best lead to typesetting garbage, at worst a TeX syntax error.
   5533  1.1  mrg \def\printindexzz#1#2\finish{%
   5534  1.1  mrg   \expandafter\ifx\csname SETtxiindexescapeisbackslash\endcsname\relax
   5535  1.1  mrg     \uccode`\~=`\\ \uppercase{\if\noexpand~}\noexpand#1
   5536  1.1  mrg       \expandafter\ifx\csname SETtxiskipindexfileswithbackslash\endcsname\relax
   5537  1.1  mrg \errmessage{%
   5538  1.1  mrg ERROR: A sorted index file in an obsolete format was skipped.
   5539  1.1  mrg To fix this problem, please upgrade your version of 'texi2dvi'
   5540  1.1  mrg or 'texi2pdf' to that at <https://ftp.gnu.org/gnu/texinfo>.
   5541  1.1  mrg If you are using an old version of 'texindex' (part of the Texinfo
   5542  1.1  mrg distribution), you may also need to upgrade to a newer version (at least 6.0).
   5543  1.1  mrg You may be able to typeset the index if you run
   5544  1.1  mrg 'texindex \jobname.\indexname' yourself.
   5545  1.1  mrg You could also try setting the 'txiindexescapeisbackslash' flag by
   5546  1.1  mrg running a command like
   5547  1.1  mrg 'texi2dvi -t "@set txiindexescapeisbackslash" \jobname.texi'.  If you do
   5548  1.1  mrg this, Texinfo will try to use index files in the old format.
   5549  1.1  mrg If you continue to have problems, deleting the index files and starting again
   5550  1.1  mrg might help (with 'rm \jobname.?? \jobname.??s')%
   5551  1.1  mrg }%
   5552  1.1  mrg       \else
   5553  1.1  mrg         (Skipped sorted index file in obsolete format)
   5554  1.1  mrg       \fi
   5555  1.1  mrg     \else
   5556  1.1  mrg       \begindoublecolumns
   5557  1.1  mrg       \input \jobname.\indexname s
   5558  1.1  mrg       \enddoublecolumns
   5559  1.1  mrg     \fi
   5560  1.1  mrg   \else
   5561  1.1  mrg     \begindoublecolumns
   5562  1.1  mrg     \catcode`\\=0\relax
   5563  1.1  mrg     \catcode`\@=12\relax
   5564  1.1  mrg     \input \jobname.\indexname s
   5565  1.1  mrg     \enddoublecolumns
   5566  1.1  mrg   \fi
   5567  1.1  mrg }
   5568  1.1  mrg 
   5569  1.1  mrg % These macros are used by the sorted index file itself.
   5570  1.1  mrg % Change them to control the appearance of the index.
   5571  1.1  mrg 
   5572  1.1  mrg {\catcode`\/=13 \catcode`\-=13 \catcode`\^=13 \catcode`\~=13 \catcode`\_=13
   5573  1.1  mrg \catcode`\|=13 \catcode`\<=13 \catcode`\>=13 \catcode`\+=13 \catcode`\"=13
   5574  1.1  mrg \catcode`\$=3
   5575  1.1  mrg \gdef\initialglyphs{%
   5576  1.1  mrg   % special control sequences used in the index sort key
   5577  1.1  mrg   \let\indexlbrace\{%
   5578  1.1  mrg   \let\indexrbrace\}%
   5579  1.1  mrg   \let\indexatchar\@%
   5580  1.1  mrg   \def\indexbackslash{\math{\backslash}}%
   5581  1.1  mrg   %
   5582  1.1  mrg   % Some changes for non-alphabetic characters.  Using the glyphs from the
   5583  1.1  mrg   % math fonts looks more consistent than the typewriter font used elsewhere
   5584  1.1  mrg   % for these characters.
   5585  1.1  mrg   \uccode`\~=`\\ \uppercase{\def~{\math{\backslash}}}
   5586  1.1  mrg   %
   5587  1.1  mrg   % In case @\ is used for backslash
   5588  1.1  mrg   \uppercase{\let\\=~}
   5589  1.1  mrg   % Can't get bold backslash so don't use bold forward slash
   5590  1.1  mrg   \catcode`\/=13
   5591  1.1  mrg   \def/{{\secrmnotbold \normalslash}}%
   5592  1.1  mrg   \def-{{\normaldash\normaldash}}% en dash `--'
   5593  1.1  mrg   \def^{{\chapbf \normalcaret}}%
   5594  1.1  mrg   \def~{{\chapbf \normaltilde}}%
   5595  1.1  mrg   \def\_{%
   5596  1.1  mrg      \leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }%
   5597  1.1  mrg   \def|{$\vert$}%
   5598  1.1  mrg   \def<{$\less$}%
   5599  1.1  mrg   \def>{$\gtr$}%
   5600  1.1  mrg   \def+{$\normalplus$}%
   5601  1.1  mrg }}
   5602  1.1  mrg 
   5603  1.1  mrg \def\initial{%
   5604  1.1  mrg   \bgroup
   5605  1.1  mrg   \initialglyphs
   5606  1.1  mrg   \initialx
   5607  1.1  mrg }
   5608  1.1  mrg 
   5609  1.1  mrg \def\initialx#1{%
   5610  1.1  mrg   % Remove any glue we may have, we'll be inserting our own.
   5611  1.1  mrg   \removelastskip
   5612  1.1  mrg   %
   5613  1.1  mrg   % We like breaks before the index initials, so insert a bonus.
   5614  1.1  mrg   % The glue before the bonus allows a little bit of space at the
   5615  1.1  mrg   % bottom of a column to reduce an increase in inter-line spacing.
   5616  1.1  mrg   \nobreak
   5617  1.1  mrg   \vskip 0pt plus 5\baselineskip
   5618  1.1  mrg   \penalty -300
   5619  1.1  mrg   \vskip 0pt plus -5\baselineskip
   5620  1.1  mrg   %
   5621  1.1  mrg   % Typeset the initial.  Making this add up to a whole number of
   5622  1.1  mrg   % baselineskips increases the chance of the dots lining up from column
   5623  1.1  mrg   % to column.  It still won't often be perfect, because of the stretch
   5624  1.1  mrg   % we need before each entry, but it's better.
   5625  1.1  mrg   %
   5626  1.1  mrg   % No shrink because it confuses \balancecolumns.
   5627  1.1  mrg   \vskip 1.67\baselineskip plus 1\baselineskip
   5628  1.1  mrg   \leftline{\secfonts \kern-0.05em \secbf #1}%
   5629  1.1  mrg   % \secfonts is inside the argument of \leftline so that the change of
   5630  1.1  mrg   % \baselineskip will not affect any glue inserted before the vbox that
   5631  1.1  mrg   % \leftline creates.
   5632  1.1  mrg   % Do our best not to break after the initial.
   5633  1.1  mrg   \nobreak
   5634  1.1  mrg   \vskip .33\baselineskip plus .1\baselineskip
   5635  1.1  mrg   \egroup % \initialglyphs
   5636  1.1  mrg }
   5637  1.1  mrg 
   5638  1.1  mrg \newdimen\entryrightmargin
   5639  1.1  mrg \entryrightmargin=0pt
   5640  1.1  mrg 
   5641  1.1  mrg % \entry typesets a paragraph consisting of the text (#1), dot leaders, and
   5642  1.1  mrg % then page number (#2) flushed to the right margin.  It is used for index
   5643  1.1  mrg % and table of contents entries.  The paragraph is indented by \leftskip.
   5644  1.1  mrg %
   5645  1.1  mrg \def\entry{%
   5646  1.1  mrg   \begingroup
   5647  1.1  mrg     %
   5648  1.1  mrg     % Start a new paragraph if necessary, so our assignments below can't
   5649  1.1  mrg     % affect previous text.
   5650  1.1  mrg     \par
   5651  1.1  mrg     %
   5652  1.1  mrg     % No extra space above this paragraph.
   5653  1.1  mrg     \parskip = 0in
   5654  1.1  mrg     %
   5655  1.1  mrg     % When reading the text of entry, convert explicit line breaks
   5656  1.1  mrg     % from @* into spaces.  The user might give these in long section
   5657  1.1  mrg     % titles, for instance.
   5658  1.1  mrg     \def\*{\unskip\space\ignorespaces}%
   5659  1.1  mrg     \def\entrybreak{\hfil\break}% An undocumented command
   5660  1.1  mrg     %
   5661  1.1  mrg     % Swallow the left brace of the text (first parameter):
   5662  1.1  mrg     \afterassignment\doentry
   5663  1.1  mrg     \let\temp =
   5664  1.1  mrg }
   5665  1.1  mrg \def\entrybreak{\unskip\space\ignorespaces}%
   5666  1.1  mrg \def\doentry{%
   5667  1.1  mrg     % Save the text of the entry
   5668  1.1  mrg     \global\setbox\boxA=\hbox\bgroup
   5669  1.1  mrg     \bgroup % Instead of the swallowed brace.
   5670  1.1  mrg       \noindent
   5671  1.1  mrg       \aftergroup\finishentry
   5672  1.1  mrg       % And now comes the text of the entry.
   5673  1.1  mrg       % Not absorbing as a macro argument reduces the chance of problems
   5674  1.1  mrg       % with catcodes occurring.
   5675  1.1  mrg }
   5676  1.1  mrg {\catcode`\@=11
   5677  1.1  mrg \gdef\finishentry#1{%
   5678  1.1  mrg     \egroup % end box A
   5679  1.1  mrg     \dimen@ = \wd\boxA % Length of text of entry
   5680  1.1  mrg     \global\setbox\boxA=\hbox\bgroup
   5681  1.1  mrg       \unhbox\boxA
   5682  1.1  mrg       % #1 is the page number.
   5683  1.1  mrg       %
   5684  1.1  mrg       % Get the width of the page numbers, and only use
   5685  1.1  mrg       % leaders if they are present.
   5686  1.1  mrg       \global\setbox\boxB = \hbox{#1}%
   5687  1.1  mrg       \ifdim\wd\boxB = 0pt
   5688  1.1  mrg         \null\nobreak\hfill\ %
   5689  1.1  mrg       \else
   5690  1.1  mrg         %
   5691  1.1  mrg         \null\nobreak\indexdotfill % Have leaders before the page number.
   5692  1.1  mrg         %
   5693  1.1  mrg         \ifpdforxetex
   5694  1.1  mrg           \pdfgettoks#1.%
   5695  1.1  mrg           \hskip\skip\thinshrinkable\the\toksA
   5696  1.1  mrg         \else
   5697  1.1  mrg           \hskip\skip\thinshrinkable #1%
   5698  1.1  mrg         \fi
   5699  1.1  mrg       \fi
   5700  1.1  mrg     \egroup % end \boxA
   5701  1.1  mrg     \ifdim\wd\boxB = 0pt
   5702  1.1  mrg       \noindent\unhbox\boxA\par
   5703  1.1  mrg       \nobreak
   5704  1.1  mrg     \else\bgroup
   5705  1.1  mrg       % We want the text of the entries to be aligned to the left, and the
   5706  1.1  mrg       % page numbers to be aligned to the right.
   5707  1.1  mrg       %
   5708  1.1  mrg       \parindent = 0pt
   5709  1.1  mrg       \advance\leftskip by 0pt plus 1fil
   5710  1.1  mrg       \advance\leftskip by 0pt plus -1fill
   5711  1.1  mrg       \rightskip = 0pt plus -1fil
   5712  1.1  mrg       \advance\rightskip by 0pt plus 1fill
   5713  1.1  mrg       % Cause last line, which could consist of page numbers on their own
   5714  1.1  mrg       % if the list of page numbers is long, to be aligned to the right.
   5715  1.1  mrg       \parfillskip=0pt plus -1fill
   5716  1.1  mrg       %
   5717  1.1  mrg       \advance\rightskip by \entryrightmargin
   5718  1.1  mrg       % Determine how far we can stretch into the margin.
   5719  1.1  mrg       % This allows, e.g., "Appendix H  GNU Free Documentation License" to
   5720  1.1  mrg       % fit on one line in @letterpaper format.
   5721  1.1  mrg       \ifdim\entryrightmargin>2.1em
   5722  1.1  mrg         \dimen@i=2.1em
   5723  1.1  mrg       \else
   5724  1.1  mrg         \dimen@i=0em
   5725  1.1  mrg       \fi
   5726  1.1  mrg       \advance \parfillskip by 0pt minus 1\dimen@i
   5727  1.1  mrg       %
   5728  1.1  mrg       \dimen@ii = \hsize
   5729  1.1  mrg       \advance\dimen@ii by -1\leftskip
   5730  1.1  mrg       \advance\dimen@ii by -1\entryrightmargin
   5731  1.1  mrg       \advance\dimen@ii by 1\dimen@i
   5732  1.1  mrg       \ifdim\wd\boxA > \dimen@ii % If the entry doesn't fit in one line
   5733  1.1  mrg       \ifdim\dimen@ > 0.8\dimen@ii   % due to long index text
   5734  1.1  mrg         % Try to split the text roughly evenly.  \dimen@ will be the length of
   5735  1.1  mrg         % the first line.
   5736  1.1  mrg         \dimen@ = 0.7\dimen@
   5737  1.1  mrg         \dimen@ii = \hsize
   5738  1.1  mrg         \ifnum\dimen@>\dimen@ii
   5739  1.1  mrg           % If the entry is too long (for example, if it needs more than
   5740  1.1  mrg           % two lines), use all the space in the first line.
   5741  1.1  mrg           \dimen@ = \dimen@ii
   5742  1.1  mrg         \fi
   5743  1.1  mrg         \advance\leftskip by 0pt plus 1fill % ragged right
   5744  1.1  mrg         \advance \dimen@ by 1\rightskip
   5745  1.1  mrg         \parshape = 2 0pt \dimen@ 0em \dimen@ii
   5746  1.1  mrg         % Ideally we'd add a finite glue at the end of the first line only,
   5747  1.1  mrg         % instead of using \parshape with explicit line lengths, but TeX
   5748  1.1  mrg         % doesn't seem to provide a way to do such a thing.
   5749  1.1  mrg         %
   5750  1.1  mrg         % Indent all lines but the first one.
   5751  1.1  mrg         \advance\leftskip by 1em
   5752  1.1  mrg         \advance\parindent by -1em
   5753  1.1  mrg       \fi\fi
   5754  1.1  mrg       \indent % start paragraph
   5755  1.1  mrg       \unhbox\boxA
   5756  1.1  mrg       %
   5757  1.1  mrg       % Do not prefer a separate line ending with a hyphen to fewer lines.
   5758  1.1  mrg       \finalhyphendemerits = 0
   5759  1.1  mrg       %
   5760  1.1  mrg       % Word spacing - no stretch
   5761  1.1  mrg       \spaceskip=\fontdimen2\font minus \fontdimen4\font
   5762  1.1  mrg       %
   5763  1.1  mrg       \linepenalty=1000  % Discourage line breaks.
   5764  1.1  mrg       \hyphenpenalty=5000  % Discourage hyphenation.
   5765  1.1  mrg       %
   5766  1.1  mrg       \par % format the paragraph
   5767  1.1  mrg     \egroup % The \vbox
   5768  1.1  mrg     \fi
   5769  1.1  mrg   \endgroup
   5770  1.1  mrg }}
   5771  1.1  mrg 
   5772  1.1  mrg \newskip\thinshrinkable
   5773  1.1  mrg \skip\thinshrinkable=.15em minus .15em
   5774  1.1  mrg 
   5775  1.1  mrg % Like plain.tex's \dotfill, except uses up at least 1 em.
   5776  1.1  mrg % The filll stretch here overpowers both the fil and fill stretch to push
   5777  1.1  mrg % the page number to the right.
   5778  1.1  mrg \def\indexdotfill{\cleaders
   5779  1.1  mrg   \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1filll}
   5780  1.1  mrg 
   5781  1.1  mrg 
   5782  1.1  mrg \def\primary #1{\line{#1\hfil}}
   5783  1.1  mrg 
   5784  1.1  mrg \def\secondary{\indententry{0.5cm}}
   5785  1.1  mrg \def\tertiary{\indententry{1cm}}
   5786  1.1  mrg 
   5787  1.1  mrg \def\indententry#1#2#3{%
   5788  1.1  mrg   \bgroup
   5789  1.1  mrg   \leftskip=#1
   5790  1.1  mrg   \entry{#2}{#3}%
   5791  1.1  mrg   \egroup
   5792  1.1  mrg }
   5793  1.1  mrg 
   5794  1.1  mrg % Define two-column mode, which we use to typeset indexes.
   5795  1.1  mrg % Adapted from the TeXbook, page 416, which is to say,
   5796  1.1  mrg % the manmac.tex format used to print the TeXbook itself.
   5797  1.1  mrg \catcode`\@=11  % private names
   5798  1.1  mrg 
   5799  1.1  mrg \newbox\partialpage
   5800  1.1  mrg \newdimen\doublecolumnhsize
   5801  1.1  mrg 
   5802  1.1  mrg \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
   5803  1.1  mrg   % If not much space left on page, start a new page.
   5804  1.1  mrg   \ifdim\pagetotal>0.8\vsize\vfill\eject\fi
   5805  1.1  mrg   %
   5806  1.1  mrg   % Grab any single-column material above us.
   5807  1.1  mrg   \output = {%
   5808  1.1  mrg     \savetopmark
   5809  1.1  mrg     %
   5810  1.1  mrg     \global\setbox\partialpage = \vbox{%
   5811  1.1  mrg       % Unvbox the main output page.
   5812  1.1  mrg       \unvbox\PAGE
   5813  1.1  mrg       \kern-\topskip \kern\baselineskip
   5814  1.1  mrg     }%
   5815  1.1  mrg   }%
   5816  1.1  mrg   \eject % run that output routine to set \partialpage
   5817  1.1  mrg   %
   5818  1.1  mrg   % Use the double-column output routine for subsequent pages.
   5819  1.1  mrg   \output = {\doublecolumnout}%
   5820  1.1  mrg   %
   5821  1.1  mrg   % Change the page size parameters.  We could do this once outside this
   5822  1.1  mrg   % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
   5823  1.1  mrg   % format, but then we repeat the same computation.  Repeating a couple
   5824  1.1  mrg   % of assignments once per index is clearly meaningless for the
   5825  1.1  mrg   % execution time, so we may as well do it in one place.
   5826  1.1  mrg   %
   5827  1.1  mrg   % First we halve the line length, less a little for the gutter between
   5828  1.1  mrg   % the columns.  We compute the gutter based on the line length, so it
   5829  1.1  mrg   % changes automatically with the paper format.  The magic constant
   5830  1.1  mrg   % below is chosen so that the gutter has the same value (well, +-<1pt)
   5831  1.1  mrg   % as it did when we hard-coded it.
   5832  1.1  mrg   %
   5833  1.1  mrg   % We put the result in a separate register, \doublecolumhsize, so we
   5834  1.1  mrg   % can restore it in \pagesofar, after \hsize itself has (potentially)
   5835  1.1  mrg   % been clobbered.
   5836  1.1  mrg   %
   5837  1.1  mrg   \doublecolumnhsize = \hsize
   5838  1.1  mrg     \advance\doublecolumnhsize by -.04154\hsize
   5839  1.1  mrg     \divide\doublecolumnhsize by 2
   5840  1.1  mrg   \hsize = \doublecolumnhsize
   5841  1.1  mrg   %
   5842  1.1  mrg   % Get the available space for the double columns -- the normal
   5843  1.1  mrg   % (undoubled) page height minus any material left over from the
   5844  1.1  mrg   % previous page.
   5845  1.1  mrg   \advance\vsize by -\ht\partialpage
   5846  1.1  mrg   \vsize = 2\vsize
   5847  1.1  mrg   %
   5848  1.1  mrg   % For the benefit of balancing columns
   5849  1.1  mrg   \advance\baselineskip by 0pt plus 0.5pt
   5850  1.1  mrg }
   5851  1.1  mrg 
   5852  1.1  mrg % The double-column output routine for all double-column pages except
   5853  1.1  mrg % the last, which is done by \balancecolumns.
   5854  1.1  mrg %
   5855  1.1  mrg \def\doublecolumnout{%
   5856  1.1  mrg   %
   5857  1.1  mrg   \savetopmark
   5858  1.1  mrg   \splittopskip=\topskip \splitmaxdepth=\maxdepth
   5859  1.1  mrg   \dimen@ = \vsize
   5860  1.1  mrg   \divide\dimen@ by 2
   5861  1.1  mrg   %
   5862  1.1  mrg   % box0 will be the left-hand column, box2 the right.
   5863  1.1  mrg   \setbox0=\vsplit\PAGE to\dimen@ \setbox2=\vsplit\PAGE to\dimen@
   5864  1.1  mrg   \global\advance\vsize by 2\ht\partialpage
   5865  1.1  mrg   \onepageout\pagesofar % empty except for the first time we are called
   5866  1.1  mrg   \unvbox\PAGE
   5867  1.1  mrg   \penalty\outputpenalty
   5868  1.1  mrg }
   5869  1.1  mrg %
   5870  1.1  mrg % Re-output the contents of the output page -- any previous material,
   5871  1.1  mrg % followed by the two boxes we just split, in box0 and box2.
   5872  1.1  mrg \def\pagesofar{%
   5873  1.1  mrg   \unvbox\partialpage
   5874  1.1  mrg   %
   5875  1.1  mrg   \hsize = \doublecolumnhsize
   5876  1.1  mrg   \wd0=\hsize \wd2=\hsize
   5877  1.1  mrg   \hbox to\txipagewidth{\box0\hfil\box2}%
   5878  1.1  mrg }
   5879  1.1  mrg 
   5880  1.1  mrg 
   5881  1.1  mrg % Finished with double columns.
   5882  1.1  mrg \def\enddoublecolumns{%
   5883  1.1  mrg   % The following penalty ensures that the page builder is exercised
   5884  1.1  mrg   % _before_ we change the output routine.  This is necessary in the
   5885  1.1  mrg   % following situation:
   5886  1.1  mrg   %
   5887  1.1  mrg   % The last section of the index consists only of a single entry.
   5888  1.1  mrg   % Before this section, \pagetotal is less than \pagegoal, so no
   5889  1.1  mrg   % break occurs before the last section starts.  However, the last
   5890  1.1  mrg   % section, consisting of \initial and the single \entry, does not
   5891  1.1  mrg   % fit on the page and has to be broken off.  Without the following
   5892  1.1  mrg   % penalty the page builder will not be exercised until \eject
   5893  1.1  mrg   % below, and by that time we'll already have changed the output
   5894  1.1  mrg   % routine to the \balancecolumns version, so the next-to-last
   5895  1.1  mrg   % double-column page will be processed with \balancecolumns, which
   5896  1.1  mrg   % is wrong:  The two columns will go to the main vertical list, with
   5897  1.1  mrg   % the broken-off section in the recent contributions.  As soon as
   5898  1.1  mrg   % the output routine finishes, TeX starts reconsidering the page
   5899  1.1  mrg   % break.  The two columns and the broken-off section both fit on the
   5900  1.1  mrg   % page, because the two columns now take up only half of the page
   5901  1.1  mrg   % goal.  When TeX sees \eject from below which follows the final
   5902  1.1  mrg   % section, it invokes the new output routine that we've set after
   5903  1.1  mrg   % \balancecolumns below; \onepageout will try to fit the two columns
   5904  1.1  mrg   % and the final section into the vbox of \txipageheight (see
   5905  1.1  mrg   % \pagebody), causing an overfull box.
   5906  1.1  mrg   %
   5907  1.1  mrg   % Note that glue won't work here, because glue does not exercise the
   5908  1.1  mrg   % page builder, unlike penalties (see The TeXbook, pp. 280-281).
   5909  1.1  mrg   \penalty0
   5910  1.1  mrg   %
   5911  1.1  mrg   \output = {%
   5912  1.1  mrg     % Split the last of the double-column material.
   5913  1.1  mrg     \savetopmark
   5914  1.1  mrg     \balancecolumns
   5915  1.1  mrg   }%
   5916  1.1  mrg   \eject % call the \output just set
   5917  1.1  mrg   \ifdim\pagetotal=0pt
   5918  1.1  mrg     % Having called \balancecolumns once, we do not
   5919  1.1  mrg     % want to call it again.  Therefore, reset \output to its normal
   5920  1.1  mrg     % definition right away.
   5921  1.1  mrg     \global\output=\expandafter{\the\defaultoutput}
   5922  1.1  mrg     %
   5923  1.1  mrg     \endgroup % started in \begindoublecolumns
   5924  1.1  mrg     % Leave the double-column material on the current page, no automatic
   5925  1.1  mrg     % page break.
   5926  1.1  mrg     \box\balancedcolumns
   5927  1.1  mrg     %
   5928  1.1  mrg     % \pagegoal was set to the doubled \vsize above, since we restarted
   5929  1.1  mrg     % the current page.  We're now back to normal single-column
   5930  1.1  mrg     % typesetting, so reset \pagegoal to the normal \vsize.
   5931  1.1  mrg     \global\vsize = \txipageheight %
   5932  1.1  mrg     \pagegoal = \txipageheight %
   5933  1.1  mrg   \else
   5934  1.1  mrg     % We had some left-over material.  This might happen when \doublecolumnout
   5935  1.1  mrg     % is called in \balancecolumns.  Try again.
   5936  1.1  mrg     \expandafter\enddoublecolumns
   5937  1.1  mrg   \fi
   5938  1.1  mrg }
   5939  1.1  mrg \newbox\balancedcolumns
   5940  1.1  mrg \setbox\balancedcolumns=\vbox{shouldnt see this}%
   5941  1.1  mrg %
   5942  1.1  mrg % Only called for the last of the double column material.  \doublecolumnout
   5943  1.1  mrg % does the others.
   5944  1.1  mrg \def\balancecolumns{%
   5945  1.1  mrg   \setbox0 = \vbox{\unvbox\PAGE}% like \box255 but more efficient, see p.120.
   5946  1.1  mrg   \dimen@ = \ht0
   5947  1.1  mrg   \ifdim\dimen@<7\baselineskip
   5948  1.1  mrg     % Don't split a short final column in two.
   5949  1.1  mrg     \setbox2=\vbox{}%
   5950  1.1  mrg     \global\setbox\balancedcolumns=\vbox{\pagesofar}%
   5951  1.1  mrg   \else
   5952  1.1  mrg     % double the leading vertical space
   5953  1.1  mrg     \advance\dimen@ by \topskip
   5954  1.1  mrg     \advance\dimen@ by-\baselineskip
   5955  1.1  mrg     \divide\dimen@ by 2 % target to split to
   5956  1.1  mrg     \dimen@ii = \dimen@
   5957  1.1  mrg     \splittopskip = \topskip
   5958  1.1  mrg     % Loop until left column is at least as high as the right column.
   5959  1.1  mrg     {%
   5960  1.1  mrg       \vbadness = 10000
   5961  1.1  mrg       \loop
   5962  1.1  mrg         \global\setbox3 = \copy0
   5963  1.1  mrg         \global\setbox1 = \vsplit3 to \dimen@
   5964  1.1  mrg       \ifdim\ht1<\ht3
   5965  1.1  mrg         \global\advance\dimen@ by 1pt
   5966  1.1  mrg       \repeat
   5967  1.1  mrg     }%
   5968  1.1  mrg     % Now the left column is in box 1, and the right column in box 3.
   5969  1.1  mrg     %
   5970  1.1  mrg     % Check whether the left column has come out higher than the page itself.
   5971  1.1  mrg     % (Note that we have doubled \vsize for the double columns, so
   5972  1.1  mrg     % the actual height of the page is 0.5\vsize).
   5973  1.1  mrg     \ifdim2\ht1>\vsize
   5974  1.1  mrg       % It appears that we have been called upon to balance too much material.
   5975  1.1  mrg       % Output some of it with \doublecolumnout, leaving the rest on the page.
   5976  1.1  mrg       \setbox\PAGE=\box0
   5977  1.1  mrg       \doublecolumnout
   5978  1.1  mrg     \else
   5979  1.1  mrg       % Compare the heights of the two columns.
   5980  1.1  mrg       \ifdim4\ht1>5\ht3
   5981  1.1  mrg         % Column heights are too different, so don't make their bottoms
   5982  1.1  mrg         % flush with each other.
   5983  1.1  mrg         \setbox2=\vbox to \ht1 {\unvbox3\vfill}%
   5984  1.1  mrg         \setbox0=\vbox to \ht1 {\unvbox1\vfill}%
   5985  1.1  mrg       \else
   5986  1.1  mrg         % Make column bottoms flush with each other.
   5987  1.1  mrg         \setbox2=\vbox to\ht1{\unvbox3\unskip}%
   5988  1.1  mrg         \setbox0=\vbox to\ht1{\unvbox1\unskip}%
   5989  1.1  mrg       \fi
   5990  1.1  mrg       \global\setbox\balancedcolumns=\vbox{\pagesofar}%
   5991  1.1  mrg     \fi
   5992  1.1  mrg   \fi
   5993  1.1  mrg   %
   5994  1.1  mrg }
   5995  1.1  mrg \catcode`\@ = \other
   5996  1.1  mrg 
   5997  1.1  mrg 
   5998  1.1  mrg \message{sectioning,}
   5999  1.1  mrg % Chapters, sections, etc.
   6000  1.1  mrg 
   6001  1.1  mrg % Let's start with @part.
   6002  1.1  mrg \outer\parseargdef\part{\partzzz{#1}}
   6003  1.1  mrg \def\partzzz#1{%
   6004  1.1  mrg   \chapoddpage
   6005  1.1  mrg   \null
   6006  1.1  mrg   \vskip.3\vsize  % move it down on the page a bit
   6007  1.1  mrg   \begingroup
   6008  1.1  mrg     \noindent \titlefonts\rm #1\par % the text
   6009  1.1  mrg     \let\lastnode=\empty      % no node to associate with
   6010  1.1  mrg     \writetocentry{part}{#1}{}% but put it in the toc
   6011  1.1  mrg     \headingsoff              % no headline or footline on the part page
   6012  1.1  mrg     % This outputs a mark at the end of the page that clears \thischapter
   6013  1.1  mrg     % and \thissection, as is done in \startcontents.
   6014  1.1  mrg     \let\pchapsepmacro\relax
   6015  1.1  mrg     \chapmacro{}{Yomitfromtoc}{}%
   6016  1.1  mrg     \chapoddpage
   6017  1.1  mrg   \endgroup
   6018  1.1  mrg }
   6019  1.1  mrg 
   6020  1.1  mrg % \unnumberedno is an oxymoron.  But we count the unnumbered
   6021  1.1  mrg % sections so that we can refer to them unambiguously in the pdf
   6022  1.1  mrg % outlines by their "section number".  We avoid collisions with chapter
   6023  1.1  mrg % numbers by starting them at 10000.  (If a document ever has 10000
   6024  1.1  mrg % chapters, we're in trouble anyway, I'm sure.)
   6025  1.1  mrg \newcount\unnumberedno \unnumberedno = 10000
   6026  1.1  mrg \newcount\chapno
   6027  1.1  mrg \newcount\secno        \secno=0
   6028  1.1  mrg \newcount\subsecno     \subsecno=0
   6029  1.1  mrg \newcount\subsubsecno  \subsubsecno=0
   6030  1.1  mrg 
   6031  1.1  mrg % This counter is funny since it counts through charcodes of letters A, B, ...
   6032  1.1  mrg \newcount\appendixno  \appendixno = `\@
   6033  1.1  mrg %
   6034  1.1  mrg % \def\appendixletter{\char\the\appendixno}
   6035  1.1  mrg % We do the following ugly conditional instead of the above simple
   6036  1.1  mrg % construct for the sake of pdftex, which needs the actual
   6037  1.1  mrg % letter in the expansion, not just typeset.
   6038  1.1  mrg %
   6039  1.1  mrg \def\appendixletter{%
   6040  1.1  mrg   \ifnum\appendixno=`A A%
   6041  1.1  mrg   \else\ifnum\appendixno=`B B%
   6042  1.1  mrg   \else\ifnum\appendixno=`C C%
   6043  1.1  mrg   \else\ifnum\appendixno=`D D%
   6044  1.1  mrg   \else\ifnum\appendixno=`E E%
   6045  1.1  mrg   \else\ifnum\appendixno=`F F%
   6046  1.1  mrg   \else\ifnum\appendixno=`G G%
   6047  1.1  mrg   \else\ifnum\appendixno=`H H%
   6048  1.1  mrg   \else\ifnum\appendixno=`I I%
   6049  1.1  mrg   \else\ifnum\appendixno=`J J%
   6050  1.1  mrg   \else\ifnum\appendixno=`K K%
   6051  1.1  mrg   \else\ifnum\appendixno=`L L%
   6052  1.1  mrg   \else\ifnum\appendixno=`M M%
   6053  1.1  mrg   \else\ifnum\appendixno=`N N%
   6054  1.1  mrg   \else\ifnum\appendixno=`O O%
   6055  1.1  mrg   \else\ifnum\appendixno=`P P%
   6056  1.1  mrg   \else\ifnum\appendixno=`Q Q%
   6057  1.1  mrg   \else\ifnum\appendixno=`R R%
   6058  1.1  mrg   \else\ifnum\appendixno=`S S%
   6059  1.1  mrg   \else\ifnum\appendixno=`T T%
   6060  1.1  mrg   \else\ifnum\appendixno=`U U%
   6061  1.1  mrg   \else\ifnum\appendixno=`V V%
   6062  1.1  mrg   \else\ifnum\appendixno=`W W%
   6063  1.1  mrg   \else\ifnum\appendixno=`X X%
   6064  1.1  mrg   \else\ifnum\appendixno=`Y Y%
   6065  1.1  mrg   \else\ifnum\appendixno=`Z Z%
   6066  1.1  mrg   % The \the is necessary, despite appearances, because \appendixletter is
   6067  1.1  mrg   % expanded while writing the .toc file.  \char\appendixno is not
   6068  1.1  mrg   % expandable, thus it is written literally, thus all appendixes come out
   6069  1.1  mrg   % with the same letter (or @) in the toc without it.
   6070  1.1  mrg   \else\char\the\appendixno
   6071  1.1  mrg   \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
   6072  1.1  mrg   \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
   6073  1.1  mrg 
   6074  1.1  mrg % Each @chapter defines these (using marks) as the number+name, number
   6075  1.1  mrg % and name of the chapter.  Page headings and footings can use
   6076  1.1  mrg % these.  @section does likewise.
   6077  1.1  mrg \def\thischapter{}
   6078  1.1  mrg \def\thischapternum{}
   6079  1.1  mrg \def\thischaptername{}
   6080  1.1  mrg \def\thissection{}
   6081  1.1  mrg \def\thissectionnum{}
   6082  1.1  mrg \def\thissectionname{}
   6083  1.1  mrg 
   6084  1.1  mrg \newcount\absseclevel % used to calculate proper heading level
   6085  1.1  mrg \newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count
   6086  1.1  mrg 
   6087  1.1  mrg % @raisesections: treat @section as chapter, @subsection as section, etc.
   6088  1.1  mrg \def\raisesections{\global\advance\secbase by -1}
   6089  1.1  mrg 
   6090  1.1  mrg % @lowersections: treat @chapter as section, @section as subsection, etc.
   6091  1.1  mrg \def\lowersections{\global\advance\secbase by 1}
   6092  1.1  mrg 
   6093  1.1  mrg % we only have subsub.
   6094  1.1  mrg \chardef\maxseclevel = 3
   6095  1.1  mrg %
   6096  1.1  mrg % A numbered section within an unnumbered changes to unnumbered too.
   6097  1.1  mrg % To achieve this, remember the "biggest" unnum. sec. we are currently in:
   6098  1.1  mrg \chardef\unnlevel = \maxseclevel
   6099  1.1  mrg %
   6100  1.1  mrg % Trace whether the current chapter is an appendix or not:
   6101  1.1  mrg % \chapheadtype is "N" or "A", unnumbered chapters are ignored.
   6102  1.1  mrg \def\chapheadtype{N}
   6103  1.1  mrg 
   6104  1.1  mrg % Choose a heading macro
   6105  1.1  mrg % #1 is heading type
   6106  1.1  mrg % #2 is heading level
   6107  1.1  mrg % #3 is text for heading
   6108  1.1  mrg \def\genhead#1#2#3{%
   6109  1.1  mrg   % Compute the abs. sec. level:
   6110  1.1  mrg   \absseclevel=#2
   6111  1.1  mrg   \advance\absseclevel by \secbase
   6112  1.1  mrg   % Make sure \absseclevel doesn't fall outside the range:
   6113  1.1  mrg   \ifnum \absseclevel < 0
   6114  1.1  mrg     \absseclevel = 0
   6115  1.1  mrg   \else
   6116  1.1  mrg     \ifnum \absseclevel > 3
   6117  1.1  mrg       \absseclevel = 3
   6118  1.1  mrg     \fi
   6119  1.1  mrg   \fi
   6120  1.1  mrg   % The heading type:
   6121  1.1  mrg   \def\headtype{#1}%
   6122  1.1  mrg   \if \headtype U%
   6123  1.1  mrg     \ifnum \absseclevel < \unnlevel
   6124  1.1  mrg       \chardef\unnlevel = \absseclevel
   6125  1.1  mrg     \fi
   6126  1.1  mrg   \else
   6127  1.1  mrg     % Check for appendix sections:
   6128  1.1  mrg     \ifnum \absseclevel = 0
   6129  1.1  mrg       \edef\chapheadtype{\headtype}%
   6130  1.1  mrg     \else
   6131  1.1  mrg       \if \headtype A\if \chapheadtype N%
   6132  1.1  mrg 	\errmessage{@appendix... within a non-appendix chapter}%
   6133  1.1  mrg       \fi\fi
   6134  1.1  mrg     \fi
   6135  1.1  mrg     % Check for numbered within unnumbered:
   6136  1.1  mrg     \ifnum \absseclevel > \unnlevel
   6137  1.1  mrg       \def\headtype{U}%
   6138  1.1  mrg     \else
   6139  1.1  mrg       \chardef\unnlevel = 3
   6140  1.1  mrg     \fi
   6141  1.1  mrg   \fi
   6142  1.1  mrg   % Now print the heading:
   6143  1.1  mrg   \if \headtype U%
   6144  1.1  mrg     \ifcase\absseclevel
   6145  1.1  mrg 	\unnumberedzzz{#3}%
   6146  1.1  mrg     \or \unnumberedseczzz{#3}%
   6147  1.1  mrg     \or \unnumberedsubseczzz{#3}%
   6148  1.1  mrg     \or \unnumberedsubsubseczzz{#3}%
   6149  1.1  mrg     \fi
   6150  1.1  mrg   \else
   6151  1.1  mrg     \if \headtype A%
   6152  1.1  mrg       \ifcase\absseclevel
   6153  1.1  mrg 	  \appendixzzz{#3}%
   6154  1.1  mrg       \or \appendixsectionzzz{#3}%
   6155  1.1  mrg       \or \appendixsubseczzz{#3}%
   6156  1.1  mrg       \or \appendixsubsubseczzz{#3}%
   6157  1.1  mrg       \fi
   6158  1.1  mrg     \else
   6159  1.1  mrg       \ifcase\absseclevel
   6160  1.1  mrg 	  \chapterzzz{#3}%
   6161  1.1  mrg       \or \seczzz{#3}%
   6162  1.1  mrg       \or \numberedsubseczzz{#3}%
   6163  1.1  mrg       \or \numberedsubsubseczzz{#3}%
   6164  1.1  mrg       \fi
   6165  1.1  mrg     \fi
   6166  1.1  mrg   \fi
   6167  1.1  mrg   \suppressfirstparagraphindent
   6168  1.1  mrg }
   6169  1.1  mrg 
   6170  1.1  mrg % an interface:
   6171  1.1  mrg \def\numhead{\genhead N}
   6172  1.1  mrg \def\apphead{\genhead A}
   6173  1.1  mrg \def\unnmhead{\genhead U}
   6174  1.1  mrg 
   6175  1.1  mrg % @chapter, @appendix, @unnumbered.  Increment top-level counter, reset
   6176  1.1  mrg % all lower-level sectioning counters to zero.
   6177  1.1  mrg %
   6178  1.1  mrg % Also set \chaplevelprefix, which we prepend to @float sequence numbers
   6179  1.1  mrg % (e.g., figures), q.v.  By default (before any chapter), that is empty.
   6180  1.1  mrg \let\chaplevelprefix = \empty
   6181  1.1  mrg %
   6182  1.1  mrg \outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz
   6183  1.1  mrg \def\chapterzzz#1{%
   6184  1.1  mrg   % section resetting is \global in case the chapter is in a group, such
   6185  1.1  mrg   % as an @include file.
   6186  1.1  mrg   \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
   6187  1.1  mrg     \global\advance\chapno by 1
   6188  1.1  mrg   %
   6189  1.1  mrg   % Used for \float.
   6190  1.1  mrg   \gdef\chaplevelprefix{\the\chapno.}%
   6191  1.1  mrg   \resetallfloatnos
   6192  1.1  mrg   %
   6193  1.1  mrg   % \putwordChapter can contain complex things in translations.
   6194  1.1  mrg   \toks0=\expandafter{\putwordChapter}%
   6195  1.1  mrg   \message{\the\toks0 \space \the\chapno}%
   6196  1.1  mrg   %
   6197  1.1  mrg   % Write the actual heading.
   6198  1.1  mrg   \chapmacro{#1}{Ynumbered}{\the\chapno}%
   6199  1.1  mrg   %
   6200  1.1  mrg   % So @section and the like are numbered underneath this chapter.
   6201  1.1  mrg   \global\let\section = \numberedsec
   6202  1.1  mrg   \global\let\subsection = \numberedsubsec
   6203  1.1  mrg   \global\let\subsubsection = \numberedsubsubsec
   6204  1.1  mrg }
   6205  1.1  mrg 
   6206  1.1  mrg \outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz
   6207  1.1  mrg %
   6208  1.1  mrg \def\appendixzzz#1{%
   6209  1.1  mrg   \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
   6210  1.1  mrg     \global\advance\appendixno by 1
   6211  1.1  mrg   \gdef\chaplevelprefix{\appendixletter.}%
   6212  1.1  mrg   \resetallfloatnos
   6213  1.1  mrg   %
   6214  1.1  mrg   % \putwordAppendix can contain complex things in translations.
   6215  1.1  mrg   \toks0=\expandafter{\putwordAppendix}%
   6216  1.1  mrg   \message{\the\toks0 \space \appendixletter}%
   6217  1.1  mrg   %
   6218  1.1  mrg   \chapmacro{#1}{Yappendix}{\appendixletter}%
   6219  1.1  mrg   %
   6220  1.1  mrg   \global\let\section = \appendixsec
   6221  1.1  mrg   \global\let\subsection = \appendixsubsec
   6222  1.1  mrg   \global\let\subsubsection = \appendixsubsubsec
   6223  1.1  mrg }
   6224  1.1  mrg 
   6225  1.1  mrg % normally unnmhead0 calls unnumberedzzz:
   6226  1.1  mrg \outer\parseargdef\unnumbered{\unnmhead0{#1}}
   6227  1.1  mrg \def\unnumberedzzz#1{%
   6228  1.1  mrg   \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
   6229  1.1  mrg     \global\advance\unnumberedno by 1
   6230  1.1  mrg   %
   6231  1.1  mrg   % Since an unnumbered has no number, no prefix for figures.
   6232  1.1  mrg   \global\let\chaplevelprefix = \empty
   6233  1.1  mrg   \resetallfloatnos
   6234  1.1  mrg   %
   6235  1.1  mrg   % This used to be simply \message{#1}, but TeX fully expands the
   6236  1.1  mrg   % argument to \message.  Therefore, if #1 contained @-commands, TeX
   6237  1.1  mrg   % expanded them.  For example, in `@unnumbered The @cite{Book}', TeX
   6238  1.1  mrg   % expanded @cite (which turns out to cause errors because \cite is meant
   6239  1.1  mrg   % to be executed, not expanded).
   6240  1.1  mrg   %
   6241  1.1  mrg   % Anyway, we don't want the fully-expanded definition of @cite to appear
   6242  1.1  mrg   % as a result of the \message, we just want `@cite' itself.  We use
   6243  1.1  mrg   % \the<toks register> to achieve this: TeX expands \the<toks> only once,
   6244  1.1  mrg   % simply yielding the contents of <toks register>.  (We also do this for
   6245  1.1  mrg   % the toc entries.)
   6246  1.1  mrg   \toks0 = {#1}%
   6247  1.1  mrg   \message{(\the\toks0)}%
   6248  1.1  mrg   %
   6249  1.1  mrg   \chapmacro{#1}{Ynothing}{\the\unnumberedno}%
   6250  1.1  mrg   %
   6251  1.1  mrg   \global\let\section = \unnumberedsec
   6252  1.1  mrg   \global\let\subsection = \unnumberedsubsec
   6253  1.1  mrg   \global\let\subsubsection = \unnumberedsubsubsec
   6254  1.1  mrg }
   6255  1.1  mrg 
   6256  1.1  mrg % @centerchap is like @unnumbered, but the heading is centered.
   6257  1.1  mrg \outer\parseargdef\centerchap{%
   6258  1.1  mrg   \let\centerparametersmaybe = \centerparameters
   6259  1.1  mrg   \unnmhead0{#1}%
   6260  1.1  mrg   \let\centerparametersmaybe = \relax
   6261  1.1  mrg }
   6262  1.1  mrg 
   6263  1.1  mrg % @top is like @unnumbered.
   6264  1.1  mrg \let\top\unnumbered
   6265  1.1  mrg 
   6266  1.1  mrg % Sections.
   6267  1.1  mrg %
   6268  1.1  mrg \outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz
   6269  1.1  mrg \def\seczzz#1{%
   6270  1.1  mrg   \global\subsecno=0 \global\subsubsecno=0  \global\advance\secno by 1
   6271  1.1  mrg   \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}%
   6272  1.1  mrg }
   6273  1.1  mrg 
   6274  1.1  mrg % normally calls appendixsectionzzz:
   6275  1.1  mrg \outer\parseargdef\appendixsection{\apphead1{#1}}
   6276  1.1  mrg \def\appendixsectionzzz#1{%
   6277  1.1  mrg   \global\subsecno=0 \global\subsubsecno=0  \global\advance\secno by 1
   6278  1.1  mrg   \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}%
   6279  1.1  mrg }
   6280  1.1  mrg \let\appendixsec\appendixsection
   6281  1.1  mrg 
   6282  1.1  mrg % normally calls unnumberedseczzz:
   6283  1.1  mrg \outer\parseargdef\unnumberedsec{\unnmhead1{#1}}
   6284  1.1  mrg \def\unnumberedseczzz#1{%
   6285  1.1  mrg   \global\subsecno=0 \global\subsubsecno=0  \global\advance\secno by 1
   6286  1.1  mrg   \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}%
   6287  1.1  mrg }
   6288  1.1  mrg 
   6289  1.1  mrg % Subsections.
   6290  1.1  mrg %
   6291  1.1  mrg % normally calls numberedsubseczzz:
   6292  1.1  mrg \outer\parseargdef\numberedsubsec{\numhead2{#1}}
   6293  1.1  mrg \def\numberedsubseczzz#1{%
   6294  1.1  mrg   \global\subsubsecno=0  \global\advance\subsecno by 1
   6295  1.1  mrg   \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}%
   6296  1.1  mrg }
   6297  1.1  mrg 
   6298  1.1  mrg % normally calls appendixsubseczzz:
   6299  1.1  mrg \outer\parseargdef\appendixsubsec{\apphead2{#1}}
   6300  1.1  mrg \def\appendixsubseczzz#1{%
   6301  1.1  mrg   \global\subsubsecno=0  \global\advance\subsecno by 1
   6302  1.1  mrg   \sectionheading{#1}{subsec}{Yappendix}%
   6303  1.1  mrg                  {\appendixletter.\the\secno.\the\subsecno}%
   6304  1.1  mrg }
   6305  1.1  mrg 
   6306  1.1  mrg % normally calls unnumberedsubseczzz:
   6307  1.1  mrg \outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}}
   6308  1.1  mrg \def\unnumberedsubseczzz#1{%
   6309  1.1  mrg   \global\subsubsecno=0  \global\advance\subsecno by 1
   6310  1.1  mrg   \sectionheading{#1}{subsec}{Ynothing}%
   6311  1.1  mrg                  {\the\unnumberedno.\the\secno.\the\subsecno}%
   6312  1.1  mrg }
   6313  1.1  mrg 
   6314  1.1  mrg % Subsubsections.
   6315  1.1  mrg %
   6316  1.1  mrg % normally numberedsubsubseczzz:
   6317  1.1  mrg \outer\parseargdef\numberedsubsubsec{\numhead3{#1}}
   6318  1.1  mrg \def\numberedsubsubseczzz#1{%
   6319  1.1  mrg   \global\advance\subsubsecno by 1
   6320  1.1  mrg   \sectionheading{#1}{subsubsec}{Ynumbered}%
   6321  1.1  mrg                  {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}%
   6322  1.1  mrg }
   6323  1.1  mrg 
   6324  1.1  mrg % normally appendixsubsubseczzz:
   6325  1.1  mrg \outer\parseargdef\appendixsubsubsec{\apphead3{#1}}
   6326  1.1  mrg \def\appendixsubsubseczzz#1{%
   6327  1.1  mrg   \global\advance\subsubsecno by 1
   6328  1.1  mrg   \sectionheading{#1}{subsubsec}{Yappendix}%
   6329  1.1  mrg                  {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}%
   6330  1.1  mrg }
   6331  1.1  mrg 
   6332  1.1  mrg % normally unnumberedsubsubseczzz:
   6333  1.1  mrg \outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}}
   6334  1.1  mrg \def\unnumberedsubsubseczzz#1{%
   6335  1.1  mrg   \global\advance\subsubsecno by 1
   6336  1.1  mrg   \sectionheading{#1}{subsubsec}{Ynothing}%
   6337  1.1  mrg                  {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}%
   6338  1.1  mrg }
   6339  1.1  mrg 
   6340  1.1  mrg % These macros control what the section commands do, according
   6341  1.1  mrg % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
   6342  1.1  mrg % Define them by default for a numbered chapter.
   6343  1.1  mrg \let\section = \numberedsec
   6344  1.1  mrg \let\subsection = \numberedsubsec
   6345  1.1  mrg \let\subsubsection = \numberedsubsubsec
   6346  1.1  mrg 
   6347  1.1  mrg % Define @majorheading, @heading and @subheading
   6348  1.1  mrg 
   6349  1.1  mrg \def\majorheading{%
   6350  1.1  mrg   {\advance\chapheadingskip by 10pt \chapbreak }%
   6351  1.1  mrg   \parsearg\chapheadingzzz
   6352  1.1  mrg }
   6353  1.1  mrg 
   6354  1.1  mrg \def\chapheading{\chapbreak \parsearg\chapheadingzzz}
   6355  1.1  mrg \def\chapheadingzzz#1{%
   6356  1.1  mrg   \vbox{\chapfonts \raggedtitlesettings #1\par}%
   6357  1.1  mrg   \nobreak\bigskip \nobreak
   6358  1.1  mrg   \suppressfirstparagraphindent
   6359  1.1  mrg }
   6360  1.1  mrg 
   6361  1.1  mrg % @heading, @subheading, @subsubheading.
   6362  1.1  mrg \parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{}
   6363  1.1  mrg   \suppressfirstparagraphindent}
   6364  1.1  mrg \parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{}
   6365  1.1  mrg   \suppressfirstparagraphindent}
   6366  1.1  mrg \parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{}
   6367  1.1  mrg   \suppressfirstparagraphindent}
   6368  1.1  mrg 
   6369  1.1  mrg % These macros generate a chapter, section, etc. heading only
   6370  1.1  mrg % (including whitespace, linebreaking, etc. around it),
   6371  1.1  mrg % given all the information in convenient, parsed form.
   6372  1.1  mrg 
   6373  1.1  mrg % Args are the skip and penalty (usually negative)
   6374  1.1  mrg \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
   6375  1.1  mrg 
   6376  1.1  mrg % Parameter controlling skip before chapter headings (if needed)
   6377  1.1  mrg \newskip\chapheadingskip
   6378  1.1  mrg 
   6379  1.1  mrg % Define plain chapter starts, and page on/off switching for it.
   6380  1.1  mrg \def\chapbreak{\dobreak \chapheadingskip {-4000}}
   6381  1.1  mrg 
   6382  1.1  mrg % Start a new page
   6383  1.1  mrg \def\chappager{\par\vfill\supereject}
   6384  1.1  mrg 
   6385  1.1  mrg % \chapoddpage - start on an odd page for a new chapter
   6386  1.1  mrg % Because \domark is called before \chapoddpage, the filler page will
   6387  1.1  mrg % get the headings for the next chapter, which is wrong.  But we don't
   6388  1.1  mrg % care -- we just disable all headings on the filler page.
   6389  1.1  mrg \def\chapoddpage{%
   6390  1.1  mrg   \chappager
   6391  1.1  mrg   \ifodd\pageno \else
   6392  1.1  mrg     \begingroup
   6393  1.1  mrg       \headingsoff
   6394  1.1  mrg       \null
   6395  1.1  mrg       \chappager
   6396  1.1  mrg     \endgroup
   6397  1.1  mrg   \fi
   6398  1.1  mrg }
   6399  1.1  mrg 
   6400  1.1  mrg \parseargdef\setchapternewpage{\csname CHAPPAG#1\endcsname}
   6401  1.1  mrg 
   6402  1.1  mrg \def\CHAPPAGoff{%
   6403  1.1  mrg \global\let\contentsalignmacro = \chappager
   6404  1.1  mrg \global\let\pchapsepmacro=\chapbreak
   6405  1.1  mrg \global\let\pagealignmacro=\chappager}
   6406  1.1  mrg 
   6407  1.1  mrg \def\CHAPPAGon{%
   6408  1.1  mrg \global\let\contentsalignmacro = \chappager
   6409  1.1  mrg \global\let\pchapsepmacro=\chappager
   6410  1.1  mrg \global\let\pagealignmacro=\chappager
   6411  1.1  mrg \global\def\HEADINGSon{\HEADINGSsingle}}
   6412  1.1  mrg 
   6413  1.1  mrg \def\CHAPPAGodd{%
   6414  1.1  mrg \global\let\contentsalignmacro = \chapoddpage
   6415  1.1  mrg \global\let\pchapsepmacro=\chapoddpage
   6416  1.1  mrg \global\let\pagealignmacro=\chapoddpage
   6417  1.1  mrg \global\def\HEADINGSon{\HEADINGSdouble}}
   6418  1.1  mrg 
   6419  1.1  mrg \CHAPPAGon
   6420  1.1  mrg 
   6421  1.1  mrg % \chapmacro - Chapter opening.
   6422  1.1  mrg %
   6423  1.1  mrg % #1 is the text, #2 is the section type (Ynumbered, Ynothing,
   6424  1.1  mrg % Yappendix, Yomitfromtoc), #3 the chapter number.
   6425  1.1  mrg % Not used for @heading series.
   6426  1.1  mrg %
   6427  1.1  mrg % To test against our argument.
   6428  1.1  mrg \def\Ynothingkeyword{Ynothing}
   6429  1.1  mrg \def\Yappendixkeyword{Yappendix}
   6430  1.1  mrg \def\Yomitfromtockeyword{Yomitfromtoc}
   6431  1.1  mrg %
   6432  1.1  mrg \def\chapmacro#1#2#3{%
   6433  1.1  mrg   \expandafter\ifx\thisenv\titlepage\else
   6434  1.1  mrg     \checkenv{}% chapters, etc., should not start inside an environment.
   6435  1.1  mrg   \fi
   6436  1.1  mrg   % Insert the first mark before the heading break (see notes for \domark).
   6437  1.1  mrg   \let\prevchapterdefs=\currentchapterdefs
   6438  1.1  mrg   \let\prevsectiondefs=\currentsectiondefs
   6439  1.1  mrg   \gdef\currentsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}%
   6440  1.1  mrg                         \gdef\thissection{}}%
   6441  1.1  mrg   %
   6442  1.1  mrg   \def\temptype{#2}%
   6443  1.1  mrg   \ifx\temptype\Ynothingkeyword
   6444  1.1  mrg     \gdef\currentchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
   6445  1.1  mrg                           \gdef\thischapter{\thischaptername}}%
   6446  1.1  mrg   \else\ifx\temptype\Yomitfromtockeyword
   6447  1.1  mrg     \gdef\currentchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
   6448  1.1  mrg                           \gdef\thischapter{}}%
   6449  1.1  mrg   \else\ifx\temptype\Yappendixkeyword
   6450  1.1  mrg     \toks0={#1}%
   6451  1.1  mrg     \xdef\currentchapterdefs{%
   6452  1.1  mrg       \gdef\noexpand\thischaptername{\the\toks0}%
   6453  1.1  mrg       \gdef\noexpand\thischapternum{\appendixletter}%
   6454  1.1  mrg       % \noexpand\putwordAppendix avoids expanding indigestible
   6455  1.1  mrg       % commands in some of the translations.
   6456  1.1  mrg       \gdef\noexpand\thischapter{\noexpand\putwordAppendix{}
   6457  1.1  mrg                                  \noexpand\thischapternum:
   6458  1.1  mrg                                  \noexpand\thischaptername}%
   6459  1.1  mrg     }%
   6460  1.1  mrg   \else
   6461  1.1  mrg     \toks0={#1}%
   6462  1.1  mrg     \xdef\currentchapterdefs{%
   6463  1.1  mrg       \gdef\noexpand\thischaptername{\the\toks0}%
   6464  1.1  mrg       \gdef\noexpand\thischapternum{\the\chapno}%
   6465  1.1  mrg       % \noexpand\putwordChapter avoids expanding indigestible
   6466  1.1  mrg       % commands in some of the translations.
   6467  1.1  mrg       \gdef\noexpand\thischapter{\noexpand\putwordChapter{}
   6468  1.1  mrg                                  \noexpand\thischapternum:
   6469  1.1  mrg                                  \noexpand\thischaptername}%
   6470  1.1  mrg     }%
   6471  1.1  mrg   \fi\fi\fi
   6472  1.1  mrg   %
   6473  1.1  mrg   % Output the mark.  Pass it through \safewhatsit, to take care of
   6474  1.1  mrg   % the preceding space.
   6475  1.1  mrg   \safewhatsit\domark
   6476  1.1  mrg   %
   6477  1.1  mrg   % Insert the chapter heading break.
   6478  1.1  mrg   \pchapsepmacro
   6479  1.1  mrg   %
   6480  1.1  mrg   % Now the second mark, after the heading break.  No break points
   6481  1.1  mrg   % between here and the heading.
   6482  1.1  mrg   \let\prevchapterdefs=\currentchapterdefs
   6483  1.1  mrg   \let\prevsectiondefs=\currentsectiondefs
   6484  1.1  mrg   \domark
   6485  1.1  mrg   %
   6486  1.1  mrg   {%
   6487  1.1  mrg     \chapfonts \rm
   6488  1.1  mrg     \let\footnote=\errfootnoteheading % give better error message
   6489  1.1  mrg     %
   6490  1.1  mrg     % Have to define \currentsection before calling \donoderef, because the
   6491  1.1  mrg     % xref code eventually uses it.  On the other hand, it has to be called
   6492  1.1  mrg     % after \pchapsepmacro, or the headline will change too soon.
   6493  1.1  mrg     \gdef\currentsection{#1}%
   6494  1.1  mrg     %
   6495  1.1  mrg     % Only insert the separating space if we have a chapter/appendix
   6496  1.1  mrg     % number, and don't print the unnumbered ``number''.
   6497  1.1  mrg     \ifx\temptype\Ynothingkeyword
   6498  1.1  mrg       \setbox0 = \hbox{}%
   6499  1.1  mrg       \def\toctype{unnchap}%
   6500  1.1  mrg     \else\ifx\temptype\Yomitfromtockeyword
   6501  1.1  mrg       \setbox0 = \hbox{}% contents like unnumbered, but no toc entry
   6502  1.1  mrg       \def\toctype{omit}%
   6503  1.1  mrg     \else\ifx\temptype\Yappendixkeyword
   6504  1.1  mrg       \setbox0 = \hbox{\putwordAppendix{} #3\enspace}%
   6505  1.1  mrg       \def\toctype{app}%
   6506  1.1  mrg     \else
   6507  1.1  mrg       \setbox0 = \hbox{#3\enspace}%
   6508  1.1  mrg       \def\toctype{numchap}%
   6509  1.1  mrg     \fi\fi\fi
   6510  1.1  mrg     %
   6511  1.1  mrg     % Write the toc entry for this chapter.  Must come before the
   6512  1.1  mrg     % \donoderef, because we include the current node name in the toc
   6513  1.1  mrg     % entry, and \donoderef resets it to empty.
   6514  1.1  mrg     \writetocentry{\toctype}{#1}{#3}%
   6515  1.1  mrg     %
   6516  1.1  mrg     % For pdftex, we have to write out the node definition (aka, make
   6517  1.1  mrg     % the pdfdest) after any page break, but before the actual text has
   6518  1.1  mrg     % been typeset.  If the destination for the pdf outline is after the
   6519  1.1  mrg     % text, then jumping from the outline may wind up with the text not
   6520  1.1  mrg     % being visible, for instance under high magnification.
   6521  1.1  mrg     \donoderef{#2}%
   6522  1.1  mrg     %
   6523  1.1  mrg     % Typeset the actual heading.
   6524  1.1  mrg     \nobreak % Avoid page breaks at the interline glue.
   6525  1.1  mrg     \vbox{\raggedtitlesettings \hangindent=\wd0 \centerparametersmaybe
   6526  1.1  mrg           \unhbox0 #1\par}%
   6527  1.1  mrg   }%
   6528  1.1  mrg   \nobreak\bigskip % no page break after a chapter title
   6529  1.1  mrg   \nobreak
   6530  1.1  mrg }
   6531  1.1  mrg 
   6532  1.1  mrg % @centerchap -- centered and unnumbered.
   6533  1.1  mrg \let\centerparametersmaybe = \relax
   6534  1.1  mrg \def\centerparameters{%
   6535  1.1  mrg   \advance\rightskip by 3\rightskip
   6536  1.1  mrg   \leftskip = \rightskip
   6537  1.1  mrg   \parfillskip = 0pt
   6538  1.1  mrg }
   6539  1.1  mrg 
   6540  1.1  mrg 
   6541  1.1  mrg % Section titles.  These macros combine the section number parts and
   6542  1.1  mrg % call the generic \sectionheading to do the printing.
   6543  1.1  mrg %
   6544  1.1  mrg \newskip\secheadingskip
   6545  1.1  mrg \def\secheadingbreak{\dobreak \secheadingskip{-1000}}
   6546  1.1  mrg 
   6547  1.1  mrg % Subsection titles.
   6548  1.1  mrg \newskip\subsecheadingskip
   6549  1.1  mrg \def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}}
   6550  1.1  mrg 
   6551  1.1  mrg % Subsubsection titles.
   6552  1.1  mrg \def\subsubsecheadingskip{\subsecheadingskip}
   6553  1.1  mrg \def\subsubsecheadingbreak{\subsecheadingbreak}
   6554  1.1  mrg 
   6555  1.1  mrg 
   6556  1.1  mrg % Print any size, any type, section title.
   6557  1.1  mrg %
   6558  1.1  mrg % #1 is the text of the title,
   6559  1.1  mrg % #2 is the section level (sec/subsec/subsubsec),
   6560  1.1  mrg % #3 is the section type (Ynumbered, Ynothing, Yappendix, Yomitfromtoc),
   6561  1.1  mrg % #4 is the section number.
   6562  1.1  mrg %
   6563  1.1  mrg \def\seckeyword{sec}
   6564  1.1  mrg %
   6565  1.1  mrg \def\sectionheading#1#2#3#4{%
   6566  1.1  mrg   {%
   6567  1.1  mrg     \def\sectionlevel{#2}%
   6568  1.1  mrg     \def\temptype{#3}%
   6569  1.1  mrg     %
   6570  1.1  mrg     % It is ok for the @heading series commands to appear inside an
   6571  1.1  mrg     % environment (it's been historically allowed, though the logic is
   6572  1.1  mrg     % dubious), but not the others.
   6573  1.1  mrg     \ifx\temptype\Yomitfromtockeyword\else
   6574  1.1  mrg       \checkenv{}% non-@*heading should not be in an environment.
   6575  1.1  mrg     \fi
   6576  1.1  mrg     \let\footnote=\errfootnoteheading
   6577  1.1  mrg     %
   6578  1.1  mrg     % Switch to the right set of fonts.
   6579  1.1  mrg     \csname #2fonts\endcsname \rm
   6580  1.1  mrg     %
   6581  1.1  mrg     % Insert first mark before the heading break (see notes for \domark).
   6582  1.1  mrg     \let\prevsectiondefs=\currentsectiondefs
   6583  1.1  mrg     \ifx\temptype\Ynothingkeyword
   6584  1.1  mrg       \ifx\sectionlevel\seckeyword
   6585  1.1  mrg         \gdef\currentsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}%
   6586  1.1  mrg                               \gdef\thissection{\thissectionname}}%
   6587  1.1  mrg       \fi
   6588  1.1  mrg     \else\ifx\temptype\Yomitfromtockeyword
   6589  1.1  mrg       % Don't redefine \thissection.
   6590  1.1  mrg     \else\ifx\temptype\Yappendixkeyword
   6591  1.1  mrg       \ifx\sectionlevel\seckeyword
   6592  1.1  mrg         \toks0={#1}%
   6593  1.1  mrg         \xdef\currentsectiondefs{%
   6594  1.1  mrg           \gdef\noexpand\thissectionname{\the\toks0}%
   6595  1.1  mrg           \gdef\noexpand\thissectionnum{#4}%
   6596  1.1  mrg           % \noexpand\putwordSection avoids expanding indigestible
   6597  1.1  mrg           % commands in some of the translations.
   6598  1.1  mrg           \gdef\noexpand\thissection{\noexpand\putwordSection{}
   6599  1.1  mrg                                      \noexpand\thissectionnum:
   6600  1.1  mrg                                      \noexpand\thissectionname}%
   6601  1.1  mrg         }%
   6602  1.1  mrg       \fi
   6603  1.1  mrg     \else
   6604  1.1  mrg       \ifx\sectionlevel\seckeyword
   6605  1.1  mrg         \toks0={#1}%
   6606  1.1  mrg         \xdef\currentsectiondefs{%
   6607  1.1  mrg           \gdef\noexpand\thissectionname{\the\toks0}%
   6608  1.1  mrg           \gdef\noexpand\thissectionnum{#4}%
   6609  1.1  mrg           % \noexpand\putwordSection avoids expanding indigestible
   6610  1.1  mrg           % commands in some of the translations.
   6611  1.1  mrg           \gdef\noexpand\thissection{\noexpand\putwordSection{}
   6612  1.1  mrg                                      \noexpand\thissectionnum:
   6613  1.1  mrg                                      \noexpand\thissectionname}%
   6614  1.1  mrg         }%
   6615  1.1  mrg       \fi
   6616  1.1  mrg     \fi\fi\fi
   6617  1.1  mrg     %
   6618  1.1  mrg     % Go into vertical mode.  Usually we'll already be there, but we
   6619  1.1  mrg     % don't want the following whatsit to end up in a preceding paragraph
   6620  1.1  mrg     % if the document didn't happen to have a blank line.
   6621  1.1  mrg     \par
   6622  1.1  mrg     %
   6623  1.1  mrg     % Output the mark.  Pass it through \safewhatsit, to take care of
   6624  1.1  mrg     % the preceding space.
   6625  1.1  mrg     \safewhatsit\domark
   6626  1.1  mrg     %
   6627  1.1  mrg     % Insert space above the heading.
   6628  1.1  mrg     \csname #2headingbreak\endcsname
   6629  1.1  mrg     %
   6630  1.1  mrg     % Now the second mark, after the heading break.  No break points
   6631  1.1  mrg     % between here and the heading.
   6632  1.1  mrg     \global\let\prevsectiondefs=\currentsectiondefs
   6633  1.1  mrg     \domark
   6634  1.1  mrg     %
   6635  1.1  mrg     % Only insert the space after the number if we have a section number.
   6636  1.1  mrg     \ifx\temptype\Ynothingkeyword
   6637  1.1  mrg       \setbox0 = \hbox{}%
   6638  1.1  mrg       \def\toctype{unn}%
   6639  1.1  mrg       \gdef\currentsection{#1}%
   6640  1.1  mrg     \else\ifx\temptype\Yomitfromtockeyword
   6641  1.1  mrg       % for @headings -- no section number, don't include in toc,
   6642  1.1  mrg       % and don't redefine \currentsection.
   6643  1.1  mrg       \setbox0 = \hbox{}%
   6644  1.1  mrg       \def\toctype{omit}%
   6645  1.1  mrg       \let\sectionlevel=\empty
   6646  1.1  mrg     \else\ifx\temptype\Yappendixkeyword
   6647  1.1  mrg       \setbox0 = \hbox{#4\enspace}%
   6648  1.1  mrg       \def\toctype{app}%
   6649  1.1  mrg       \gdef\currentsection{#1}%
   6650  1.1  mrg     \else
   6651  1.1  mrg       \setbox0 = \hbox{#4\enspace}%
   6652  1.1  mrg       \def\toctype{num}%
   6653  1.1  mrg       \gdef\currentsection{#1}%
   6654  1.1  mrg     \fi\fi\fi
   6655  1.1  mrg     %
   6656  1.1  mrg     % Write the toc entry (before \donoderef).  See comments in \chapmacro.
   6657  1.1  mrg     \writetocentry{\toctype\sectionlevel}{#1}{#4}%
   6658  1.1  mrg     %
   6659  1.1  mrg     % Write the node reference (= pdf destination for pdftex).
   6660  1.1  mrg     % Again, see comments in \chapmacro.
   6661  1.1  mrg     \donoderef{#3}%
   6662  1.1  mrg     %
   6663  1.1  mrg     % Interline glue will be inserted when the vbox is completed.
   6664  1.1  mrg     % That glue will be a valid breakpoint for the page, since it'll be
   6665  1.1  mrg     % preceded by a whatsit (usually from the \donoderef, or from the
   6666  1.1  mrg     % \writetocentry if there was no node).  We don't want to allow that
   6667  1.1  mrg     % break, since then the whatsits could end up on page n while the
   6668  1.1  mrg     % section is on page n+1, thus toc/etc. are wrong.  Debian bug 276000.
   6669  1.1  mrg     \nobreak
   6670  1.1  mrg     %
   6671  1.1  mrg     % Output the actual section heading.
   6672  1.1  mrg     \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright
   6673  1.1  mrg           \hangindent=\wd0  % zero if no section number
   6674  1.1  mrg           \unhbox0 #1}%
   6675  1.1  mrg   }%
   6676  1.1  mrg   % Add extra space after the heading -- half of whatever came above it.
   6677  1.1  mrg   % Don't allow stretch, though.
   6678  1.1  mrg   \kern .5 \csname #2headingskip\endcsname
   6679  1.1  mrg   %
   6680  1.1  mrg   % Do not let the kern be a potential breakpoint, as it would be if it
   6681  1.1  mrg   % was followed by glue.
   6682  1.1  mrg   \nobreak
   6683  1.1  mrg   %
   6684  1.1  mrg   % We'll almost certainly start a paragraph next, so don't let that
   6685  1.1  mrg   % glue accumulate.  (Not a breakpoint because it's preceded by a
   6686  1.1  mrg   % discardable item.)  However, when a paragraph is not started next
   6687  1.1  mrg   % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out
   6688  1.1  mrg   % or the negative glue will cause weirdly wrong output, typically
   6689  1.1  mrg   % obscuring the section heading with something else.
   6690  1.1  mrg   \vskip-\parskip
   6691  1.1  mrg   %
   6692  1.1  mrg   % This is so the last item on the main vertical list is a known
   6693  1.1  mrg   % \penalty > 10000, so \startdefun, etc., can recognize the situation
   6694  1.1  mrg   % and do the needful.
   6695  1.1  mrg   \penalty 10001
   6696  1.1  mrg }
   6697  1.1  mrg 
   6698  1.1  mrg 
   6699  1.1  mrg \message{toc,}
   6700  1.1  mrg % Table of contents.
   6701  1.1  mrg \newwrite\tocfile
   6702  1.1  mrg 
   6703  1.1  mrg % Write an entry to the toc file, opening it if necessary.
   6704  1.1  mrg % Called from @chapter, etc.
   6705  1.1  mrg %
   6706  1.1  mrg % Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno}
   6707  1.1  mrg % We append the current node name (if any) and page number as additional
   6708  1.1  mrg % arguments for the \{chap,sec,...}entry macros which will eventually
   6709  1.1  mrg % read this.  The node name is used in the pdf outlines as the
   6710  1.1  mrg % destination to jump to.
   6711  1.1  mrg %
   6712  1.1  mrg % We open the .toc file for writing here instead of at @setfilename (or
   6713  1.1  mrg % any other fixed time) so that @contents can be anywhere in the document.
   6714  1.1  mrg % But if #1 is `omit', then we don't do anything.  This is used for the
   6715  1.1  mrg % table of contents chapter openings themselves.
   6716  1.1  mrg %
   6717  1.1  mrg \newif\iftocfileopened
   6718  1.1  mrg \def\omitkeyword{omit}%
   6719  1.1  mrg %
   6720  1.1  mrg \def\writetocentry#1#2#3{%
   6721  1.1  mrg   \edef\writetoctype{#1}%
   6722  1.1  mrg   \ifx\writetoctype\omitkeyword \else
   6723  1.1  mrg     \iftocfileopened\else
   6724  1.1  mrg       \immediate\openout\tocfile = \jobname.toc
   6725  1.1  mrg       \global\tocfileopenedtrue
   6726  1.1  mrg     \fi
   6727  1.1  mrg     %
   6728  1.1  mrg     \iflinks
   6729  1.1  mrg       {\atdummies
   6730  1.1  mrg        \edef\temp{%
   6731  1.1  mrg          \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}%
   6732  1.1  mrg        \temp
   6733  1.1  mrg       }%
   6734  1.1  mrg     \fi
   6735  1.1  mrg   \fi
   6736  1.1  mrg   %
   6737  1.1  mrg   % Tell \shipout to create a pdf destination on each page, if we're
   6738  1.1  mrg   % writing pdf.  These are used in the table of contents.  We can't
   6739  1.1  mrg   % just write one on every page because the title pages are numbered
   6740  1.1  mrg   % 1 and 2 (the page numbers aren't printed), and so are the first
   6741  1.1  mrg   % two pages of the document.  Thus, we'd have two destinations named
   6742  1.1  mrg   % `1', and two named `2'.
   6743  1.1  mrg   \ifpdforxetex
   6744  1.1  mrg     \global\pdfmakepagedesttrue
   6745  1.1  mrg   \fi
   6746  1.1  mrg }
   6747  1.1  mrg 
   6748  1.1  mrg 
   6749  1.1  mrg % These characters do not print properly in the Computer Modern roman
   6750  1.1  mrg % fonts, so we must take special care.  This is more or less redundant
   6751  1.1  mrg % with the Texinfo input format setup at the end of this file.
   6752  1.1  mrg %
   6753  1.1  mrg \def\activecatcodes{%
   6754  1.1  mrg   \catcode`\"=\active
   6755  1.1  mrg   \catcode`\$=\active
   6756  1.1  mrg   \catcode`\<=\active
   6757  1.1  mrg   \catcode`\>=\active
   6758  1.1  mrg   \catcode`\\=\active
   6759  1.1  mrg   \catcode`\^=\active
   6760  1.1  mrg   \catcode`\_=\active
   6761  1.1  mrg   \catcode`\|=\active
   6762  1.1  mrg   \catcode`\~=\active
   6763  1.1  mrg }
   6764  1.1  mrg 
   6765  1.1  mrg 
   6766  1.1  mrg % Read the toc file, which is essentially Texinfo input.
   6767  1.1  mrg \def\readtocfile{%
   6768  1.1  mrg   \setupdatafile
   6769  1.1  mrg   \activecatcodes
   6770  1.1  mrg   \input \tocreadfilename
   6771  1.1  mrg }
   6772  1.1  mrg 
   6773  1.1  mrg \newskip\contentsrightmargin \contentsrightmargin=1in
   6774  1.1  mrg \newcount\savepageno
   6775  1.1  mrg \newcount\lastnegativepageno \lastnegativepageno = -1
   6776  1.1  mrg 
   6777  1.1  mrg % Prepare to read what we've written to \tocfile.
   6778  1.1  mrg %
   6779  1.1  mrg \def\startcontents#1{%
   6780  1.1  mrg   % If @setchapternewpage on, and @headings double, the contents should
   6781  1.1  mrg   % start on an odd page, unlike chapters.  Thus, we maintain
   6782  1.1  mrg   % \contentsalignmacro in parallel with \pagealignmacro.
   6783  1.1  mrg   % From: Torbjorn Granlund <tege (a] matematik.su.se>
   6784  1.1  mrg   \contentsalignmacro
   6785  1.1  mrg   \immediate\closeout\tocfile
   6786  1.1  mrg   %
   6787  1.1  mrg   % Don't need to put `Contents' or `Short Contents' in the headline.
   6788  1.1  mrg   % It is abundantly clear what they are.
   6789  1.1  mrg   \chapmacro{#1}{Yomitfromtoc}{}%
   6790  1.1  mrg   %
   6791  1.1  mrg   \savepageno = \pageno
   6792  1.1  mrg   \begingroup                  % Set up to handle contents files properly.
   6793  1.1  mrg     \raggedbottom              % Worry more about breakpoints than the bottom.
   6794  1.1  mrg     \entryrightmargin=\contentsrightmargin % Don't use the full line length.
   6795  1.1  mrg     %
   6796  1.1  mrg     % Roman numerals for page numbers.
   6797  1.1  mrg     \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
   6798  1.1  mrg }
   6799  1.1  mrg 
   6800  1.1  mrg % redefined for the two-volume lispref.  We always output on
   6801  1.1  mrg % \jobname.toc even if this is redefined.
   6802  1.1  mrg %
   6803  1.1  mrg \def\tocreadfilename{\jobname.toc}
   6804  1.1  mrg 
   6805  1.1  mrg % Normal (long) toc.
   6806  1.1  mrg %
   6807  1.1  mrg \def\contents{%
   6808  1.1  mrg   \startcontents{\putwordTOC}%
   6809  1.1  mrg     \openin 1 \tocreadfilename\space
   6810  1.1  mrg     \ifeof 1 \else
   6811  1.1  mrg       \readtocfile
   6812  1.1  mrg     \fi
   6813  1.1  mrg     \vfill \eject
   6814  1.1  mrg     \contentsalignmacro % in case @setchapternewpage odd is in effect
   6815  1.1  mrg     \ifeof 1 \else
   6816  1.1  mrg       \pdfmakeoutlines
   6817  1.1  mrg     \fi
   6818  1.1  mrg     \closein 1
   6819  1.1  mrg   \endgroup
   6820  1.1  mrg   \lastnegativepageno = \pageno
   6821  1.1  mrg   \global\pageno = \savepageno
   6822  1.1  mrg }
   6823  1.1  mrg 
   6824  1.1  mrg % And just the chapters.
   6825  1.1  mrg \def\summarycontents{%
   6826  1.1  mrg   \startcontents{\putwordShortTOC}%
   6827  1.1  mrg     %
   6828  1.1  mrg     \let\partentry = \shortpartentry
   6829  1.1  mrg     \let\numchapentry = \shortchapentry
   6830  1.1  mrg     \let\appentry = \shortchapentry
   6831  1.1  mrg     \let\unnchapentry = \shortunnchapentry
   6832  1.1  mrg     % We want a true roman here for the page numbers.
   6833  1.1  mrg     \secfonts
   6834  1.1  mrg     \let\rm=\shortcontrm \let\bf=\shortcontbf
   6835  1.1  mrg     \let\sl=\shortcontsl \let\tt=\shortconttt
   6836  1.1  mrg     \rm
   6837  1.1  mrg     \hyphenpenalty = 10000
   6838  1.1  mrg     \advance\baselineskip by 1pt % Open it up a little.
   6839  1.1  mrg     \def\numsecentry##1##2##3##4{}
   6840  1.1  mrg     \let\appsecentry = \numsecentry
   6841  1.1  mrg     \let\unnsecentry = \numsecentry
   6842  1.1  mrg     \let\numsubsecentry = \numsecentry
   6843  1.1  mrg     \let\appsubsecentry = \numsecentry
   6844  1.1  mrg     \let\unnsubsecentry = \numsecentry
   6845  1.1  mrg     \let\numsubsubsecentry = \numsecentry
   6846  1.1  mrg     \let\appsubsubsecentry = \numsecentry
   6847  1.1  mrg     \let\unnsubsubsecentry = \numsecentry
   6848  1.1  mrg     \openin 1 \tocreadfilename\space
   6849  1.1  mrg     \ifeof 1 \else
   6850  1.1  mrg       \readtocfile
   6851  1.1  mrg     \fi
   6852  1.1  mrg     \closein 1
   6853  1.1  mrg     \vfill \eject
   6854  1.1  mrg     \contentsalignmacro % in case @setchapternewpage odd is in effect
   6855  1.1  mrg   \endgroup
   6856  1.1  mrg   \lastnegativepageno = \pageno
   6857  1.1  mrg   \global\pageno = \savepageno
   6858  1.1  mrg }
   6859  1.1  mrg \let\shortcontents = \summarycontents
   6860  1.1  mrg 
   6861  1.1  mrg % Typeset the label for a chapter or appendix for the short contents.
   6862  1.1  mrg % The arg is, e.g., `A' for an appendix, or `3' for a chapter.
   6863  1.1  mrg %
   6864  1.1  mrg \def\shortchaplabel#1{%
   6865  1.1  mrg   % This space should be enough, since a single number is .5em, and the
   6866  1.1  mrg   % widest letter (M) is 1em, at least in the Computer Modern fonts.
   6867  1.1  mrg   % But use \hss just in case.
   6868  1.1  mrg   % (This space doesn't include the extra space that gets added after
   6869  1.1  mrg   % the label; that gets put in by \shortchapentry above.)
   6870  1.1  mrg   %
   6871  1.1  mrg   % We'd like to right-justify chapter numbers, but that looks strange
   6872  1.1  mrg   % with appendix letters.  And right-justifying numbers and
   6873  1.1  mrg   % left-justifying letters looks strange when there is less than 10
   6874  1.1  mrg   % chapters.  Have to read the whole toc once to know how many chapters
   6875  1.1  mrg   % there are before deciding ...
   6876  1.1  mrg   \hbox to 1em{#1\hss}%
   6877  1.1  mrg }
   6878  1.1  mrg 
   6879  1.1  mrg % These macros generate individual entries in the table of contents.
   6880  1.1  mrg % The first argument is the chapter or section name.
   6881  1.1  mrg % The last argument is the page number.
   6882  1.1  mrg % The arguments in between are the chapter number, section number, ...
   6883  1.1  mrg 
   6884  1.1  mrg % Parts, in the main contents.  Replace the part number, which doesn't
   6885  1.1  mrg % exist, with an empty box.  Let's hope all the numbers have the same width.
   6886  1.1  mrg % Also ignore the page number, which is conventionally not printed.
   6887  1.1  mrg \def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}}
   6888  1.1  mrg \def\partentry#1#2#3#4{%
   6889  1.1  mrg   % Add stretch and a bonus for breaking the page before the part heading.
   6890  1.1  mrg   % This reduces the chance of the page being broken immediately after the
   6891  1.1  mrg   % part heading, before a following chapter heading.
   6892  1.1  mrg   \vskip 0pt plus 5\baselineskip
   6893  1.1  mrg   \penalty-300
   6894  1.1  mrg   \vskip 0pt plus -5\baselineskip
   6895  1.1  mrg   \dochapentry{\numeralbox\labelspace#1}{}%
   6896  1.1  mrg }
   6897  1.1  mrg %
   6898  1.1  mrg % Parts, in the short toc.
   6899  1.1  mrg \def\shortpartentry#1#2#3#4{%
   6900  1.1  mrg   \penalty-300
   6901  1.1  mrg   \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip
   6902  1.1  mrg   \shortchapentry{{\bf #1}}{\numeralbox}{}{}%
   6903  1.1  mrg }
   6904  1.1  mrg 
   6905  1.1  mrg % Chapters, in the main contents.
   6906  1.1  mrg \def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}}
   6907  1.1  mrg 
   6908  1.1  mrg % Chapters, in the short toc.
   6909  1.1  mrg % See comments in \dochapentry re vbox and related settings.
   6910  1.1  mrg \def\shortchapentry#1#2#3#4{%
   6911  1.1  mrg   \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}%
   6912  1.1  mrg }
   6913  1.1  mrg 
   6914  1.1  mrg % Appendices, in the main contents.
   6915  1.1  mrg % Need the word Appendix, and a fixed-size box.
   6916  1.1  mrg %
   6917  1.1  mrg \def\appendixbox#1{%
   6918  1.1  mrg   % We use M since it's probably the widest letter.
   6919  1.1  mrg   \setbox0 = \hbox{\putwordAppendix{} M}%
   6920  1.1  mrg   \hbox to \wd0{\putwordAppendix{} #1\hss}}
   6921  1.1  mrg %
   6922  1.1  mrg \def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\hskip.7em#1}{#4}}
   6923  1.1  mrg 
   6924  1.1  mrg % Unnumbered chapters.
   6925  1.1  mrg \def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}}
   6926  1.1  mrg \def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}}
   6927  1.1  mrg 
   6928  1.1  mrg % Sections.
   6929  1.1  mrg \def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}}
   6930  1.1  mrg \let\appsecentry=\numsecentry
   6931  1.1  mrg \def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}}
   6932  1.1  mrg 
   6933  1.1  mrg % Subsections.
   6934  1.1  mrg \def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}}
   6935  1.1  mrg \let\appsubsecentry=\numsubsecentry
   6936  1.1  mrg \def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}}
   6937  1.1  mrg 
   6938  1.1  mrg % And subsubsections.
   6939  1.1  mrg \def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}}
   6940  1.1  mrg \let\appsubsubsecentry=\numsubsubsecentry
   6941  1.1  mrg \def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}}
   6942  1.1  mrg 
   6943  1.1  mrg % This parameter controls the indentation of the various levels.
   6944  1.1  mrg % Same as \defaultparindent.
   6945  1.1  mrg \newdimen\tocindent \tocindent = 15pt
   6946  1.1  mrg 
   6947  1.1  mrg % Now for the actual typesetting. In all these, #1 is the text and #2 is the
   6948  1.1  mrg % page number.
   6949  1.1  mrg %
   6950  1.1  mrg % If the toc has to be broken over pages, we want it to be at chapters
   6951  1.1  mrg % if at all possible; hence the \penalty.
   6952  1.1  mrg \def\dochapentry#1#2{%
   6953  1.1  mrg    \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
   6954  1.1  mrg    \begingroup
   6955  1.1  mrg      % Move the page numbers slightly to the right
   6956  1.1  mrg      \advance\entryrightmargin by -0.05em
   6957  1.1  mrg      \chapentryfonts
   6958  1.1  mrg      \tocentry{#1}{\dopageno\bgroup#2\egroup}%
   6959  1.1  mrg    \endgroup
   6960  1.1  mrg    \nobreak\vskip .25\baselineskip plus.1\baselineskip
   6961  1.1  mrg }
   6962  1.1  mrg 
   6963  1.1  mrg \def\dosecentry#1#2{\begingroup
   6964  1.1  mrg   \secentryfonts \leftskip=\tocindent
   6965  1.1  mrg   \tocentry{#1}{\dopageno\bgroup#2\egroup}%
   6966  1.1  mrg \endgroup}
   6967  1.1  mrg 
   6968  1.1  mrg \def\dosubsecentry#1#2{\begingroup
   6969  1.1  mrg   \subsecentryfonts \leftskip=2\tocindent
   6970  1.1  mrg   \tocentry{#1}{\dopageno\bgroup#2\egroup}%
   6971  1.1  mrg \endgroup}
   6972  1.1  mrg 
   6973  1.1  mrg \def\dosubsubsecentry#1#2{\begingroup
   6974  1.1  mrg   \subsubsecentryfonts \leftskip=3\tocindent
   6975  1.1  mrg   \tocentry{#1}{\dopageno\bgroup#2\egroup}%
   6976  1.1  mrg \endgroup}
   6977  1.1  mrg 
   6978  1.1  mrg % We use the same \entry macro as for the index entries.
   6979  1.1  mrg \let\tocentry = \entry
   6980  1.1  mrg 
   6981  1.1  mrg % Space between chapter (or whatever) number and the title.
   6982  1.1  mrg \def\labelspace{\hskip1em \relax}
   6983  1.1  mrg 
   6984  1.1  mrg \def\dopageno#1{{\rm #1}}
   6985  1.1  mrg \def\doshortpageno#1{{\rm #1}}
   6986  1.1  mrg 
   6987  1.1  mrg \def\chapentryfonts{\secfonts \rm}
   6988  1.1  mrg \def\secentryfonts{\textfonts}
   6989  1.1  mrg \def\subsecentryfonts{\textfonts}
   6990  1.1  mrg \def\subsubsecentryfonts{\textfonts}
   6991  1.1  mrg 
   6992  1.1  mrg 
   6993  1.1  mrg \message{environments,}
   6994  1.1  mrg % @foo ... @end foo.
   6995  1.1  mrg 
   6996  1.1  mrg % @tex ... @end tex    escapes into raw TeX temporarily.
   6997  1.1  mrg % One exception: @ is still an escape character, so that @end tex works.
   6998  1.1  mrg % But \@ or @@ will get a plain @ character.
   6999  1.1  mrg 
   7000  1.1  mrg \envdef\tex{%
   7001  1.1  mrg   \setupmarkupstyle{tex}%
   7002  1.1  mrg   \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
   7003  1.1  mrg   \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
   7004  1.1  mrg   \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
   7005  1.1  mrg   \catcode `\%=14
   7006  1.1  mrg   \catcode `\+=\other
   7007  1.1  mrg   \catcode `\"=\other
   7008  1.1  mrg   \catcode `\|=\other
   7009  1.1  mrg   \catcode `\<=\other
   7010  1.1  mrg   \catcode `\>=\other
   7011  1.1  mrg   \catcode `\`=\other
   7012  1.1  mrg   \catcode `\'=\other
   7013  1.1  mrg   %
   7014  1.1  mrg   % ' is active in math mode (mathcode"8000).  So reset it, and all our
   7015  1.1  mrg   % other math active characters (just in case), to plain's definitions.
   7016  1.1  mrg   \mathactive
   7017  1.1  mrg   %
   7018  1.1  mrg   % Inverse of the list at the beginning of the file.
   7019  1.1  mrg   \let\b=\ptexb
   7020  1.1  mrg   \let\bullet=\ptexbullet
   7021  1.1  mrg   \let\c=\ptexc
   7022  1.1  mrg   \let\,=\ptexcomma
   7023  1.1  mrg   \let\.=\ptexdot
   7024  1.1  mrg   \let\dots=\ptexdots
   7025  1.1  mrg   \let\equiv=\ptexequiv
   7026  1.1  mrg   \let\!=\ptexexclam
   7027  1.1  mrg   \let\i=\ptexi
   7028  1.1  mrg   \let\indent=\ptexindent
   7029  1.1  mrg   \let\noindent=\ptexnoindent
   7030  1.1  mrg   \let\{=\ptexlbrace
   7031  1.1  mrg   \let\+=\tabalign
   7032  1.1  mrg   \let\}=\ptexrbrace
   7033  1.1  mrg   \let\/=\ptexslash
   7034  1.1  mrg   \let\sp=\ptexsp
   7035  1.1  mrg   \let\*=\ptexstar
   7036  1.1  mrg   %\let\sup=\ptexsup % do not redefine, we want @sup to work in math mode
   7037  1.1  mrg   \let\t=\ptext
   7038  1.1  mrg   \expandafter \let\csname top\endcsname=\ptextop  % we've made it outer
   7039  1.1  mrg   \let\frenchspacing=\plainfrenchspacing
   7040  1.1  mrg   %
   7041  1.1  mrg   \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
   7042  1.1  mrg   \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
   7043  1.1  mrg   \def\@{@}%
   7044  1.1  mrg }
   7045  1.1  mrg % There is no need to define \Etex.
   7046  1.1  mrg 
   7047  1.1  mrg % Define @lisp ... @end lisp.
   7048  1.1  mrg % @lisp environment forms a group so it can rebind things,
   7049  1.1  mrg % including the definition of @end lisp (which normally is erroneous).
   7050  1.1  mrg 
   7051  1.1  mrg % Amount to narrow the margins by for @lisp.
   7052  1.1  mrg \newskip\lispnarrowing \lispnarrowing=0.4in
   7053  1.1  mrg 
   7054  1.1  mrg % This is the definition that ^^M gets inside @lisp, @example, and other
   7055  1.1  mrg % such environments.  \null is better than a space, since it doesn't
   7056  1.1  mrg % have any width.
   7057  1.1  mrg \def\lisppar{\null\endgraf}
   7058  1.1  mrg 
   7059  1.1  mrg % This space is always present above and below environments.
   7060  1.1  mrg \newskip\envskipamount \envskipamount = 0pt
   7061  1.1  mrg 
   7062  1.1  mrg % Make spacing and below environment symmetrical.  We use \parskip here
   7063  1.1  mrg % to help in doing that, since in @example-like environments \parskip
   7064  1.1  mrg % is reset to zero; thus the \afterenvbreak inserts no space -- but the
   7065  1.1  mrg % start of the next paragraph will insert \parskip.
   7066  1.1  mrg %
   7067  1.1  mrg \def\aboveenvbreak{{%
   7068  1.1  mrg   % =10000 instead of <10000 because of a special case in \itemzzz and
   7069  1.1  mrg   % \sectionheading, q.v.
   7070  1.1  mrg   \ifnum \lastpenalty=10000 \else
   7071  1.1  mrg     \advance\envskipamount by \parskip
   7072  1.1  mrg     \endgraf
   7073  1.1  mrg     \ifdim\lastskip<\envskipamount
   7074  1.1  mrg       \removelastskip
   7075  1.1  mrg       \ifnum\lastpenalty<10000
   7076  1.1  mrg         % Penalize breaking before the environment, because preceding text
   7077  1.1  mrg         % often leads into it.
   7078  1.1  mrg         \penalty100
   7079  1.1  mrg       \fi
   7080  1.1  mrg       \vskip\envskipamount
   7081  1.1  mrg     \fi
   7082  1.1  mrg   \fi
   7083  1.1  mrg }}
   7084  1.1  mrg 
   7085  1.1  mrg \def\afterenvbreak{{%
   7086  1.1  mrg   % =10000 instead of <10000 because of a special case in \itemzzz and
   7087  1.1  mrg   % \sectionheading, q.v.
   7088  1.1  mrg   \ifnum \lastpenalty=10000 \else
   7089  1.1  mrg     \advance\envskipamount by \parskip
   7090  1.1  mrg     \endgraf
   7091  1.1  mrg     \ifdim\lastskip<\envskipamount
   7092  1.1  mrg       \removelastskip
   7093  1.1  mrg       % it's not a good place to break if the last penalty was \nobreak
   7094  1.1  mrg       % or better ...
   7095  1.1  mrg       \ifnum\lastpenalty<10000 \penalty-50 \fi
   7096  1.1  mrg       \vskip\envskipamount
   7097  1.1  mrg     \fi
   7098  1.1  mrg   \fi
   7099  1.1  mrg }}
   7100  1.1  mrg 
   7101  1.1  mrg % \nonarrowing is a flag.  If "set", @lisp etc don't narrow margins; it will
   7102  1.1  mrg % also clear it, so that its embedded environments do the narrowing again.
   7103  1.1  mrg \let\nonarrowing=\relax
   7104  1.1  mrg 
   7105  1.1  mrg % @cartouche ... @end cartouche: draw rectangle w/rounded corners around
   7106  1.1  mrg % environment contents.
   7107  1.1  mrg 
   7108  1.1  mrg %
   7109  1.1  mrg \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
   7110  1.1  mrg \def\ctr{{\hskip 6pt\circle\char'010}}
   7111  1.1  mrg \def\cbl{{\circle\char'012\hskip -6pt}}
   7112  1.1  mrg \def\cbr{{\hskip 6pt\circle\char'011}}
   7113  1.1  mrg \def\carttop{\hbox to \cartouter{\hskip\lskip
   7114  1.1  mrg         \ctl\leaders\hrule height\circthick\hfil\ctr
   7115  1.1  mrg         \hskip\rskip}}
   7116  1.1  mrg \def\cartbot{\hbox to \cartouter{\hskip\lskip
   7117  1.1  mrg         \cbl\leaders\hrule height\circthick\hfil\cbr
   7118  1.1  mrg         \hskip\rskip}}
   7119  1.1  mrg %
   7120  1.1  mrg \newskip\lskip\newskip\rskip
   7121  1.1  mrg 
   7122  1.1  mrg % only require the font if @cartouche is actually used
   7123  1.1  mrg \def\cartouchefontdefs{%
   7124  1.1  mrg   \font\circle=lcircle10\relax
   7125  1.1  mrg   \circthick=\fontdimen8\circle
   7126  1.1  mrg }
   7127  1.1  mrg \newdimen\circthick
   7128  1.1  mrg \newdimen\cartouter\newdimen\cartinner
   7129  1.1  mrg \newskip\normbskip\newskip\normpskip\newskip\normlskip
   7130  1.1  mrg 
   7131  1.1  mrg 
   7132  1.1  mrg \envdef\cartouche{%
   7133  1.1  mrg   \cartouchefontdefs
   7134  1.1  mrg   \ifhmode\par\fi  % can't be in the midst of a paragraph.
   7135  1.1  mrg   \startsavinginserts
   7136  1.1  mrg   \lskip=\leftskip \rskip=\rightskip
   7137  1.1  mrg   \leftskip=0pt\rightskip=0pt % we want these *outside*.
   7138  1.1  mrg   \cartinner=\hsize \advance\cartinner by-\lskip
   7139  1.1  mrg   \advance\cartinner by-\rskip
   7140  1.1  mrg   \cartouter=\hsize
   7141  1.1  mrg   \advance\cartouter by 18.4pt	% allow for 3pt kerns on either
   7142  1.1  mrg 				% side, and for 6pt waste from
   7143  1.1  mrg 				% each corner char, and rule thickness
   7144  1.1  mrg   \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
   7145  1.1  mrg   %
   7146  1.1  mrg   % If this cartouche directly follows a sectioning command, we need the
   7147  1.1  mrg   % \parskip glue (backspaced over by default) or the cartouche can
   7148  1.1  mrg   % collide with the section heading.
   7149  1.1  mrg   \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi
   7150  1.1  mrg   %
   7151  1.1  mrg   \setbox\groupbox=\vbox\bgroup
   7152  1.1  mrg       \baselineskip=0pt\parskip=0pt\lineskip=0pt
   7153  1.1  mrg       \carttop
   7154  1.1  mrg       \hbox\bgroup
   7155  1.1  mrg 	  \hskip\lskip
   7156  1.1  mrg 	  \vrule\kern3pt
   7157  1.1  mrg 	  \vbox\bgroup
   7158  1.1  mrg 	      \kern3pt
   7159  1.1  mrg 	      \hsize=\cartinner
   7160  1.1  mrg 	      \baselineskip=\normbskip
   7161  1.1  mrg 	      \lineskip=\normlskip
   7162  1.1  mrg 	      \parskip=\normpskip
   7163  1.1  mrg 	      \vskip -\parskip
   7164  1.1  mrg 	      \comment % For explanation, see the end of def\group.
   7165  1.1  mrg }
   7166  1.1  mrg \def\Ecartouche{%
   7167  1.1  mrg               \ifhmode\par\fi
   7168  1.1  mrg 	      \kern3pt
   7169  1.1  mrg 	  \egroup
   7170  1.1  mrg 	  \kern3pt\vrule
   7171  1.1  mrg 	  \hskip\rskip
   7172  1.1  mrg       \egroup
   7173  1.1  mrg       \cartbot
   7174  1.1  mrg   \egroup
   7175  1.1  mrg   \addgroupbox
   7176  1.1  mrg   \checkinserts
   7177  1.1  mrg }
   7178  1.1  mrg 
   7179  1.1  mrg 
   7180  1.1  mrg % This macro is called at the beginning of all the @example variants,
   7181  1.1  mrg % inside a group.
   7182  1.1  mrg \newdimen\nonfillparindent
   7183  1.1  mrg \def\nonfillstart{%
   7184  1.1  mrg   \aboveenvbreak
   7185  1.1  mrg   \ifdim\hfuzz < 12pt \hfuzz = 12pt \fi % Don't be fussy
   7186  1.1  mrg   \sepspaces % Make spaces be word-separators rather than space tokens.
   7187  1.1  mrg   \let\par = \lisppar % don't ignore blank lines
   7188  1.1  mrg   \obeylines % each line of input is a line of output
   7189  1.1  mrg   \parskip = 0pt
   7190  1.1  mrg   % Turn off paragraph indentation but redefine \indent to emulate
   7191  1.1  mrg   % the normal \indent.
   7192  1.1  mrg   \nonfillparindent=\parindent
   7193  1.1  mrg   \parindent = 0pt
   7194  1.1  mrg   \let\indent\nonfillindent
   7195  1.1  mrg   %
   7196  1.1  mrg   \emergencystretch = 0pt % don't try to avoid overfull boxes
   7197  1.1  mrg   \ifx\nonarrowing\relax
   7198  1.1  mrg     \advance \leftskip by \lispnarrowing
   7199  1.1  mrg     \exdentamount=\lispnarrowing
   7200  1.1  mrg   \else
   7201  1.1  mrg     \let\nonarrowing = \relax
   7202  1.1  mrg   \fi
   7203  1.1  mrg   \let\exdent=\nofillexdent
   7204  1.1  mrg }
   7205  1.1  mrg 
   7206  1.1  mrg \begingroup
   7207  1.1  mrg \obeyspaces
   7208  1.1  mrg % We want to swallow spaces (but not other tokens) after the fake
   7209  1.1  mrg % @indent in our nonfill-environments, where spaces are normally
   7210  1.1  mrg % active and set to @tie, resulting in them not being ignored after
   7211  1.1  mrg % @indent.
   7212  1.1  mrg \gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}%
   7213  1.1  mrg \gdef\nonfillindentcheck{%
   7214  1.1  mrg \ifx\temp %
   7215  1.1  mrg \expandafter\nonfillindentgobble%
   7216  1.1  mrg \else%
   7217  1.1  mrg \leavevmode\nonfillindentbox%
   7218  1.1  mrg \fi%
   7219  1.1  mrg }%
   7220  1.1  mrg \endgroup
   7221  1.1  mrg \def\nonfillindentgobble#1{\nonfillindent}
   7222  1.1  mrg \def\nonfillindentbox{\hbox to \nonfillparindent{\hss}}
   7223  1.1  mrg 
   7224  1.1  mrg % If you want all examples etc. small: @set dispenvsize small.
   7225  1.1  mrg % If you want even small examples the full size: @set dispenvsize nosmall.
   7226  1.1  mrg % This affects the following displayed environments:
   7227  1.1  mrg %    @example, @display, @format, @lisp
   7228  1.1  mrg %
   7229  1.1  mrg \def\smallword{small}
   7230  1.1  mrg \def\nosmallword{nosmall}
   7231  1.1  mrg \let\SETdispenvsize\relax
   7232  1.1  mrg \def\setnormaldispenv{%
   7233  1.1  mrg   \ifx\SETdispenvsize\smallword
   7234  1.1  mrg     % end paragraph for sake of leading, in case document has no blank
   7235  1.1  mrg     % line.  This is redundant with what happens in \aboveenvbreak, but
   7236  1.1  mrg     % we need to do it before changing the fonts, and it's inconvenient
   7237  1.1  mrg     % to change the fonts afterward.
   7238  1.1  mrg     \ifnum \lastpenalty=10000 \else \endgraf \fi
   7239  1.1  mrg     \smallexamplefonts \rm
   7240  1.1  mrg   \fi
   7241  1.1  mrg }
   7242  1.1  mrg \def\setsmalldispenv{%
   7243  1.1  mrg   \ifx\SETdispenvsize\nosmallword
   7244  1.1  mrg   \else
   7245  1.1  mrg     \ifnum \lastpenalty=10000 \else \endgraf \fi
   7246  1.1  mrg     \smallexamplefonts \rm
   7247  1.1  mrg   \fi
   7248  1.1  mrg }
   7249  1.1  mrg 
   7250  1.1  mrg % We often define two environments, @foo and @smallfoo.
   7251  1.1  mrg % Let's do it in one command.  #1 is the env name, #2 the definition.
   7252  1.1  mrg \def\makedispenvdef#1#2{%
   7253  1.1  mrg   \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}%
   7254  1.1  mrg   \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}%
   7255  1.1  mrg   \expandafter\let\csname E#1\endcsname \afterenvbreak
   7256  1.1  mrg   \expandafter\let\csname Esmall#1\endcsname \afterenvbreak
   7257  1.1  mrg }
   7258  1.1  mrg 
   7259  1.1  mrg % Define two environment synonyms (#1 and #2) for an environment.
   7260  1.1  mrg \def\maketwodispenvdef#1#2#3{%
   7261  1.1  mrg   \makedispenvdef{#1}{#3}%
   7262  1.1  mrg   \makedispenvdef{#2}{#3}%
   7263  1.1  mrg }
   7264  1.1  mrg %
   7265  1.1  mrg % @lisp: indented, narrowed, typewriter font;
   7266  1.1  mrg % @example: same as @lisp.
   7267  1.1  mrg %
   7268  1.1  mrg % @smallexample and @smalllisp: use smaller fonts.
   7269  1.1  mrg % Originally contributed by Pavel@xerox.
   7270  1.1  mrg %
   7271  1.1  mrg \maketwodispenvdef{lisp}{example}{%
   7272  1.1  mrg   \nonfillstart
   7273  1.1  mrg   \tt\setupmarkupstyle{example}%
   7274  1.1  mrg   \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
   7275  1.1  mrg   \gobble % eat return
   7276  1.1  mrg }
   7277  1.1  mrg % @display/@smalldisplay: same as @lisp except keep current font.
   7278  1.1  mrg %
   7279  1.1  mrg \makedispenvdef{display}{%
   7280  1.1  mrg   \nonfillstart
   7281  1.1  mrg   \gobble
   7282  1.1  mrg }
   7283  1.1  mrg 
   7284  1.1  mrg % @format/@smallformat: same as @display except don't narrow margins.
   7285  1.1  mrg %
   7286  1.1  mrg \makedispenvdef{format}{%
   7287  1.1  mrg   \let\nonarrowing = t%
   7288  1.1  mrg   \nonfillstart
   7289  1.1  mrg   \gobble
   7290  1.1  mrg }
   7291  1.1  mrg 
   7292  1.1  mrg % @flushleft: same as @format, but doesn't obey \SETdispenvsize.
   7293  1.1  mrg \envdef\flushleft{%
   7294  1.1  mrg   \let\nonarrowing = t%
   7295  1.1  mrg   \nonfillstart
   7296  1.1  mrg   \gobble
   7297  1.1  mrg }
   7298  1.1  mrg \let\Eflushleft = \afterenvbreak
   7299  1.1  mrg 
   7300  1.1  mrg % @flushright.
   7301  1.1  mrg %
   7302  1.1  mrg \envdef\flushright{%
   7303  1.1  mrg   \let\nonarrowing = t%
   7304  1.1  mrg   \nonfillstart
   7305  1.1  mrg   \advance\leftskip by 0pt plus 1fill\relax
   7306  1.1  mrg   \gobble
   7307  1.1  mrg }
   7308  1.1  mrg \let\Eflushright = \afterenvbreak
   7309  1.1  mrg 
   7310  1.1  mrg 
   7311  1.1  mrg % @raggedright does more-or-less normal line breaking but no right
   7312  1.1  mrg % justification.  From plain.tex.
   7313  1.1  mrg \envdef\raggedright{%
   7314  1.1  mrg   \rightskip0pt plus2.4em \spaceskip.3333em \xspaceskip.5em\relax
   7315  1.1  mrg }
   7316  1.1  mrg \let\Eraggedright\par
   7317  1.1  mrg 
   7318  1.1  mrg \envdef\raggedleft{%
   7319  1.1  mrg   \parindent=0pt \leftskip0pt plus2em
   7320  1.1  mrg   \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
   7321  1.1  mrg   \hbadness=10000 % Last line will usually be underfull, so turn off
   7322  1.1  mrg                   % badness reporting.
   7323  1.1  mrg }
   7324  1.1  mrg \let\Eraggedleft\par
   7325  1.1  mrg 
   7326  1.1  mrg \envdef\raggedcenter{%
   7327  1.1  mrg   \parindent=0pt \rightskip0pt plus1em \leftskip0pt plus1em
   7328  1.1  mrg   \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
   7329  1.1  mrg   \hbadness=10000 % Last line will usually be underfull, so turn off
   7330  1.1  mrg                   % badness reporting.
   7331  1.1  mrg }
   7332  1.1  mrg \let\Eraggedcenter\par
   7333  1.1  mrg 
   7334  1.1  mrg 
   7335  1.1  mrg % @quotation does normal linebreaking (hence we can't use \nonfillstart)
   7336  1.1  mrg % and narrows the margins.  We keep \parskip nonzero in general, since
   7337  1.1  mrg % we're doing normal filling.  So, when using \aboveenvbreak and
   7338  1.1  mrg % \afterenvbreak, temporarily make \parskip 0.
   7339  1.1  mrg %
   7340  1.1  mrg \makedispenvdef{quotation}{\quotationstart}
   7341  1.1  mrg %
   7342  1.1  mrg \def\quotationstart{%
   7343  1.1  mrg   \indentedblockstart % same as \indentedblock, but increase right margin too.
   7344  1.1  mrg   \ifx\nonarrowing\relax
   7345  1.1  mrg     \advance\rightskip by \lispnarrowing
   7346  1.1  mrg   \fi
   7347  1.1  mrg   \parsearg\quotationlabel
   7348  1.1  mrg }
   7349  1.1  mrg 
   7350  1.1  mrg % We have retained a nonzero parskip for the environment, since we're
   7351  1.1  mrg % doing normal filling.
   7352  1.1  mrg %
   7353  1.1  mrg \def\Equotation{%
   7354  1.1  mrg   \par
   7355  1.1  mrg   \ifx\quotationauthor\thisisundefined\else
   7356  1.1  mrg     % indent a bit.
   7357  1.1  mrg     \leftline{\kern 2\leftskip \sl ---\quotationauthor}%
   7358  1.1  mrg   \fi
   7359  1.1  mrg   {\parskip=0pt \afterenvbreak}%
   7360  1.1  mrg }
   7361  1.1  mrg \def\Esmallquotation{\Equotation}
   7362  1.1  mrg 
   7363  1.1  mrg % If we're given an argument, typeset it in bold with a colon after.
   7364  1.1  mrg \def\quotationlabel#1{%
   7365  1.1  mrg   \def\temp{#1}%
   7366  1.1  mrg   \ifx\temp\empty \else
   7367  1.1  mrg     {\bf #1: }%
   7368  1.1  mrg   \fi
   7369  1.1  mrg }
   7370  1.1  mrg 
   7371  1.1  mrg % @indentedblock is like @quotation, but indents only on the left and
   7372  1.1  mrg % has no optional argument.
   7373  1.1  mrg %
   7374  1.1  mrg \makedispenvdef{indentedblock}{\indentedblockstart}
   7375  1.1  mrg %
   7376  1.1  mrg \def\indentedblockstart{%
   7377  1.1  mrg   {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
   7378  1.1  mrg   \parindent=0pt
   7379  1.1  mrg   %
   7380  1.1  mrg   % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
   7381  1.1  mrg   \ifx\nonarrowing\relax
   7382  1.1  mrg     \advance\leftskip by \lispnarrowing
   7383  1.1  mrg     \exdentamount = \lispnarrowing
   7384  1.1  mrg   \else
   7385  1.1  mrg     \let\nonarrowing = \relax
   7386  1.1  mrg   \fi
   7387  1.1  mrg }
   7388  1.1  mrg 
   7389  1.1  mrg % Keep a nonzero parskip for the environment, since we're doing normal filling.
   7390  1.1  mrg %
   7391  1.1  mrg \def\Eindentedblock{%
   7392  1.1  mrg   \par
   7393  1.1  mrg   {\parskip=0pt \afterenvbreak}%
   7394  1.1  mrg }
   7395  1.1  mrg \def\Esmallindentedblock{\Eindentedblock}
   7396  1.1  mrg 
   7397  1.1  mrg 
   7398  1.1  mrg % LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
   7399  1.1  mrg % If we want to allow any <char> as delimiter,
   7400  1.1  mrg % we need the curly braces so that makeinfo sees the @verb command, eg:
   7401  1.1  mrg % `@verbx...x' would look like the '@verbx' command.  --janneke (a] gnu.org
   7402  1.1  mrg %
   7403  1.1  mrg % [Knuth]: Donald Ervin Knuth, 1996.  The TeXbook.
   7404  1.1  mrg %
   7405  1.1  mrg % [Knuth] p.344; only we need to do the other characters Texinfo sets
   7406  1.1  mrg % active too.  Otherwise, they get lost as the first character on a
   7407  1.1  mrg % verbatim line.
   7408  1.1  mrg \def\dospecials{%
   7409  1.1  mrg   \do\ \do\\\do\{\do\}\do\$\do\&%
   7410  1.1  mrg   \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~%
   7411  1.1  mrg   \do\<\do\>\do\|\do\@\do+\do\"%
   7412  1.1  mrg   % Don't do the quotes -- if we do, @set txicodequoteundirected and
   7413  1.1  mrg   % @set txicodequotebacktick will not have effect on @verb and
   7414  1.1  mrg   % @verbatim, and ?` and !` ligatures won't get disabled.
   7415  1.1  mrg   %\do\`\do\'%
   7416  1.1  mrg }
   7417  1.1  mrg %
   7418  1.1  mrg % [Knuth] p. 380
   7419  1.1  mrg \def\uncatcodespecials{%
   7420  1.1  mrg   \def\do##1{\catcode`##1=\other}\dospecials}
   7421  1.1  mrg %
   7422  1.1  mrg % Setup for the @verb command.
   7423  1.1  mrg %
   7424  1.1  mrg % Eight spaces for a tab
   7425  1.1  mrg \begingroup
   7426  1.1  mrg   \catcode`\^^I=\active
   7427  1.1  mrg   \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
   7428  1.1  mrg \endgroup
   7429  1.1  mrg %
   7430  1.1  mrg \def\setupverb{%
   7431  1.1  mrg   \tt  % easiest (and conventionally used) font for verbatim
   7432  1.1  mrg   \def\par{\leavevmode\endgraf}%
   7433  1.1  mrg   \setupmarkupstyle{verb}%
   7434  1.1  mrg   \tabeightspaces
   7435  1.1  mrg   % Respect line breaks,
   7436  1.1  mrg   % print special symbols as themselves, and
   7437  1.1  mrg   % make each space count
   7438  1.1  mrg   % must do in this order:
   7439  1.1  mrg   \obeylines \uncatcodespecials \sepspaces
   7440  1.1  mrg }
   7441  1.1  mrg 
   7442  1.1  mrg % Setup for the @verbatim environment
   7443  1.1  mrg %
   7444  1.1  mrg % Real tab expansion.
   7445  1.1  mrg \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
   7446  1.1  mrg %
   7447  1.1  mrg % We typeset each line of the verbatim in an \hbox, so we can handle
   7448  1.1  mrg % tabs.  The \global is in case the verbatim line starts with an accent,
   7449  1.1  mrg % or some other command that starts with a begin-group.  Otherwise, the
   7450  1.1  mrg % entire \verbbox would disappear at the corresponding end-group, before
   7451  1.1  mrg % it is typeset.  Meanwhile, we can't have nested verbatim commands
   7452  1.1  mrg % (can we?), so the \global won't be overwriting itself.
   7453  1.1  mrg \newbox\verbbox
   7454  1.1  mrg \def\starttabbox{\global\setbox\verbbox=\hbox\bgroup}
   7455  1.1  mrg %
   7456  1.1  mrg \begingroup
   7457  1.1  mrg   \catcode`\^^I=\active
   7458  1.1  mrg   \gdef\tabexpand{%
   7459  1.1  mrg     \catcode`\^^I=\active
   7460  1.1  mrg     \def^^I{\leavevmode\egroup
   7461  1.1  mrg       \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab
   7462  1.1  mrg       \divide\dimen\verbbox by\tabw
   7463  1.1  mrg       \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw
   7464  1.1  mrg       \advance\dimen\verbbox by\tabw  % advance to next multiple of \tabw
   7465  1.1  mrg       \wd\verbbox=\dimen\verbbox \box\verbbox \starttabbox
   7466  1.1  mrg     }%
   7467  1.1  mrg   }
   7468  1.1  mrg \endgroup
   7469  1.1  mrg 
   7470  1.1  mrg % start the verbatim environment.
   7471  1.1  mrg \def\setupverbatim{%
   7472  1.1  mrg   \let\nonarrowing = t%
   7473  1.1  mrg   \nonfillstart
   7474  1.1  mrg   \tt % easiest (and conventionally used) font for verbatim
   7475  1.1  mrg   % The \leavevmode here is for blank lines.  Otherwise, we would
   7476  1.1  mrg   % never \starttabbox and the \egroup would end verbatim mode.
   7477  1.1  mrg   \def\par{\leavevmode\egroup\box\verbbox\endgraf}%
   7478  1.1  mrg   \tabexpand
   7479  1.1  mrg   \setupmarkupstyle{verbatim}%
   7480  1.1  mrg   % Respect line breaks,
   7481  1.1  mrg   % print special symbols as themselves, and
   7482  1.1  mrg   % make each space count.
   7483  1.1  mrg   % Must do in this order:
   7484  1.1  mrg   \obeylines \uncatcodespecials \sepspaces
   7485  1.1  mrg   \everypar{\starttabbox}%
   7486  1.1  mrg }
   7487  1.1  mrg 
   7488  1.1  mrg % Do the @verb magic: verbatim text is quoted by unique
   7489  1.1  mrg % delimiter characters.  Before first delimiter expect a
   7490  1.1  mrg % right brace, after last delimiter expect closing brace:
   7491  1.1  mrg %
   7492  1.1  mrg %    \def\doverb'{'<char>#1<char>'}'{#1}
   7493  1.1  mrg %
   7494  1.1  mrg % [Knuth] p. 382; only eat outer {}
   7495  1.1  mrg \begingroup
   7496  1.1  mrg   \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other
   7497  1.1  mrg   \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
   7498  1.1  mrg \endgroup
   7499  1.1  mrg %
   7500  1.1  mrg \def\verb{\begingroup\setupverb\doverb}
   7501  1.1  mrg %
   7502  1.1  mrg %
   7503  1.1  mrg % Do the @verbatim magic: define the macro \doverbatim so that
   7504  1.1  mrg % the (first) argument ends when '@end verbatim' is reached, ie:
   7505  1.1  mrg %
   7506  1.1  mrg %     \def\doverbatim#1@end verbatim{#1}
   7507  1.1  mrg %
   7508  1.1  mrg % For Texinfo it's a lot easier than for LaTeX,
   7509  1.1  mrg % because texinfo's \verbatim doesn't stop at '\end{verbatim}':
   7510  1.1  mrg % we need not redefine '\', '{' and '}'.
   7511  1.1  mrg %
   7512  1.1  mrg % Inspired by LaTeX's verbatim command set [latex.ltx]
   7513  1.1  mrg %
   7514  1.1  mrg \begingroup
   7515  1.1  mrg   \catcode`\ =\active
   7516  1.1  mrg   \obeylines %
   7517  1.1  mrg   % ignore everything up to the first ^^M, that's the newline at the end
   7518  1.1  mrg   % of the @verbatim input line itself.  Otherwise we get an extra blank
   7519  1.1  mrg   % line in the output.
   7520  1.1  mrg   \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}%
   7521  1.1  mrg   % We really want {...\end verbatim} in the body of the macro, but
   7522  1.1  mrg   % without the active space; thus we have to use \xdef and \gobble.
   7523  1.1  mrg \endgroup
   7524  1.1  mrg %
   7525  1.1  mrg \envdef\verbatim{%
   7526  1.1  mrg     \setupverbatim\doverbatim
   7527  1.1  mrg }
   7528  1.1  mrg \let\Everbatim = \afterenvbreak
   7529  1.1  mrg 
   7530  1.1  mrg 
   7531  1.1  mrg % @verbatiminclude FILE - insert text of file in verbatim environment.
   7532  1.1  mrg %
   7533  1.1  mrg \def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude}
   7534  1.1  mrg %
   7535  1.1  mrg \def\doverbatiminclude#1{%
   7536  1.1  mrg   {%
   7537  1.1  mrg     \makevalueexpandable
   7538  1.1  mrg     \setupverbatim
   7539  1.1  mrg     {%
   7540  1.1  mrg       \indexnofonts       % Allow `@@' and other weird things in file names.
   7541  1.1  mrg       \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}%
   7542  1.1  mrg       \edef\tmp{\noexpand\input #1 }
   7543  1.1  mrg       \expandafter
   7544  1.1  mrg     }\tmp
   7545  1.1  mrg     \afterenvbreak
   7546  1.1  mrg   }%
   7547  1.1  mrg }
   7548  1.1  mrg 
   7549  1.1  mrg % @copying ... @end copying.
   7550  1.1  mrg % Save the text away for @insertcopying later.
   7551  1.1  mrg %
   7552  1.1  mrg % We save the uninterpreted tokens, rather than creating a box.
   7553  1.1  mrg % Saving the text in a box would be much easier, but then all the
   7554  1.1  mrg % typesetting commands (@smallbook, font changes, etc.) have to be done
   7555  1.1  mrg % beforehand -- and a) we want @copying to be done first in the source
   7556  1.1  mrg % file; b) letting users define the frontmatter in as flexible order as
   7557  1.1  mrg % possible is desirable.
   7558  1.1  mrg %
   7559  1.1  mrg \def\copying{\checkenv{}\begingroup\scanargctxt\docopying}
   7560  1.1  mrg \def\docopying#1@end copying{\endgroup\def\copyingtext{#1}}
   7561  1.1  mrg %
   7562  1.1  mrg \def\insertcopying{%
   7563  1.1  mrg   \begingroup
   7564  1.1  mrg     \parindent = 0pt  % paragraph indentation looks wrong on title page
   7565  1.1  mrg     \scanexp\copyingtext
   7566  1.1  mrg   \endgroup
   7567  1.1  mrg }
   7568  1.1  mrg 
   7569  1.1  mrg 
   7570  1.1  mrg \message{defuns,}
   7571  1.1  mrg % @defun etc.
   7572  1.1  mrg 
   7573  1.1  mrg \newskip\defbodyindent \defbodyindent=.4in
   7574  1.1  mrg \newskip\defargsindent \defargsindent=50pt
   7575  1.1  mrg \newskip\deflastargmargin \deflastargmargin=18pt
   7576  1.1  mrg \newcount\defunpenalty
   7577  1.1  mrg 
   7578  1.1  mrg % Start the processing of @deffn:
   7579  1.1  mrg \def\startdefun{%
   7580  1.1  mrg   \ifnum\lastpenalty<10000
   7581  1.1  mrg     \medbreak
   7582  1.1  mrg     \defunpenalty=10003 % Will keep this @deffn together with the
   7583  1.1  mrg                         % following @def command, see below.
   7584  1.1  mrg   \else
   7585  1.1  mrg     % If there are two @def commands in a row, we'll have a \nobreak,
   7586  1.1  mrg     % which is there to keep the function description together with its
   7587  1.1  mrg     % header.  But if there's nothing but headers, we need to allow a
   7588  1.1  mrg     % break somewhere.  Check specifically for penalty 10002, inserted
   7589  1.1  mrg     % by \printdefunline, instead of 10000, since the sectioning
   7590  1.1  mrg     % commands also insert a nobreak penalty, and we don't want to allow
   7591  1.1  mrg     % a break between a section heading and a defun.
   7592  1.1  mrg     %
   7593  1.1  mrg     % As a further refinement, we avoid "club" headers by signalling
   7594  1.1  mrg     % with penalty of 10003 after the very first @deffn in the
   7595  1.1  mrg     % sequence (see above), and penalty of 10002 after any following
   7596  1.1  mrg     % @def command.
   7597  1.1  mrg     \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi
   7598  1.1  mrg     %
   7599  1.1  mrg     % Similarly, after a section heading, do not allow a break.
   7600  1.1  mrg     % But do insert the glue.
   7601  1.1  mrg     \medskip  % preceded by discardable penalty, so not a breakpoint
   7602  1.1  mrg   \fi
   7603  1.1  mrg   %
   7604  1.1  mrg   \parindent=0in
   7605  1.1  mrg   \advance\leftskip by \defbodyindent
   7606  1.1  mrg   \exdentamount=\defbodyindent
   7607  1.1  mrg }
   7608  1.1  mrg 
   7609  1.1  mrg \def\dodefunx#1{%
   7610  1.1  mrg   % First, check whether we are in the right environment:
   7611  1.1  mrg   \checkenv#1%
   7612  1.1  mrg   %
   7613  1.1  mrg   % As above, allow line break if we have multiple x headers in a row.
   7614  1.1  mrg   % It's not a great place, though.
   7615  1.1  mrg   \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi
   7616  1.1  mrg   %
   7617  1.1  mrg   % And now, it's time to reuse the body of the original defun:
   7618  1.1  mrg   \expandafter\gobbledefun#1%
   7619  1.1  mrg }
   7620  1.1  mrg \def\gobbledefun#1\startdefun{}
   7621  1.1  mrg 
   7622  1.1  mrg % \printdefunline \deffnheader{text}
   7623  1.1  mrg %
   7624  1.1  mrg \def\printdefunline#1#2{%
   7625  1.1  mrg   \begingroup
   7626  1.1  mrg     % call \deffnheader:
   7627  1.1  mrg     #1#2 \endheader
   7628  1.1  mrg     % common ending:
   7629  1.1  mrg     \interlinepenalty = 10000
   7630  1.1  mrg     \advance\rightskip by 0pt plus 1fil\relax
   7631  1.1  mrg     \endgraf
   7632  1.1  mrg     \nobreak\vskip -\parskip
   7633  1.1  mrg     \penalty\defunpenalty  % signal to \startdefun and \dodefunx
   7634  1.1  mrg     % Some of the @defun-type tags do not enable magic parentheses,
   7635  1.1  mrg     % rendering the following check redundant.  But we don't optimize.
   7636  1.1  mrg     \checkparencounts
   7637  1.1  mrg   \endgroup
   7638  1.1  mrg }
   7639  1.1  mrg 
   7640  1.1  mrg \def\Edefun{\endgraf\medbreak}
   7641  1.1  mrg 
   7642  1.1  mrg % \makedefun{deffn} creates \deffn, \deffnx and \Edeffn;
   7643  1.1  mrg % the only thing remaining is to define \deffnheader.
   7644  1.1  mrg %
   7645  1.1  mrg \def\makedefun#1{%
   7646  1.1  mrg   \expandafter\let\csname E#1\endcsname = \Edefun
   7647  1.1  mrg   \edef\temp{\noexpand\domakedefun
   7648  1.1  mrg     \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}%
   7649  1.1  mrg   \temp
   7650  1.1  mrg }
   7651  1.1  mrg 
   7652  1.1  mrg % \domakedefun \deffn \deffnx \deffnheader { (defn. of \deffnheader) }
   7653  1.1  mrg %
   7654  1.1  mrg % Define \deffn and \deffnx, without parameters.
   7655  1.1  mrg % \deffnheader has to be defined explicitly.
   7656  1.1  mrg %
   7657  1.1  mrg \def\domakedefun#1#2#3{%
   7658  1.1  mrg   \envdef#1{%
   7659  1.1  mrg     \startdefun
   7660  1.1  mrg     \doingtypefnfalse    % distinguish typed functions from all else
   7661  1.1  mrg     \parseargusing\activeparens{\printdefunline#3}%
   7662  1.1  mrg   }%
   7663  1.1  mrg   \def#2{\dodefunx#1}%
   7664  1.1  mrg   \def#3%
   7665  1.1  mrg }
   7666  1.1  mrg 
   7667  1.1  mrg \newif\ifdoingtypefn       % doing typed function?
   7668  1.1  mrg \newif\ifrettypeownline    % typeset return type on its own line?
   7669  1.1  mrg 
   7670  1.1  mrg % @deftypefnnewline on|off says whether the return type of typed functions
   7671  1.1  mrg % are printed on their own line.  This affects @deftypefn, @deftypefun,
   7672  1.1  mrg % @deftypeop, and @deftypemethod.
   7673  1.1  mrg %
   7674  1.1  mrg \parseargdef\deftypefnnewline{%
   7675  1.1  mrg   \def\temp{#1}%
   7676  1.1  mrg   \ifx\temp\onword
   7677  1.1  mrg     \expandafter\let\csname SETtxideftypefnnl\endcsname
   7678  1.1  mrg       = \empty
   7679  1.1  mrg   \else\ifx\temp\offword
   7680  1.1  mrg     \expandafter\let\csname SETtxideftypefnnl\endcsname
   7681  1.1  mrg       = \relax
   7682  1.1  mrg   \else
   7683  1.1  mrg     \errhelp = \EMsimple
   7684  1.1  mrg     \errmessage{Unknown @txideftypefnnl value `\temp',
   7685  1.1  mrg                 must be on|off}%
   7686  1.1  mrg   \fi\fi
   7687  1.1  mrg }
   7688  1.1  mrg 
   7689  1.1  mrg % \dosubind {index}{topic}{subtopic}
   7690  1.1  mrg %
   7691  1.1  mrg % If SUBTOPIC is present, precede it with a space, and call \doind.
   7692  1.1  mrg % (At some time during the 20th century, this made a two-level entry in an
   7693  1.1  mrg % index such as the operation index.  Nobody seemed to notice the change in
   7694  1.1  mrg % behaviour though.)
   7695  1.1  mrg \def\dosubind#1#2#3{%
   7696  1.1  mrg   \def\thirdarg{#3}%
   7697  1.1  mrg   \ifx\thirdarg\empty
   7698  1.1  mrg     \doind{#1}{#2}%
   7699  1.1  mrg   \else
   7700  1.1  mrg     \doind{#1}{#2\space#3}%
   7701  1.1  mrg   \fi
   7702  1.1  mrg }
   7703  1.1  mrg 
   7704  1.1  mrg % Untyped functions:
   7705  1.1  mrg 
   7706  1.1  mrg % @deffn category name args
   7707  1.1  mrg \makedefun{deffn}{\deffngeneral{}}
   7708  1.1  mrg 
   7709  1.1  mrg % @deffn category class name args
   7710  1.1  mrg \makedefun{defop}#1 {\defopon{#1\ \putwordon}}
   7711  1.1  mrg 
   7712  1.1  mrg % \defopon {category on}class name args
   7713  1.1  mrg \def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
   7714  1.1  mrg 
   7715  1.1  mrg % \deffngeneral {subind}category name args
   7716  1.1  mrg %
   7717  1.1  mrg \def\deffngeneral#1#2 #3 #4\endheader{%
   7718  1.1  mrg   \dosubind{fn}{\code{#3}}{#1}%
   7719  1.1  mrg   \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}%
   7720  1.1  mrg }
   7721  1.1  mrg 
   7722  1.1  mrg % Typed functions:
   7723  1.1  mrg 
   7724  1.1  mrg % @deftypefn category type name args
   7725  1.1  mrg \makedefun{deftypefn}{\deftypefngeneral{}}
   7726  1.1  mrg 
   7727  1.1  mrg % @deftypeop category class type name args
   7728  1.1  mrg \makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}}
   7729  1.1  mrg 
   7730  1.1  mrg % \deftypeopon {category on}class type name args
   7731  1.1  mrg \def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
   7732  1.1  mrg 
   7733  1.1  mrg % \deftypefngeneral {subind}category type name args
   7734  1.1  mrg %
   7735  1.1  mrg \def\deftypefngeneral#1#2 #3 #4 #5\endheader{%
   7736  1.1  mrg   \dosubind{fn}{\code{#4}}{#1}%
   7737  1.1  mrg   \doingtypefntrue
   7738  1.1  mrg   \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
   7739  1.1  mrg }
   7740  1.1  mrg 
   7741  1.1  mrg % Typed variables:
   7742  1.1  mrg 
   7743  1.1  mrg % @deftypevr category type var args
   7744  1.1  mrg \makedefun{deftypevr}{\deftypecvgeneral{}}
   7745  1.1  mrg 
   7746  1.1  mrg % @deftypecv category class type var args
   7747  1.1  mrg \makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}}
   7748  1.1  mrg 
   7749  1.1  mrg % \deftypecvof {category of}class type var args
   7750  1.1  mrg \def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} }
   7751  1.1  mrg 
   7752  1.1  mrg % \deftypecvgeneral {subind}category type var args
   7753  1.1  mrg %
   7754  1.1  mrg \def\deftypecvgeneral#1#2 #3 #4 #5\endheader{%
   7755  1.1  mrg   \dosubind{vr}{\code{#4}}{#1}%
   7756  1.1  mrg   \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
   7757  1.1  mrg }
   7758  1.1  mrg 
   7759  1.1  mrg % Untyped variables:
   7760  1.1  mrg 
   7761  1.1  mrg % @defvr category var args
   7762  1.1  mrg \makedefun{defvr}#1 {\deftypevrheader{#1} {} }
   7763  1.1  mrg 
   7764  1.1  mrg % @defcv category class var args
   7765  1.1  mrg \makedefun{defcv}#1 {\defcvof{#1\ \putwordof}}
   7766  1.1  mrg 
   7767  1.1  mrg % \defcvof {category of}class var args
   7768  1.1  mrg \def\defcvof#1#2 {\deftypecvof{#1}#2 {} }
   7769  1.1  mrg 
   7770  1.1  mrg % Types:
   7771  1.1  mrg 
   7772  1.1  mrg % @deftp category name args
   7773  1.1  mrg \makedefun{deftp}#1 #2 #3\endheader{%
   7774  1.1  mrg   \doind{tp}{\code{#2}}%
   7775  1.1  mrg   \defname{#1}{}{#2}\defunargs{#3\unskip}%
   7776  1.1  mrg }
   7777  1.1  mrg 
   7778  1.1  mrg % Remaining @defun-like shortcuts:
   7779  1.1  mrg \makedefun{defun}{\deffnheader{\putwordDeffunc} }
   7780  1.1  mrg \makedefun{defmac}{\deffnheader{\putwordDefmac} }
   7781  1.1  mrg \makedefun{defspec}{\deffnheader{\putwordDefspec} }
   7782  1.1  mrg \makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} }
   7783  1.1  mrg \makedefun{defvar}{\defvrheader{\putwordDefvar} }
   7784  1.1  mrg \makedefun{defopt}{\defvrheader{\putwordDefopt} }
   7785  1.1  mrg \makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} }
   7786  1.1  mrg \makedefun{defmethod}{\defopon\putwordMethodon}
   7787  1.1  mrg \makedefun{deftypemethod}{\deftypeopon\putwordMethodon}
   7788  1.1  mrg \makedefun{defivar}{\defcvof\putwordInstanceVariableof}
   7789  1.1  mrg \makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof}
   7790  1.1  mrg 
   7791  1.1  mrg % \defname, which formats the name of the @def (not the args).
   7792  1.1  mrg % #1 is the category, such as "Function".
   7793  1.1  mrg % #2 is the return type, if any.
   7794  1.1  mrg % #3 is the function name.
   7795  1.1  mrg %
   7796  1.1  mrg % We are followed by (but not passed) the arguments, if any.
   7797  1.1  mrg %
   7798  1.1  mrg \def\defname#1#2#3{%
   7799  1.1  mrg   \par
   7800  1.1  mrg   % Get the values of \leftskip and \rightskip as they were outside the @def...
   7801  1.1  mrg   \advance\leftskip by -\defbodyindent
   7802  1.1  mrg   %
   7803  1.1  mrg   % Determine if we are typesetting the return type of a typed function
   7804  1.1  mrg   % on a line by itself.
   7805  1.1  mrg   \rettypeownlinefalse
   7806  1.1  mrg   \ifdoingtypefn  % doing a typed function specifically?
   7807  1.1  mrg     % then check user option for putting return type on its own line:
   7808  1.1  mrg     \expandafter\ifx\csname SETtxideftypefnnl\endcsname\relax \else
   7809  1.1  mrg       \rettypeownlinetrue
   7810  1.1  mrg     \fi
   7811  1.1  mrg   \fi
   7812  1.1  mrg   %
   7813  1.1  mrg   % How we'll format the category name.  Putting it in brackets helps
   7814  1.1  mrg   % distinguish it from the body text that may end up on the next line
   7815  1.1  mrg   % just below it.
   7816  1.1  mrg   \def\temp{#1}%
   7817  1.1  mrg   \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi}
   7818  1.1  mrg   %
   7819  1.1  mrg   % Figure out line sizes for the paragraph shape.  We'll always have at
   7820  1.1  mrg   % least two.
   7821  1.1  mrg   \tempnum = 2
   7822  1.1  mrg   %
   7823  1.1  mrg   % The first line needs space for \box0; but if \rightskip is nonzero,
   7824  1.1  mrg   % we need only space for the part of \box0 which exceeds it:
   7825  1.1  mrg   \dimen0=\hsize  \advance\dimen0 by -\wd0  \advance\dimen0 by \rightskip
   7826  1.1  mrg   %
   7827  1.1  mrg   % If doing a return type on its own line, we'll have another line.
   7828  1.1  mrg   \ifrettypeownline
   7829  1.1  mrg     \advance\tempnum by 1
   7830  1.1  mrg     \def\maybeshapeline{0in \hsize}%
   7831  1.1  mrg   \else
   7832  1.1  mrg     \def\maybeshapeline{}%
   7833  1.1  mrg   \fi
   7834  1.1  mrg   %
   7835  1.1  mrg   % The continuations:
   7836  1.1  mrg   \dimen2=\hsize  \advance\dimen2 by -\defargsindent
   7837  1.1  mrg   %
   7838  1.1  mrg   % The final paragraph shape:
   7839  1.1  mrg   \parshape \tempnum  0in \dimen0  \maybeshapeline  \defargsindent \dimen2
   7840  1.1  mrg   %
   7841  1.1  mrg   % Put the category name at the right margin.
   7842  1.1  mrg   \noindent
   7843  1.1  mrg   \hbox to 0pt{%
   7844  1.1  mrg     \hfil\box0 \kern-\hsize
   7845  1.1  mrg     % \hsize has to be shortened this way:
   7846  1.1  mrg     \kern\leftskip
   7847  1.1  mrg     % Intentionally do not respect \rightskip, since we need the space.
   7848  1.1  mrg   }%
   7849  1.1  mrg   %
   7850  1.1  mrg   % Allow all lines to be underfull without complaint:
   7851  1.1  mrg   \tolerance=10000 \hbadness=10000
   7852  1.1  mrg   \exdentamount=\defbodyindent
   7853  1.1  mrg   {%
   7854  1.1  mrg     % defun fonts. We use typewriter by default (used to be bold) because:
   7855  1.1  mrg     % . we're printing identifiers, they should be in tt in principle.
   7856  1.1  mrg     % . in languages with many accents, such as Czech or French, it's
   7857  1.1  mrg     %   common to leave accents off identifiers.  The result looks ok in
   7858  1.1  mrg     %   tt, but exceedingly strange in rm.
   7859  1.1  mrg     % . we don't want -- and --- to be treated as ligatures.
   7860  1.1  mrg     % . this still does not fix the ?` and !` ligatures, but so far no
   7861  1.1  mrg     %   one has made identifiers using them :).
   7862  1.1  mrg     \df \tt
   7863  1.1  mrg     \def\temp{#2}% text of the return type
   7864  1.1  mrg     \ifx\temp\empty\else
   7865  1.1  mrg       \tclose{\temp}% typeset the return type
   7866  1.1  mrg       \ifrettypeownline
   7867  1.1  mrg         % put return type on its own line; prohibit line break following:
   7868  1.1  mrg         \hfil\vadjust{\nobreak}\break
   7869  1.1  mrg       \else
   7870  1.1  mrg         \space  % type on same line, so just followed by a space
   7871  1.1  mrg       \fi
   7872  1.1  mrg     \fi           % no return type
   7873  1.1  mrg     #3% output function name
   7874  1.1  mrg   }%
   7875  1.1  mrg   {\rm\enskip}% hskip 0.5 em of \rmfont
   7876  1.1  mrg   %
   7877  1.1  mrg   \boldbrax
   7878  1.1  mrg   % arguments will be output next, if any.
   7879  1.1  mrg }
   7880  1.1  mrg 
   7881  1.1  mrg % Print arguments in slanted roman (not ttsl), inconsistently with using
   7882  1.1  mrg % tt for the name.  This is because literal text is sometimes needed in
   7883  1.1  mrg % the argument list (groff manual), and ttsl and tt are not very
   7884  1.1  mrg % distinguishable.  Prevent hyphenation at `-' chars.
   7885  1.1  mrg %
   7886  1.1  mrg \def\defunargs#1{%
   7887  1.1  mrg   % use sl by default (not ttsl),
   7888  1.1  mrg   % tt for the names.
   7889  1.1  mrg   \df \sl \hyphenchar\font=0
   7890  1.1  mrg   %
   7891  1.1  mrg   % On the other hand, if an argument has two dashes (for instance), we
   7892  1.1  mrg   % want a way to get ttsl.  We used to recommend @var for that, so
   7893  1.1  mrg   % leave the code in, but it's strange for @var to lead to typewriter.
   7894  1.1  mrg   % Nowadays we recommend @code, since the difference between a ttsl hyphen
   7895  1.1  mrg   % and a tt hyphen is pretty tiny.  @code also disables ?` !`.
   7896  1.1  mrg   \def\var##1{{\setupmarkupstyle{var}\ttslanted{##1}}}%
   7897  1.1  mrg   #1%
   7898  1.1  mrg   \sl\hyphenchar\font=45
   7899  1.1  mrg }
   7900  1.1  mrg 
   7901  1.1  mrg % We want ()&[] to print specially on the defun line.
   7902  1.1  mrg %
   7903  1.1  mrg \def\activeparens{%
   7904  1.1  mrg   \catcode`\(=\active \catcode`\)=\active
   7905  1.1  mrg   \catcode`\[=\active \catcode`\]=\active
   7906  1.1  mrg   \catcode`\&=\active
   7907  1.1  mrg }
   7908  1.1  mrg 
   7909  1.1  mrg % Make control sequences which act like normal parenthesis chars.
   7910  1.1  mrg \let\lparen = ( \let\rparen = )
   7911  1.1  mrg 
   7912  1.1  mrg % Be sure that we always have a definition for `(', etc.  For example,
   7913  1.1  mrg % if the fn name has parens in it, \boldbrax will not be in effect yet,
   7914  1.1  mrg % so TeX would otherwise complain about undefined control sequence.
   7915  1.1  mrg {
   7916  1.1  mrg   \activeparens
   7917  1.1  mrg   \global\let(=\lparen \global\let)=\rparen
   7918  1.1  mrg   \global\let[=\lbrack \global\let]=\rbrack
   7919  1.1  mrg   \global\let& = \&
   7920  1.1  mrg 
   7921  1.1  mrg   \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
   7922  1.1  mrg   \gdef\magicamp{\let&=\amprm}
   7923  1.1  mrg }
   7924  1.1  mrg \let\ampchar\&
   7925  1.1  mrg 
   7926  1.1  mrg \newcount\parencount
   7927  1.1  mrg 
   7928  1.1  mrg % If we encounter &foo, then turn on ()-hacking afterwards
   7929  1.1  mrg \newif\ifampseen
   7930  1.1  mrg \def\amprm#1 {\ampseentrue{\bf\&#1 }}
   7931  1.1  mrg 
   7932  1.1  mrg \def\parenfont{%
   7933  1.1  mrg   \ifampseen
   7934  1.1  mrg     % At the first level, print parens in roman,
   7935  1.1  mrg     % otherwise use the default font.
   7936  1.1  mrg     \ifnum \parencount=1 \rm \fi
   7937  1.1  mrg   \else
   7938  1.1  mrg     % The \sf parens (in \boldbrax) actually are a little bolder than
   7939  1.1  mrg     % the contained text.  This is especially needed for [ and ] .
   7940  1.1  mrg     \sf
   7941  1.1  mrg   \fi
   7942  1.1  mrg }
   7943  1.1  mrg \def\infirstlevel#1{%
   7944  1.1  mrg   \ifampseen
   7945  1.1  mrg     \ifnum\parencount=1
   7946  1.1  mrg       #1%
   7947  1.1  mrg     \fi
   7948  1.1  mrg   \fi
   7949  1.1  mrg }
   7950  1.1  mrg \def\bfafterword#1 {#1 \bf}
   7951  1.1  mrg 
   7952  1.1  mrg \def\opnr{%
   7953  1.1  mrg   \global\advance\parencount by 1
   7954  1.1  mrg   {\parenfont(}%
   7955  1.1  mrg   \infirstlevel \bfafterword
   7956  1.1  mrg }
   7957  1.1  mrg \def\clnr{%
   7958  1.1  mrg   {\parenfont)}%
   7959  1.1  mrg   \infirstlevel \sl
   7960  1.1  mrg   \global\advance\parencount by -1
   7961  1.1  mrg }
   7962  1.1  mrg 
   7963  1.1  mrg \newcount\brackcount
   7964  1.1  mrg \def\lbrb{%
   7965  1.1  mrg   \global\advance\brackcount by 1
   7966  1.1  mrg   {\bf[}%
   7967  1.1  mrg }
   7968  1.1  mrg \def\rbrb{%
   7969  1.1  mrg   {\bf]}%
   7970  1.1  mrg   \global\advance\brackcount by -1
   7971  1.1  mrg }
   7972  1.1  mrg 
   7973  1.1  mrg \def\checkparencounts{%
   7974  1.1  mrg   \ifnum\parencount=0 \else \badparencount \fi
   7975  1.1  mrg   \ifnum\brackcount=0 \else \badbrackcount \fi
   7976  1.1  mrg }
   7977  1.1  mrg % these should not use \errmessage; the glibc manual, at least, actually
   7978  1.1  mrg % has such constructs (when documenting function pointers).
   7979  1.1  mrg \def\badparencount{%
   7980  1.1  mrg   \message{Warning: unbalanced parentheses in @def...}%
   7981  1.1  mrg   \global\parencount=0
   7982  1.1  mrg }
   7983  1.1  mrg \def\badbrackcount{%
   7984  1.1  mrg   \message{Warning: unbalanced square brackets in @def...}%
   7985  1.1  mrg   \global\brackcount=0
   7986  1.1  mrg }
   7987  1.1  mrg 
   7988  1.1  mrg 
   7989  1.1  mrg \message{macros,}
   7990  1.1  mrg % @macro.
   7991  1.1  mrg 
   7992  1.1  mrg % To do this right we need a feature of e-TeX, \scantokens,
   7993  1.1  mrg % which we arrange to emulate with a temporary file in ordinary TeX.
   7994  1.1  mrg \ifx\eTeXversion\thisisundefined
   7995  1.1  mrg   \newwrite\macscribble
   7996  1.1  mrg   \def\scantokens#1{%
   7997  1.1  mrg     \toks0={#1}%
   7998  1.1  mrg     \immediate\openout\macscribble=\jobname.tmp
   7999  1.1  mrg     \immediate\write\macscribble{\the\toks0}%
   8000  1.1  mrg     \immediate\closeout\macscribble
   8001  1.1  mrg     \input \jobname.tmp
   8002  1.1  mrg   }
   8003  1.1  mrg \fi
   8004  1.1  mrg 
   8005  1.1  mrg % Used at the time of macro expansion.
   8006  1.1  mrg % Argument is macro body with arguments substituted
   8007  1.1  mrg \def\scanmacro#1{%
   8008  1.1  mrg   \newlinechar`\^^M
   8009  1.1  mrg   \def\xeatspaces{\eatspaces}%
   8010  1.1  mrg   %
   8011  1.1  mrg   % Process the macro body under the current catcode regime.
   8012  1.1  mrg   \scantokens{#1@comment}%
   8013  1.1  mrg   %
   8014  1.1  mrg   % The \comment is to remove the \newlinechar added by \scantokens, and
   8015  1.1  mrg   % can be noticed by \parsearg.  Note \c isn't used because this means cedilla
   8016  1.1  mrg   % in math mode.
   8017  1.1  mrg }
   8018  1.1  mrg 
   8019  1.1  mrg % Used for copying and captions
   8020  1.1  mrg \def\scanexp#1{%
   8021  1.1  mrg   \expandafter\scanmacro\expandafter{#1}%
   8022  1.1  mrg }
   8023  1.1  mrg 
   8024  1.1  mrg \newcount\paramno   % Count of parameters
   8025  1.1  mrg \newtoks\macname    % Macro name
   8026  1.1  mrg \newif\ifrecursive  % Is it recursive?
   8027  1.1  mrg 
   8028  1.1  mrg % List of all defined macros in the form
   8029  1.1  mrg %    \commondummyword\macro1\commondummyword\macro2...
   8030  1.1  mrg % Currently is also contains all @aliases; the list can be split
   8031  1.1  mrg % if there is a need.
   8032  1.1  mrg \def\macrolist{}
   8033  1.1  mrg 
   8034  1.1  mrg % Add the macro to \macrolist
   8035  1.1  mrg \def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname}
   8036  1.1  mrg \def\addtomacrolistxxx#1{%
   8037  1.1  mrg      \toks0 = \expandafter{\macrolist\commondummyword#1}%
   8038  1.1  mrg      \xdef\macrolist{\the\toks0}%
   8039  1.1  mrg }
   8040  1.1  mrg 
   8041  1.1  mrg % Utility routines.
   8042  1.1  mrg % This does \let #1 = #2, with \csnames; that is,
   8043  1.1  mrg %   \let \csname#1\endcsname = \csname#2\endcsname
   8044  1.1  mrg % (except of course we have to play expansion games).
   8045  1.1  mrg %
   8046  1.1  mrg \def\cslet#1#2{%
   8047  1.1  mrg   \expandafter\let
   8048  1.1  mrg   \csname#1\expandafter\endcsname
   8049  1.1  mrg   \csname#2\endcsname
   8050  1.1  mrg }
   8051  1.1  mrg 
   8052  1.1  mrg % Trim leading and trailing spaces off a string.
   8053  1.1  mrg % Concepts from aro-bend problem 15 (see CTAN).
   8054  1.1  mrg {\catcode`\@=11
   8055  1.1  mrg \gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
   8056  1.1  mrg \gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
   8057  1.1  mrg \gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
   8058  1.1  mrg \def\unbrace#1{#1}
   8059  1.1  mrg \unbrace{\gdef\trim@@@ #1 } #2@{#1}
   8060  1.1  mrg }
   8061  1.1  mrg 
   8062  1.1  mrg % Trim a single trailing ^^M off a string.
   8063  1.1  mrg {\catcode`\^^M=\other \catcode`\Q=3%
   8064  1.1  mrg \gdef\eatcr #1{\eatcra #1Q^^MQ}%
   8065  1.1  mrg \gdef\eatcra#1^^MQ{\eatcrb#1Q}%
   8066  1.1  mrg \gdef\eatcrb#1Q#2Q{#1}%
   8067  1.1  mrg }
   8068  1.1  mrg 
   8069  1.1  mrg % Macro bodies are absorbed as an argument in a context where
   8070  1.1  mrg % all characters are catcode 10, 11 or 12, except \ which is active
   8071  1.1  mrg % (as in normal texinfo). It is necessary to change the definition of \
   8072  1.1  mrg % to recognize macro arguments; this is the job of \mbodybackslash.
   8073  1.1  mrg %
   8074  1.1  mrg % Non-ASCII encodings make 8-bit characters active, so un-activate
   8075  1.1  mrg % them to avoid their expansion.  Must do this non-globally, to
   8076  1.1  mrg % confine the change to the current group.
   8077  1.1  mrg %
   8078  1.1  mrg % It's necessary to have hard CRs when the macro is executed. This is
   8079  1.1  mrg % done by making ^^M (\endlinechar) catcode 12 when reading the macro
   8080  1.1  mrg % body, and then making it the \newlinechar in \scanmacro.
   8081  1.1  mrg %
   8082  1.1  mrg \def\scanctxt{% used as subroutine
   8083  1.1  mrg   \catcode`\"=\other
   8084  1.1  mrg   \catcode`\+=\other
   8085  1.1  mrg   \catcode`\<=\other
   8086  1.1  mrg   \catcode`\>=\other
   8087  1.1  mrg   \catcode`\^=\other
   8088  1.1  mrg   \catcode`\_=\other
   8089  1.1  mrg   \catcode`\|=\other
   8090  1.1  mrg   \catcode`\~=\other
   8091  1.1  mrg   \passthroughcharstrue
   8092  1.1  mrg }
   8093  1.1  mrg 
   8094  1.1  mrg \def\scanargctxt{% used for copying and captions, not macros.
   8095  1.1  mrg   \scanctxt
   8096  1.1  mrg   \catcode`\@=\other
   8097  1.1  mrg   \catcode`\\=\other
   8098  1.1  mrg   \catcode`\^^M=\other
   8099  1.1  mrg }
   8100  1.1  mrg 
   8101  1.1  mrg \def\macrobodyctxt{% used for @macro definitions
   8102  1.1  mrg   \scanctxt
   8103  1.1  mrg   \catcode`\ =\other
   8104  1.1  mrg   \catcode`\@=\other
   8105  1.1  mrg   \catcode`\{=\other
   8106  1.1  mrg   \catcode`\}=\other
   8107  1.1  mrg   \catcode`\^^M=\other
   8108  1.1  mrg   \usembodybackslash
   8109  1.1  mrg }
   8110  1.1  mrg 
   8111  1.1  mrg % Used when scanning braced macro arguments.  Note, however, that catcode
   8112  1.1  mrg % changes here are ineffectual if the macro invocation was nested inside
   8113  1.1  mrg % an argument to another Texinfo command.
   8114  1.1  mrg \def\macroargctxt{%
   8115  1.1  mrg   \scanctxt
   8116  1.1  mrg   \catcode`\ =\active
   8117  1.1  mrg   \catcode`\@=\other
   8118  1.1  mrg   \catcode`\^^M=\other
   8119  1.1  mrg   \catcode`\\=\active
   8120  1.1  mrg }
   8121  1.1  mrg 
   8122  1.1  mrg \def\macrolineargctxt{% used for whole-line arguments without braces
   8123  1.1  mrg   \scanctxt
   8124  1.1  mrg   \catcode`\@=\other
   8125  1.1  mrg   \catcode`\{=\other
   8126  1.1  mrg   \catcode`\}=\other
   8127  1.1  mrg }
   8128  1.1  mrg 
   8129  1.1  mrg % \mbodybackslash is the definition of \ in @macro bodies.
   8130  1.1  mrg % It maps \foo\ => \csname macarg.foo\endcsname => #N
   8131  1.1  mrg % where N is the macro parameter number.
   8132  1.1  mrg % We define \csname macarg.\endcsname to be \realbackslash, so
   8133  1.1  mrg % \\ in macro replacement text gets you a backslash.
   8134  1.1  mrg %
   8135  1.1  mrg {\catcode`@=0 @catcode`@\=@active
   8136  1.1  mrg  @gdef@usembodybackslash{@let\=@mbodybackslash}
   8137  1.1  mrg  @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
   8138  1.1  mrg }
   8139  1.1  mrg \expandafter\def\csname macarg.\endcsname{\realbackslash}
   8140  1.1  mrg 
   8141  1.1  mrg \def\margbackslash#1{\char`\#1 }
   8142  1.1  mrg 
   8143  1.1  mrg \def\macro{\recursivefalse\parsearg\macroxxx}
   8144  1.1  mrg \def\rmacro{\recursivetrue\parsearg\macroxxx}
   8145  1.1  mrg 
   8146  1.1  mrg \def\macroxxx#1{%
   8147  1.1  mrg   \getargs{#1}% now \macname is the macname and \argl the arglist
   8148  1.1  mrg   \ifx\argl\empty       % no arguments
   8149  1.1  mrg      \paramno=0\relax
   8150  1.1  mrg   \else
   8151  1.1  mrg      \expandafter\parsemargdef \argl;%
   8152  1.1  mrg      \if\paramno>256\relax
   8153  1.1  mrg        \ifx\eTeXversion\thisisundefined
   8154  1.1  mrg          \errhelp = \EMsimple
   8155  1.1  mrg          \errmessage{You need eTeX to compile a file with macros with more than 256 arguments}
   8156  1.1  mrg        \fi
   8157  1.1  mrg      \fi
   8158  1.1  mrg   \fi
   8159  1.1  mrg   \if1\csname ismacro.\the\macname\endcsname
   8160  1.1  mrg      \message{Warning: redefining \the\macname}%
   8161  1.1  mrg   \else
   8162  1.1  mrg      \expandafter\ifx\csname \the\macname\endcsname \relax
   8163  1.1  mrg      \else \errmessage{Macro name \the\macname\space already defined}\fi
   8164  1.1  mrg      \global\cslet{macsave.\the\macname}{\the\macname}%
   8165  1.1  mrg      \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
   8166  1.1  mrg      \addtomacrolist{\the\macname}%
   8167  1.1  mrg   \fi
   8168  1.1  mrg   \begingroup \macrobodyctxt
   8169  1.1  mrg   \ifrecursive \expandafter\parsermacbody
   8170  1.1  mrg   \else \expandafter\parsemacbody
   8171  1.1  mrg   \fi}
   8172  1.1  mrg 
   8173  1.1  mrg \parseargdef\unmacro{%
   8174  1.1  mrg   \if1\csname ismacro.#1\endcsname
   8175  1.1  mrg     \global\cslet{#1}{macsave.#1}%
   8176  1.1  mrg     \global\expandafter\let \csname ismacro.#1\endcsname=0%
   8177  1.1  mrg     % Remove the macro name from \macrolist:
   8178  1.1  mrg     \begingroup
   8179  1.1  mrg       \expandafter\let\csname#1\endcsname \relax
   8180  1.1  mrg       \let\commondummyword\unmacrodo
   8181  1.1  mrg       \xdef\macrolist{\macrolist}%
   8182  1.1  mrg     \endgroup
   8183  1.1  mrg   \else
   8184  1.1  mrg     \errmessage{Macro #1 not defined}%
   8185  1.1  mrg   \fi
   8186  1.1  mrg }
   8187  1.1  mrg 
   8188  1.1  mrg % Called by \do from \dounmacro on each macro.  The idea is to omit any
   8189  1.1  mrg % macro definitions that have been changed to \relax.
   8190  1.1  mrg %
   8191  1.1  mrg \def\unmacrodo#1{%
   8192  1.1  mrg   \ifx #1\relax
   8193  1.1  mrg     % remove this
   8194  1.1  mrg   \else
   8195  1.1  mrg     \noexpand\commondummyword \noexpand#1%
   8196  1.1  mrg   \fi
   8197  1.1  mrg }
   8198  1.1  mrg 
   8199  1.1  mrg % \getargs -- Parse the arguments to a @macro line.  Set \macname to
   8200  1.1  mrg % the name of the macro, and \argl to the braced argument list.
   8201  1.1  mrg \def\getargs#1{\getargsxxx#1{}}
   8202  1.1  mrg \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
   8203  1.1  mrg \def\getmacname#1 #2\relax{\macname={#1}}
   8204  1.1  mrg \def\getmacargs#1{\def\argl{#1}}
   8205  1.1  mrg % This made use of the feature that if the last token of a
   8206  1.1  mrg % <parameter list> is #, then the preceding argument is delimited by
   8207  1.1  mrg % an opening brace, and that opening brace is not consumed.
   8208  1.1  mrg 
   8209  1.1  mrg % Parse the optional {params} list to @macro or @rmacro.
   8210  1.1  mrg % Set \paramno to the number of arguments,
   8211  1.1  mrg % and \paramlist to a parameter text for the macro (e.g. #1,#2,#3 for a
   8212  1.1  mrg % three-param macro.)  Define \macarg.BLAH for each BLAH in the params
   8213  1.1  mrg % list to some hook where the argument is to be expanded.  If there are
   8214  1.1  mrg % less than 10 arguments that hook is to be replaced by ##N where N
   8215  1.1  mrg % is the position in that list, that is to say the macro arguments are to be
   8216  1.1  mrg % defined `a la TeX in the macro body.
   8217  1.1  mrg %
   8218  1.1  mrg % That gets used by \mbodybackslash (above).
   8219  1.1  mrg %
   8220  1.1  mrg % If there are 10 or more arguments, a different technique is used: see
   8221  1.1  mrg % \parsemmanyargdef.
   8222  1.1  mrg %
   8223  1.1  mrg \def\parsemargdef#1;{%
   8224  1.1  mrg   \paramno=0\def\paramlist{}%
   8225  1.1  mrg   \let\hash\relax
   8226  1.1  mrg   % \hash is redefined to `#' later to get it into definitions
   8227  1.1  mrg   \let\xeatspaces\relax
   8228  1.1  mrg   \parsemargdefxxx#1,;,%
   8229  1.1  mrg   \ifnum\paramno<10\relax\else
   8230  1.1  mrg     \paramno0\relax
   8231  1.1  mrg     \parsemmanyargdef@@#1,;,% 10 or more arguments
   8232  1.1  mrg   \fi
   8233  1.1  mrg }
   8234  1.1  mrg \def\parsemargdefxxx#1,{%
   8235  1.1  mrg   \if#1;\let\next=\relax
   8236  1.1  mrg   \else \let\next=\parsemargdefxxx
   8237  1.1  mrg     \advance\paramno by 1
   8238  1.1  mrg     \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
   8239  1.1  mrg         {\xeatspaces{\hash\the\paramno}}%
   8240  1.1  mrg     \edef\paramlist{\paramlist\hash\the\paramno,}%
   8241  1.1  mrg   \fi\next}
   8242  1.1  mrg 
   8243  1.1  mrg % \parsemacbody, \parsermacbody
   8244  1.1  mrg %
   8245  1.1  mrg % Read recursive and nonrecursive macro bodies. (They're different since
   8246  1.1  mrg % rec and nonrec macros end differently.)
   8247  1.1  mrg %
   8248  1.1  mrg % We are in \macrobodyctxt, and the \xdef causes backslashshes in the macro
   8249  1.1  mrg % body to be transformed.
   8250  1.1  mrg % Set \macrobody to the body of the macro, and call \defmacro.
   8251  1.1  mrg %
   8252  1.1  mrg {\catcode`\ =\other\long\gdef\parsemacbody#1@end macro{%
   8253  1.1  mrg \xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}%
   8254  1.1  mrg {\catcode`\ =\other\long\gdef\parsermacbody#1@end rmacro{%
   8255  1.1  mrg \xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}%
   8256  1.1  mrg 
   8257  1.1  mrg % Make @ a letter, so that we can make private-to-Texinfo macro names.
   8258  1.1  mrg \edef\texiatcatcode{\the\catcode`\@}
   8259  1.1  mrg \catcode `@=11\relax
   8260  1.1  mrg 
   8261  1.1  mrg %%%%%%%%%%%%%% Code for > 10 arguments only   %%%%%%%%%%%%%%%%%%
   8262  1.1  mrg 
   8263  1.1  mrg % If there are 10 or more arguments, a different technique is used, where the
   8264  1.1  mrg % hook remains in the body, and when macro is to be expanded the body is
   8265  1.1  mrg % processed again to replace the arguments.
   8266  1.1  mrg %
   8267  1.1  mrg % In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the
   8268  1.1  mrg % argument N value and then \edef the body (nothing else will expand because of
   8269  1.1  mrg % the catcode regime under which the body was input).
   8270  1.1  mrg %
   8271  1.1  mrg % If you compile with TeX (not eTeX), and you have macros with 10 or more
   8272  1.1  mrg % arguments, no macro can have more than 256 arguments (else error).
   8273  1.1  mrg %
   8274  1.1  mrg % In case that there are 10 or more arguments we parse again the arguments
   8275  1.1  mrg % list to set new definitions for the \macarg.BLAH macros corresponding to
   8276  1.1  mrg % each BLAH argument. It was anyhow needed to parse already once this list
   8277  1.1  mrg % in order to count the arguments, and as macros with at most 9 arguments
   8278  1.1  mrg % are by far more frequent than macro with 10 or more arguments, defining
   8279  1.1  mrg % twice the \macarg.BLAH macros does not cost too much processing power.
   8280  1.1  mrg \def\parsemmanyargdef@@#1,{%
   8281  1.1  mrg   \if#1;\let\next=\relax
   8282  1.1  mrg   \else
   8283  1.1  mrg     \let\next=\parsemmanyargdef@@
   8284  1.1  mrg     \edef\tempb{\eatspaces{#1}}%
   8285  1.1  mrg     \expandafter\def\expandafter\tempa
   8286  1.1  mrg        \expandafter{\csname macarg.\tempb\endcsname}%
   8287  1.1  mrg     % Note that we need some extra \noexpand\noexpand, this is because we
   8288  1.1  mrg     % don't want \the  to be expanded in the \parsermacbody  as it uses an
   8289  1.1  mrg     % \xdef .
   8290  1.1  mrg     \expandafter\edef\tempa
   8291  1.1  mrg       {\noexpand\noexpand\noexpand\the\toks\the\paramno}%
   8292  1.1  mrg     \advance\paramno by 1\relax
   8293  1.1  mrg   \fi\next}
   8294  1.1  mrg 
   8295  1.1  mrg 
   8296  1.1  mrg \let\endargs@\relax
   8297  1.1  mrg \let\nil@\relax
   8298  1.1  mrg \def\nilm@{\nil@}%
   8299  1.1  mrg \long\def\nillm@{\nil@}%
   8300  1.1  mrg 
   8301  1.1  mrg % This macro is expanded during the Texinfo macro expansion, not during its
   8302  1.1  mrg % definition.  It gets all the arguments' values and assigns them to macros
   8303  1.1  mrg % macarg.ARGNAME
   8304  1.1  mrg %
   8305  1.1  mrg % #1 is the macro name
   8306  1.1  mrg % #2 is the list of argument names
   8307  1.1  mrg % #3 is the list of argument values
   8308  1.1  mrg \def\getargvals@#1#2#3{%
   8309  1.1  mrg   \def\macargdeflist@{}%
   8310  1.1  mrg   \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion.
   8311  1.1  mrg   \def\paramlist{#2,\nil@}%
   8312  1.1  mrg   \def\macroname{#1}%
   8313  1.1  mrg   \begingroup
   8314  1.1  mrg   \macroargctxt
   8315  1.1  mrg   \def\argvaluelist{#3,\nil@}%
   8316  1.1  mrg   \def\@tempa{#3}%
   8317  1.1  mrg   \ifx\@tempa\empty
   8318  1.1  mrg     \setemptyargvalues@
   8319  1.1  mrg   \else
   8320  1.1  mrg     \getargvals@@
   8321  1.1  mrg   \fi
   8322  1.1  mrg }
   8323  1.1  mrg \def\getargvals@@{%
   8324  1.1  mrg   \ifx\paramlist\nilm@
   8325  1.1  mrg       % Some sanity check needed here that \argvaluelist is also empty.
   8326  1.1  mrg       \ifx\argvaluelist\nillm@
   8327  1.1  mrg       \else
   8328  1.1  mrg         \errhelp = \EMsimple
   8329  1.1  mrg         \errmessage{Too many arguments in macro `\macroname'!}%
   8330  1.1  mrg       \fi
   8331  1.1  mrg       \let\next\macargexpandinbody@
   8332  1.1  mrg   \else
   8333  1.1  mrg     \ifx\argvaluelist\nillm@
   8334  1.1  mrg        % No more arguments values passed to macro.  Set remaining named-arg
   8335  1.1  mrg        % macros to empty.
   8336  1.1  mrg        \let\next\setemptyargvalues@
   8337  1.1  mrg     \else
   8338  1.1  mrg       % pop current arg name into \@tempb
   8339  1.1  mrg       \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}%
   8340  1.1  mrg       \expandafter\@tempa\expandafter{\paramlist}%
   8341  1.1  mrg        % pop current argument value into \@tempc
   8342  1.1  mrg       \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}%
   8343  1.1  mrg       \expandafter\@tempa\expandafter{\argvaluelist}%
   8344  1.1  mrg        % Here \@tempb is the current arg name and \@tempc is the current arg value.
   8345  1.1  mrg        % First place the new argument macro definition into \@tempd
   8346  1.1  mrg        \expandafter\macname\expandafter{\@tempc}%
   8347  1.1  mrg        \expandafter\let\csname macarg.\@tempb\endcsname\relax
   8348  1.1  mrg        \expandafter\def\expandafter\@tempe\expandafter{%
   8349  1.1  mrg          \csname macarg.\@tempb\endcsname}%
   8350  1.1  mrg        \edef\@tempd{\long\def\@tempe{\the\macname}}%
   8351  1.1  mrg        \push@\@tempd\macargdeflist@
   8352  1.1  mrg        \let\next\getargvals@@
   8353  1.1  mrg     \fi
   8354  1.1  mrg   \fi
   8355  1.1  mrg   \next
   8356  1.1  mrg }
   8357  1.1  mrg 
   8358  1.1  mrg \def\push@#1#2{%
   8359  1.1  mrg   \expandafter\expandafter\expandafter\def
   8360  1.1  mrg   \expandafter\expandafter\expandafter#2%
   8361  1.1  mrg   \expandafter\expandafter\expandafter{%
   8362  1.1  mrg   \expandafter#1#2}%
   8363  1.1  mrg }
   8364  1.1  mrg 
   8365  1.1  mrg % Replace arguments by their values in the macro body, and place the result
   8366  1.1  mrg % in macro \@tempa.
   8367  1.1  mrg %
   8368  1.1  mrg \def\macvalstoargs@{%
   8369  1.1  mrg   %  To do this we use the property that token registers that are \the'ed
   8370  1.1  mrg   % within an \edef  expand only once. So we are going to place all argument
   8371  1.1  mrg   % values into respective token registers.
   8372  1.1  mrg   %
   8373  1.1  mrg   % First we save the token context, and initialize argument numbering.
   8374  1.1  mrg   \begingroup
   8375  1.1  mrg     \paramno0\relax
   8376  1.1  mrg     % Then, for each argument number #N, we place the corresponding argument
   8377  1.1  mrg     % value into a new token list register \toks#N
   8378  1.1  mrg     \expandafter\putargsintokens@\saveparamlist@,;,%
   8379  1.1  mrg     % Then, we expand the body so that argument are replaced by their
   8380  1.1  mrg     % values. The trick for values not to be expanded themselves is that they
   8381  1.1  mrg     % are within tokens and that tokens expand only once in an \edef .
   8382  1.1  mrg     \edef\@tempc{\csname mac.\macroname .body\endcsname}%
   8383  1.1  mrg     % Now we restore the token stack pointer to free the token list registers
   8384  1.1  mrg     % which we have used, but we make sure that expanded body is saved after
   8385  1.1  mrg     % group.
   8386  1.1  mrg     \expandafter
   8387  1.1  mrg   \endgroup
   8388  1.1  mrg   \expandafter\def\expandafter\@tempa\expandafter{\@tempc}%
   8389  1.1  mrg   }
   8390  1.1  mrg 
   8391  1.1  mrg % Define the named-macro outside of this group and then close this group.
   8392  1.1  mrg %
   8393  1.1  mrg \def\macargexpandinbody@{%
   8394  1.1  mrg   \expandafter
   8395  1.1  mrg   \endgroup
   8396  1.1  mrg   \macargdeflist@
   8397  1.1  mrg   % First the replace in body the macro arguments by their values, the result
   8398  1.1  mrg   % is in \@tempa .
   8399  1.1  mrg   \macvalstoargs@
   8400  1.1  mrg   % Then we point at the \norecurse or \gobble (for recursive) macro value
   8401  1.1  mrg   % with \@tempb .
   8402  1.1  mrg   \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname
   8403  1.1  mrg   % Depending on whether it is recursive or not, we need some tailing
   8404  1.1  mrg   % \egroup .
   8405  1.1  mrg   \ifx\@tempb\gobble
   8406  1.1  mrg      \let\@tempc\relax
   8407  1.1  mrg   \else
   8408  1.1  mrg      \let\@tempc\egroup
   8409  1.1  mrg   \fi
   8410  1.1  mrg   % And now we do the real job:
   8411  1.1  mrg   \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}%
   8412  1.1  mrg   \@tempd
   8413  1.1  mrg }
   8414  1.1  mrg 
   8415  1.1  mrg \def\putargsintokens@#1,{%
   8416  1.1  mrg   \if#1;\let\next\relax
   8417  1.1  mrg   \else
   8418  1.1  mrg     \let\next\putargsintokens@
   8419  1.1  mrg     % First we allocate the new token list register, and give it a temporary
   8420  1.1  mrg     % alias \@tempb .
   8421  1.1  mrg     \toksdef\@tempb\the\paramno
   8422  1.1  mrg     % Then we place the argument value into that token list register.
   8423  1.1  mrg     \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname
   8424  1.1  mrg     \expandafter\@tempb\expandafter{\@tempa}%
   8425  1.1  mrg     \advance\paramno by 1\relax
   8426  1.1  mrg   \fi
   8427  1.1  mrg   \next
   8428  1.1  mrg }
   8429  1.1  mrg 
   8430  1.1  mrg % Trailing missing arguments are set to empty.
   8431  1.1  mrg %
   8432  1.1  mrg \def\setemptyargvalues@{%
   8433  1.1  mrg   \ifx\paramlist\nilm@
   8434  1.1  mrg     \let\next\macargexpandinbody@
   8435  1.1  mrg   \else
   8436  1.1  mrg     \expandafter\setemptyargvaluesparser@\paramlist\endargs@
   8437  1.1  mrg     \let\next\setemptyargvalues@
   8438  1.1  mrg   \fi
   8439  1.1  mrg   \next
   8440  1.1  mrg }
   8441  1.1  mrg 
   8442  1.1  mrg \def\setemptyargvaluesparser@#1,#2\endargs@{%
   8443  1.1  mrg   \expandafter\def\expandafter\@tempa\expandafter{%
   8444  1.1  mrg     \expandafter\def\csname macarg.#1\endcsname{}}%
   8445  1.1  mrg   \push@\@tempa\macargdeflist@
   8446  1.1  mrg   \def\paramlist{#2}%
   8447  1.1  mrg }
   8448  1.1  mrg 
   8449  1.1  mrg % #1 is the element target macro
   8450  1.1  mrg % #2 is the list macro
   8451  1.1  mrg % #3,#4\endargs@ is the list value
   8452  1.1  mrg \def\pop@#1#2#3,#4\endargs@{%
   8453  1.1  mrg    \def#1{#3}%
   8454  1.1  mrg    \def#2{#4}%
   8455  1.1  mrg }
   8456  1.1  mrg \long\def\longpop@#1#2#3,#4\endargs@{%
   8457  1.1  mrg    \long\def#1{#3}%
   8458  1.1  mrg    \long\def#2{#4}%
   8459  1.1  mrg }
   8460  1.1  mrg 
   8461  1.1  mrg 
   8462  1.1  mrg %%%%%%%%%%%%%% End of code for > 10 arguments %%%%%%%%%%%%%%%%%%
   8463  1.1  mrg 
   8464  1.1  mrg 
   8465  1.1  mrg % This defines a Texinfo @macro or @rmacro, called by \parsemacbody.
   8466  1.1  mrg %    \macrobody has the body of the macro in it, with placeholders for
   8467  1.1  mrg % its parameters, looking like "\xeatspaces{\hash 1}".
   8468  1.1  mrg %    \paramno is the number of parameters
   8469  1.1  mrg %    \paramlist is a TeX parameter text, e.g. "#1,#2,#3,"
   8470  1.1  mrg % There are four cases: macros of zero, one, up to nine, and many arguments.
   8471  1.1  mrg % \xdef is used so that macro definitions will survive the file
   8472  1.1  mrg % they're defined in: @include reads the file inside a group.
   8473  1.1  mrg %
   8474  1.1  mrg \def\defmacro{%
   8475  1.1  mrg   \let\hash=##% convert placeholders to macro parameter chars
   8476  1.1  mrg   \ifnum\paramno=1
   8477  1.1  mrg     \def\xeatspaces##1{##1}%
   8478  1.1  mrg     % This removes the pair of braces around the argument.  We don't
   8479  1.1  mrg     % use \eatspaces, because this can cause ends of lines to be lost
   8480  1.1  mrg     % when the argument to \eatspaces is read, leading to line-based
   8481  1.1  mrg     % commands like "@itemize" not being read correctly.
   8482  1.1  mrg   \else
   8483  1.1  mrg     \let\xeatspaces\relax % suppress expansion
   8484  1.1  mrg   \fi
   8485  1.1  mrg   \ifcase\paramno
   8486  1.1  mrg   % 0
   8487  1.1  mrg     \expandafter\xdef\csname\the\macname\endcsname{%
   8488  1.1  mrg       \bgroup
   8489  1.1  mrg         \noexpand\spaceisspace
   8490  1.1  mrg         \noexpand\endlineisspace
   8491  1.1  mrg         \noexpand\expandafter % skip any whitespace after the macro name.
   8492  1.1  mrg         \expandafter\noexpand\csname\the\macname @@@\endcsname}%
   8493  1.1  mrg     \expandafter\xdef\csname\the\macname @@@\endcsname{%
   8494  1.1  mrg       \egroup
   8495  1.1  mrg       \noexpand\scanmacro{\macrobody}}%
   8496  1.1  mrg   \or % 1
   8497  1.1  mrg     \expandafter\xdef\csname\the\macname\endcsname{%
   8498  1.1  mrg        \bgroup
   8499  1.1  mrg        \noexpand\braceorline
   8500  1.1  mrg        \expandafter\noexpand\csname\the\macname @@@\endcsname}%
   8501  1.1  mrg     \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
   8502  1.1  mrg       \egroup
   8503  1.1  mrg       \noexpand\scanmacro{\macrobody}%
   8504  1.1  mrg       }%
   8505  1.1  mrg   \else % at most 9
   8506  1.1  mrg     \ifnum\paramno<10\relax
   8507  1.1  mrg       % @MACNAME sets the context for reading the macro argument
   8508  1.1  mrg       % @MACNAME@@ gets the argument, processes backslashes and appends a
   8509  1.1  mrg       % comma.
   8510  1.1  mrg       % @MACNAME@@@ removes braces surrounding the argument list.
   8511  1.1  mrg       % @MACNAME@@@@ scans the macro body with arguments substituted.
   8512  1.1  mrg       \expandafter\xdef\csname\the\macname\endcsname{%
   8513  1.1  mrg         \bgroup
   8514  1.1  mrg         \noexpand\expandafter  % This \expandafter skip any spaces after the
   8515  1.1  mrg         \noexpand\macroargctxt % macro before we change the catcode of space.
   8516  1.1  mrg         \noexpand\expandafter
   8517  1.1  mrg         \expandafter\noexpand\csname\the\macname @@\endcsname}%
   8518  1.1  mrg       \expandafter\xdef\csname\the\macname @@\endcsname##1{%
   8519  1.1  mrg           \noexpand\passargtomacro
   8520  1.1  mrg           \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}%
   8521  1.1  mrg       \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
   8522  1.1  mrg           \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}%
   8523  1.1  mrg       \expandafter\expandafter
   8524  1.1  mrg       \expandafter\xdef
   8525  1.1  mrg       \expandafter\expandafter
   8526  1.1  mrg         \csname\the\macname @@@@\endcsname\paramlist{%
   8527  1.1  mrg           \egroup\noexpand\scanmacro{\macrobody}}%
   8528  1.1  mrg     \else % 10 or more:
   8529  1.1  mrg       \expandafter\xdef\csname\the\macname\endcsname{%
   8530  1.1  mrg         \noexpand\getargvals@{\the\macname}{\argl}%
   8531  1.1  mrg       }%
   8532  1.1  mrg       \global\expandafter\let\csname mac.\the\macname .body\endcsname\macrobody
   8533  1.1  mrg       \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble
   8534  1.1  mrg     \fi
   8535  1.1  mrg   \fi}
   8536  1.1  mrg 
   8537  1.1  mrg \catcode `\@\texiatcatcode\relax % end private-to-Texinfo catcodes
   8538  1.1  mrg 
   8539  1.1  mrg \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
   8540  1.1  mrg 
   8541  1.1  mrg 
   8542  1.1  mrg %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8543  1.1  mrg %
   8544  1.1  mrg {\catcode`\@=0 \catcode`\\=13  % We need to manipulate \ so use @ as escape
   8545  1.1  mrg @catcode`@_=11  % private names
   8546  1.1  mrg @catcode`@!=11  % used as argument separator
   8547  1.1  mrg 
   8548  1.1  mrg % \passargtomacro#1#2 -
   8549  1.1  mrg % Call #1 with a list of tokens #2, with any doubled backslashes in #2
   8550  1.1  mrg % compressed to one.
   8551  1.1  mrg %
   8552  1.1  mrg % This implementation works by expansion, and not execution (so we cannot use
   8553  1.1  mrg % \def or similar).  This reduces the risk of this failing in contexts where
   8554  1.1  mrg % complete expansion is done with no execution (for example, in writing out to
   8555  1.1  mrg % an auxiliary file for an index entry).
   8556  1.1  mrg %
   8557  1.1  mrg % State is kept in the input stream: the argument passed to
   8558  1.1  mrg % @look_ahead, @gobble_and_check_finish and @add_segment is
   8559  1.1  mrg %
   8560  1.1  mrg % THE_MACRO ARG_RESULT ! {PENDING_BS} NEXT_TOKEN  (... rest of input)
   8561  1.1  mrg %
   8562  1.1  mrg % where:
   8563  1.1  mrg % THE_MACRO - name of the macro we want to call
   8564  1.1  mrg % ARG_RESULT - argument list we build to pass to that macro
   8565  1.1  mrg % PENDING_BS - either a backslash or nothing
   8566  1.1  mrg % NEXT_TOKEN - used to look ahead in the input stream to see what's coming next
   8567  1.1  mrg 
   8568  1.1  mrg @gdef@passargtomacro#1#2{%
   8569  1.1  mrg   @add_segment #1!{}@relax#2\@_finish\%
   8570  1.1  mrg }
   8571  1.1  mrg @gdef@_finish{@_finishx} @global@let@_finishx@relax
   8572  1.1  mrg 
   8573  1.1  mrg % #1 - THE_MACRO ARG_RESULT
   8574  1.1  mrg % #2 - PENDING_BS
   8575  1.1  mrg % #3 - NEXT_TOKEN
   8576  1.1  mrg % #4 used to look ahead
   8577  1.1  mrg %
   8578  1.1  mrg % If the next token is not a backslash, process the rest of the argument;
   8579  1.1  mrg % otherwise, remove the next token.
   8580  1.1  mrg @gdef@look_ahead#1!#2#3#4{%
   8581  1.1  mrg   @ifx#4\%
   8582  1.1  mrg    @expandafter@gobble_and_check_finish
   8583  1.1  mrg   @else
   8584  1.1  mrg    @expandafter@add_segment
   8585  1.1  mrg   @fi#1!{#2}#4#4%
   8586  1.1  mrg }
   8587  1.1  mrg 
   8588  1.1  mrg % #1 - THE_MACRO ARG_RESULT
   8589  1.1  mrg % #2 - PENDING_BS
   8590  1.1  mrg % #3 - NEXT_TOKEN
   8591  1.1  mrg % #4 should be a backslash, which is gobbled.
   8592  1.1  mrg % #5 looks ahead
   8593  1.1  mrg %
   8594  1.1  mrg % Double backslash found.  Add a single backslash, and look ahead.
   8595  1.1  mrg @gdef@gobble_and_check_finish#1!#2#3#4#5{%
   8596  1.1  mrg   @add_segment#1\!{}#5#5%
   8597  1.1  mrg }
   8598  1.1  mrg 
   8599  1.1  mrg @gdef@is_fi{@fi}
   8600  1.1  mrg 
   8601  1.1  mrg % #1 - THE_MACRO ARG_RESULT
   8602  1.1  mrg % #2 - PENDING_BS
   8603  1.1  mrg % #3 - NEXT_TOKEN
   8604  1.1  mrg % #4 is input stream until next backslash
   8605  1.1  mrg %
   8606  1.1  mrg % Input stream is either at the start of the argument, or just after a
   8607  1.1  mrg % backslash sequence, either a lone backslash, or a doubled backslash.
   8608  1.1  mrg % NEXT_TOKEN contains the first token in the input stream: if it is \finish,
   8609  1.1  mrg % finish; otherwise, append to ARG_RESULT the segment of the argument up until
   8610  1.1  mrg % the next backslash.  PENDING_BACKSLASH contains a backslash to represent
   8611  1.1  mrg % a backslash just before the start of the input stream that has not been
   8612  1.1  mrg % added to ARG_RESULT.
   8613  1.1  mrg @gdef@add_segment#1!#2#3#4\{%
   8614  1.1  mrg @ifx#3@_finish
   8615  1.1  mrg   @call_the_macro#1!%
   8616  1.1  mrg @else
   8617  1.1  mrg   % append the pending backslash to the result, followed by the next segment
   8618  1.1  mrg   @expandafter@is_fi@look_ahead#1#2#4!{\}@fi
   8619  1.1  mrg   % this @fi is discarded by @look_ahead.
   8620  1.1  mrg   % we can't get rid of it with \expandafter because we don't know how
   8621  1.1  mrg   % long #4 is.
   8622  1.1  mrg }
   8623  1.1  mrg 
   8624  1.1  mrg % #1 - THE_MACRO
   8625  1.1  mrg % #2 - ARG_RESULT
   8626  1.1  mrg % #3 discards the res of the conditional in @add_segment, and @is_fi ends the
   8627  1.1  mrg % conditional.
   8628  1.1  mrg @gdef@call_the_macro#1#2!#3@fi{@is_fi #1{#2}}
   8629  1.1  mrg 
   8630  1.1  mrg }
   8631  1.1  mrg %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8632  1.1  mrg 
   8633  1.1  mrg % \braceorline MAC is used for a one-argument macro MAC.  It checks
   8634  1.1  mrg % whether the next non-whitespace character is a {.  It sets the context
   8635  1.1  mrg % for reading the argument (slightly different in the two cases).  Then,
   8636  1.1  mrg % to read the argument, in the whole-line case, it then calls the regular
   8637  1.1  mrg % \parsearg MAC; in the lbrace case, it calls \passargtomacro MAC.
   8638  1.1  mrg %
   8639  1.1  mrg \def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx}
   8640  1.1  mrg \def\braceorlinexxx{%
   8641  1.1  mrg   \ifx\nchar\bgroup
   8642  1.1  mrg     \macroargctxt
   8643  1.1  mrg     \expandafter\passargtomacro
   8644  1.1  mrg   \else
   8645  1.1  mrg     \macrolineargctxt\expandafter\parsearg
   8646  1.1  mrg   \fi \macnamexxx}
   8647  1.1  mrg 
   8648  1.1  mrg 
   8649  1.1  mrg % @alias.
   8650  1.1  mrg % We need some trickery to remove the optional spaces around the equal
   8651  1.1  mrg % sign.  Make them active and then expand them all to nothing.
   8652  1.1  mrg %
   8653  1.1  mrg \def\alias{\parseargusing\obeyspaces\aliasxxx}
   8654  1.1  mrg \def\aliasxxx #1{\aliasyyy#1\relax}
   8655  1.1  mrg \def\aliasyyy #1=#2\relax{%
   8656  1.1  mrg   {%
   8657  1.1  mrg     \expandafter\let\obeyedspace=\empty
   8658  1.1  mrg     \addtomacrolist{#1}%
   8659  1.1  mrg     \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}%
   8660  1.1  mrg   }%
   8661  1.1  mrg   \next
   8662  1.1  mrg }
   8663  1.1  mrg 
   8664  1.1  mrg 
   8665  1.1  mrg \message{cross references,}
   8666  1.1  mrg 
   8667  1.1  mrg \newwrite\auxfile
   8668  1.1  mrg \newif\ifhavexrefs    % True if xref values are known.
   8669  1.1  mrg \newif\ifwarnedxrefs  % True if we warned once that they aren't known.
   8670  1.1  mrg 
   8671  1.1  mrg % @inforef is relatively simple.
   8672  1.1  mrg \def\inforef #1{\inforefzzz #1,,,,**}
   8673  1.1  mrg \def\inforefzzz #1,#2,#3,#4**{%
   8674  1.1  mrg   \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
   8675  1.1  mrg   node \samp{\ignorespaces#1{}}}
   8676  1.1  mrg 
   8677  1.1  mrg % @node's only job in TeX is to define \lastnode, which is used in
   8678  1.1  mrg % cross-references.  The @node line might or might not have commas, and
   8679  1.1  mrg % might or might not have spaces before the first comma, like:
   8680  1.1  mrg % @node foo , bar , ...
   8681  1.1  mrg % We don't want such trailing spaces in the node name.
   8682  1.1  mrg %
   8683  1.1  mrg \parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse}
   8684  1.1  mrg %
   8685  1.1  mrg % also remove a trailing comma, in case of something like this:
   8686  1.1  mrg % @node Help-Cross,  ,  , Cross-refs
   8687  1.1  mrg \def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse}
   8688  1.1  mrg \def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}\omittopnode}
   8689  1.1  mrg 
   8690  1.1  mrg % Used so that the @top node doesn't have to be wrapped in an @ifnottex
   8691  1.1  mrg % conditional.
   8692  1.1  mrg % \doignore goes to more effort to skip nested conditionals but we don't need
   8693  1.1  mrg % that here.
   8694  1.1  mrg \def\omittopnode{%
   8695  1.1  mrg    \ifx\lastnode\wordTop
   8696  1.1  mrg    \expandafter\ignorenode\fi
   8697  1.1  mrg }
   8698  1.1  mrg \def\wordTop{Top}
   8699  1.1  mrg 
   8700  1.1  mrg % Until the next @node or @bye command, divert output to a box that is not
   8701  1.1  mrg % output.
   8702  1.1  mrg \def\ignorenode{\setbox\dummybox\vbox\bgroup\def\node{\egroup\node}%
   8703  1.1  mrg \ignorenodebye
   8704  1.1  mrg }
   8705  1.1  mrg 
   8706  1.1  mrg {\let\bye\relax
   8707  1.1  mrg \gdef\ignorenodebye{\let\bye\ignorenodebyedef}
   8708  1.1  mrg \gdef\ignorenodebyedef{\egroup(`Top' node ignored)\bye}}
   8709  1.1  mrg % The redefinition of \bye here is because it is declared \outer
   8710  1.1  mrg 
   8711  1.1  mrg \let\lastnode=\empty
   8712  1.1  mrg 
   8713  1.1  mrg % Write a cross-reference definition for the current node.  #1 is the
   8714  1.1  mrg % type (Ynumbered, Yappendix, Ynothing).
   8715  1.1  mrg %
   8716  1.1  mrg \def\donoderef#1{%
   8717  1.1  mrg   \ifx\lastnode\empty\else
   8718  1.1  mrg     \setref{\lastnode}{#1}%
   8719  1.1  mrg     \global\let\lastnode=\empty
   8720  1.1  mrg   \fi
   8721  1.1  mrg }
   8722  1.1  mrg 
   8723  1.1  mrg % @anchor{NAME} -- define xref target at arbitrary point.
   8724  1.1  mrg %
   8725  1.1  mrg \newcount\savesfregister
   8726  1.1  mrg %
   8727  1.1  mrg \def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
   8728  1.1  mrg \def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
   8729  1.1  mrg \def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
   8730  1.1  mrg 
   8731  1.1  mrg % \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
   8732  1.1  mrg % anchor), which consists of three parts:
   8733  1.1  mrg % 1) NAME-title - the current sectioning name taken from \currentsection,
   8734  1.1  mrg %                 or the anchor name.
   8735  1.1  mrg % 2) NAME-snt   - section number and type, passed as the SNT arg, or
   8736  1.1  mrg %                 empty for anchors.
   8737  1.1  mrg % 3) NAME-pg    - the page number.
   8738  1.1  mrg %
   8739  1.1  mrg % This is called from \donoderef, \anchor, and \dofloat.  In the case of
   8740  1.1  mrg % floats, there is an additional part, which is not written here:
   8741  1.1  mrg % 4) NAME-lof   - the text as it should appear in a @listoffloats.
   8742  1.1  mrg %
   8743  1.1  mrg \def\setref#1#2{%
   8744  1.1  mrg   \pdfmkdest{#1}%
   8745  1.1  mrg   \iflinks
   8746  1.1  mrg     {%
   8747  1.1  mrg       \requireauxfile
   8748  1.1  mrg       \atdummies  % preserve commands, but don't expand them
   8749  1.1  mrg       % match definition in \xrdef, \refx, \xrefX.
   8750  1.1  mrg       \def\value##1{##1}%
   8751  1.1  mrg       \edef\writexrdef##1##2{%
   8752  1.1  mrg 	\write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef
   8753  1.1  mrg 	  ##1}{##2}}% these are parameters of \writexrdef
   8754  1.1  mrg       }%
   8755  1.1  mrg       \toks0 = \expandafter{\currentsection}%
   8756  1.1  mrg       \immediate \writexrdef{title}{\the\toks0 }%
   8757  1.1  mrg       \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
   8758  1.1  mrg       \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout
   8759  1.1  mrg     }%
   8760  1.1  mrg   \fi
   8761  1.1  mrg }
   8762  1.1  mrg 
   8763  1.1  mrg % @xrefautosectiontitle on|off says whether @section(ing) names are used
   8764  1.1  mrg % automatically in xrefs, if the third arg is not explicitly specified.
   8765  1.1  mrg % This was provided as a "secret" @set xref-automatic-section-title
   8766  1.1  mrg % variable, now it's official.
   8767  1.1  mrg %
   8768  1.1  mrg \parseargdef\xrefautomaticsectiontitle{%
   8769  1.1  mrg   \def\temp{#1}%
   8770  1.1  mrg   \ifx\temp\onword
   8771  1.1  mrg     \expandafter\let\csname SETxref-automatic-section-title\endcsname
   8772  1.1  mrg       = \empty
   8773  1.1  mrg   \else\ifx\temp\offword
   8774  1.1  mrg     \expandafter\let\csname SETxref-automatic-section-title\endcsname
   8775  1.1  mrg       = \relax
   8776  1.1  mrg   \else
   8777  1.1  mrg     \errhelp = \EMsimple
   8778  1.1  mrg     \errmessage{Unknown @xrefautomaticsectiontitle value `\temp',
   8779  1.1  mrg                 must be on|off}%
   8780  1.1  mrg   \fi\fi
   8781  1.1  mrg }
   8782  1.1  mrg 
   8783  1.1  mrg %
   8784  1.1  mrg % @xref, @pxref, and @ref generate cross-references.  For \xrefX, #1 is
   8785  1.1  mrg % the node name, #2 the name of the Info cross-reference, #3 the printed
   8786  1.1  mrg % node name, #4 the name of the Info file, #5 the name of the printed
   8787  1.1  mrg % manual.  All but the node name can be omitted.
   8788  1.1  mrg %
   8789  1.1  mrg \def\pxref{\putwordsee{} \xrefXX}
   8790  1.1  mrg \def\xref{\putwordSee{} \xrefXX}
   8791  1.1  mrg \def\ref{\xrefXX}
   8792  1.1  mrg 
   8793  1.1  mrg \def\xrefXX#1{\def\xrefXXarg{#1}\futurelet\tokenafterxref\xrefXXX}
   8794  1.1  mrg \def\xrefXXX{\expandafter\xrefX\expandafter[\xrefXXarg,,,,,,,]}
   8795  1.1  mrg %
   8796  1.1  mrg \newbox\toprefbox
   8797  1.1  mrg \newbox\printedrefnamebox
   8798  1.1  mrg \newbox\infofilenamebox
   8799  1.1  mrg \newbox\printedmanualbox
   8800  1.1  mrg %
   8801  1.1  mrg \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
   8802  1.1  mrg   \unsepspaces
   8803  1.1  mrg   %
   8804  1.1  mrg   % Get args without leading/trailing spaces.
   8805  1.1  mrg   \def\printedrefname{\ignorespaces #3}%
   8806  1.1  mrg   \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}%
   8807  1.1  mrg   %
   8808  1.1  mrg   \def\infofilename{\ignorespaces #4}%
   8809  1.1  mrg   \setbox\infofilenamebox = \hbox{\infofilename\unskip}%
   8810  1.1  mrg   %
   8811  1.1  mrg   \def\printedmanual{\ignorespaces #5}%
   8812  1.1  mrg   \setbox\printedmanualbox  = \hbox{\printedmanual\unskip}%
   8813  1.1  mrg   %
   8814  1.1  mrg   % If the printed reference name (arg #3) was not explicitly given in
   8815  1.1  mrg   % the @xref, figure out what we want to use.
   8816  1.1  mrg   \ifdim \wd\printedrefnamebox = 0pt
   8817  1.1  mrg     % No printed node name was explicitly given.
   8818  1.1  mrg     \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax
   8819  1.1  mrg       % Not auto section-title: use node name inside the square brackets.
   8820  1.1  mrg       \def\printedrefname{\ignorespaces #1}%
   8821  1.1  mrg     \else
   8822  1.1  mrg       % Auto section-title: use chapter/section title inside
   8823  1.1  mrg       % the square brackets if we have it.
   8824  1.1  mrg       \ifdim \wd\printedmanualbox > 0pt
   8825  1.1  mrg         % It is in another manual, so we don't have it; use node name.
   8826  1.1  mrg         \def\printedrefname{\ignorespaces #1}%
   8827  1.1  mrg       \else
   8828  1.1  mrg         \ifhavexrefs
   8829  1.1  mrg           % We (should) know the real title if we have the xref values.
   8830  1.1  mrg           \def\printedrefname{\refx{#1-title}{}}%
   8831  1.1  mrg         \else
   8832  1.1  mrg           % Otherwise just copy the Info node name.
   8833  1.1  mrg           \def\printedrefname{\ignorespaces #1}%
   8834  1.1  mrg         \fi%
   8835  1.1  mrg       \fi
   8836  1.1  mrg     \fi
   8837  1.1  mrg   \fi
   8838  1.1  mrg   %
   8839  1.1  mrg   % Make link in pdf output.
   8840  1.1  mrg   \ifpdf
   8841  1.1  mrg     % For pdfTeX and LuaTeX
   8842  1.1  mrg     {\indexnofonts
   8843  1.1  mrg      \makevalueexpandable
   8844  1.1  mrg      \turnoffactive
   8845  1.1  mrg      % This expands tokens, so do it after making catcode changes, so _
   8846  1.1  mrg      % etc. don't get their TeX definitions.  This ignores all spaces in
   8847  1.1  mrg      % #4, including (wrongly) those in the middle of the filename.
   8848  1.1  mrg      \getfilename{#4}%
   8849  1.1  mrg      %
   8850  1.1  mrg      % This (wrongly) does not take account of leading or trailing
   8851  1.1  mrg      % spaces in #1, which should be ignored.
   8852  1.1  mrg      \setpdfdestname{#1}%
   8853  1.1  mrg      %
   8854  1.1  mrg      \ifx\pdfdestname\empty
   8855  1.1  mrg        \def\pdfdestname{Top}% no empty targets
   8856  1.1  mrg      \fi
   8857  1.1  mrg      %
   8858  1.1  mrg      \leavevmode
   8859  1.1  mrg      \startlink attr{/Border [0 0 0]}%
   8860  1.1  mrg      \ifnum\filenamelength>0
   8861  1.1  mrg        goto file{\the\filename.pdf} name{\pdfdestname}%
   8862  1.1  mrg      \else
   8863  1.1  mrg        goto name{\pdfmkpgn{\pdfdestname}}%
   8864  1.1  mrg      \fi
   8865  1.1  mrg     }%
   8866  1.1  mrg     \setcolor{\linkcolor}%
   8867  1.1  mrg   \else
   8868  1.1  mrg     \ifx\XeTeXrevision\thisisundefined
   8869  1.1  mrg     \else
   8870  1.1  mrg       % For XeTeX
   8871  1.1  mrg       {\indexnofonts
   8872  1.1  mrg        \makevalueexpandable
   8873  1.1  mrg        \turnoffactive
   8874  1.1  mrg        % This expands tokens, so do it after making catcode changes, so _
   8875  1.1  mrg        % etc. don't get their TeX definitions.  This ignores all spaces in
   8876  1.1  mrg        % #4, including (wrongly) those in the middle of the filename.
   8877  1.1  mrg        \getfilename{#4}%
   8878  1.1  mrg        %
   8879  1.1  mrg        % This (wrongly) does not take account of leading or trailing
   8880  1.1  mrg        % spaces in #1, which should be ignored.
   8881  1.1  mrg        \setpdfdestname{#1}%
   8882  1.1  mrg        %
   8883  1.1  mrg        \ifx\pdfdestname\empty
   8884  1.1  mrg          \def\pdfdestname{Top}% no empty targets
   8885  1.1  mrg        \fi
   8886  1.1  mrg        %
   8887  1.1  mrg        \leavevmode
   8888  1.1  mrg        \ifnum\filenamelength>0
   8889  1.1  mrg          % With default settings,
   8890  1.1  mrg          % XeTeX (xdvipdfmx) replaces link destination names with integers.
   8891  1.1  mrg          % In this case, the replaced destination names of
   8892  1.1  mrg          % remote PDFs are no longer known.  In order to avoid a replacement,
   8893  1.1  mrg          % you can use xdvipdfmx's command line option `-C 0x0010'.
   8894  1.1  mrg          % If you use XeTeX 0.99996+ (TeX Live 2016+),
   8895  1.1  mrg          % this command line option is no longer necessary
   8896  1.1  mrg          % because we can use the `dvipdfmx:config' special.
   8897  1.1  mrg          \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A
   8898  1.1  mrg            << /S /GoToR /F (\the\filename.pdf) /D (\pdfdestname) >> >>}%
   8899  1.1  mrg        \else
   8900  1.1  mrg          \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A
   8901  1.1  mrg            << /S /GoTo /D (\pdfdestname) >> >>}%
   8902  1.1  mrg        \fi
   8903  1.1  mrg       }%
   8904  1.1  mrg       \setcolor{\linkcolor}%
   8905  1.1  mrg     \fi
   8906  1.1  mrg   \fi
   8907  1.1  mrg   {%
   8908  1.1  mrg     % Have to otherify everything special to allow the \csname to
   8909  1.1  mrg     % include an _ in the xref name, etc.
   8910  1.1  mrg     \indexnofonts
   8911  1.1  mrg     \turnoffactive
   8912  1.1  mrg     \def\value##1{##1}%
   8913  1.1  mrg     \expandafter\global\expandafter\let\expandafter\Xthisreftitle
   8914  1.1  mrg       \csname XR#1-title\endcsname
   8915  1.1  mrg   }%
   8916  1.1  mrg   %
   8917  1.1  mrg   % Float references are printed completely differently: "Figure 1.2"
   8918  1.1  mrg   % instead of "[somenode], p.3".  \iffloat distinguishes them by
   8919  1.1  mrg   % \Xthisreftitle being set to a magic string.
   8920  1.1  mrg   \iffloat\Xthisreftitle
   8921  1.1  mrg     % If the user specified the print name (third arg) to the ref,
   8922  1.1  mrg     % print it instead of our usual "Figure 1.2".
   8923  1.1  mrg     \ifdim\wd\printedrefnamebox = 0pt
   8924  1.1  mrg       \refx{#1-snt}{}%
   8925  1.1  mrg     \else
   8926  1.1  mrg       \printedrefname
   8927  1.1  mrg     \fi
   8928  1.1  mrg     %
   8929  1.1  mrg     % If the user also gave the printed manual name (fifth arg), append
   8930  1.1  mrg     % "in MANUALNAME".
   8931  1.1  mrg     \ifdim \wd\printedmanualbox > 0pt
   8932  1.1  mrg       \space \putwordin{} \cite{\printedmanual}%
   8933  1.1  mrg     \fi
   8934  1.1  mrg   \else
   8935  1.1  mrg     % node/anchor (non-float) references.
   8936  1.1  mrg     %
   8937  1.1  mrg     % If we use \unhbox to print the node names, TeX does not insert
   8938  1.1  mrg     % empty discretionaries after hyphens, which means that it will not
   8939  1.1  mrg     % find a line break at a hyphen in a node names.  Since some manuals
   8940  1.1  mrg     % are best written with fairly long node names, containing hyphens,
   8941  1.1  mrg     % this is a loss.  Therefore, we give the text of the node name
   8942  1.1  mrg     % again, so it is as if TeX is seeing it for the first time.
   8943  1.1  mrg     %
   8944  1.1  mrg     \ifdim \wd\printedmanualbox > 0pt
   8945  1.1  mrg       % Cross-manual reference with a printed manual name.
   8946  1.1  mrg       %
   8947  1.1  mrg       \crossmanualxref{\cite{\printedmanual\unskip}}%
   8948  1.1  mrg     %
   8949  1.1  mrg     \else\ifdim \wd\infofilenamebox > 0pt
   8950  1.1  mrg       % Cross-manual reference with only an info filename (arg 4), no
   8951  1.1  mrg       % printed manual name (arg 5).  This is essentially the same as
   8952  1.1  mrg       % the case above; we output the filename, since we have nothing else.
   8953  1.1  mrg       %
   8954  1.1  mrg       \crossmanualxref{\code{\infofilename\unskip}}%
   8955  1.1  mrg     %
   8956  1.1  mrg     \else
   8957  1.1  mrg       % Reference within this manual.
   8958  1.1  mrg       %
   8959  1.1  mrg       % Only output a following space if the -snt ref is nonempty; for
   8960  1.1  mrg       % @unnumbered and @anchor, it won't be.
   8961  1.1  mrg       \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
   8962  1.1  mrg       \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
   8963  1.1  mrg       %
   8964  1.1  mrg       % output the `[mynode]' via the macro below so it can be overridden.
   8965  1.1  mrg       \xrefprintnodename\printedrefname
   8966  1.1  mrg       %
   8967  1.1  mrg       % But we always want a comma and a space:
   8968  1.1  mrg       ,\space
   8969  1.1  mrg       %
   8970  1.1  mrg       % output the `page 3'.
   8971  1.1  mrg       \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
   8972  1.1  mrg       % Add a , if xref followed by a space
   8973  1.1  mrg       \if\space\noexpand\tokenafterxref ,%
   8974  1.1  mrg       \else\ifx\	\tokenafterxref ,% @TAB
   8975  1.1  mrg       \else\ifx\*\tokenafterxref ,%   @*
   8976  1.1  mrg       \else\ifx\ \tokenafterxref ,%   @SPACE
   8977  1.1  mrg       \else\ifx\
   8978  1.1  mrg                 \tokenafterxref ,%    @NL
   8979  1.1  mrg       \else\ifx\tie\tokenafterxref ,% @tie
   8980  1.1  mrg       \fi\fi\fi\fi\fi\fi
   8981  1.1  mrg     \fi\fi
   8982  1.1  mrg   \fi
   8983  1.1  mrg   \endlink
   8984  1.1  mrg \endgroup}
   8985  1.1  mrg 
   8986  1.1  mrg % Output a cross-manual xref to #1.  Used just above (twice).
   8987  1.1  mrg %
   8988  1.1  mrg % Only include the text "Section ``foo'' in" if the foo is neither
   8989  1.1  mrg % missing or Top.  Thus, @xref{,,,foo,The Foo Manual} outputs simply
   8990  1.1  mrg % "see The Foo Manual", the idea being to refer to the whole manual.
   8991  1.1  mrg %
   8992  1.1  mrg % But, this being TeX, we can't easily compare our node name against the
   8993  1.1  mrg % string "Top" while ignoring the possible spaces before and after in
   8994  1.1  mrg % the input.  By adding the arbitrary 7sp below, we make it much less
   8995  1.1  mrg % likely that a real node name would have the same width as "Top" (e.g.,
   8996  1.1  mrg % in a monospaced font).  Hopefully it will never happen in practice.
   8997  1.1  mrg %
   8998  1.1  mrg % For the same basic reason, we retypeset the "Top" at every
   8999  1.1  mrg % reference, since the current font is indeterminate.
   9000  1.1  mrg %
   9001  1.1  mrg \def\crossmanualxref#1{%
   9002  1.1  mrg   \setbox\toprefbox = \hbox{Top\kern7sp}%
   9003  1.1  mrg   \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}%
   9004  1.1  mrg   \ifdim \wd2 > 7sp  % nonempty?
   9005  1.1  mrg     \ifdim \wd2 = \wd\toprefbox \else  % same as Top?
   9006  1.1  mrg       \putwordSection{} ``\printedrefname'' \putwordin{}\space
   9007  1.1  mrg     \fi
   9008  1.1  mrg   \fi
   9009  1.1  mrg   #1%
   9010  1.1  mrg }
   9011  1.1  mrg 
   9012  1.1  mrg % This macro is called from \xrefX for the `[nodename]' part of xref
   9013  1.1  mrg % output.  It's a separate macro only so it can be changed more easily,
   9014  1.1  mrg % since square brackets don't work well in some documents.  Particularly
   9015  1.1  mrg % one that Bob is working on :).
   9016  1.1  mrg %
   9017  1.1  mrg \def\xrefprintnodename#1{[#1]}
   9018  1.1  mrg 
   9019  1.1  mrg % Things referred to by \setref.
   9020  1.1  mrg %
   9021  1.1  mrg \def\Ynothing{}
   9022  1.1  mrg \def\Yomitfromtoc{}
   9023  1.1  mrg \def\Ynumbered{%
   9024  1.1  mrg   \ifnum\secno=0
   9025  1.1  mrg     \putwordChapter@tie \the\chapno
   9026  1.1  mrg   \else \ifnum\subsecno=0
   9027  1.1  mrg     \putwordSection@tie \the\chapno.\the\secno
   9028  1.1  mrg   \else \ifnum\subsubsecno=0
   9029  1.1  mrg     \putwordSection@tie \the\chapno.\the\secno.\the\subsecno
   9030  1.1  mrg   \else
   9031  1.1  mrg     \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno
   9032  1.1  mrg   \fi\fi\fi
   9033  1.1  mrg }
   9034  1.1  mrg \def\Yappendix{%
   9035  1.1  mrg   \ifnum\secno=0
   9036  1.1  mrg      \putwordAppendix@tie @char\the\appendixno{}%
   9037  1.1  mrg   \else \ifnum\subsecno=0
   9038  1.1  mrg      \putwordSection@tie @char\the\appendixno.\the\secno
   9039  1.1  mrg   \else \ifnum\subsubsecno=0
   9040  1.1  mrg     \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno
   9041  1.1  mrg   \else
   9042  1.1  mrg     \putwordSection@tie
   9043  1.1  mrg       @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno
   9044  1.1  mrg   \fi\fi\fi
   9045  1.1  mrg }
   9046  1.1  mrg 
   9047  1.1  mrg % \refx{NAME}{SUFFIX} - reference a cross-reference string named NAME.  SUFFIX
   9048  1.1  mrg % is output afterwards if non-empty.
   9049  1.1  mrg \def\refx#1#2{%
   9050  1.1  mrg   \requireauxfile
   9051  1.1  mrg   {%
   9052  1.1  mrg     \indexnofonts
   9053  1.1  mrg     \turnoffactive
   9054  1.1  mrg     \def\value##1{##1}%
   9055  1.1  mrg     \expandafter\global\expandafter\let\expandafter\thisrefX
   9056  1.1  mrg       \csname XR#1\endcsname
   9057  1.1  mrg   }%
   9058  1.1  mrg   \ifx\thisrefX\relax
   9059  1.1  mrg     % If not defined, say something at least.
   9060  1.1  mrg     \angleleft un\-de\-fined\angleright
   9061  1.1  mrg     \iflinks
   9062  1.1  mrg       \ifhavexrefs
   9063  1.1  mrg         {\toks0 = {#1}% avoid expansion of possibly-complex value
   9064  1.1  mrg          \message{\linenumber Undefined cross reference `\the\toks0'.}}%
   9065  1.1  mrg       \else
   9066  1.1  mrg         \ifwarnedxrefs\else
   9067  1.1  mrg           \global\warnedxrefstrue
   9068  1.1  mrg           \message{Cross reference values unknown; you must run TeX again.}%
   9069  1.1  mrg         \fi
   9070  1.1  mrg       \fi
   9071  1.1  mrg     \fi
   9072  1.1  mrg   \else
   9073  1.1  mrg     % It's defined, so just use it.
   9074  1.1  mrg     \thisrefX
   9075  1.1  mrg   \fi
   9076  1.1  mrg   #2% Output the suffix in any case.
   9077  1.1  mrg }
   9078  1.1  mrg 
   9079  1.1  mrg % This is the macro invoked by entries in the aux file.  Define a control
   9080  1.1  mrg % sequence for a cross-reference target (we prepend XR to the control sequence
   9081  1.1  mrg % name to avoid collisions).  The value is the page number.  If this is a float
   9082  1.1  mrg % type, we have more work to do.
   9083  1.1  mrg %
   9084  1.1  mrg \def\xrdef#1#2{%
   9085  1.1  mrg   {% Expand the node or anchor name to remove control sequences.
   9086  1.1  mrg    % \turnoffactive stops 8-bit characters being changed to commands
   9087  1.1  mrg    % like @'e.  \refx does the same to retrieve the value in the definition.
   9088  1.1  mrg     \indexnofonts
   9089  1.1  mrg     \turnoffactive
   9090  1.1  mrg     \def\value##1{##1}%
   9091  1.1  mrg     \xdef\safexrefname{#1}%
   9092  1.1  mrg   }%
   9093  1.1  mrg   %
   9094  1.1  mrg   \bgroup
   9095  1.1  mrg     \expandafter\gdef\csname XR\safexrefname\endcsname{#2}%
   9096  1.1  mrg   \egroup
   9097  1.1  mrg   % We put the \gdef inside a group to avoid the definitions building up on
   9098  1.1  mrg   % TeX's save stack, which can cause it to run out of space for aux files with
   9099  1.1  mrg   % thousands of lines.  \gdef doesn't use the save stack, but \csname does
   9100  1.1  mrg   % when it defines an unknown control sequence as \relax.
   9101  1.1  mrg   %
   9102  1.1  mrg   % Was that xref control sequence that we just defined for a float?
   9103  1.1  mrg   \expandafter\iffloat\csname XR\safexrefname\endcsname
   9104  1.1  mrg     % it was a float, and we have the (safe) float type in \iffloattype.
   9105  1.1  mrg     \expandafter\let\expandafter\floatlist
   9106  1.1  mrg       \csname floatlist\iffloattype\endcsname
   9107  1.1  mrg     %
   9108  1.1  mrg     % Is this the first time we've seen this float type?
   9109  1.1  mrg     \expandafter\ifx\floatlist\relax
   9110  1.1  mrg       \toks0 = {\do}% yes, so just \do
   9111  1.1  mrg     \else
   9112  1.1  mrg       % had it before, so preserve previous elements in list.
   9113  1.1  mrg       \toks0 = \expandafter{\floatlist\do}%
   9114  1.1  mrg     \fi
   9115  1.1  mrg     %
   9116  1.1  mrg     % Remember this xref in the control sequence \floatlistFLOATTYPE,
   9117  1.1  mrg     % for later use in \listoffloats.
   9118  1.1  mrg     \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0
   9119  1.1  mrg       {\safexrefname}}%
   9120  1.1  mrg   \fi
   9121  1.1  mrg }
   9122  1.1  mrg 
   9123  1.1  mrg % If working on a large document in chapters, it is convenient to
   9124  1.1  mrg % be able to disable indexing, cross-referencing, and contents, for test runs.
   9125  1.1  mrg % This is done with @novalidate at the beginning of the file.
   9126  1.1  mrg %
   9127  1.1  mrg \newif\iflinks \linkstrue % by default we want the aux files.
   9128  1.1  mrg \let\novalidate = \linksfalse
   9129  1.1  mrg 
   9130  1.1  mrg % Used when writing to the aux file, or when using data from it.
   9131  1.1  mrg \def\requireauxfile{%
   9132  1.1  mrg   \iflinks
   9133  1.1  mrg     \tryauxfile
   9134  1.1  mrg     % Open the new aux file.  TeX will close it automatically at exit.
   9135  1.1  mrg     \immediate\openout\auxfile=\jobname.aux
   9136  1.1  mrg   \fi
   9137  1.1  mrg   \global\let\requireauxfile=\relax   % Only do this once.
   9138  1.1  mrg }
   9139  1.1  mrg 
   9140  1.1  mrg % Read the last existing aux file, if any.  No error if none exists.
   9141  1.1  mrg %
   9142  1.1  mrg \def\tryauxfile{%
   9143  1.1  mrg   \openin 1 \jobname.aux
   9144  1.1  mrg   \ifeof 1 \else
   9145  1.1  mrg     \readdatafile{aux}%
   9146  1.1  mrg     \global\havexrefstrue
   9147  1.1  mrg   \fi
   9148  1.1  mrg   \closein 1
   9149  1.1  mrg }
   9150  1.1  mrg 
   9151  1.1  mrg \def\setupdatafile{%
   9152  1.1  mrg   \catcode`\^^@=\other
   9153  1.1  mrg   \catcode`\^^A=\other
   9154  1.1  mrg   \catcode`\^^B=\other
   9155  1.1  mrg   \catcode`\^^C=\other
   9156  1.1  mrg   \catcode`\^^D=\other
   9157  1.1  mrg   \catcode`\^^E=\other
   9158  1.1  mrg   \catcode`\^^F=\other
   9159  1.1  mrg   \catcode`\^^G=\other
   9160  1.1  mrg   \catcode`\^^H=\other
   9161  1.1  mrg   \catcode`\^^K=\other
   9162  1.1  mrg   \catcode`\^^L=\other
   9163  1.1  mrg   \catcode`\^^N=\other
   9164  1.1  mrg   \catcode`\^^P=\other
   9165  1.1  mrg   \catcode`\^^Q=\other
   9166  1.1  mrg   \catcode`\^^R=\other
   9167  1.1  mrg   \catcode`\^^S=\other
   9168  1.1  mrg   \catcode`\^^T=\other
   9169  1.1  mrg   \catcode`\^^U=\other
   9170  1.1  mrg   \catcode`\^^V=\other
   9171  1.1  mrg   \catcode`\^^W=\other
   9172  1.1  mrg   \catcode`\^^X=\other
   9173  1.1  mrg   \catcode`\^^Z=\other
   9174  1.1  mrg   \catcode`\^^[=\other
   9175  1.1  mrg   \catcode`\^^\=\other
   9176  1.1  mrg   \catcode`\^^]=\other
   9177  1.1  mrg   \catcode`\^^^=\other
   9178  1.1  mrg   \catcode`\^^_=\other
   9179  1.1  mrg   \catcode`\^=\other
   9180  1.1  mrg   %
   9181  1.1  mrg   % Special characters.  Should be turned off anyway, but...
   9182  1.1  mrg   \catcode`\~=\other
   9183  1.1  mrg   \catcode`\[=\other
   9184  1.1  mrg   \catcode`\]=\other
   9185  1.1  mrg   \catcode`\"=\other
   9186  1.1  mrg   \catcode`\_=\other
   9187  1.1  mrg   \catcode`\|=\other
   9188  1.1  mrg   \catcode`\<=\other
   9189  1.1  mrg   \catcode`\>=\other
   9190  1.1  mrg   \catcode`\$=\other
   9191  1.1  mrg   \catcode`\#=\other
   9192  1.1  mrg   \catcode`\&=\other
   9193  1.1  mrg   \catcode`\%=\other
   9194  1.1  mrg   \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
   9195  1.1  mrg   %
   9196  1.1  mrg   \catcode`\\=\active
   9197  1.1  mrg   %
   9198  1.1  mrg   % @ is our escape character in .aux files, and we need braces.
   9199  1.1  mrg   \catcode`\{=1
   9200  1.1  mrg   \catcode`\}=2
   9201  1.1  mrg   \catcode`\@=0
   9202  1.1  mrg }
   9203  1.1  mrg 
   9204  1.1  mrg \def\readdatafile#1{%
   9205  1.1  mrg \begingroup
   9206  1.1  mrg   \setupdatafile
   9207  1.1  mrg   \input\jobname.#1
   9208  1.1  mrg \endgroup}
   9209  1.1  mrg 
   9210  1.1  mrg 
   9211  1.1  mrg \message{insertions,}
   9212  1.1  mrg % including footnotes.
   9213  1.1  mrg 
   9214  1.1  mrg \newcount \footnoteno
   9215  1.1  mrg 
   9216  1.1  mrg % The trailing space in the following definition for supereject is
   9217  1.1  mrg % vital for proper filling; pages come out unaligned when you do a
   9218  1.1  mrg % pagealignmacro call if that space before the closing brace is
   9219  1.1  mrg % removed. (Generally, numeric constants should always be followed by a
   9220  1.1  mrg % space to prevent strange expansion errors.)
   9221  1.1  mrg \def\supereject{\par\penalty -20000\footnoteno =0 }
   9222  1.1  mrg 
   9223  1.1  mrg % @footnotestyle is meaningful for Info output only.
   9224  1.1  mrg \let\footnotestyle=\comment
   9225  1.1  mrg 
   9226  1.1  mrg {\catcode `\@=11
   9227  1.1  mrg %
   9228  1.1  mrg % Auto-number footnotes.  Otherwise like plain.
   9229  1.1  mrg \gdef\footnote{%
   9230  1.1  mrg   \global\advance\footnoteno by \@ne
   9231  1.1  mrg   \edef\thisfootno{$^{\the\footnoteno}$}%
   9232  1.1  mrg   %
   9233  1.1  mrg   % In case the footnote comes at the end of a sentence, preserve the
   9234  1.1  mrg   % extra spacing after we do the footnote number.
   9235  1.1  mrg   \let\@sf\empty
   9236  1.1  mrg   \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi
   9237  1.1  mrg   %
   9238  1.1  mrg   % Remove inadvertent blank space before typesetting the footnote number.
   9239  1.1  mrg   \unskip
   9240  1.1  mrg   \thisfootno\@sf
   9241  1.1  mrg   \dofootnote
   9242  1.1  mrg }%
   9243  1.1  mrg 
   9244  1.1  mrg % Don't bother with the trickery in plain.tex to not require the
   9245  1.1  mrg % footnote text as a parameter.  Our footnotes don't need to be so general.
   9246  1.1  mrg %
   9247  1.1  mrg % Oh yes, they do; otherwise, @ifset (and anything else that uses
   9248  1.1  mrg % \parseargline) fails inside footnotes because the tokens are fixed when
   9249  1.1  mrg % the footnote is read.  --karl, 16nov96.
   9250  1.1  mrg %
   9251  1.1  mrg \gdef\dofootnote{%
   9252  1.1  mrg   \insert\footins\bgroup
   9253  1.1  mrg   %
   9254  1.1  mrg   % Nested footnotes are not supported in TeX, that would take a lot
   9255  1.1  mrg   % more work.  (\startsavinginserts does not suffice.)
   9256  1.1  mrg   \let\footnote=\errfootnotenest
   9257  1.1  mrg   %
   9258  1.1  mrg   % We want to typeset this text as a normal paragraph, even if the
   9259  1.1  mrg   % footnote reference occurs in (for example) a display environment.
   9260  1.1  mrg   % So reset some parameters.
   9261  1.1  mrg   \hsize=\txipagewidth
   9262  1.1  mrg   \interlinepenalty\interfootnotelinepenalty
   9263  1.1  mrg   \splittopskip\ht\strutbox % top baseline for broken footnotes
   9264  1.1  mrg   \splitmaxdepth\dp\strutbox
   9265  1.1  mrg   \floatingpenalty\@MM
   9266  1.1  mrg   \leftskip\z@skip
   9267  1.1  mrg   \rightskip\z@skip
   9268  1.1  mrg   \spaceskip\z@skip
   9269  1.1  mrg   \xspaceskip\z@skip
   9270  1.1  mrg   \parindent\defaultparindent
   9271  1.1  mrg   %
   9272  1.1  mrg   \smallfonts \rm
   9273  1.1  mrg   %
   9274  1.1  mrg   % Because we use hanging indentation in footnotes, a @noindent appears
   9275  1.1  mrg   % to exdent this text, so make it be a no-op.  makeinfo does not use
   9276  1.1  mrg   % hanging indentation so @noindent can still be needed within footnote
   9277  1.1  mrg   % text after an @example or the like (not that this is good style).
   9278  1.1  mrg   \let\noindent = \relax
   9279  1.1  mrg   %
   9280  1.1  mrg   % Hang the footnote text off the number.  Use \everypar in case the
   9281  1.1  mrg   % footnote extends for more than one paragraph.
   9282  1.1  mrg   \everypar = {\hang}%
   9283  1.1  mrg   \textindent{\thisfootno}%
   9284  1.1  mrg   %
   9285  1.1  mrg   % Don't crash into the line above the footnote text.  Since this
   9286  1.1  mrg   % expands into a box, it must come within the paragraph, lest it
   9287  1.1  mrg   % provide a place where TeX can split the footnote.
   9288  1.1  mrg   \footstrut
   9289  1.1  mrg   %
   9290  1.1  mrg   % Invoke rest of plain TeX footnote routine.
   9291  1.1  mrg   \futurelet\next\fo@t
   9292  1.1  mrg }
   9293  1.1  mrg }%end \catcode `\@=11
   9294  1.1  mrg 
   9295  1.1  mrg \def\errfootnotenest{%
   9296  1.1  mrg   \errhelp=\EMsimple
   9297  1.1  mrg   \errmessage{Nested footnotes not supported in texinfo.tex,
   9298  1.1  mrg     even though they work in makeinfo; sorry}
   9299  1.1  mrg }
   9300  1.1  mrg 
   9301  1.1  mrg \def\errfootnoteheading{%
   9302  1.1  mrg   \errhelp=\EMsimple
   9303  1.1  mrg   \errmessage{Footnotes in chapters, sections, etc., are not supported}
   9304  1.1  mrg }
   9305  1.1  mrg 
   9306  1.1  mrg % In case a @footnote appears in a vbox, save the footnote text and create
   9307  1.1  mrg % the real \insert just after the vbox finished.  Otherwise, the insertion
   9308  1.1  mrg % would be lost.
   9309  1.1  mrg % Similarly, if a @footnote appears inside an alignment, save the footnote
   9310  1.1  mrg % text to a box and make the \insert when a row of the table is finished.
   9311  1.1  mrg % And the same can be done for other insert classes.  --kasal, 16nov03.
   9312  1.1  mrg %
   9313  1.1  mrg % Replace the \insert primitive by a cheating macro.
   9314  1.1  mrg % Deeper inside, just make sure that the saved insertions are not spilled
   9315  1.1  mrg % out prematurely.
   9316  1.1  mrg %
   9317  1.1  mrg \def\startsavinginserts{%
   9318  1.1  mrg   \ifx \insert\ptexinsert
   9319  1.1  mrg     \let\insert\saveinsert
   9320  1.1  mrg   \else
   9321  1.1  mrg     \let\checkinserts\relax
   9322  1.1  mrg   \fi
   9323  1.1  mrg }
   9324  1.1  mrg 
   9325  1.1  mrg % This \insert replacement works for both \insert\footins{foo} and
   9326  1.1  mrg % \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}.
   9327  1.1  mrg %
   9328  1.1  mrg \def\saveinsert#1{%
   9329  1.1  mrg   \edef\next{\noexpand\savetobox \makeSAVEname#1}%
   9330  1.1  mrg   \afterassignment\next
   9331  1.1  mrg   % swallow the left brace
   9332  1.1  mrg   \let\temp =
   9333  1.1  mrg }
   9334  1.1  mrg \def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}}
   9335  1.1  mrg \def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1}
   9336  1.1  mrg 
   9337  1.1  mrg \def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi}
   9338  1.1  mrg 
   9339  1.1  mrg \def\placesaveins#1{%
   9340  1.1  mrg   \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname
   9341  1.1  mrg     {\box#1}%
   9342  1.1  mrg }
   9343  1.1  mrg 
   9344  1.1  mrg % eat @SAVE -- beware, all of them have catcode \other:
   9345  1.1  mrg {
   9346  1.1  mrg   \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials  %  ;-)
   9347  1.1  mrg   \gdef\gobblesave @SAVE{}
   9348  1.1  mrg }
   9349  1.1  mrg 
   9350  1.1  mrg % initialization:
   9351  1.1  mrg \def\newsaveins #1{%
   9352  1.1  mrg   \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}%
   9353  1.1  mrg   \next
   9354  1.1  mrg }
   9355  1.1  mrg \def\newsaveinsX #1{%
   9356  1.1  mrg   \csname newbox\endcsname #1%
   9357  1.1  mrg   \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts
   9358  1.1  mrg     \checksaveins #1}%
   9359  1.1  mrg }
   9360  1.1  mrg 
   9361  1.1  mrg % initialize:
   9362  1.1  mrg \let\checkinserts\empty
   9363  1.1  mrg \newsaveins\footins
   9364  1.1  mrg \newsaveins\margin
   9365  1.1  mrg 
   9366  1.1  mrg 
   9367  1.1  mrg % @image.  We use the macros from epsf.tex to support this.
   9368  1.1  mrg % If epsf.tex is not installed and @image is used, we complain.
   9369  1.1  mrg %
   9370  1.1  mrg % Check for and read epsf.tex up front.  If we read it only at @image
   9371  1.1  mrg % time, we might be inside a group, and then its definitions would get
   9372  1.1  mrg % undone and the next image would fail.
   9373  1.1  mrg \openin 1 = epsf.tex
   9374  1.1  mrg \ifeof 1 \else
   9375  1.1  mrg   % Do not bother showing banner with epsf.tex v2.7k (available in
   9376  1.1  mrg   % doc/epsf.tex and on ctan).
   9377  1.1  mrg   \def\epsfannounce{\toks0 = }%
   9378  1.1  mrg   \input epsf.tex
   9379  1.1  mrg \fi
   9380  1.1  mrg \closein 1
   9381  1.1  mrg %
   9382  1.1  mrg % We will only complain once about lack of epsf.tex.
   9383  1.1  mrg \newif\ifwarnednoepsf
   9384  1.1  mrg \newhelp\noepsfhelp{epsf.tex must be installed for images to
   9385  1.1  mrg   work.  It is also included in the Texinfo distribution, or you can get
   9386  1.1  mrg   it from https://ctan.org/texarchive/macros/texinfo/texinfo/doc/epsf.tex.}
   9387  1.1  mrg %
   9388  1.1  mrg \def\image#1{%
   9389  1.1  mrg   \ifx\epsfbox\thisisundefined
   9390  1.1  mrg     \ifwarnednoepsf \else
   9391  1.1  mrg       \errhelp = \noepsfhelp
   9392  1.1  mrg       \errmessage{epsf.tex not found, images will be ignored}%
   9393  1.1  mrg       \global\warnednoepsftrue
   9394  1.1  mrg     \fi
   9395  1.1  mrg   \else
   9396  1.1  mrg     \imagexxx #1,,,,,\finish
   9397  1.1  mrg   \fi
   9398  1.1  mrg }
   9399  1.1  mrg %
   9400  1.1  mrg % Arguments to @image:
   9401  1.1  mrg % #1 is (mandatory) image filename; we tack on .eps extension.
   9402  1.1  mrg % #2 is (optional) width, #3 is (optional) height.
   9403  1.1  mrg % #4 is (ignored optional) html alt text.
   9404  1.1  mrg % #5 is (ignored optional) extension.
   9405  1.1  mrg % #6 is just the usual extra ignored arg for parsing stuff.
   9406  1.1  mrg \newif\ifimagevmode
   9407  1.1  mrg \def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
   9408  1.1  mrg   \catcode`\^^M = 5     % in case we're inside an example
   9409  1.1  mrg   \normalturnoffactive  % allow _ et al. in names
   9410  1.1  mrg   \def\xprocessmacroarg{\eatspaces}% in case we are being used via a macro
   9411  1.1  mrg   % If the image is by itself, center it.
   9412  1.1  mrg   \ifvmode
   9413  1.1  mrg     \imagevmodetrue
   9414  1.1  mrg   \else \ifx\centersub\centerV
   9415  1.1  mrg     % for @center @image, we need a vbox so we can have our vertical space
   9416  1.1  mrg     \imagevmodetrue
   9417  1.1  mrg     \vbox\bgroup % vbox has better behavior than vtop herev
   9418  1.1  mrg   \fi\fi
   9419  1.1  mrg   %
   9420  1.1  mrg   \ifimagevmode
   9421  1.1  mrg     \nobreak\medskip
   9422  1.1  mrg     % Usually we'll have text after the image which will insert
   9423  1.1  mrg     % \parskip glue, so insert it here too to equalize the space
   9424  1.1  mrg     % above and below.
   9425  1.1  mrg     \nobreak\vskip\parskip
   9426  1.1  mrg     \nobreak
   9427  1.1  mrg   \fi
   9428  1.1  mrg   %
   9429  1.1  mrg   % Leave vertical mode so that indentation from an enclosing
   9430  1.1  mrg   %  environment such as @quotation is respected.
   9431  1.1  mrg   % However, if we're at the top level, we don't want the
   9432  1.1  mrg   %  normal paragraph indentation.
   9433  1.1  mrg   % On the other hand, if we are in the case of @center @image, we don't
   9434  1.1  mrg   %  want to start a paragraph, which will create a hsize-width box and
   9435  1.1  mrg   %  eradicate the centering.
   9436  1.1  mrg   \ifx\centersub\centerV\else \noindent \fi
   9437  1.1  mrg   %
   9438  1.1  mrg   % Output the image.
   9439  1.1  mrg   \ifpdf
   9440  1.1  mrg     % For pdfTeX and LuaTeX <= 0.80
   9441  1.1  mrg     \dopdfimage{#1}{#2}{#3}%
   9442  1.1  mrg   \else
   9443  1.1  mrg     \ifx\XeTeXrevision\thisisundefined
   9444  1.1  mrg       % For epsf.tex
   9445  1.1  mrg       % \epsfbox itself resets \epsf?size at each figure.
   9446  1.1  mrg       \setbox0 = \hbox{\ignorespaces #2}%
   9447  1.1  mrg         \ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
   9448  1.1  mrg       \setbox0 = \hbox{\ignorespaces #3}%
   9449  1.1  mrg         \ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
   9450  1.1  mrg       \epsfbox{#1.eps}%
   9451  1.1  mrg     \else
   9452  1.1  mrg       % For XeTeX
   9453  1.1  mrg       \doxeteximage{#1}{#2}{#3}%
   9454  1.1  mrg     \fi
   9455  1.1  mrg   \fi
   9456  1.1  mrg   %
   9457  1.1  mrg   \ifimagevmode
   9458  1.1  mrg     \medskip  % space after a standalone image
   9459  1.1  mrg   \fi
   9460  1.1  mrg   \ifx\centersub\centerV \egroup \fi
   9461  1.1  mrg \endgroup}
   9462  1.1  mrg 
   9463  1.1  mrg 
   9464  1.1  mrg % @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables,
   9465  1.1  mrg % etc.  We don't actually implement floating yet, we always include the
   9466  1.1  mrg % float "here".  But it seemed the best name for the future.
   9467  1.1  mrg %
   9468  1.1  mrg \envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish}
   9469  1.1  mrg 
   9470  1.1  mrg % There may be a space before second and/or third parameter; delete it.
   9471  1.1  mrg \def\eatcommaspace#1, {#1,}
   9472  1.1  mrg 
   9473  1.1  mrg % #1 is the optional FLOATTYPE, the text label for this float, typically
   9474  1.1  mrg % "Figure", "Table", "Example", etc.  Can't contain commas.  If omitted,
   9475  1.1  mrg % this float will not be numbered and cannot be referred to.
   9476  1.1  mrg %
   9477  1.1  mrg % #2 is the optional xref label.  Also must be present for the float to
   9478  1.1  mrg % be referable.
   9479  1.1  mrg %
   9480  1.1  mrg % #3 is the optional positioning argument; for now, it is ignored.  It
   9481  1.1  mrg % will somehow specify the positions allowed to float to (here, top, bottom).
   9482  1.1  mrg %
   9483  1.1  mrg % We keep a separate counter for each FLOATTYPE, which we reset at each
   9484  1.1  mrg % chapter-level command.
   9485  1.1  mrg \let\resetallfloatnos=\empty
   9486  1.1  mrg %
   9487  1.1  mrg \def\dofloat#1,#2,#3,#4\finish{%
   9488  1.1  mrg   \let\thiscaption=\empty
   9489  1.1  mrg   \let\thisshortcaption=\empty
   9490  1.1  mrg   %
   9491  1.1  mrg   % don't lose footnotes inside @float.
   9492  1.1  mrg   %
   9493  1.1  mrg   % BEWARE: when the floats start float, we have to issue warning whenever an
   9494  1.1  mrg   % insert appears inside a float which could possibly float. --kasal, 26may04
   9495  1.1  mrg   %
   9496  1.1  mrg   \startsavinginserts
   9497  1.1  mrg   %
   9498  1.1  mrg   % We can't be used inside a paragraph.
   9499  1.1  mrg   \par
   9500  1.1  mrg   %
   9501  1.1  mrg   \vtop\bgroup
   9502  1.1  mrg     \def\floattype{#1}%
   9503  1.1  mrg     \def\floatlabel{#2}%
   9504  1.1  mrg     \def\floatloc{#3}% we do nothing with this yet.
   9505  1.1  mrg     %
   9506  1.1  mrg     \ifx\floattype\empty
   9507  1.1  mrg       \let\safefloattype=\empty
   9508  1.1  mrg     \else
   9509  1.1  mrg       {%
   9510  1.1  mrg         % the floattype might have accents or other special characters,
   9511  1.1  mrg         % but we need to use it in a control sequence name.
   9512  1.1  mrg         \indexnofonts
   9513  1.1  mrg         \turnoffactive
   9514  1.1  mrg         \xdef\safefloattype{\floattype}%
   9515  1.1  mrg       }%
   9516  1.1  mrg     \fi
   9517  1.1  mrg     %
   9518  1.1  mrg     % If label is given but no type, we handle that as the empty type.
   9519  1.1  mrg     \ifx\floatlabel\empty \else
   9520  1.1  mrg       % We want each FLOATTYPE to be numbered separately (Figure 1,
   9521  1.1  mrg       % Table 1, Figure 2, ...).  (And if no label, no number.)
   9522  1.1  mrg       %
   9523  1.1  mrg       \expandafter\getfloatno\csname\safefloattype floatno\endcsname
   9524  1.1  mrg       \global\advance\floatno by 1
   9525  1.1  mrg       %
   9526  1.1  mrg       {%
   9527  1.1  mrg         % This magic value for \currentsection is output by \setref as the
   9528  1.1  mrg         % XREFLABEL-title value.  \xrefX uses it to distinguish float
   9529  1.1  mrg         % labels (which have a completely different output format) from
   9530  1.1  mrg         % node and anchor labels.  And \xrdef uses it to construct the
   9531  1.1  mrg         % lists of floats.
   9532  1.1  mrg         %
   9533  1.1  mrg         \edef\currentsection{\floatmagic=\safefloattype}%
   9534  1.1  mrg         \setref{\floatlabel}{Yfloat}%
   9535  1.1  mrg       }%
   9536  1.1  mrg     \fi
   9537  1.1  mrg     %
   9538  1.1  mrg     % start with \parskip glue, I guess.
   9539  1.1  mrg     \vskip\parskip
   9540  1.1  mrg     %
   9541  1.1  mrg     % Don't suppress indentation if a float happens to start a section.
   9542  1.1  mrg     \restorefirstparagraphindent
   9543  1.1  mrg }
   9544  1.1  mrg 
   9545  1.1  mrg % we have these possibilities:
   9546  1.1  mrg % @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap
   9547  1.1  mrg % @float Foo,lbl & no caption:    Foo 1.1
   9548  1.1  mrg % @float Foo & @caption{Cap}:     Foo: Cap
   9549  1.1  mrg % @float Foo & no caption:        Foo
   9550  1.1  mrg % @float ,lbl & Caption{Cap}:     1.1: Cap
   9551  1.1  mrg % @float ,lbl & no caption:       1.1
   9552  1.1  mrg % @float & @caption{Cap}:         Cap
   9553  1.1  mrg % @float & no caption:
   9554  1.1  mrg %
   9555  1.1  mrg \def\Efloat{%
   9556  1.1  mrg     \let\floatident = \empty
   9557  1.1  mrg     %
   9558  1.1  mrg     % In all cases, if we have a float type, it comes first.
   9559  1.1  mrg     \ifx\floattype\empty \else \def\floatident{\floattype}\fi
   9560  1.1  mrg     %
   9561  1.1  mrg     % If we have an xref label, the number comes next.
   9562  1.1  mrg     \ifx\floatlabel\empty \else
   9563  1.1  mrg       \ifx\floattype\empty \else % if also had float type, need tie first.
   9564  1.1  mrg         \appendtomacro\floatident{\tie}%
   9565  1.1  mrg       \fi
   9566  1.1  mrg       % the number.
   9567  1.1  mrg       \appendtomacro\floatident{\chaplevelprefix\the\floatno}%
   9568  1.1  mrg     \fi
   9569  1.1  mrg     %
   9570  1.1  mrg     % Start the printed caption with what we've constructed in
   9571  1.1  mrg     % \floatident, but keep it separate; we need \floatident again.
   9572  1.1  mrg     \let\captionline = \floatident
   9573  1.1  mrg     %
   9574  1.1  mrg     \ifx\thiscaption\empty \else
   9575  1.1  mrg       \ifx\floatident\empty \else
   9576  1.1  mrg         \appendtomacro\captionline{: }% had ident, so need a colon between
   9577  1.1  mrg       \fi
   9578  1.1  mrg       %
   9579  1.1  mrg       % caption text.
   9580  1.1  mrg       \appendtomacro\captionline{\scanexp\thiscaption}%
   9581  1.1  mrg     \fi
   9582  1.1  mrg     %
   9583  1.1  mrg     % If we have anything to print, print it, with space before.
   9584  1.1  mrg     % Eventually this needs to become an \insert.
   9585  1.1  mrg     \ifx\captionline\empty \else
   9586  1.1  mrg       \vskip.5\parskip
   9587  1.1  mrg       \captionline
   9588  1.1  mrg       %
   9589  1.1  mrg       % Space below caption.
   9590  1.1  mrg       \vskip\parskip
   9591  1.1  mrg     \fi
   9592  1.1  mrg     %
   9593  1.1  mrg     % If have an xref label, write the list of floats info.  Do this
   9594  1.1  mrg     % after the caption, to avoid chance of it being a breakpoint.
   9595  1.1  mrg     \ifx\floatlabel\empty \else
   9596  1.1  mrg       % Write the text that goes in the lof to the aux file as
   9597  1.1  mrg       % \floatlabel-lof.  Besides \floatident, we include the short
   9598  1.1  mrg       % caption if specified, else the full caption if specified, else nothing.
   9599  1.1  mrg       {%
   9600  1.1  mrg         \requireauxfile
   9601  1.1  mrg         \atdummies
   9602  1.1  mrg         %
   9603  1.1  mrg         \ifx\thisshortcaption\empty
   9604  1.1  mrg           \def\gtemp{\thiscaption}%
   9605  1.1  mrg         \else
   9606  1.1  mrg           \def\gtemp{\thisshortcaption}%
   9607  1.1  mrg         \fi
   9608  1.1  mrg         \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident
   9609  1.1  mrg           \ifx\gtemp\empty \else : \gtemp \fi}}%
   9610  1.1  mrg       }%
   9611  1.1  mrg     \fi
   9612  1.1  mrg   \egroup  % end of \vtop
   9613  1.1  mrg   %
   9614  1.1  mrg   \checkinserts
   9615  1.1  mrg }
   9616  1.1  mrg 
   9617  1.1  mrg % Append the tokens #2 to the definition of macro #1, not expanding either.
   9618  1.1  mrg %
   9619  1.1  mrg \def\appendtomacro#1#2{%
   9620  1.1  mrg   \expandafter\def\expandafter#1\expandafter{#1#2}%
   9621  1.1  mrg }
   9622  1.1  mrg 
   9623  1.1  mrg % @caption, @shortcaption
   9624  1.1  mrg %
   9625  1.1  mrg \def\caption{\docaption\thiscaption}
   9626  1.1  mrg \def\shortcaption{\docaption\thisshortcaption}
   9627  1.1  mrg \def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption}
   9628  1.1  mrg \def\defcaption#1#2{\egroup \def#1{#2}}
   9629  1.1  mrg 
   9630  1.1  mrg % The parameter is the control sequence identifying the counter we are
   9631  1.1  mrg % going to use.  Create it if it doesn't exist and assign it to \floatno.
   9632  1.1  mrg \def\getfloatno#1{%
   9633  1.1  mrg   \ifx#1\relax
   9634  1.1  mrg       % Haven't seen this figure type before.
   9635  1.1  mrg       \csname newcount\endcsname #1%
   9636  1.1  mrg       %
   9637  1.1  mrg       % Remember to reset this floatno at the next chap.
   9638  1.1  mrg       \expandafter\gdef\expandafter\resetallfloatnos
   9639  1.1  mrg         \expandafter{\resetallfloatnos #1=0 }%
   9640  1.1  mrg   \fi
   9641  1.1  mrg   \let\floatno#1%
   9642  1.1  mrg }
   9643  1.1  mrg 
   9644  1.1  mrg % \setref calls this to get the XREFLABEL-snt value.  We want an @xref
   9645  1.1  mrg % to the FLOATLABEL to expand to "Figure 3.1".  We call \setref when we
   9646  1.1  mrg % first read the @float command.
   9647  1.1  mrg %
   9648  1.1  mrg \def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}%
   9649  1.1  mrg 
   9650  1.1  mrg % Magic string used for the XREFLABEL-title value, so \xrefX can
   9651  1.1  mrg % distinguish floats from other xref types.
   9652  1.1  mrg \def\floatmagic{!!float!!}
   9653  1.1  mrg 
   9654  1.1  mrg % #1 is the control sequence we are passed; we expand into a conditional
   9655  1.1  mrg % which is true if #1 represents a float ref.  That is, the magic
   9656  1.1  mrg % \currentsection value which we \setref above.
   9657  1.1  mrg %
   9658  1.1  mrg \def\iffloat#1{\expandafter\doiffloat#1==\finish}
   9659  1.1  mrg %
   9660  1.1  mrg % #1 is (maybe) the \floatmagic string.  If so, #2 will be the
   9661  1.1  mrg % (safe) float type for this float.  We set \iffloattype to #2.
   9662  1.1  mrg %
   9663  1.1  mrg \def\doiffloat#1=#2=#3\finish{%
   9664  1.1  mrg   \def\temp{#1}%
   9665  1.1  mrg   \def\iffloattype{#2}%
   9666  1.1  mrg   \ifx\temp\floatmagic
   9667  1.1  mrg }
   9668  1.1  mrg 
   9669  1.1  mrg % @listoffloats FLOATTYPE - print a list of floats like a table of contents.
   9670  1.1  mrg %
   9671  1.1  mrg \parseargdef\listoffloats{%
   9672  1.1  mrg   \def\floattype{#1}% floattype
   9673  1.1  mrg   {%
   9674  1.1  mrg     % the floattype might have accents or other special characters,
   9675  1.1  mrg     % but we need to use it in a control sequence name.
   9676  1.1  mrg     \indexnofonts
   9677  1.1  mrg     \turnoffactive
   9678  1.1  mrg     \xdef\safefloattype{\floattype}%
   9679  1.1  mrg   }%
   9680  1.1  mrg   %
   9681  1.1  mrg   % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE.
   9682  1.1  mrg   \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax
   9683  1.1  mrg     \ifhavexrefs
   9684  1.1  mrg       % if the user said @listoffloats foo but never @float foo.
   9685  1.1  mrg       \message{\linenumber No `\safefloattype' floats to list.}%
   9686  1.1  mrg     \fi
   9687  1.1  mrg   \else
   9688  1.1  mrg     \begingroup
   9689  1.1  mrg       \leftskip=\tocindent  % indent these entries like a toc
   9690  1.1  mrg       \let\do=\listoffloatsdo
   9691  1.1  mrg       \csname floatlist\safefloattype\endcsname
   9692  1.1  mrg     \endgroup
   9693  1.1  mrg   \fi
   9694  1.1  mrg }
   9695  1.1  mrg 
   9696  1.1  mrg % This is called on each entry in a list of floats.  We're passed the
   9697  1.1  mrg % xref label, in the form LABEL-title, which is how we save it in the
   9698  1.1  mrg % aux file.  We strip off the -title and look up \XRLABEL-lof, which
   9699  1.1  mrg % has the text we're supposed to typeset here.
   9700  1.1  mrg %
   9701  1.1  mrg % Figures without xref labels will not be included in the list (since
   9702  1.1  mrg % they won't appear in the aux file).
   9703  1.1  mrg %
   9704  1.1  mrg \def\listoffloatsdo#1{\listoffloatsdoentry#1\finish}
   9705  1.1  mrg \def\listoffloatsdoentry#1-title\finish{{%
   9706  1.1  mrg   % Can't fully expand XR#1-lof because it can contain anything.  Just
   9707  1.1  mrg   % pass the control sequence.  On the other hand, XR#1-pg is just the
   9708  1.1  mrg   % page number, and we want to fully expand that so we can get a link
   9709  1.1  mrg   % in pdf output.
   9710  1.1  mrg   \toksA = \expandafter{\csname XR#1-lof\endcsname}%
   9711  1.1  mrg   %
   9712  1.1  mrg   % use the same \entry macro we use to generate the TOC and index.
   9713  1.1  mrg   \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}%
   9714  1.1  mrg   \writeentry
   9715  1.1  mrg }}
   9716  1.1  mrg 
   9717  1.1  mrg 
   9718  1.1  mrg \message{localization,}
   9719  1.1  mrg 
   9720  1.1  mrg % For single-language documents, @documentlanguage is usually given very
   9721  1.1  mrg % early, just after @documentencoding.  Single argument is the language
   9722  1.1  mrg % (de) or locale (de_DE) abbreviation.
   9723  1.1  mrg %
   9724  1.1  mrg {
   9725  1.1  mrg   \catcode`\_ = \active
   9726  1.1  mrg   \globaldefs=1
   9727  1.1  mrg \parseargdef\documentlanguage{%
   9728  1.1  mrg   \tex % read txi-??.tex file in plain TeX.
   9729  1.1  mrg     % Read the file by the name they passed if it exists.
   9730  1.1  mrg     \let_ = \normalunderscore  % normal _ character for filename test
   9731  1.1  mrg     \openin 1 txi-#1.tex
   9732  1.1  mrg     \ifeof 1
   9733  1.1  mrg       \documentlanguagetrywithoutunderscore #1_\finish
   9734  1.1  mrg     \else
   9735  1.1  mrg       \globaldefs = 1  % everything in the txi-LL files needs to persist
   9736  1.1  mrg       \input txi-#1.tex
   9737  1.1  mrg     \fi
   9738  1.1  mrg     \closein 1
   9739  1.1  mrg   \endgroup % end raw TeX
   9740  1.1  mrg }
   9741  1.1  mrg %
   9742  1.1  mrg % If they passed de_DE, and txi-de_DE.tex doesn't exist,
   9743  1.1  mrg % try txi-de.tex.
   9744  1.1  mrg %
   9745  1.1  mrg \gdef\documentlanguagetrywithoutunderscore#1_#2\finish{%
   9746  1.1  mrg   \openin 1 txi-#1.tex
   9747  1.1  mrg   \ifeof 1
   9748  1.1  mrg     \errhelp = \nolanghelp
   9749  1.1  mrg     \errmessage{Cannot read language file txi-#1.tex}%
   9750  1.1  mrg   \else
   9751  1.1  mrg     \globaldefs = 1  % everything in the txi-LL files needs to persist
   9752  1.1  mrg     \input txi-#1.tex
   9753  1.1  mrg   \fi
   9754  1.1  mrg   \closein 1
   9755  1.1  mrg }
   9756  1.1  mrg }% end of special _ catcode
   9757  1.1  mrg %
   9758  1.1  mrg \newhelp\nolanghelp{The given language definition file cannot be found or
   9759  1.1  mrg is empty.  Maybe you need to install it?  Putting it in the current
   9760  1.1  mrg directory should work if nowhere else does.}
   9761  1.1  mrg 
   9762  1.1  mrg % This macro is called from txi-??.tex files; the first argument is the
   9763  1.1  mrg % \language name to set (without the "\lang@" prefix), the second and
   9764  1.1  mrg % third args are \{left,right}hyphenmin.
   9765  1.1  mrg %
   9766  1.1  mrg % The language names to pass are determined when the format is built.
   9767  1.1  mrg % See the etex.log file created at that time, e.g.,
   9768  1.1  mrg % /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log.
   9769  1.1  mrg %
   9770  1.1  mrg % With TeX Live 2008, etex now includes hyphenation patterns for all
   9771  1.1  mrg % available languages.  This means we can support hyphenation in
   9772  1.1  mrg % Texinfo, at least to some extent.  (This still doesn't solve the
   9773  1.1  mrg % accented characters problem.)
   9774  1.1  mrg %
   9775  1.1  mrg \catcode`@=11
   9776  1.1  mrg \def\txisetlanguage#1#2#3{%
   9777  1.1  mrg   % do not set the language if the name is undefined in the current TeX.
   9778  1.1  mrg   \expandafter\ifx\csname lang@#1\endcsname \relax
   9779  1.1  mrg     \message{no patterns for #1}%
   9780  1.1  mrg   \else
   9781  1.1  mrg     \global\language = \csname lang@#1\endcsname
   9782  1.1  mrg   \fi
   9783  1.1  mrg   % but there is no harm in adjusting the hyphenmin values regardless.
   9784  1.1  mrg   \global\lefthyphenmin = #2\relax
   9785  1.1  mrg   \global\righthyphenmin = #3\relax
   9786  1.1  mrg }
   9787  1.1  mrg 
   9788  1.1  mrg % XeTeX and LuaTeX can handle Unicode natively.
   9789  1.1  mrg % Their default I/O uses UTF-8 sequences instead of a byte-wise operation.
   9790  1.1  mrg % Other TeX engines' I/O (pdfTeX, etc.) is byte-wise.
   9791  1.1  mrg %
   9792  1.1  mrg \newif\iftxinativeunicodecapable
   9793  1.1  mrg \newif\iftxiusebytewiseio
   9794  1.1  mrg 
   9795  1.1  mrg \ifx\XeTeXrevision\thisisundefined
   9796  1.1  mrg   \ifx\luatexversion\thisisundefined
   9797  1.1  mrg     \txinativeunicodecapablefalse
   9798  1.1  mrg     \txiusebytewiseiotrue
   9799  1.1  mrg   \else
   9800  1.1  mrg     \txinativeunicodecapabletrue
   9801  1.1  mrg     \txiusebytewiseiofalse
   9802  1.1  mrg   \fi
   9803  1.1  mrg \else
   9804  1.1  mrg   \txinativeunicodecapabletrue
   9805  1.1  mrg   \txiusebytewiseiofalse
   9806  1.1  mrg \fi
   9807  1.1  mrg 
   9808  1.1  mrg % Set I/O by bytes instead of UTF-8 sequence for XeTeX and LuaTex
   9809  1.1  mrg % for non-UTF-8 (byte-wise) encodings.
   9810  1.1  mrg %
   9811  1.1  mrg \def\setbytewiseio{%
   9812  1.1  mrg   \ifx\XeTeXrevision\thisisundefined
   9813  1.1  mrg   \else
   9814  1.1  mrg     \XeTeXdefaultencoding "bytes"  % For subsequent files to be read
   9815  1.1  mrg     \XeTeXinputencoding "bytes"  % For document root file
   9816  1.1  mrg     % Unfortunately, there seems to be no corresponding XeTeX command for
   9817  1.1  mrg     % output encoding.  This is a problem for auxiliary index and TOC files.
   9818  1.1  mrg     % The only solution would be perhaps to write out @U{...} sequences in
   9819  1.1  mrg     % place of non-ASCII characters.
   9820  1.1  mrg   \fi
   9821  1.1  mrg 
   9822  1.1  mrg   \ifx\luatexversion\thisisundefined
   9823  1.1  mrg   \else
   9824  1.1  mrg     \directlua{
   9825  1.1  mrg     local utf8_char, byte, gsub = unicode.utf8.char, string.byte, string.gsub
   9826  1.1  mrg     local function convert_char (char)
   9827  1.1  mrg       return utf8_char(byte(char))
   9828  1.1  mrg     end
   9829  1.1  mrg 
   9830  1.1  mrg     local function convert_line (line)
   9831  1.1  mrg       return gsub(line, ".", convert_char)
   9832  1.1  mrg     end
   9833  1.1  mrg 
   9834  1.1  mrg     callback.register("process_input_buffer", convert_line)
   9835  1.1  mrg 
   9836  1.1  mrg     local function convert_line_out (line)
   9837  1.1  mrg       local line_out = ""
   9838  1.1  mrg       for c in string.utfvalues(line) do
   9839  1.1  mrg          line_out = line_out .. string.char(c)
   9840  1.1  mrg       end
   9841  1.1  mrg       return line_out
   9842  1.1  mrg     end
   9843  1.1  mrg 
   9844  1.1  mrg     callback.register("process_output_buffer", convert_line_out)
   9845  1.1  mrg     }
   9846  1.1  mrg   \fi
   9847  1.1  mrg 
   9848  1.1  mrg   \txiusebytewiseiotrue
   9849  1.1  mrg }
   9850  1.1  mrg 
   9851  1.1  mrg 
   9852  1.1  mrg % Helpers for encodings.
   9853  1.1  mrg % Set the catcode of characters 128 through 255 to the specified number.
   9854  1.1  mrg %
   9855  1.1  mrg \def\setnonasciicharscatcode#1{%
   9856  1.1  mrg    \count255=128
   9857  1.1  mrg    \loop\ifnum\count255<256
   9858  1.1  mrg       \global\catcode\count255=#1\relax
   9859  1.1  mrg       \advance\count255 by 1
   9860  1.1  mrg    \repeat
   9861  1.1  mrg }
   9862  1.1  mrg 
   9863  1.1  mrg \def\setnonasciicharscatcodenonglobal#1{%
   9864  1.1  mrg    \count255=128
   9865  1.1  mrg    \loop\ifnum\count255<256
   9866  1.1  mrg       \catcode\count255=#1\relax
   9867  1.1  mrg       \advance\count255 by 1
   9868  1.1  mrg    \repeat
   9869  1.1  mrg }
   9870  1.1  mrg 
   9871  1.1  mrg % @documentencoding sets the definition of non-ASCII characters
   9872  1.1  mrg % according to the specified encoding.
   9873  1.1  mrg %
   9874  1.1  mrg \def\documentencoding{\parseargusing\filenamecatcodes\documentencodingzzz}
   9875  1.1  mrg \def\documentencodingzzz#1{%
   9876  1.1  mrg   %
   9877  1.1  mrg   % Encoding being declared for the document.
   9878  1.1  mrg   \def\declaredencoding{\csname #1.enc\endcsname}%
   9879  1.1  mrg   %
   9880  1.1  mrg   % Supported encodings: names converted to tokens in order to be able
   9881  1.1  mrg   % to compare them with \ifx.
   9882  1.1  mrg   \def\ascii{\csname US-ASCII.enc\endcsname}%
   9883  1.1  mrg   \def\latnine{\csname ISO-8859-15.enc\endcsname}%
   9884  1.1  mrg   \def\latone{\csname ISO-8859-1.enc\endcsname}%
   9885  1.1  mrg   \def\lattwo{\csname ISO-8859-2.enc\endcsname}%
   9886  1.1  mrg   \def\utfeight{\csname UTF-8.enc\endcsname}%
   9887  1.1  mrg   %
   9888  1.1  mrg   \ifx \declaredencoding \ascii
   9889  1.1  mrg      \asciichardefs
   9890  1.1  mrg   %
   9891  1.1  mrg   \else \ifx \declaredencoding \lattwo
   9892  1.1  mrg      \iftxinativeunicodecapable
   9893  1.1  mrg        \setbytewiseio
   9894  1.1  mrg      \fi
   9895  1.1  mrg      \setnonasciicharscatcode\active
   9896  1.1  mrg      \lattwochardefs
   9897  1.1  mrg   %
   9898  1.1  mrg   \else \ifx \declaredencoding \latone
   9899  1.1  mrg      \iftxinativeunicodecapable
   9900  1.1  mrg        \setbytewiseio
   9901  1.1  mrg      \fi
   9902  1.1  mrg      \setnonasciicharscatcode\active
   9903  1.1  mrg      \latonechardefs
   9904  1.1  mrg   %
   9905  1.1  mrg   \else \ifx \declaredencoding \latnine
   9906  1.1  mrg      \iftxinativeunicodecapable
   9907  1.1  mrg        \setbytewiseio
   9908  1.1  mrg      \fi
   9909  1.1  mrg      \setnonasciicharscatcode\active
   9910  1.1  mrg      \latninechardefs
   9911  1.1  mrg   %
   9912  1.1  mrg   \else \ifx \declaredencoding \utfeight
   9913  1.1  mrg      \iftxinativeunicodecapable
   9914  1.1  mrg        % For native Unicode handling (XeTeX and LuaTeX)
   9915  1.1  mrg        \nativeunicodechardefs
   9916  1.1  mrg      \else
   9917  1.1  mrg        % For treating UTF-8 as byte sequences (TeX, eTeX and pdfTeX)
   9918  1.1  mrg        \setnonasciicharscatcode\active
   9919  1.1  mrg        % since we already invoked \utfeightchardefs at the top level
   9920  1.1  mrg        % (below), do not re-invoke it, otherwise our check for duplicated
   9921  1.1  mrg        % definitions gets triggered.  Making non-ascii chars active is
   9922  1.1  mrg        % sufficient.
   9923  1.1  mrg      \fi
   9924  1.1  mrg   %
   9925  1.1  mrg   \else
   9926  1.1  mrg     \message{Ignoring unknown document encoding: #1.}%
   9927  1.1  mrg   %
   9928  1.1  mrg   \fi % utfeight
   9929  1.1  mrg   \fi % latnine
   9930  1.1  mrg   \fi % latone
   9931  1.1  mrg   \fi % lattwo
   9932  1.1  mrg   \fi % ascii
   9933  1.1  mrg   %
   9934  1.1  mrg   \ifx\XeTeXrevision\thisisundefined
   9935  1.1  mrg   \else
   9936  1.1  mrg     \ifx \declaredencoding \utfeight
   9937  1.1  mrg     \else
   9938  1.1  mrg       \ifx \declaredencoding \ascii
   9939  1.1  mrg       \else
   9940  1.1  mrg         \message{Warning: XeTeX with non-UTF-8 encodings cannot handle %
   9941  1.1  mrg         non-ASCII characters in auxiliary files.}%
   9942  1.1  mrg       \fi
   9943  1.1  mrg     \fi
   9944  1.1  mrg   \fi
   9945  1.1  mrg }
   9946  1.1  mrg 
   9947  1.1  mrg % emacs-page
   9948  1.1  mrg % A message to be logged when using a character that isn't available
   9949  1.1  mrg % the default font encoding (OT1).
   9950  1.1  mrg %
   9951  1.1  mrg \def\missingcharmsg#1{\message{Character missing, sorry: #1.}}
   9952  1.1  mrg 
   9953  1.1  mrg % Take account of \c (plain) vs. \, (Texinfo) difference.
   9954  1.1  mrg \def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi}
   9955  1.1  mrg 
   9956  1.1  mrg % First, make active non-ASCII characters in order for them to be
   9957  1.1  mrg % correctly categorized when TeX reads the replacement text of
   9958  1.1  mrg % macros containing the character definitions.
   9959  1.1  mrg \setnonasciicharscatcode\active
   9960  1.1  mrg %
   9961  1.1  mrg 
   9962  1.1  mrg \def\gdefchar#1#2{%
   9963  1.1  mrg \gdef#1{%
   9964  1.1  mrg    \ifpassthroughchars
   9965  1.1  mrg      \string#1%
   9966  1.1  mrg    \else
   9967  1.1  mrg      #2%
   9968  1.1  mrg    \fi
   9969  1.1  mrg }}
   9970  1.1  mrg 
   9971  1.1  mrg % Latin1 (ISO-8859-1) character definitions.
   9972  1.1  mrg \def\latonechardefs{%
   9973  1.1  mrg   \gdefchar^^a0{\tie}
   9974  1.1  mrg   \gdefchar^^a1{\exclamdown}
   9975  1.1  mrg   \gdefchar^^a2{{\tcfont \char162}} % cent
   9976  1.1  mrg   \gdefchar^^a3{\pounds{}}
   9977  1.1  mrg   \gdefchar^^a4{{\tcfont \char164}} % currency
   9978  1.1  mrg   \gdefchar^^a5{{\tcfont \char165}} % yen
   9979  1.1  mrg   \gdefchar^^a6{{\tcfont \char166}} % broken bar
   9980  1.1  mrg   \gdefchar^^a7{\S}
   9981  1.1  mrg   \gdefchar^^a8{\"{}}
   9982  1.1  mrg   \gdefchar^^a9{\copyright{}}
   9983  1.1  mrg   \gdefchar^^aa{\ordf}
   9984  1.1  mrg   \gdefchar^^ab{\guillemetleft{}}
   9985  1.1  mrg   \gdefchar^^ac{\ensuremath\lnot}
   9986  1.1  mrg   \gdefchar^^ad{\-}
   9987  1.1  mrg   \gdefchar^^ae{\registeredsymbol{}}
   9988  1.1  mrg   \gdefchar^^af{\={}}
   9989  1.1  mrg   %
   9990  1.1  mrg   \gdefchar^^b0{\textdegree}
   9991  1.1  mrg   \gdefchar^^b1{$\pm$}
   9992  1.1  mrg   \gdefchar^^b2{$^2$}
   9993  1.1  mrg   \gdefchar^^b3{$^3$}
   9994  1.1  mrg   \gdefchar^^b4{\'{}}
   9995  1.1  mrg   \gdefchar^^b5{$\mu$}
   9996  1.1  mrg   \gdefchar^^b6{\P}
   9997  1.1  mrg   \gdefchar^^b7{\ensuremath\cdot}
   9998  1.1  mrg   \gdefchar^^b8{\cedilla\ }
   9999  1.1  mrg   \gdefchar^^b9{$^1$}
   10000  1.1  mrg   \gdefchar^^ba{\ordm}
   10001  1.1  mrg   \gdefchar^^bb{\guillemetright{}}
   10002  1.1  mrg   \gdefchar^^bc{$1\over4$}
   10003  1.1  mrg   \gdefchar^^bd{$1\over2$}
   10004  1.1  mrg   \gdefchar^^be{$3\over4$}
   10005  1.1  mrg   \gdefchar^^bf{\questiondown}
   10006  1.1  mrg   %
   10007  1.1  mrg   \gdefchar^^c0{\`A}
   10008  1.1  mrg   \gdefchar^^c1{\'A}
   10009  1.1  mrg   \gdefchar^^c2{\^A}
   10010  1.1  mrg   \gdefchar^^c3{\~A}
   10011  1.1  mrg   \gdefchar^^c4{\"A}
   10012  1.1  mrg   \gdefchar^^c5{\ringaccent A}
   10013  1.1  mrg   \gdefchar^^c6{\AE}
   10014  1.1  mrg   \gdefchar^^c7{\cedilla C}
   10015  1.1  mrg   \gdefchar^^c8{\`E}
   10016  1.1  mrg   \gdefchar^^c9{\'E}
   10017  1.1  mrg   \gdefchar^^ca{\^E}
   10018  1.1  mrg   \gdefchar^^cb{\"E}
   10019  1.1  mrg   \gdefchar^^cc{\`I}
   10020  1.1  mrg   \gdefchar^^cd{\'I}
   10021  1.1  mrg   \gdefchar^^ce{\^I}
   10022  1.1  mrg   \gdefchar^^cf{\"I}
   10023  1.1  mrg   %
   10024  1.1  mrg   \gdefchar^^d0{\DH}
   10025  1.1  mrg   \gdefchar^^d1{\~N}
   10026  1.1  mrg   \gdefchar^^d2{\`O}
   10027  1.1  mrg   \gdefchar^^d3{\'O}
   10028  1.1  mrg   \gdefchar^^d4{\^O}
   10029  1.1  mrg   \gdefchar^^d5{\~O}
   10030  1.1  mrg   \gdefchar^^d6{\"O}
   10031  1.1  mrg   \gdefchar^^d7{$\times$}
   10032  1.1  mrg   \gdefchar^^d8{\O}
   10033  1.1  mrg   \gdefchar^^d9{\`U}
   10034  1.1  mrg   \gdefchar^^da{\'U}
   10035  1.1  mrg   \gdefchar^^db{\^U}
   10036  1.1  mrg   \gdefchar^^dc{\"U}
   10037  1.1  mrg   \gdefchar^^dd{\'Y}
   10038  1.1  mrg   \gdefchar^^de{\TH}
   10039  1.1  mrg   \gdefchar^^df{\ss}
   10040  1.1  mrg   %
   10041  1.1  mrg   \gdefchar^^e0{\`a}
   10042  1.1  mrg   \gdefchar^^e1{\'a}
   10043  1.1  mrg   \gdefchar^^e2{\^a}
   10044  1.1  mrg   \gdefchar^^e3{\~a}
   10045  1.1  mrg   \gdefchar^^e4{\"a}
   10046  1.1  mrg   \gdefchar^^e5{\ringaccent a}
   10047  1.1  mrg   \gdefchar^^e6{\ae}
   10048  1.1  mrg   \gdefchar^^e7{\cedilla c}
   10049  1.1  mrg   \gdefchar^^e8{\`e}
   10050  1.1  mrg   \gdefchar^^e9{\'e}
   10051  1.1  mrg   \gdefchar^^ea{\^e}
   10052  1.1  mrg   \gdefchar^^eb{\"e}
   10053  1.1  mrg   \gdefchar^^ec{\`{\dotless i}}
   10054  1.1  mrg   \gdefchar^^ed{\'{\dotless i}}
   10055  1.1  mrg   \gdefchar^^ee{\^{\dotless i}}
   10056  1.1  mrg   \gdefchar^^ef{\"{\dotless i}}
   10057  1.1  mrg   %
   10058  1.1  mrg   \gdefchar^^f0{\dh}
   10059  1.1  mrg   \gdefchar^^f1{\~n}
   10060  1.1  mrg   \gdefchar^^f2{\`o}
   10061  1.1  mrg   \gdefchar^^f3{\'o}
   10062  1.1  mrg   \gdefchar^^f4{\^o}
   10063  1.1  mrg   \gdefchar^^f5{\~o}
   10064  1.1  mrg   \gdefchar^^f6{\"o}
   10065  1.1  mrg   \gdefchar^^f7{$\div$}
   10066  1.1  mrg   \gdefchar^^f8{\o}
   10067  1.1  mrg   \gdefchar^^f9{\`u}
   10068  1.1  mrg   \gdefchar^^fa{\'u}
   10069  1.1  mrg   \gdefchar^^fb{\^u}
   10070  1.1  mrg   \gdefchar^^fc{\"u}
   10071  1.1  mrg   \gdefchar^^fd{\'y}
   10072  1.1  mrg   \gdefchar^^fe{\th}
   10073  1.1  mrg   \gdefchar^^ff{\"y}
   10074  1.1  mrg }
   10075  1.1  mrg 
   10076  1.1  mrg % Latin9 (ISO-8859-15) encoding character definitions.
   10077  1.1  mrg \def\latninechardefs{%
   10078  1.1  mrg   % Encoding is almost identical to Latin1.
   10079  1.1  mrg   \latonechardefs
   10080  1.1  mrg   %
   10081  1.1  mrg   \gdefchar^^a4{\euro{}}
   10082  1.1  mrg   \gdefchar^^a6{\v S}
   10083  1.1  mrg   \gdefchar^^a8{\v s}
   10084  1.1  mrg   \gdefchar^^b4{\v Z}
   10085  1.1  mrg   \gdefchar^^b8{\v z}
   10086  1.1  mrg   \gdefchar^^bc{\OE}
   10087  1.1  mrg   \gdefchar^^bd{\oe}
   10088  1.1  mrg   \gdefchar^^be{\"Y}
   10089  1.1  mrg }
   10090  1.1  mrg 
   10091  1.1  mrg % Latin2 (ISO-8859-2) character definitions.
   10092  1.1  mrg \def\lattwochardefs{%
   10093  1.1  mrg   \gdefchar^^a0{\tie}
   10094  1.1  mrg   \gdefchar^^a1{\ogonek{A}}
   10095  1.1  mrg   \gdefchar^^a2{\u{}}
   10096  1.1  mrg   \gdefchar^^a3{\L}
   10097  1.1  mrg   \gdefchar^^a4{\missingcharmsg{CURRENCY SIGN}}
   10098  1.1  mrg   \gdefchar^^a5{\v L}
   10099  1.1  mrg   \gdefchar^^a6{\'S}
   10100  1.1  mrg   \gdefchar^^a7{\S}
   10101  1.1  mrg   \gdefchar^^a8{\"{}}
   10102  1.1  mrg   \gdefchar^^a9{\v S}
   10103  1.1  mrg   \gdefchar^^aa{\cedilla S}
   10104  1.1  mrg   \gdefchar^^ab{\v T}
   10105  1.1  mrg   \gdefchar^^ac{\'Z}
   10106  1.1  mrg   \gdefchar^^ad{\-}
   10107  1.1  mrg   \gdefchar^^ae{\v Z}
   10108  1.1  mrg   \gdefchar^^af{\dotaccent Z}
   10109  1.1  mrg   %
   10110  1.1  mrg   \gdefchar^^b0{\textdegree{}}
   10111  1.1  mrg   \gdefchar^^b1{\ogonek{a}}
   10112  1.1  mrg   \gdefchar^^b2{\ogonek{ }}
   10113  1.1  mrg   \gdefchar^^b3{\l}
   10114  1.1  mrg   \gdefchar^^b4{\'{}}
   10115  1.1  mrg   \gdefchar^^b5{\v l}
   10116  1.1  mrg   \gdefchar^^b6{\'s}
   10117  1.1  mrg   \gdefchar^^b7{\v{}}
   10118  1.1  mrg   \gdefchar^^b8{\cedilla\ }
   10119  1.1  mrg   \gdefchar^^b9{\v s}
   10120  1.1  mrg   \gdefchar^^ba{\cedilla s}
   10121  1.1  mrg   \gdefchar^^bb{\v t}
   10122  1.1  mrg   \gdefchar^^bc{\'z}
   10123  1.1  mrg   \gdefchar^^bd{\H{}}
   10124  1.1  mrg   \gdefchar^^be{\v z}
   10125  1.1  mrg   \gdefchar^^bf{\dotaccent z}
   10126  1.1  mrg   %
   10127  1.1  mrg   \gdefchar^^c0{\'R}
   10128  1.1  mrg   \gdefchar^^c1{\'A}
   10129  1.1  mrg   \gdefchar^^c2{\^A}
   10130  1.1  mrg   \gdefchar^^c3{\u A}
   10131  1.1  mrg   \gdefchar^^c4{\"A}
   10132  1.1  mrg   \gdefchar^^c5{\'L}
   10133  1.1  mrg   \gdefchar^^c6{\'C}
   10134  1.1  mrg   \gdefchar^^c7{\cedilla C}
   10135  1.1  mrg   \gdefchar^^c8{\v C}
   10136  1.1  mrg   \gdefchar^^c9{\'E}
   10137  1.1  mrg   \gdefchar^^ca{\ogonek{E}}
   10138  1.1  mrg   \gdefchar^^cb{\"E}
   10139  1.1  mrg   \gdefchar^^cc{\v E}
   10140  1.1  mrg   \gdefchar^^cd{\'I}
   10141  1.1  mrg   \gdefchar^^ce{\^I}
   10142  1.1  mrg   \gdefchar^^cf{\v D}
   10143  1.1  mrg   %
   10144  1.1  mrg   \gdefchar^^d0{\DH}
   10145  1.1  mrg   \gdefchar^^d1{\'N}
   10146  1.1  mrg   \gdefchar^^d2{\v N}
   10147  1.1  mrg   \gdefchar^^d3{\'O}
   10148  1.1  mrg   \gdefchar^^d4{\^O}
   10149  1.1  mrg   \gdefchar^^d5{\H O}
   10150  1.1  mrg   \gdefchar^^d6{\"O}
   10151  1.1  mrg   \gdefchar^^d7{$\times$}
   10152  1.1  mrg   \gdefchar^^d8{\v R}
   10153  1.1  mrg   \gdefchar^^d9{\ringaccent U}
   10154  1.1  mrg   \gdefchar^^da{\'U}
   10155  1.1  mrg   \gdefchar^^db{\H U}
   10156  1.1  mrg   \gdefchar^^dc{\"U}
   10157  1.1  mrg   \gdefchar^^dd{\'Y}
   10158  1.1  mrg   \gdefchar^^de{\cedilla T}
   10159  1.1  mrg   \gdefchar^^df{\ss}
   10160  1.1  mrg   %
   10161  1.1  mrg   \gdefchar^^e0{\'r}
   10162  1.1  mrg   \gdefchar^^e1{\'a}
   10163  1.1  mrg   \gdefchar^^e2{\^a}
   10164  1.1  mrg   \gdefchar^^e3{\u a}
   10165  1.1  mrg   \gdefchar^^e4{\"a}
   10166  1.1  mrg   \gdefchar^^e5{\'l}
   10167  1.1  mrg   \gdefchar^^e6{\'c}
   10168  1.1  mrg   \gdefchar^^e7{\cedilla c}
   10169  1.1  mrg   \gdefchar^^e8{\v c}
   10170  1.1  mrg   \gdefchar^^e9{\'e}
   10171  1.1  mrg   \gdefchar^^ea{\ogonek{e}}
   10172  1.1  mrg   \gdefchar^^eb{\"e}
   10173  1.1  mrg   \gdefchar^^ec{\v e}
   10174  1.1  mrg   \gdefchar^^ed{\'{\dotless{i}}}
   10175  1.1  mrg   \gdefchar^^ee{\^{\dotless{i}}}
   10176  1.1  mrg   \gdefchar^^ef{\v d}
   10177  1.1  mrg   %
   10178  1.1  mrg   \gdefchar^^f0{\dh}
   10179  1.1  mrg   \gdefchar^^f1{\'n}
   10180  1.1  mrg   \gdefchar^^f2{\v n}
   10181  1.1  mrg   \gdefchar^^f3{\'o}
   10182  1.1  mrg   \gdefchar^^f4{\^o}
   10183  1.1  mrg   \gdefchar^^f5{\H o}
   10184  1.1  mrg   \gdefchar^^f6{\"o}
   10185  1.1  mrg   \gdefchar^^f7{$\div$}
   10186  1.1  mrg   \gdefchar^^f8{\v r}
   10187  1.1  mrg   \gdefchar^^f9{\ringaccent u}
   10188  1.1  mrg   \gdefchar^^fa{\'u}
   10189  1.1  mrg   \gdefchar^^fb{\H u}
   10190  1.1  mrg   \gdefchar^^fc{\"u}
   10191  1.1  mrg   \gdefchar^^fd{\'y}
   10192  1.1  mrg   \gdefchar^^fe{\cedilla t}
   10193  1.1  mrg   \gdefchar^^ff{\dotaccent{}}
   10194  1.1  mrg }
   10195  1.1  mrg 
   10196  1.1  mrg % UTF-8 character definitions.
   10197  1.1  mrg %
   10198  1.1  mrg % This code to support UTF-8 is based on LaTeX's utf8.def, with some
   10199  1.1  mrg % changes for Texinfo conventions.  It is included here under the GPL by
   10200  1.1  mrg % permission from Frank Mittelbach and the LaTeX team.
   10201  1.1  mrg %
   10202  1.1  mrg \newcount\countUTFx
   10203  1.1  mrg \newcount\countUTFy
   10204  1.1  mrg \newcount\countUTFz
   10205  1.1  mrg 
   10206  1.1  mrg \gdef\UTFviiiTwoOctets#1#2{\expandafter
   10207  1.1  mrg    \UTFviiiDefined\csname u8:#1\string #2\endcsname}
   10208  1.1  mrg %
   10209  1.1  mrg \gdef\UTFviiiThreeOctets#1#2#3{\expandafter
   10210  1.1  mrg    \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname}
   10211  1.1  mrg %
   10212  1.1  mrg \gdef\UTFviiiFourOctets#1#2#3#4{\expandafter
   10213  1.1  mrg    \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname}
   10214  1.1  mrg 
   10215  1.1  mrg \gdef\UTFviiiDefined#1{%
   10216  1.1  mrg   \ifx #1\relax
   10217  1.1  mrg     \message{\linenumber Unicode char \string #1 not defined for Texinfo}%
   10218  1.1  mrg   \else
   10219  1.1  mrg     \expandafter #1%
   10220  1.1  mrg   \fi
   10221  1.1  mrg }
   10222  1.1  mrg 
   10223  1.1  mrg % Give non-ASCII bytes the active definitions for processing UTF-8 sequences
   10224  1.1  mrg \begingroup
   10225  1.1  mrg   \catcode`\~13
   10226  1.1  mrg   \catcode`\$12
   10227  1.1  mrg   \catcode`\"12
   10228  1.1  mrg 
   10229  1.1  mrg   % Loop from \countUTFx to \countUTFy, performing \UTFviiiTmp
   10230  1.1  mrg   % substituting ~ and $ with a character token of that value.
   10231  1.1  mrg   \def\UTFviiiLoop{%
   10232  1.1  mrg     \global\catcode\countUTFx\active
   10233  1.1  mrg     \uccode`\~\countUTFx
   10234  1.1  mrg     \uccode`\$\countUTFx
   10235  1.1  mrg     \uppercase\expandafter{\UTFviiiTmp}%
   10236  1.1  mrg     \advance\countUTFx by 1
   10237  1.1  mrg     \ifnum\countUTFx < \countUTFy
   10238  1.1  mrg       \expandafter\UTFviiiLoop
   10239  1.1  mrg     \fi}
   10240  1.1  mrg 
   10241  1.1  mrg   % For bytes other than the first in a UTF-8 sequence.  Not expected to
   10242  1.1  mrg   % be expanded except when writing to auxiliary files.
   10243  1.1  mrg   \countUTFx = "80
   10244  1.1  mrg   \countUTFy = "C2
   10245  1.1  mrg   \def\UTFviiiTmp{%
   10246  1.1  mrg     \gdef~{%
   10247  1.1  mrg         \ifpassthroughchars $\fi}}%
   10248  1.1  mrg   \UTFviiiLoop
   10249  1.1  mrg 
   10250  1.1  mrg   \countUTFx = "C2
   10251  1.1  mrg   \countUTFy = "E0
   10252  1.1  mrg   \def\UTFviiiTmp{%
   10253  1.1  mrg     \gdef~{%
   10254  1.1  mrg         \ifpassthroughchars $%
   10255  1.1  mrg         \else\expandafter\UTFviiiTwoOctets\expandafter$\fi}}%
   10256  1.1  mrg   \UTFviiiLoop
   10257  1.1  mrg 
   10258  1.1  mrg   \countUTFx = "E0
   10259  1.1  mrg   \countUTFy = "F0
   10260  1.1  mrg   \def\UTFviiiTmp{%
   10261  1.1  mrg     \gdef~{%
   10262  1.1  mrg         \ifpassthroughchars $%
   10263  1.1  mrg         \else\expandafter\UTFviiiThreeOctets\expandafter$\fi}}%
   10264  1.1  mrg   \UTFviiiLoop
   10265  1.1  mrg 
   10266  1.1  mrg   \countUTFx = "F0
   10267  1.1  mrg   \countUTFy = "F4
   10268  1.1  mrg   \def\UTFviiiTmp{%
   10269  1.1  mrg     \gdef~{%
   10270  1.1  mrg         \ifpassthroughchars $%
   10271  1.1  mrg         \else\expandafter\UTFviiiFourOctets\expandafter$\fi
   10272  1.1  mrg         }}%
   10273  1.1  mrg   \UTFviiiLoop
   10274  1.1  mrg \endgroup
   10275  1.1  mrg 
   10276  1.1  mrg \def\globallet{\global\let} % save some \expandafter's below
   10277  1.1  mrg 
   10278  1.1  mrg % @U{xxxx} to produce U+xxxx, if we support it.
   10279  1.1  mrg \def\U#1{%
   10280  1.1  mrg   \expandafter\ifx\csname uni:#1\endcsname \relax
   10281  1.1  mrg     \iftxinativeunicodecapable
   10282  1.1  mrg       % All Unicode characters can be used if native Unicode handling is
   10283  1.1  mrg       % active.  However, if the font does not have the glyph,
   10284  1.1  mrg       % letters are missing.
   10285  1.1  mrg       \begingroup
   10286  1.1  mrg         \uccode`\.="#1\relax
   10287  1.1  mrg         \uppercase{.}
   10288  1.1  mrg       \endgroup
   10289  1.1  mrg     \else
   10290  1.1  mrg       \errhelp = \EMsimple
   10291  1.1  mrg       \errmessage{Unicode character U+#1 not supported, sorry}%
   10292  1.1  mrg     \fi
   10293  1.1  mrg   \else
   10294  1.1  mrg     \csname uni:#1\endcsname
   10295  1.1  mrg   \fi
   10296  1.1  mrg }
   10297  1.1  mrg 
   10298  1.1  mrg % These macros are used here to construct the name of a control
   10299  1.1  mrg % sequence to be defined.
   10300  1.1  mrg \def\UTFviiiTwoOctetsName#1#2{%
   10301  1.1  mrg   \csname u8:#1\string #2\endcsname}%
   10302  1.1  mrg \def\UTFviiiThreeOctetsName#1#2#3{%
   10303  1.1  mrg   \csname u8:#1\string #2\string #3\endcsname}%
   10304  1.1  mrg \def\UTFviiiFourOctetsName#1#2#3#4{%
   10305  1.1  mrg   \csname u8:#1\string #2\string #3\string #4\endcsname}%
   10306  1.1  mrg 
   10307  1.1  mrg % For UTF-8 byte sequences (TeX, e-TeX and pdfTeX),
   10308  1.1  mrg % provide a definition macro to replace a Unicode character;
   10309  1.1  mrg % this gets used by the @U command
   10310  1.1  mrg %
   10311  1.1  mrg \begingroup
   10312  1.1  mrg   \catcode`\"=12
   10313  1.1  mrg   \catcode`\<=12
   10314  1.1  mrg   \catcode`\.=12
   10315  1.1  mrg   \catcode`\,=12
   10316  1.1  mrg   \catcode`\;=12
   10317  1.1  mrg   \catcode`\!=12
   10318  1.1  mrg   \catcode`\~=13
   10319  1.1  mrg   \gdef\DeclareUnicodeCharacterUTFviii#1#2{%
   10320  1.1  mrg     \countUTFz = "#1\relax
   10321  1.1  mrg     \begingroup
   10322  1.1  mrg       \parseXMLCharref
   10323  1.1  mrg 
   10324  1.1  mrg       % Give \u8:... its definition.  The sequence of seven \expandafter's
   10325  1.1  mrg       % expands after the \gdef three times, e.g.
   10326  1.1  mrg       %
   10327  1.1  mrg       % 1.  \UTFviiTwoOctetsName B1 B2
   10328  1.1  mrg       % 2.  \csname u8:B1 \string B2 \endcsname
   10329  1.1  mrg       % 3.  \u8: B1 B2  (a single control sequence token)
   10330  1.1  mrg       %
   10331  1.1  mrg       \expandafter\expandafter
   10332  1.1  mrg       \expandafter\expandafter
   10333  1.1  mrg       \expandafter\expandafter
   10334  1.1  mrg       \expandafter\gdef       \UTFviiiTmp{#2}%
   10335  1.1  mrg       %
   10336  1.1  mrg       \expandafter\ifx\csname uni:#1\endcsname \relax \else
   10337  1.1  mrg        \message{Internal error, already defined: #1}%
   10338  1.1  mrg       \fi
   10339  1.1  mrg       %
   10340  1.1  mrg       % define an additional control sequence for this code point.
   10341  1.1  mrg       \expandafter\globallet\csname uni:#1\endcsname \UTFviiiTmp
   10342  1.1  mrg     \endgroup}
   10343  1.1  mrg   %
   10344  1.1  mrg   % Given the value in \countUTFz as a Unicode code point, set \UTFviiiTmp
   10345  1.1  mrg   % to the corresponding UTF-8 sequence.
   10346  1.1  mrg   \gdef\parseXMLCharref{%
   10347  1.1  mrg     \ifnum\countUTFz < "A0\relax
   10348  1.1  mrg       \errhelp = \EMsimple
   10349  1.1  mrg       \errmessage{Cannot define Unicode char value < 00A0}%
   10350  1.1  mrg     \else\ifnum\countUTFz < "800\relax
   10351  1.1  mrg       \parseUTFviiiA,%
   10352  1.1  mrg       \parseUTFviiiB C\UTFviiiTwoOctetsName.,%
   10353  1.1  mrg     \else\ifnum\countUTFz < "10000\relax
   10354  1.1  mrg       \parseUTFviiiA;%
   10355  1.1  mrg       \parseUTFviiiA,%
   10356  1.1  mrg       \parseUTFviiiB E\UTFviiiThreeOctetsName.{,;}%
   10357  1.1  mrg     \else
   10358  1.1  mrg       \parseUTFviiiA;%
   10359  1.1  mrg       \parseUTFviiiA,%
   10360  1.1  mrg       \parseUTFviiiA!%
   10361  1.1  mrg       \parseUTFviiiB F\UTFviiiFourOctetsName.{!,;}%
   10362  1.1  mrg     \fi\fi\fi
   10363  1.1  mrg   }
   10364  1.1  mrg 
   10365  1.1  mrg   % Extract a byte from the end of the UTF-8 representation of \countUTFx.
   10366  1.1  mrg   % It must be a non-initial byte in the sequence.
   10367  1.1  mrg   % Change \uccode of #1 for it to be used in \parseUTFviiiB as one
   10368  1.1  mrg   % of the bytes.
   10369  1.1  mrg   \gdef\parseUTFviiiA#1{%
   10370  1.1  mrg     \countUTFx = \countUTFz
   10371  1.1  mrg     \divide\countUTFz by 64
   10372  1.1  mrg     \countUTFy = \countUTFz  % Save to be the future value of \countUTFz.
   10373  1.1  mrg     \multiply\countUTFz by 64
   10374  1.1  mrg 
   10375  1.1  mrg     % \countUTFz is now \countUTFx with the last 5 bits cleared.  Subtract
   10376  1.1  mrg     % in order to get the last five bits.
   10377  1.1  mrg     \advance\countUTFx by -\countUTFz
   10378  1.1  mrg 
   10379  1.1  mrg     % Convert this to the byte in the UTF-8 sequence.
   10380  1.1  mrg     \advance\countUTFx by 128
   10381  1.1  mrg     \uccode `#1\countUTFx
   10382  1.1  mrg     \countUTFz = \countUTFy}
   10383  1.1  mrg 
   10384  1.1  mrg   % Used to put a UTF-8 byte sequence into \UTFviiiTmp
   10385  1.1  mrg   % #1 is the increment for \countUTFz to yield a the first byte of the UTF-8
   10386  1.1  mrg   %    sequence.
   10387  1.1  mrg   % #2 is one of the \UTFviii*OctetsName macros.
   10388  1.1  mrg   % #3 is always a full stop (.)
   10389  1.1  mrg   % #4 is a template for the other bytes in the sequence.  The values for these
   10390  1.1  mrg   %    bytes is substituted in here with \uppercase using the \uccode's.
   10391  1.1  mrg   \gdef\parseUTFviiiB#1#2#3#4{%
   10392  1.1  mrg     \advance\countUTFz by "#10\relax
   10393  1.1  mrg     \uccode `#3\countUTFz
   10394  1.1  mrg     \uppercase{\gdef\UTFviiiTmp{#2#3#4}}}
   10395  1.1  mrg \endgroup
   10396  1.1  mrg 
   10397  1.1  mrg % For native Unicode handling (XeTeX and LuaTeX),
   10398  1.1  mrg % provide a definition macro that sets a catcode to `other' non-globally
   10399  1.1  mrg %
   10400  1.1  mrg \def\DeclareUnicodeCharacterNativeOther#1#2{%
   10401  1.1  mrg   \catcode"#1=\other
   10402  1.1  mrg }
   10403  1.1  mrg 
   10404  1.1  mrg % https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_M
   10405  1.1  mrg % U+0000..U+007F = https://en.wikipedia.org/wiki/Basic_Latin_(Unicode_block)
   10406  1.1  mrg % U+0080..U+00FF = https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)
   10407  1.1  mrg % U+0100..U+017F = https://en.wikipedia.org/wiki/Latin_Extended-A
   10408  1.1  mrg % U+0180..U+024F = https://en.wikipedia.org/wiki/Latin_Extended-B
   10409  1.1  mrg %
   10410  1.1  mrg % Many of our renditions are less than wonderful, and all the missing
   10411  1.1  mrg % characters are available somewhere.  Loading the necessary fonts
   10412  1.1  mrg % awaits user request.  We can't truly support Unicode without
   10413  1.1  mrg % reimplementing everything that's been done in LaTeX for many years,
   10414  1.1  mrg % plus probably using luatex or xetex, and who knows what else.
   10415  1.1  mrg % We won't be doing that here in this simple file.  But we can try to at
   10416  1.1  mrg % least make most of the characters not bomb out.
   10417  1.1  mrg %
   10418  1.1  mrg \def\unicodechardefs{%
   10419  1.1  mrg   \DeclareUnicodeCharacter{00A0}{\tie}%
   10420  1.1  mrg   \DeclareUnicodeCharacter{00A1}{\exclamdown}%
   10421  1.1  mrg   \DeclareUnicodeCharacter{00A2}{{\tcfont \char162}}% 0242=cent
   10422  1.1  mrg   \DeclareUnicodeCharacter{00A3}{\pounds{}}%
   10423  1.1  mrg   \DeclareUnicodeCharacter{00A4}{{\tcfont \char164}}% 0244=currency
   10424  1.1  mrg   \DeclareUnicodeCharacter{00A5}{{\tcfont \char165}}% 0245=yen
   10425  1.1  mrg   \DeclareUnicodeCharacter{00A6}{{\tcfont \char166}}% 0246=brokenbar
   10426  1.1  mrg   \DeclareUnicodeCharacter{00A7}{\S}%
   10427  1.1  mrg   \DeclareUnicodeCharacter{00A8}{\"{ }}%
   10428  1.1  mrg   \DeclareUnicodeCharacter{00A9}{\copyright{}}%
   10429  1.1  mrg   \DeclareUnicodeCharacter{00AA}{\ordf}%
   10430  1.1  mrg   \DeclareUnicodeCharacter{00AB}{\guillemetleft{}}%
   10431  1.1  mrg   \DeclareUnicodeCharacter{00AC}{\ensuremath\lnot}%
   10432  1.1  mrg   \DeclareUnicodeCharacter{00AD}{\-}%
   10433  1.1  mrg   \DeclareUnicodeCharacter{00AE}{\registeredsymbol{}}%
   10434  1.1  mrg   \DeclareUnicodeCharacter{00AF}{\={ }}%
   10435  1.1  mrg   %
   10436  1.1  mrg   \DeclareUnicodeCharacter{00B0}{\ringaccent{ }}%
   10437  1.1  mrg   \DeclareUnicodeCharacter{00B1}{\ensuremath\pm}%
   10438  1.1  mrg   \DeclareUnicodeCharacter{00B2}{$^2$}%
   10439  1.1  mrg   \DeclareUnicodeCharacter{00B3}{$^3$}%
   10440  1.1  mrg   \DeclareUnicodeCharacter{00B4}{\'{ }}%
   10441  1.1  mrg   \DeclareUnicodeCharacter{00B5}{$\mu$}%
   10442  1.1  mrg   \DeclareUnicodeCharacter{00B6}{\P}%
   10443  1.1  mrg   \DeclareUnicodeCharacter{00B7}{\ensuremath\cdot}%
   10444  1.1  mrg   \DeclareUnicodeCharacter{00B8}{\cedilla{ }}%
   10445  1.1  mrg   \DeclareUnicodeCharacter{00B9}{$^1$}%
   10446  1.1  mrg   \DeclareUnicodeCharacter{00BA}{\ordm}%
   10447  1.1  mrg   \DeclareUnicodeCharacter{00BB}{\guillemetright{}}%
   10448  1.1  mrg   \DeclareUnicodeCharacter{00BC}{$1\over4$}%
   10449  1.1  mrg   \DeclareUnicodeCharacter{00BD}{$1\over2$}%
   10450  1.1  mrg   \DeclareUnicodeCharacter{00BE}{$3\over4$}%
   10451  1.1  mrg   \DeclareUnicodeCharacter{00BF}{\questiondown}%
   10452  1.1  mrg   %
   10453  1.1  mrg   \DeclareUnicodeCharacter{00C0}{\`A}%
   10454  1.1  mrg   \DeclareUnicodeCharacter{00C1}{\'A}%
   10455  1.1  mrg   \DeclareUnicodeCharacter{00C2}{\^A}%
   10456  1.1  mrg   \DeclareUnicodeCharacter{00C3}{\~A}%
   10457  1.1  mrg   \DeclareUnicodeCharacter{00C4}{\"A}%
   10458  1.1  mrg   \DeclareUnicodeCharacter{00C5}{\AA}%
   10459  1.1  mrg   \DeclareUnicodeCharacter{00C6}{\AE}%
   10460  1.1  mrg   \DeclareUnicodeCharacter{00C7}{\cedilla{C}}%
   10461  1.1  mrg   \DeclareUnicodeCharacter{00C8}{\`E}%
   10462  1.1  mrg   \DeclareUnicodeCharacter{00C9}{\'E}%
   10463  1.1  mrg   \DeclareUnicodeCharacter{00CA}{\^E}%
   10464  1.1  mrg   \DeclareUnicodeCharacter{00CB}{\"E}%
   10465  1.1  mrg   \DeclareUnicodeCharacter{00CC}{\`I}%
   10466  1.1  mrg   \DeclareUnicodeCharacter{00CD}{\'I}%
   10467  1.1  mrg   \DeclareUnicodeCharacter{00CE}{\^I}%
   10468  1.1  mrg   \DeclareUnicodeCharacter{00CF}{\"I}%
   10469  1.1  mrg   %
   10470  1.1  mrg   \DeclareUnicodeCharacter{00D0}{\DH}%
   10471  1.1  mrg   \DeclareUnicodeCharacter{00D1}{\~N}%
   10472  1.1  mrg   \DeclareUnicodeCharacter{00D2}{\`O}%
   10473  1.1  mrg   \DeclareUnicodeCharacter{00D3}{\'O}%
   10474  1.1  mrg   \DeclareUnicodeCharacter{00D4}{\^O}%
   10475  1.1  mrg   \DeclareUnicodeCharacter{00D5}{\~O}%
   10476  1.1  mrg   \DeclareUnicodeCharacter{00D6}{\"O}%
   10477  1.1  mrg   \DeclareUnicodeCharacter{00D7}{\ensuremath\times}%
   10478  1.1  mrg   \DeclareUnicodeCharacter{00D8}{\O}%
   10479  1.1  mrg   \DeclareUnicodeCharacter{00D9}{\`U}%
   10480  1.1  mrg   \DeclareUnicodeCharacter{00DA}{\'U}%
   10481  1.1  mrg   \DeclareUnicodeCharacter{00DB}{\^U}%
   10482  1.1  mrg   \DeclareUnicodeCharacter{00DC}{\"U}%
   10483  1.1  mrg   \DeclareUnicodeCharacter{00DD}{\'Y}%
   10484  1.1  mrg   \DeclareUnicodeCharacter{00DE}{\TH}%
   10485  1.1  mrg   \DeclareUnicodeCharacter{00DF}{\ss}%
   10486  1.1  mrg   %
   10487  1.1  mrg   \DeclareUnicodeCharacter{00E0}{\`a}%
   10488  1.1  mrg   \DeclareUnicodeCharacter{00E1}{\'a}%
   10489  1.1  mrg   \DeclareUnicodeCharacter{00E2}{\^a}%
   10490  1.1  mrg   \DeclareUnicodeCharacter{00E3}{\~a}%
   10491  1.1  mrg   \DeclareUnicodeCharacter{00E4}{\"a}%
   10492  1.1  mrg   \DeclareUnicodeCharacter{00E5}{\aa}%
   10493  1.1  mrg   \DeclareUnicodeCharacter{00E6}{\ae}%
   10494  1.1  mrg   \DeclareUnicodeCharacter{00E7}{\cedilla{c}}%
   10495  1.1  mrg   \DeclareUnicodeCharacter{00E8}{\`e}%
   10496  1.1  mrg   \DeclareUnicodeCharacter{00E9}{\'e}%
   10497  1.1  mrg   \DeclareUnicodeCharacter{00EA}{\^e}%
   10498  1.1  mrg   \DeclareUnicodeCharacter{00EB}{\"e}%
   10499  1.1  mrg   \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}}%
   10500  1.1  mrg   \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}}%
   10501  1.1  mrg   \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}}%
   10502  1.1  mrg   \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}}%
   10503  1.1  mrg   %
   10504  1.1  mrg   \DeclareUnicodeCharacter{00F0}{\dh}%
   10505  1.1  mrg   \DeclareUnicodeCharacter{00F1}{\~n}%
   10506  1.1  mrg   \DeclareUnicodeCharacter{00F2}{\`o}%
   10507  1.1  mrg   \DeclareUnicodeCharacter{00F3}{\'o}%
   10508  1.1  mrg   \DeclareUnicodeCharacter{00F4}{\^o}%
   10509  1.1  mrg   \DeclareUnicodeCharacter{00F5}{\~o}%
   10510  1.1  mrg   \DeclareUnicodeCharacter{00F6}{\"o}%
   10511  1.1  mrg   \DeclareUnicodeCharacter{00F7}{\ensuremath\div}%
   10512  1.1  mrg   \DeclareUnicodeCharacter{00F8}{\o}%
   10513  1.1  mrg   \DeclareUnicodeCharacter{00F9}{\`u}%
   10514  1.1  mrg   \DeclareUnicodeCharacter{00FA}{\'u}%
   10515  1.1  mrg   \DeclareUnicodeCharacter{00FB}{\^u}%
   10516  1.1  mrg   \DeclareUnicodeCharacter{00FC}{\"u}%
   10517  1.1  mrg   \DeclareUnicodeCharacter{00FD}{\'y}%
   10518  1.1  mrg   \DeclareUnicodeCharacter{00FE}{\th}%
   10519  1.1  mrg   \DeclareUnicodeCharacter{00FF}{\"y}%
   10520  1.1  mrg   %
   10521  1.1  mrg   \DeclareUnicodeCharacter{0100}{\=A}%
   10522  1.1  mrg   \DeclareUnicodeCharacter{0101}{\=a}%
   10523  1.1  mrg   \DeclareUnicodeCharacter{0102}{\u{A}}%
   10524  1.1  mrg   \DeclareUnicodeCharacter{0103}{\u{a}}%
   10525  1.1  mrg   \DeclareUnicodeCharacter{0104}{\ogonek{A}}%
   10526  1.1  mrg   \DeclareUnicodeCharacter{0105}{\ogonek{a}}%
   10527  1.1  mrg   \DeclareUnicodeCharacter{0106}{\'C}%
   10528  1.1  mrg   \DeclareUnicodeCharacter{0107}{\'c}%
   10529  1.1  mrg   \DeclareUnicodeCharacter{0108}{\^C}%
   10530  1.1  mrg   \DeclareUnicodeCharacter{0109}{\^c}%
   10531  1.1  mrg   \DeclareUnicodeCharacter{010A}{\dotaccent{C}}%
   10532  1.1  mrg   \DeclareUnicodeCharacter{010B}{\dotaccent{c}}%
   10533  1.1  mrg   \DeclareUnicodeCharacter{010C}{\v{C}}%
   10534  1.1  mrg   \DeclareUnicodeCharacter{010D}{\v{c}}%
   10535  1.1  mrg   \DeclareUnicodeCharacter{010E}{\v{D}}%
   10536  1.1  mrg   \DeclareUnicodeCharacter{010F}{d'}%
   10537  1.1  mrg   %
   10538  1.1  mrg   \DeclareUnicodeCharacter{0110}{\DH}%
   10539  1.1  mrg   \DeclareUnicodeCharacter{0111}{\dh}%
   10540  1.1  mrg   \DeclareUnicodeCharacter{0112}{\=E}%
   10541  1.1  mrg   \DeclareUnicodeCharacter{0113}{\=e}%
   10542  1.1  mrg   \DeclareUnicodeCharacter{0114}{\u{E}}%
   10543  1.1  mrg   \DeclareUnicodeCharacter{0115}{\u{e}}%
   10544  1.1  mrg   \DeclareUnicodeCharacter{0116}{\dotaccent{E}}%
   10545  1.1  mrg   \DeclareUnicodeCharacter{0117}{\dotaccent{e}}%
   10546  1.1  mrg   \DeclareUnicodeCharacter{0118}{\ogonek{E}}%
   10547  1.1  mrg   \DeclareUnicodeCharacter{0119}{\ogonek{e}}%
   10548  1.1  mrg   \DeclareUnicodeCharacter{011A}{\v{E}}%
   10549  1.1  mrg   \DeclareUnicodeCharacter{011B}{\v{e}}%
   10550  1.1  mrg   \DeclareUnicodeCharacter{011C}{\^G}%
   10551  1.1  mrg   \DeclareUnicodeCharacter{011D}{\^g}%
   10552  1.1  mrg   \DeclareUnicodeCharacter{011E}{\u{G}}%
   10553  1.1  mrg   \DeclareUnicodeCharacter{011F}{\u{g}}%
   10554  1.1  mrg   %
   10555  1.1  mrg   \DeclareUnicodeCharacter{0120}{\dotaccent{G}}%
   10556  1.1  mrg   \DeclareUnicodeCharacter{0121}{\dotaccent{g}}%
   10557  1.1  mrg   \DeclareUnicodeCharacter{0122}{\cedilla{G}}%
   10558  1.1  mrg   \DeclareUnicodeCharacter{0123}{\cedilla{g}}%
   10559  1.1  mrg   \DeclareUnicodeCharacter{0124}{\^H}%
   10560  1.1  mrg   \DeclareUnicodeCharacter{0125}{\^h}%
   10561  1.1  mrg   \DeclareUnicodeCharacter{0126}{\missingcharmsg{H WITH STROKE}}%
   10562  1.1  mrg   \DeclareUnicodeCharacter{0127}{\missingcharmsg{h WITH STROKE}}%
   10563  1.1  mrg   \DeclareUnicodeCharacter{0128}{\~I}%
   10564  1.1  mrg   \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}}%
   10565  1.1  mrg   \DeclareUnicodeCharacter{012A}{\=I}%
   10566  1.1  mrg   \DeclareUnicodeCharacter{012B}{\={\dotless{i}}}%
   10567  1.1  mrg   \DeclareUnicodeCharacter{012C}{\u{I}}%
   10568  1.1  mrg   \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}}%
   10569  1.1  mrg   \DeclareUnicodeCharacter{012E}{\ogonek{I}}%
   10570  1.1  mrg   \DeclareUnicodeCharacter{012F}{\ogonek{i}}%
   10571  1.1  mrg   %
   10572  1.1  mrg   \DeclareUnicodeCharacter{0130}{\dotaccent{I}}%
   10573  1.1  mrg   \DeclareUnicodeCharacter{0131}{\dotless{i}}%
   10574  1.1  mrg   \DeclareUnicodeCharacter{0132}{IJ}%
   10575  1.1  mrg   \DeclareUnicodeCharacter{0133}{ij}%
   10576  1.1  mrg   \DeclareUnicodeCharacter{0134}{\^J}%
   10577  1.1  mrg   \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}}%
   10578  1.1  mrg   \DeclareUnicodeCharacter{0136}{\cedilla{K}}%
   10579  1.1  mrg   \DeclareUnicodeCharacter{0137}{\cedilla{k}}%
   10580  1.1  mrg   \DeclareUnicodeCharacter{0138}{\ensuremath\kappa}%
   10581  1.1  mrg   \DeclareUnicodeCharacter{0139}{\'L}%
   10582  1.1  mrg   \DeclareUnicodeCharacter{013A}{\'l}%
   10583  1.1  mrg   \DeclareUnicodeCharacter{013B}{\cedilla{L}}%
   10584  1.1  mrg   \DeclareUnicodeCharacter{013C}{\cedilla{l}}%
   10585  1.1  mrg   \DeclareUnicodeCharacter{013D}{L'}% should kern
   10586  1.1  mrg   \DeclareUnicodeCharacter{013E}{l'}% should kern
   10587  1.1  mrg   \DeclareUnicodeCharacter{013F}{L\U{00B7}}%
   10588  1.1  mrg   %
   10589  1.1  mrg   \DeclareUnicodeCharacter{0140}{l\U{00B7}}%
   10590  1.1  mrg   \DeclareUnicodeCharacter{0141}{\L}%
   10591  1.1  mrg   \DeclareUnicodeCharacter{0142}{\l}%
   10592  1.1  mrg   \DeclareUnicodeCharacter{0143}{\'N}%
   10593  1.1  mrg   \DeclareUnicodeCharacter{0144}{\'n}%
   10594  1.1  mrg   \DeclareUnicodeCharacter{0145}{\cedilla{N}}%
   10595  1.1  mrg   \DeclareUnicodeCharacter{0146}{\cedilla{n}}%
   10596  1.1  mrg   \DeclareUnicodeCharacter{0147}{\v{N}}%
   10597  1.1  mrg   \DeclareUnicodeCharacter{0148}{\v{n}}%
   10598  1.1  mrg   \DeclareUnicodeCharacter{0149}{'n}%
   10599  1.1  mrg   \DeclareUnicodeCharacter{014A}{\missingcharmsg{ENG}}%
   10600  1.1  mrg   \DeclareUnicodeCharacter{014B}{\missingcharmsg{eng}}%
   10601  1.1  mrg   \DeclareUnicodeCharacter{014C}{\=O}%
   10602  1.1  mrg   \DeclareUnicodeCharacter{014D}{\=o}%
   10603  1.1  mrg   \DeclareUnicodeCharacter{014E}{\u{O}}%
   10604  1.1  mrg   \DeclareUnicodeCharacter{014F}{\u{o}}%
   10605  1.1  mrg   %
   10606  1.1  mrg   \DeclareUnicodeCharacter{0150}{\H{O}}%
   10607  1.1  mrg   \DeclareUnicodeCharacter{0151}{\H{o}}%
   10608  1.1  mrg   \DeclareUnicodeCharacter{0152}{\OE}%
   10609  1.1  mrg   \DeclareUnicodeCharacter{0153}{\oe}%
   10610  1.1  mrg   \DeclareUnicodeCharacter{0154}{\'R}%
   10611  1.1  mrg   \DeclareUnicodeCharacter{0155}{\'r}%
   10612  1.1  mrg   \DeclareUnicodeCharacter{0156}{\cedilla{R}}%
   10613  1.1  mrg   \DeclareUnicodeCharacter{0157}{\cedilla{r}}%
   10614  1.1  mrg   \DeclareUnicodeCharacter{0158}{\v{R}}%
   10615  1.1  mrg   \DeclareUnicodeCharacter{0159}{\v{r}}%
   10616  1.1  mrg   \DeclareUnicodeCharacter{015A}{\'S}%
   10617  1.1  mrg   \DeclareUnicodeCharacter{015B}{\'s}%
   10618  1.1  mrg   \DeclareUnicodeCharacter{015C}{\^S}%
   10619  1.1  mrg   \DeclareUnicodeCharacter{015D}{\^s}%
   10620  1.1  mrg   \DeclareUnicodeCharacter{015E}{\cedilla{S}}%
   10621  1.1  mrg   \DeclareUnicodeCharacter{015F}{\cedilla{s}}%
   10622  1.1  mrg   %
   10623  1.1  mrg   \DeclareUnicodeCharacter{0160}{\v{S}}%
   10624  1.1  mrg   \DeclareUnicodeCharacter{0161}{\v{s}}%
   10625  1.1  mrg   \DeclareUnicodeCharacter{0162}{\cedilla{T}}%
   10626  1.1  mrg   \DeclareUnicodeCharacter{0163}{\cedilla{t}}%
   10627  1.1  mrg   \DeclareUnicodeCharacter{0164}{\v{T}}%
   10628  1.1  mrg   \DeclareUnicodeCharacter{0165}{\v{t}}%
   10629  1.1  mrg   \DeclareUnicodeCharacter{0166}{\missingcharmsg{H WITH STROKE}}%
   10630  1.1  mrg   \DeclareUnicodeCharacter{0167}{\missingcharmsg{h WITH STROKE}}%
   10631  1.1  mrg   \DeclareUnicodeCharacter{0168}{\~U}%
   10632  1.1  mrg   \DeclareUnicodeCharacter{0169}{\~u}%
   10633  1.1  mrg   \DeclareUnicodeCharacter{016A}{\=U}%
   10634  1.1  mrg   \DeclareUnicodeCharacter{016B}{\=u}%
   10635  1.1  mrg   \DeclareUnicodeCharacter{016C}{\u{U}}%
   10636  1.1  mrg   \DeclareUnicodeCharacter{016D}{\u{u}}%
   10637  1.1  mrg   \DeclareUnicodeCharacter{016E}{\ringaccent{U}}%
   10638  1.1  mrg   \DeclareUnicodeCharacter{016F}{\ringaccent{u}}%
   10639  1.1  mrg   %
   10640  1.1  mrg   \DeclareUnicodeCharacter{0170}{\H{U}}%
   10641  1.1  mrg   \DeclareUnicodeCharacter{0171}{\H{u}}%
   10642  1.1  mrg   \DeclareUnicodeCharacter{0172}{\ogonek{U}}%
   10643  1.1  mrg   \DeclareUnicodeCharacter{0173}{\ogonek{u}}%
   10644  1.1  mrg   \DeclareUnicodeCharacter{0174}{\^W}%
   10645  1.1  mrg   \DeclareUnicodeCharacter{0175}{\^w}%
   10646  1.1  mrg   \DeclareUnicodeCharacter{0176}{\^Y}%
   10647  1.1  mrg   \DeclareUnicodeCharacter{0177}{\^y}%
   10648  1.1  mrg   \DeclareUnicodeCharacter{0178}{\"Y}%
   10649  1.1  mrg   \DeclareUnicodeCharacter{0179}{\'Z}%
   10650  1.1  mrg   \DeclareUnicodeCharacter{017A}{\'z}%
   10651  1.1  mrg   \DeclareUnicodeCharacter{017B}{\dotaccent{Z}}%
   10652  1.1  mrg   \DeclareUnicodeCharacter{017C}{\dotaccent{z}}%
   10653  1.1  mrg   \DeclareUnicodeCharacter{017D}{\v{Z}}%
   10654  1.1  mrg   \DeclareUnicodeCharacter{017E}{\v{z}}%
   10655  1.1  mrg   \DeclareUnicodeCharacter{017F}{\missingcharmsg{LONG S}}%
   10656  1.1  mrg   %
   10657  1.1  mrg   \DeclareUnicodeCharacter{01C4}{D\v{Z}}%
   10658  1.1  mrg   \DeclareUnicodeCharacter{01C5}{D\v{z}}%
   10659  1.1  mrg   \DeclareUnicodeCharacter{01C6}{d\v{z}}%
   10660  1.1  mrg   \DeclareUnicodeCharacter{01C7}{LJ}%
   10661  1.1  mrg   \DeclareUnicodeCharacter{01C8}{Lj}%
   10662  1.1  mrg   \DeclareUnicodeCharacter{01C9}{lj}%
   10663  1.1  mrg   \DeclareUnicodeCharacter{01CA}{NJ}%
   10664  1.1  mrg   \DeclareUnicodeCharacter{01CB}{Nj}%
   10665  1.1  mrg   \DeclareUnicodeCharacter{01CC}{nj}%
   10666  1.1  mrg   \DeclareUnicodeCharacter{01CD}{\v{A}}%
   10667  1.1  mrg   \DeclareUnicodeCharacter{01CE}{\v{a}}%
   10668  1.1  mrg   \DeclareUnicodeCharacter{01CF}{\v{I}}%
   10669  1.1  mrg   %
   10670  1.1  mrg   \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}}%
   10671  1.1  mrg   \DeclareUnicodeCharacter{01D1}{\v{O}}%
   10672  1.1  mrg   \DeclareUnicodeCharacter{01D2}{\v{o}}%
   10673  1.1  mrg   \DeclareUnicodeCharacter{01D3}{\v{U}}%
   10674  1.1  mrg   \DeclareUnicodeCharacter{01D4}{\v{u}}%
   10675  1.1  mrg   %
   10676  1.1  mrg   \DeclareUnicodeCharacter{01E2}{\={\AE}}%
   10677  1.1  mrg   \DeclareUnicodeCharacter{01E3}{\={\ae}}%
   10678  1.1  mrg   \DeclareUnicodeCharacter{01E6}{\v{G}}%
   10679  1.1  mrg   \DeclareUnicodeCharacter{01E7}{\v{g}}%
   10680  1.1  mrg   \DeclareUnicodeCharacter{01E8}{\v{K}}%
   10681  1.1  mrg   \DeclareUnicodeCharacter{01E9}{\v{k}}%
   10682  1.1  mrg   %
   10683  1.1  mrg   \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}}%
   10684  1.1  mrg   \DeclareUnicodeCharacter{01F1}{DZ}%
   10685  1.1  mrg   \DeclareUnicodeCharacter{01F2}{Dz}%
   10686  1.1  mrg   \DeclareUnicodeCharacter{01F3}{dz}%
   10687  1.1  mrg   \DeclareUnicodeCharacter{01F4}{\'G}%
   10688  1.1  mrg   \DeclareUnicodeCharacter{01F5}{\'g}%
   10689  1.1  mrg   \DeclareUnicodeCharacter{01F8}{\`N}%
   10690  1.1  mrg   \DeclareUnicodeCharacter{01F9}{\`n}%
   10691  1.1  mrg   \DeclareUnicodeCharacter{01FC}{\'{\AE}}%
   10692  1.1  mrg   \DeclareUnicodeCharacter{01FD}{\'{\ae}}%
   10693  1.1  mrg   \DeclareUnicodeCharacter{01FE}{\'{\O}}%
   10694  1.1  mrg   \DeclareUnicodeCharacter{01FF}{\'{\o}}%
   10695  1.1  mrg   %
   10696  1.1  mrg   \DeclareUnicodeCharacter{021E}{\v{H}}%
   10697  1.1  mrg   \DeclareUnicodeCharacter{021F}{\v{h}}%
   10698  1.1  mrg   %
   10699  1.1  mrg   \DeclareUnicodeCharacter{0226}{\dotaccent{A}}%
   10700  1.1  mrg   \DeclareUnicodeCharacter{0227}{\dotaccent{a}}%
   10701  1.1  mrg   \DeclareUnicodeCharacter{0228}{\cedilla{E}}%
   10702  1.1  mrg   \DeclareUnicodeCharacter{0229}{\cedilla{e}}%
   10703  1.1  mrg   \DeclareUnicodeCharacter{022E}{\dotaccent{O}}%
   10704  1.1  mrg   \DeclareUnicodeCharacter{022F}{\dotaccent{o}}%
   10705  1.1  mrg   %
   10706  1.1  mrg   \DeclareUnicodeCharacter{0232}{\=Y}%
   10707  1.1  mrg   \DeclareUnicodeCharacter{0233}{\=y}%
   10708  1.1  mrg   \DeclareUnicodeCharacter{0237}{\dotless{j}}%
   10709  1.1  mrg   %
   10710  1.1  mrg   \DeclareUnicodeCharacter{02DB}{\ogonek{ }}%
   10711  1.1  mrg   %
   10712  1.1  mrg   % Greek letters upper case
   10713  1.1  mrg   \DeclareUnicodeCharacter{0391}{{\it A}}%
   10714  1.1  mrg   \DeclareUnicodeCharacter{0392}{{\it B}}%
   10715  1.1  mrg   \DeclareUnicodeCharacter{0393}{\ensuremath{\mit\Gamma}}%
   10716  1.1  mrg   \DeclareUnicodeCharacter{0394}{\ensuremath{\mit\Delta}}%
   10717  1.1  mrg   \DeclareUnicodeCharacter{0395}{{\it E}}%
   10718  1.1  mrg   \DeclareUnicodeCharacter{0396}{{\it Z}}%
   10719  1.1  mrg   \DeclareUnicodeCharacter{0397}{{\it H}}%
   10720  1.1  mrg   \DeclareUnicodeCharacter{0398}{\ensuremath{\mit\Theta}}%
   10721  1.1  mrg   \DeclareUnicodeCharacter{0399}{{\it I}}%
   10722  1.1  mrg   \DeclareUnicodeCharacter{039A}{{\it K}}%
   10723  1.1  mrg   \DeclareUnicodeCharacter{039B}{\ensuremath{\mit\Lambda}}%
   10724  1.1  mrg   \DeclareUnicodeCharacter{039C}{{\it M}}%
   10725  1.1  mrg   \DeclareUnicodeCharacter{039D}{{\it N}}%
   10726  1.1  mrg   \DeclareUnicodeCharacter{039E}{\ensuremath{\mit\Xi}}%
   10727  1.1  mrg   \DeclareUnicodeCharacter{039F}{{\it O}}%
   10728  1.1  mrg   \DeclareUnicodeCharacter{03A0}{\ensuremath{\mit\Pi}}%
   10729  1.1  mrg   \DeclareUnicodeCharacter{03A1}{{\it P}}%
   10730  1.1  mrg   %\DeclareUnicodeCharacter{03A2}{} % none - corresponds to final sigma
   10731  1.1  mrg   \DeclareUnicodeCharacter{03A3}{\ensuremath{\mit\Sigma}}%
   10732  1.1  mrg   \DeclareUnicodeCharacter{03A4}{{\it T}}%
   10733  1.1  mrg   \DeclareUnicodeCharacter{03A5}{\ensuremath{\mit\Upsilon}}%
   10734  1.1  mrg   \DeclareUnicodeCharacter{03A6}{\ensuremath{\mit\Phi}}%
   10735  1.1  mrg   \DeclareUnicodeCharacter{03A7}{{\it X}}%
   10736  1.1  mrg   \DeclareUnicodeCharacter{03A8}{\ensuremath{\mit\Psi}}%
   10737  1.1  mrg   \DeclareUnicodeCharacter{03A9}{\ensuremath{\mit\Omega}}%
   10738  1.1  mrg   %
   10739  1.1  mrg   % Vowels with accents
   10740  1.1  mrg   \DeclareUnicodeCharacter{0390}{\ensuremath{\ddot{\acute\iota}}}%
   10741  1.1  mrg   \DeclareUnicodeCharacter{03AC}{\ensuremath{\acute\alpha}}%
   10742  1.1  mrg   \DeclareUnicodeCharacter{03AD}{\ensuremath{\acute\epsilon}}%
   10743  1.1  mrg   \DeclareUnicodeCharacter{03AE}{\ensuremath{\acute\eta}}%
   10744  1.1  mrg   \DeclareUnicodeCharacter{03AF}{\ensuremath{\acute\iota}}%
   10745  1.1  mrg   \DeclareUnicodeCharacter{03B0}{\ensuremath{\acute{\ddot\upsilon}}}%
   10746  1.1  mrg   %
   10747  1.1  mrg   % Standalone accent
   10748  1.1  mrg   \DeclareUnicodeCharacter{0384}{\ensuremath{\acute{\ }}}%
   10749  1.1  mrg   %
   10750  1.1  mrg   % Greek letters lower case
   10751  1.1  mrg   \DeclareUnicodeCharacter{03B1}{\ensuremath\alpha}%
   10752  1.1  mrg   \DeclareUnicodeCharacter{03B2}{\ensuremath\beta}%
   10753  1.1  mrg   \DeclareUnicodeCharacter{03B3}{\ensuremath\gamma}%
   10754  1.1  mrg   \DeclareUnicodeCharacter{03B4}{\ensuremath\delta}%
   10755  1.1  mrg   \DeclareUnicodeCharacter{03B5}{\ensuremath\epsilon}%
   10756  1.1  mrg   \DeclareUnicodeCharacter{03B6}{\ensuremath\zeta}%
   10757  1.1  mrg   \DeclareUnicodeCharacter{03B7}{\ensuremath\eta}%
   10758  1.1  mrg   \DeclareUnicodeCharacter{03B8}{\ensuremath\theta}%
   10759  1.1  mrg   \DeclareUnicodeCharacter{03B9}{\ensuremath\iota}%
   10760  1.1  mrg   \DeclareUnicodeCharacter{03BA}{\ensuremath\kappa}%
   10761  1.1  mrg   \DeclareUnicodeCharacter{03BB}{\ensuremath\lambda}%
   10762  1.1  mrg   \DeclareUnicodeCharacter{03BC}{\ensuremath\mu}%
   10763  1.1  mrg   \DeclareUnicodeCharacter{03BD}{\ensuremath\nu}%
   10764  1.1  mrg   \DeclareUnicodeCharacter{03BE}{\ensuremath\xi}%
   10765  1.1  mrg   \DeclareUnicodeCharacter{03BF}{{\it o}}% omicron
   10766  1.1  mrg   \DeclareUnicodeCharacter{03C0}{\ensuremath\pi}%
   10767  1.1  mrg   \DeclareUnicodeCharacter{03C1}{\ensuremath\rho}%
   10768  1.1  mrg   \DeclareUnicodeCharacter{03C2}{\ensuremath\varsigma}%
   10769  1.1  mrg   \DeclareUnicodeCharacter{03C3}{\ensuremath\sigma}%
   10770  1.1  mrg   \DeclareUnicodeCharacter{03C4}{\ensuremath\tau}%
   10771  1.1  mrg   \DeclareUnicodeCharacter{03C5}{\ensuremath\upsilon}%
   10772  1.1  mrg   \DeclareUnicodeCharacter{03C6}{\ensuremath\phi}%
   10773  1.1  mrg   \DeclareUnicodeCharacter{03C7}{\ensuremath\chi}%
   10774  1.1  mrg   \DeclareUnicodeCharacter{03C8}{\ensuremath\psi}%
   10775  1.1  mrg   \DeclareUnicodeCharacter{03C9}{\ensuremath\omega}%
   10776  1.1  mrg   %
   10777  1.1  mrg   % More Greek vowels with accents
   10778  1.1  mrg   \DeclareUnicodeCharacter{03CA}{\ensuremath{\ddot\iota}}%
   10779  1.1  mrg   \DeclareUnicodeCharacter{03CB}{\ensuremath{\ddot\upsilon}}%
   10780  1.1  mrg   \DeclareUnicodeCharacter{03CC}{\ensuremath{\acute o}}%
   10781  1.1  mrg   \DeclareUnicodeCharacter{03CD}{\ensuremath{\acute\upsilon}}%
   10782  1.1  mrg   \DeclareUnicodeCharacter{03CE}{\ensuremath{\acute\omega}}%
   10783  1.1  mrg   %
   10784  1.1  mrg   % Variant Greek letters
   10785  1.1  mrg   \DeclareUnicodeCharacter{03D1}{\ensuremath\vartheta}%
   10786  1.1  mrg   \DeclareUnicodeCharacter{03D6}{\ensuremath\varpi}%
   10787  1.1  mrg   \DeclareUnicodeCharacter{03F1}{\ensuremath\varrho}%
   10788  1.1  mrg   %
   10789  1.1  mrg   \DeclareUnicodeCharacter{1E02}{\dotaccent{B}}%
   10790  1.1  mrg   \DeclareUnicodeCharacter{1E03}{\dotaccent{b}}%
   10791  1.1  mrg   \DeclareUnicodeCharacter{1E04}{\udotaccent{B}}%
   10792  1.1  mrg   \DeclareUnicodeCharacter{1E05}{\udotaccent{b}}%
   10793  1.1  mrg   \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}}%
   10794  1.1  mrg   \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}}%
   10795  1.1  mrg   \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}}%
   10796  1.1  mrg   \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}}%
   10797  1.1  mrg   \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}}%
   10798  1.1  mrg   \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}}%
   10799  1.1  mrg   \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}}%
   10800  1.1  mrg   \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}}%
   10801  1.1  mrg   %
   10802  1.1  mrg   \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}}%
   10803  1.1  mrg   \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}}%
   10804  1.1  mrg   %
   10805  1.1  mrg   \DeclareUnicodeCharacter{1E20}{\=G}%
   10806  1.1  mrg   \DeclareUnicodeCharacter{1E21}{\=g}%
   10807  1.1  mrg   \DeclareUnicodeCharacter{1E22}{\dotaccent{H}}%
   10808  1.1  mrg   \DeclareUnicodeCharacter{1E23}{\dotaccent{h}}%
   10809  1.1  mrg   \DeclareUnicodeCharacter{1E24}{\udotaccent{H}}%
   10810  1.1  mrg   \DeclareUnicodeCharacter{1E25}{\udotaccent{h}}%
   10811  1.1  mrg   \DeclareUnicodeCharacter{1E26}{\"H}%
   10812  1.1  mrg   \DeclareUnicodeCharacter{1E27}{\"h}%
   10813  1.1  mrg   %
   10814  1.1  mrg   \DeclareUnicodeCharacter{1E30}{\'K}%
   10815  1.1  mrg   \DeclareUnicodeCharacter{1E31}{\'k}%
   10816  1.1  mrg   \DeclareUnicodeCharacter{1E32}{\udotaccent{K}}%
   10817  1.1  mrg   \DeclareUnicodeCharacter{1E33}{\udotaccent{k}}%
   10818  1.1  mrg   \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}}%
   10819  1.1  mrg   \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}}%
   10820  1.1  mrg   \DeclareUnicodeCharacter{1E36}{\udotaccent{L}}%
   10821  1.1  mrg   \DeclareUnicodeCharacter{1E37}{\udotaccent{l}}%
   10822  1.1  mrg   \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}}%
   10823  1.1  mrg   \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}}%
   10824  1.1  mrg   \DeclareUnicodeCharacter{1E3E}{\'M}%
   10825  1.1  mrg   \DeclareUnicodeCharacter{1E3F}{\'m}%
   10826  1.1  mrg   %
   10827  1.1  mrg   \DeclareUnicodeCharacter{1E40}{\dotaccent{M}}%
   10828  1.1  mrg   \DeclareUnicodeCharacter{1E41}{\dotaccent{m}}%
   10829  1.1  mrg   \DeclareUnicodeCharacter{1E42}{\udotaccent{M}}%
   10830  1.1  mrg   \DeclareUnicodeCharacter{1E43}{\udotaccent{m}}%
   10831  1.1  mrg   \DeclareUnicodeCharacter{1E44}{\dotaccent{N}}%
   10832  1.1  mrg   \DeclareUnicodeCharacter{1E45}{\dotaccent{n}}%
   10833  1.1  mrg   \DeclareUnicodeCharacter{1E46}{\udotaccent{N}}%
   10834  1.1  mrg   \DeclareUnicodeCharacter{1E47}{\udotaccent{n}}%
   10835  1.1  mrg   \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}}%
   10836  1.1  mrg   \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}}%
   10837  1.1  mrg   %
   10838  1.1  mrg   \DeclareUnicodeCharacter{1E54}{\'P}%
   10839  1.1  mrg   \DeclareUnicodeCharacter{1E55}{\'p}%
   10840  1.1  mrg   \DeclareUnicodeCharacter{1E56}{\dotaccent{P}}%
   10841  1.1  mrg   \DeclareUnicodeCharacter{1E57}{\dotaccent{p}}%
   10842  1.1  mrg   \DeclareUnicodeCharacter{1E58}{\dotaccent{R}}%
   10843  1.1  mrg   \DeclareUnicodeCharacter{1E59}{\dotaccent{r}}%
   10844  1.1  mrg   \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}}%
   10845  1.1  mrg   \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}}%
   10846  1.1  mrg   \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}}%
   10847  1.1  mrg   \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}}%
   10848  1.1  mrg   %
   10849  1.1  mrg   \DeclareUnicodeCharacter{1E60}{\dotaccent{S}}%
   10850  1.1  mrg   \DeclareUnicodeCharacter{1E61}{\dotaccent{s}}%
   10851  1.1  mrg   \DeclareUnicodeCharacter{1E62}{\udotaccent{S}}%
   10852  1.1  mrg   \DeclareUnicodeCharacter{1E63}{\udotaccent{s}}%
   10853  1.1  mrg   \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}}%
   10854  1.1  mrg   \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}}%
   10855  1.1  mrg   \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}}%
   10856  1.1  mrg   \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}}%
   10857  1.1  mrg   \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}}%
   10858  1.1  mrg   \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}}%
   10859  1.1  mrg   %
   10860  1.1  mrg   \DeclareUnicodeCharacter{1E7C}{\~V}%
   10861  1.1  mrg   \DeclareUnicodeCharacter{1E7D}{\~v}%
   10862  1.1  mrg   \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}}%
   10863  1.1  mrg   \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}}%
   10864  1.1  mrg   %
   10865  1.1  mrg   \DeclareUnicodeCharacter{1E80}{\`W}%
   10866  1.1  mrg   \DeclareUnicodeCharacter{1E81}{\`w}%
   10867  1.1  mrg   \DeclareUnicodeCharacter{1E82}{\'W}%
   10868  1.1  mrg   \DeclareUnicodeCharacter{1E83}{\'w}%
   10869  1.1  mrg   \DeclareUnicodeCharacter{1E84}{\"W}%
   10870  1.1  mrg   \DeclareUnicodeCharacter{1E85}{\"w}%
   10871  1.1  mrg   \DeclareUnicodeCharacter{1E86}{\dotaccent{W}}%
   10872  1.1  mrg   \DeclareUnicodeCharacter{1E87}{\dotaccent{w}}%
   10873  1.1  mrg   \DeclareUnicodeCharacter{1E88}{\udotaccent{W}}%
   10874  1.1  mrg   \DeclareUnicodeCharacter{1E89}{\udotaccent{w}}%
   10875  1.1  mrg   \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}}%
   10876  1.1  mrg   \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}}%
   10877  1.1  mrg   \DeclareUnicodeCharacter{1E8C}{\"X}%
   10878  1.1  mrg   \DeclareUnicodeCharacter{1E8D}{\"x}%
   10879  1.1  mrg   \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}}%
   10880  1.1  mrg   \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}}%
   10881  1.1  mrg   %
   10882  1.1  mrg   \DeclareUnicodeCharacter{1E90}{\^Z}%
   10883  1.1  mrg   \DeclareUnicodeCharacter{1E91}{\^z}%
   10884  1.1  mrg   \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}}%
   10885  1.1  mrg   \DeclareUnicodeCharacter{1E93}{\udotaccent{z}}%
   10886  1.1  mrg   \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}}%
   10887  1.1  mrg   \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}}%
   10888  1.1  mrg   \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}}%
   10889  1.1  mrg   \DeclareUnicodeCharacter{1E97}{\"t}%
   10890  1.1  mrg   \DeclareUnicodeCharacter{1E98}{\ringaccent{w}}%
   10891  1.1  mrg   \DeclareUnicodeCharacter{1E99}{\ringaccent{y}}%
   10892  1.1  mrg   %
   10893  1.1  mrg   \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}}%
   10894  1.1  mrg   \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}}%
   10895  1.1  mrg   %
   10896  1.1  mrg   \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}}%
   10897  1.1  mrg   \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}}%
   10898  1.1  mrg   \DeclareUnicodeCharacter{1EBC}{\~E}%
   10899  1.1  mrg   \DeclareUnicodeCharacter{1EBD}{\~e}%
   10900  1.1  mrg   %
   10901  1.1  mrg   \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}}%
   10902  1.1  mrg   \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}}%
   10903  1.1  mrg   \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}}%
   10904  1.1  mrg   \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}}%
   10905  1.1  mrg   %
   10906  1.1  mrg   \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}}%
   10907  1.1  mrg   \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}}%
   10908  1.1  mrg   %
   10909  1.1  mrg   \DeclareUnicodeCharacter{1EF2}{\`Y}%
   10910  1.1  mrg   \DeclareUnicodeCharacter{1EF3}{\`y}%
   10911  1.1  mrg   \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}}%
   10912  1.1  mrg   %
   10913  1.1  mrg   \DeclareUnicodeCharacter{1EF8}{\~Y}%
   10914  1.1  mrg   \DeclareUnicodeCharacter{1EF9}{\~y}%
   10915  1.1  mrg   %
   10916  1.1  mrg   % Punctuation
   10917  1.1  mrg   \DeclareUnicodeCharacter{2013}{--}%
   10918  1.1  mrg   \DeclareUnicodeCharacter{2014}{---}%
   10919  1.1  mrg   \DeclareUnicodeCharacter{2018}{\quoteleft{}}%
   10920  1.1  mrg   \DeclareUnicodeCharacter{2019}{\quoteright{}}%
   10921  1.1  mrg   \DeclareUnicodeCharacter{201A}{\quotesinglbase{}}%
   10922  1.1  mrg   \DeclareUnicodeCharacter{201C}{\quotedblleft{}}%
   10923  1.1  mrg   \DeclareUnicodeCharacter{201D}{\quotedblright{}}%
   10924  1.1  mrg   \DeclareUnicodeCharacter{201E}{\quotedblbase{}}%
   10925  1.1  mrg   \DeclareUnicodeCharacter{2020}{\ensuremath\dagger}%
   10926  1.1  mrg   \DeclareUnicodeCharacter{2021}{\ensuremath\ddagger}%
   10927  1.1  mrg   \DeclareUnicodeCharacter{2022}{\bullet{}}%
   10928  1.1  mrg   \DeclareUnicodeCharacter{202F}{\thinspace}%
   10929  1.1  mrg   \DeclareUnicodeCharacter{2026}{\dots{}}%
   10930  1.1  mrg   \DeclareUnicodeCharacter{2039}{\guilsinglleft{}}%
   10931  1.1  mrg   \DeclareUnicodeCharacter{203A}{\guilsinglright{}}%
   10932  1.1  mrg   %
   10933  1.1  mrg   \DeclareUnicodeCharacter{20AC}{\euro{}}%
   10934  1.1  mrg   %
   10935  1.1  mrg   \DeclareUnicodeCharacter{2192}{\expansion{}}%
   10936  1.1  mrg   \DeclareUnicodeCharacter{21D2}{\result{}}%
   10937  1.1  mrg   %
   10938  1.1  mrg   % Mathematical symbols
   10939  1.1  mrg   \DeclareUnicodeCharacter{2200}{\ensuremath\forall}%
   10940  1.1  mrg   \DeclareUnicodeCharacter{2203}{\ensuremath\exists}%
   10941  1.1  mrg   \DeclareUnicodeCharacter{2208}{\ensuremath\in}%
   10942  1.1  mrg   \DeclareUnicodeCharacter{2212}{\minus{}}%
   10943  1.1  mrg   \DeclareUnicodeCharacter{2217}{\ast}%
   10944  1.1  mrg   \DeclareUnicodeCharacter{221E}{\ensuremath\infty}%
   10945  1.1  mrg   \DeclareUnicodeCharacter{2225}{\ensuremath\parallel}%
   10946  1.1  mrg   \DeclareUnicodeCharacter{2227}{\ensuremath\wedge}%
   10947  1.1  mrg   \DeclareUnicodeCharacter{2229}{\ensuremath\cap}%
   10948  1.1  mrg   \DeclareUnicodeCharacter{2261}{\equiv{}}%
   10949  1.1  mrg   \DeclareUnicodeCharacter{2264}{\ensuremath\leq}%
   10950  1.1  mrg   \DeclareUnicodeCharacter{2265}{\ensuremath\geq}%
   10951  1.1  mrg   \DeclareUnicodeCharacter{2282}{\ensuremath\subset}%
   10952  1.1  mrg   \DeclareUnicodeCharacter{2287}{\ensuremath\supseteq}%
   10953  1.1  mrg   %
   10954  1.1  mrg   \DeclareUnicodeCharacter{2016}{\ensuremath\Vert}%
   10955  1.1  mrg   \DeclareUnicodeCharacter{2032}{\ensuremath\prime}%
   10956  1.1  mrg   \DeclareUnicodeCharacter{210F}{\ensuremath\hbar}%
   10957  1.1  mrg   \DeclareUnicodeCharacter{2111}{\ensuremath\Im}%
   10958  1.1  mrg   \DeclareUnicodeCharacter{2113}{\ensuremath\ell}%
   10959  1.1  mrg   \DeclareUnicodeCharacter{2118}{\ensuremath\wp}%
   10960  1.1  mrg   \DeclareUnicodeCharacter{211C}{\ensuremath\Re}%
   10961  1.1  mrg   \DeclareUnicodeCharacter{2135}{\ensuremath\aleph}%
   10962  1.1  mrg   \DeclareUnicodeCharacter{2190}{\ensuremath\leftarrow}%
   10963  1.1  mrg   \DeclareUnicodeCharacter{2191}{\ensuremath\uparrow}%
   10964  1.1  mrg   \DeclareUnicodeCharacter{2193}{\ensuremath\downarrow}%
   10965  1.1  mrg   \DeclareUnicodeCharacter{2194}{\ensuremath\leftrightarrow}%
   10966  1.1  mrg   \DeclareUnicodeCharacter{2195}{\ensuremath\updownarrow}%
   10967  1.1  mrg   \DeclareUnicodeCharacter{2196}{\ensuremath\nwarrow}%
   10968  1.1  mrg   \DeclareUnicodeCharacter{2197}{\ensuremath\nearrow}%
   10969  1.1  mrg   \DeclareUnicodeCharacter{2198}{\ensuremath\searrow}%
   10970  1.1  mrg   \DeclareUnicodeCharacter{2199}{\ensuremath\swarrow}%
   10971  1.1  mrg   \DeclareUnicodeCharacter{21A6}{\ensuremath\mapsto}%
   10972  1.1  mrg   \DeclareUnicodeCharacter{21A9}{\ensuremath\hookleftarrow}%
   10973  1.1  mrg   \DeclareUnicodeCharacter{21AA}{\ensuremath\hookrightarrow}%
   10974  1.1  mrg   \DeclareUnicodeCharacter{21BC}{\ensuremath\leftharpoonup}%
   10975  1.1  mrg   \DeclareUnicodeCharacter{21BD}{\ensuremath\leftharpoondown}%
   10976  1.1  mrg   \DeclareUnicodeCharacter{21C0}{\ensuremath\rightharpoonup}%
   10977  1.1  mrg   \DeclareUnicodeCharacter{21C1}{\ensuremath\rightharpoondown}%
   10978  1.1  mrg   \DeclareUnicodeCharacter{21CC}{\ensuremath\rightleftharpoons}%
   10979  1.1  mrg   \DeclareUnicodeCharacter{21D0}{\ensuremath\Leftarrow}%
   10980  1.1  mrg   \DeclareUnicodeCharacter{21D1}{\ensuremath\Uparrow}%
   10981  1.1  mrg   \DeclareUnicodeCharacter{21D3}{\ensuremath\Downarrow}%
   10982  1.1  mrg   \DeclareUnicodeCharacter{21D4}{\ensuremath\Leftrightarrow}%
   10983  1.1  mrg   \DeclareUnicodeCharacter{21D5}{\ensuremath\Updownarrow}%
   10984  1.1  mrg   \DeclareUnicodeCharacter{2202}{\ensuremath\partial}%
   10985  1.1  mrg   \DeclareUnicodeCharacter{2205}{\ensuremath\emptyset}%
   10986  1.1  mrg   \DeclareUnicodeCharacter{2207}{\ensuremath\nabla}%
   10987  1.1  mrg   \DeclareUnicodeCharacter{2209}{\ensuremath\notin}%
   10988  1.1  mrg   \DeclareUnicodeCharacter{220B}{\ensuremath\owns}%
   10989  1.1  mrg   \DeclareUnicodeCharacter{220F}{\ensuremath\prod}%
   10990  1.1  mrg   \DeclareUnicodeCharacter{2210}{\ensuremath\coprod}%
   10991  1.1  mrg   \DeclareUnicodeCharacter{2211}{\ensuremath\sum}%
   10992  1.1  mrg   \DeclareUnicodeCharacter{2213}{\ensuremath\mp}%
   10993  1.1  mrg   \DeclareUnicodeCharacter{2218}{\ensuremath\circ}%
   10994  1.1  mrg   \DeclareUnicodeCharacter{221A}{\ensuremath\surd}%
   10995  1.1  mrg   \DeclareUnicodeCharacter{221D}{\ensuremath\propto}%
   10996  1.1  mrg   \DeclareUnicodeCharacter{2220}{\ensuremath\angle}%
   10997  1.1  mrg   \DeclareUnicodeCharacter{2223}{\ensuremath\mid}%
   10998  1.1  mrg   \DeclareUnicodeCharacter{2228}{\ensuremath\vee}%
   10999  1.1  mrg   \DeclareUnicodeCharacter{222A}{\ensuremath\cup}%
   11000  1.1  mrg   \DeclareUnicodeCharacter{222B}{\ensuremath\smallint}%
   11001  1.1  mrg   \DeclareUnicodeCharacter{222E}{\ensuremath\oint}%
   11002  1.1  mrg   \DeclareUnicodeCharacter{223C}{\ensuremath\sim}%
   11003  1.1  mrg   \DeclareUnicodeCharacter{2240}{\ensuremath\wr}%
   11004  1.1  mrg   \DeclareUnicodeCharacter{2243}{\ensuremath\simeq}%
   11005  1.1  mrg   \DeclareUnicodeCharacter{2245}{\ensuremath\cong}%
   11006  1.1  mrg   \DeclareUnicodeCharacter{2248}{\ensuremath\approx}%
   11007  1.1  mrg   \DeclareUnicodeCharacter{224D}{\ensuremath\asymp}%
   11008  1.1  mrg   \DeclareUnicodeCharacter{2250}{\ensuremath\doteq}%
   11009  1.1  mrg   \DeclareUnicodeCharacter{2260}{\ensuremath\neq}%
   11010  1.1  mrg   \DeclareUnicodeCharacter{226A}{\ensuremath\ll}%
   11011  1.1  mrg   \DeclareUnicodeCharacter{226B}{\ensuremath\gg}%
   11012  1.1  mrg   \DeclareUnicodeCharacter{227A}{\ensuremath\prec}%
   11013  1.1  mrg   \DeclareUnicodeCharacter{227B}{\ensuremath\succ}%
   11014  1.1  mrg   \DeclareUnicodeCharacter{2283}{\ensuremath\supset}%
   11015  1.1  mrg   \DeclareUnicodeCharacter{2286}{\ensuremath\subseteq}%
   11016  1.1  mrg   \DeclareUnicodeCharacter{228E}{\ensuremath\uplus}%
   11017  1.1  mrg   \DeclareUnicodeCharacter{2291}{\ensuremath\sqsubseteq}%
   11018  1.1  mrg   \DeclareUnicodeCharacter{2292}{\ensuremath\sqsupseteq}%
   11019  1.1  mrg   \DeclareUnicodeCharacter{2293}{\ensuremath\sqcap}%
   11020  1.1  mrg   \DeclareUnicodeCharacter{2294}{\ensuremath\sqcup}%
   11021  1.1  mrg   \DeclareUnicodeCharacter{2295}{\ensuremath\oplus}%
   11022  1.1  mrg   \DeclareUnicodeCharacter{2296}{\ensuremath\ominus}%
   11023  1.1  mrg   \DeclareUnicodeCharacter{2297}{\ensuremath\otimes}%
   11024  1.1  mrg   \DeclareUnicodeCharacter{2298}{\ensuremath\oslash}%
   11025  1.1  mrg   \DeclareUnicodeCharacter{2299}{\ensuremath\odot}%
   11026  1.1  mrg   \DeclareUnicodeCharacter{22A2}{\ensuremath\vdash}%
   11027  1.1  mrg   \DeclareUnicodeCharacter{22A3}{\ensuremath\dashv}%
   11028  1.1  mrg   \DeclareUnicodeCharacter{22A4}{\ensuremath\ptextop}%
   11029  1.1  mrg   \DeclareUnicodeCharacter{22A5}{\ensuremath\bot}%
   11030  1.1  mrg   \DeclareUnicodeCharacter{22A8}{\ensuremath\models}%
   11031  1.1  mrg   \DeclareUnicodeCharacter{22C0}{\ensuremath\bigwedge}%
   11032  1.1  mrg   \DeclareUnicodeCharacter{22C1}{\ensuremath\bigvee}%
   11033  1.1  mrg   \DeclareUnicodeCharacter{22C2}{\ensuremath\bigcap}%
   11034  1.1  mrg   \DeclareUnicodeCharacter{22C3}{\ensuremath\bigcup}%
   11035  1.1  mrg   \DeclareUnicodeCharacter{22C4}{\ensuremath\diamond}%
   11036  1.1  mrg   \DeclareUnicodeCharacter{22C5}{\ensuremath\cdot}%
   11037  1.1  mrg   \DeclareUnicodeCharacter{22C6}{\ensuremath\star}%
   11038  1.1  mrg   \DeclareUnicodeCharacter{22C8}{\ensuremath\bowtie}%
   11039  1.1  mrg   \DeclareUnicodeCharacter{2308}{\ensuremath\lceil}%
   11040  1.1  mrg   \DeclareUnicodeCharacter{2309}{\ensuremath\rceil}%
   11041  1.1  mrg   \DeclareUnicodeCharacter{230A}{\ensuremath\lfloor}%
   11042  1.1  mrg   \DeclareUnicodeCharacter{230B}{\ensuremath\rfloor}%
   11043  1.1  mrg   \DeclareUnicodeCharacter{2322}{\ensuremath\frown}%
   11044  1.1  mrg   \DeclareUnicodeCharacter{2323}{\ensuremath\smile}%
   11045  1.1  mrg   %
   11046  1.1  mrg   \DeclareUnicodeCharacter{25B3}{\ensuremath\triangle}%
   11047  1.1  mrg   \DeclareUnicodeCharacter{25B7}{\ensuremath\triangleright}%
   11048  1.1  mrg   \DeclareUnicodeCharacter{25BD}{\ensuremath\bigtriangledown}%
   11049  1.1  mrg   \DeclareUnicodeCharacter{25C1}{\ensuremath\triangleleft}%
   11050  1.1  mrg   \DeclareUnicodeCharacter{25C7}{\ensuremath\diamond}%
   11051  1.1  mrg   \DeclareUnicodeCharacter{2660}{\ensuremath\spadesuit}%
   11052  1.1  mrg   \DeclareUnicodeCharacter{2661}{\ensuremath\heartsuit}%
   11053  1.1  mrg   \DeclareUnicodeCharacter{2662}{\ensuremath\diamondsuit}%
   11054  1.1  mrg   \DeclareUnicodeCharacter{2663}{\ensuremath\clubsuit}%
   11055  1.1  mrg   \DeclareUnicodeCharacter{266D}{\ensuremath\flat}%
   11056  1.1  mrg   \DeclareUnicodeCharacter{266E}{\ensuremath\natural}%
   11057  1.1  mrg   \DeclareUnicodeCharacter{266F}{\ensuremath\sharp}%
   11058  1.1  mrg   \DeclareUnicodeCharacter{26AA}{\ensuremath\bigcirc}%
   11059  1.1  mrg   \DeclareUnicodeCharacter{27B9}{\ensuremath\rangle}%
   11060  1.1  mrg   \DeclareUnicodeCharacter{27C2}{\ensuremath\perp}%
   11061  1.1  mrg   \DeclareUnicodeCharacter{27E8}{\ensuremath\langle}%
   11062  1.1  mrg   \DeclareUnicodeCharacter{27F5}{\ensuremath\longleftarrow}%
   11063  1.1  mrg   \DeclareUnicodeCharacter{27F6}{\ensuremath\longrightarrow}%
   11064  1.1  mrg   \DeclareUnicodeCharacter{27F7}{\ensuremath\longleftrightarrow}%
   11065  1.1  mrg   \DeclareUnicodeCharacter{27FC}{\ensuremath\longmapsto}%
   11066  1.1  mrg   \DeclareUnicodeCharacter{29F5}{\ensuremath\setminus}%
   11067  1.1  mrg   \DeclareUnicodeCharacter{2A00}{\ensuremath\bigodot}%
   11068  1.1  mrg   \DeclareUnicodeCharacter{2A01}{\ensuremath\bigoplus}%
   11069  1.1  mrg   \DeclareUnicodeCharacter{2A02}{\ensuremath\bigotimes}%
   11070  1.1  mrg   \DeclareUnicodeCharacter{2A04}{\ensuremath\biguplus}%
   11071  1.1  mrg   \DeclareUnicodeCharacter{2A06}{\ensuremath\bigsqcup}%
   11072  1.1  mrg   \DeclareUnicodeCharacter{2A3F}{\ensuremath\amalg}%
   11073  1.1  mrg   \DeclareUnicodeCharacter{2AAF}{\ensuremath\preceq}%
   11074  1.1  mrg   \DeclareUnicodeCharacter{2AB0}{\ensuremath\succeq}%
   11075  1.1  mrg   %
   11076  1.1  mrg   \global\mathchardef\checkmark="1370% actually the square root sign
   11077  1.1  mrg   \DeclareUnicodeCharacter{2713}{\ensuremath\checkmark}%
   11078  1.1  mrg }% end of \unicodechardefs
   11079  1.1  mrg 
   11080  1.1  mrg % UTF-8 byte sequence (pdfTeX) definitions (replacing and @U command)
   11081  1.1  mrg % It makes the setting that replace UTF-8 byte sequence.
   11082  1.1  mrg \def\utfeightchardefs{%
   11083  1.1  mrg   \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterUTFviii
   11084  1.1  mrg   \unicodechardefs
   11085  1.1  mrg }
   11086  1.1  mrg 
   11087  1.1  mrg % Whether the active definitions of non-ASCII characters expand to
   11088  1.1  mrg % non-active tokens with the same character code.  This is used to
   11089  1.1  mrg % write characters literally, instead of using active definitions for
   11090  1.1  mrg % printing the correct glyphs.
   11091  1.1  mrg \newif\ifpassthroughchars
   11092  1.1  mrg \passthroughcharsfalse
   11093  1.1  mrg 
   11094  1.1  mrg % For native Unicode handling (XeTeX and LuaTeX),
   11095  1.1  mrg % provide a definition macro to replace/pass-through a Unicode character
   11096  1.1  mrg %
   11097  1.1  mrg \def\DeclareUnicodeCharacterNative#1#2{%
   11098  1.1  mrg   \catcode"#1=\active
   11099  1.1  mrg   \def\dodeclareunicodecharacternative##1##2##3{%
   11100  1.1  mrg     \begingroup
   11101  1.1  mrg       \uccode`\~="##2\relax
   11102  1.1  mrg       \uppercase{\gdef~}{%
   11103  1.1  mrg         \ifpassthroughchars
   11104  1.1  mrg           ##1%
   11105  1.1  mrg         \else
   11106  1.1  mrg           ##3%
   11107  1.1  mrg         \fi
   11108  1.1  mrg       }
   11109  1.1  mrg     \endgroup
   11110  1.1  mrg   }
   11111  1.1  mrg   \begingroup
   11112  1.1  mrg     \uccode`\.="#1\relax
   11113  1.1  mrg     \uppercase{\def\UTFNativeTmp{.}}%
   11114  1.1  mrg     \expandafter\dodeclareunicodecharacternative\UTFNativeTmp{#1}{#2}%
   11115  1.1  mrg   \endgroup
   11116  1.1  mrg }
   11117  1.1  mrg 
   11118  1.1  mrg % Native Unicode handling (XeTeX and LuaTeX) character replacing definition.
   11119  1.1  mrg % It activates the setting that replaces Unicode characters.
   11120  1.1  mrg \def\nativeunicodechardefs{%
   11121  1.1  mrg   \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNative
   11122  1.1  mrg   \unicodechardefs
   11123  1.1  mrg }
   11124  1.1  mrg 
   11125  1.1  mrg % For native Unicode handling (XeTeX and LuaTeX),
   11126  1.1  mrg % make the character token expand
   11127  1.1  mrg % to the sequences given in \unicodechardefs for printing.
   11128  1.1  mrg \def\DeclareUnicodeCharacterNativeAtU#1#2{%
   11129  1.1  mrg   \def\UTFAtUTmp{#2}
   11130  1.1  mrg   \expandafter\globallet\csname uni:#1\endcsname \UTFAtUTmp
   11131  1.1  mrg }
   11132  1.1  mrg 
   11133  1.1  mrg % @U command definitions for native Unicode handling (XeTeX and LuaTeX).
   11134  1.1  mrg \def\nativeunicodechardefsatu{%
   11135  1.1  mrg   \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNativeAtU
   11136  1.1  mrg   \unicodechardefs
   11137  1.1  mrg }
   11138  1.1  mrg 
   11139  1.1  mrg % US-ASCII character definitions.
   11140  1.1  mrg \def\asciichardefs{% nothing need be done
   11141  1.1  mrg    \relax
   11142  1.1  mrg }
   11143  1.1  mrg 
   11144  1.1  mrg % Define all Unicode characters we know about.  This makes UTF-8 the default
   11145  1.1  mrg % input encoding and allows @U to work.
   11146  1.1  mrg \iftxinativeunicodecapable
   11147  1.1  mrg   \nativeunicodechardefsatu
   11148  1.1  mrg \else
   11149  1.1  mrg   \utfeightchardefs
   11150  1.1  mrg \fi
   11151  1.1  mrg 
   11152  1.1  mrg \message{formatting,}
   11153  1.1  mrg 
   11154  1.1  mrg \newdimen\defaultparindent \defaultparindent = 15pt
   11155  1.1  mrg 
   11156  1.1  mrg \chapheadingskip = 15pt plus 4pt minus 2pt
   11157  1.1  mrg \secheadingskip = 12pt plus 3pt minus 2pt
   11158  1.1  mrg \subsecheadingskip = 9pt plus 2pt minus 2pt
   11159  1.1  mrg 
   11160  1.1  mrg % Prevent underfull vbox error messages.
   11161  1.1  mrg \vbadness = 10000
   11162  1.1  mrg 
   11163  1.1  mrg % Don't be very finicky about underfull hboxes, either.
   11164  1.1  mrg \hbadness = 6666
   11165  1.1  mrg 
   11166  1.1  mrg % Following George Bush, get rid of widows and orphans.
   11167  1.1  mrg \widowpenalty=10000
   11168  1.1  mrg \clubpenalty=10000
   11169  1.1  mrg 
   11170  1.1  mrg % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
   11171  1.1  mrg % using an old version of TeX, don't do anything.  We want the amount of
   11172  1.1  mrg % stretch added to depend on the line length, hence the dependence on
   11173  1.1  mrg % \hsize.  We call this whenever the paper size is set.
   11174  1.1  mrg %
   11175  1.1  mrg \def\setemergencystretch{%
   11176  1.1  mrg   \ifx\emergencystretch\thisisundefined
   11177  1.1  mrg     % Allow us to assign to \emergencystretch anyway.
   11178  1.1  mrg     \def\emergencystretch{\dimen0}%
   11179  1.1  mrg   \else
   11180  1.1  mrg     \emergencystretch = .15\hsize
   11181  1.1  mrg   \fi
   11182  1.1  mrg }
   11183  1.1  mrg 
   11184  1.1  mrg % Parameters in order: 1) textheight; 2) textwidth;
   11185  1.1  mrg % 3) voffset; 4) hoffset; 5) binding offset; 6) topskip;
   11186  1.1  mrg % 7) physical page height; 8) physical page width.
   11187  1.1  mrg %
   11188  1.1  mrg % We also call \setleading{\textleading}, so the caller should define
   11189  1.1  mrg % \textleading.  The caller should also set \parskip.
   11190  1.1  mrg %
   11191  1.1  mrg \def\internalpagesizes#1#2#3#4#5#6#7#8{%
   11192  1.1  mrg   \voffset = #3\relax
   11193  1.1  mrg   \topskip = #6\relax
   11194  1.1  mrg   \splittopskip = \topskip
   11195  1.1  mrg   %
   11196  1.1  mrg   \vsize = #1\relax
   11197  1.1  mrg   \advance\vsize by \topskip
   11198  1.1  mrg   \outervsize = \vsize
   11199  1.1  mrg   \advance\outervsize by 2\topandbottommargin
   11200  1.1  mrg   \txipageheight = \vsize
   11201  1.1  mrg   %
   11202  1.1  mrg   \hsize = #2\relax
   11203  1.1  mrg   \outerhsize = \hsize
   11204  1.1  mrg   \advance\outerhsize by 0.5in
   11205  1.1  mrg   \txipagewidth = \hsize
   11206  1.1  mrg   %
   11207  1.1  mrg   \normaloffset = #4\relax
   11208  1.1  mrg   \bindingoffset = #5\relax
   11209  1.1  mrg   %
   11210  1.1  mrg   \ifpdf
   11211  1.1  mrg     \pdfpageheight #7\relax
   11212  1.1  mrg     \pdfpagewidth #8\relax
   11213  1.1  mrg     % if we don't reset these, they will remain at "1 true in" of
   11214  1.1  mrg     % whatever layout pdftex was dumped with.
   11215  1.1  mrg     \pdfhorigin = 1 true in
   11216  1.1  mrg     \pdfvorigin = 1 true in
   11217  1.1  mrg   \else
   11218  1.1  mrg     \ifx\XeTeXrevision\thisisundefined
   11219  1.1  mrg       \special{papersize=#8,#7}%
   11220  1.1  mrg     \else
   11221  1.1  mrg       \pdfpageheight #7\relax
   11222  1.1  mrg       \pdfpagewidth #8\relax
   11223  1.1  mrg       % XeTeX does not have \pdfhorigin and \pdfvorigin.
   11224  1.1  mrg     \fi
   11225  1.1  mrg   \fi
   11226  1.1  mrg   %
   11227  1.1  mrg   \setleading{\textleading}
   11228  1.1  mrg   %
   11229  1.1  mrg   \parindent = \defaultparindent
   11230  1.1  mrg   \setemergencystretch
   11231  1.1  mrg }
   11232  1.1  mrg 
   11233  1.1  mrg % @letterpaper (the default).
   11234  1.1  mrg \def\letterpaper{{\globaldefs = 1
   11235  1.1  mrg   \parskip = 3pt plus 2pt minus 1pt
   11236  1.1  mrg   \textleading = 13.2pt
   11237  1.1  mrg   %
   11238  1.1  mrg   % If page is nothing but text, make it come out even.
   11239  1.1  mrg   \internalpagesizes{607.2pt}{6in}% that's 46 lines
   11240  1.1  mrg                     {\voffset}{.25in}%
   11241  1.1  mrg                     {\bindingoffset}{36pt}%
   11242  1.1  mrg                     {11in}{8.5in}%
   11243  1.1  mrg }}
   11244  1.1  mrg 
   11245  1.1  mrg % Use @smallbook to reset parameters for 7x9.25 trim size.
   11246  1.1  mrg \def\smallbook{{\globaldefs = 1
   11247  1.1  mrg   \parskip = 2pt plus 1pt
   11248  1.1  mrg   \textleading = 12pt
   11249  1.1  mrg   %
   11250  1.1  mrg   \internalpagesizes{7.5in}{5in}%
   11251  1.1  mrg                     {-.2in}{0in}%
   11252  1.1  mrg                     {\bindingoffset}{16pt}%
   11253  1.1  mrg                     {9.25in}{7in}%
   11254  1.1  mrg   %
   11255  1.1  mrg   \lispnarrowing = 0.3in
   11256  1.1  mrg   \tolerance = 700
   11257  1.1  mrg   \contentsrightmargin = 0pt
   11258  1.1  mrg   \defbodyindent = .5cm
   11259  1.1  mrg }}
   11260  1.1  mrg 
   11261  1.1  mrg % Use @smallerbook to reset parameters for 6x9 trim size.
   11262  1.1  mrg % (Just testing, parameters still in flux.)
   11263  1.1  mrg \def\smallerbook{{\globaldefs = 1
   11264  1.1  mrg   \parskip = 1.5pt plus 1pt
   11265  1.1  mrg   \textleading = 12pt
   11266  1.1  mrg   %
   11267  1.1  mrg   \internalpagesizes{7.4in}{4.8in}%
   11268  1.1  mrg                     {-.2in}{-.4in}%
   11269  1.1  mrg                     {0pt}{14pt}%
   11270  1.1  mrg                     {9in}{6in}%
   11271  1.1  mrg   %
   11272  1.1  mrg   \lispnarrowing = 0.25in
   11273  1.1  mrg   \tolerance = 700
   11274  1.1  mrg   \contentsrightmargin = 0pt
   11275  1.1  mrg   \defbodyindent = .4cm
   11276  1.1  mrg }}
   11277  1.1  mrg 
   11278  1.1  mrg % Use @afourpaper to print on European A4 paper.
   11279  1.1  mrg \def\afourpaper{{\globaldefs = 1
   11280  1.1  mrg   \parskip = 3pt plus 2pt minus 1pt
   11281  1.1  mrg   \textleading = 13.2pt
   11282  1.1  mrg   %
   11283  1.1  mrg   % Double-side printing via postscript on Laserjet 4050
   11284  1.1  mrg   % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm.
   11285  1.1  mrg   % To change the settings for a different printer or situation, adjust
   11286  1.1  mrg   % \normaloffset until the front-side and back-side texts align.  Then
   11287  1.1  mrg   % do the same for \bindingoffset.  You can set these for testing in
   11288  1.1  mrg   % your texinfo source file like this:
   11289  1.1  mrg   % @tex
   11290  1.1  mrg   % \global\normaloffset = -6mm
   11291  1.1  mrg   % \global\bindingoffset = 10mm
   11292  1.1  mrg   % @end tex
   11293  1.1  mrg   \internalpagesizes{673.2pt}{160mm}% that's 51 lines
   11294  1.1  mrg                     {\voffset}{\hoffset}%
   11295  1.1  mrg                     {\bindingoffset}{44pt}%
   11296  1.1  mrg                     {297mm}{210mm}%
   11297  1.1  mrg   %
   11298  1.1  mrg   \tolerance = 700
   11299  1.1  mrg   \contentsrightmargin = 0pt
   11300  1.1  mrg   \defbodyindent = 5mm
   11301  1.1  mrg }}
   11302  1.1  mrg 
   11303  1.1  mrg % Use @afivepaper to print on European A5 paper.
   11304  1.1  mrg % From romildo (a] urano.iceb.ufop.br, 2 July 2000.
   11305  1.1  mrg % He also recommends making @example and @lisp be small.
   11306  1.1  mrg \def\afivepaper{{\globaldefs = 1
   11307  1.1  mrg   \parskip = 2pt plus 1pt minus 0.1pt
   11308  1.1  mrg   \textleading = 12.5pt
   11309  1.1  mrg   %
   11310  1.1  mrg   \internalpagesizes{160mm}{120mm}%
   11311  1.1  mrg                     {\voffset}{\hoffset}%
   11312  1.1  mrg                     {\bindingoffset}{8pt}%
   11313  1.1  mrg                     {210mm}{148mm}%
   11314  1.1  mrg   %
   11315  1.1  mrg   \lispnarrowing = 0.2in
   11316  1.1  mrg   \tolerance = 800
   11317  1.1  mrg   \contentsrightmargin = 0pt
   11318  1.1  mrg   \defbodyindent = 2mm
   11319  1.1  mrg   \tableindent = 12mm
   11320  1.1  mrg }}
   11321  1.1  mrg 
   11322  1.1  mrg % A specific text layout, 24x15cm overall, intended for A4 paper.
   11323  1.1  mrg \def\afourlatex{{\globaldefs = 1
   11324  1.1  mrg   \afourpaper
   11325  1.1  mrg   \internalpagesizes{237mm}{150mm}%
   11326  1.1  mrg                     {\voffset}{4.6mm}%
   11327  1.1  mrg                     {\bindingoffset}{7mm}%
   11328  1.1  mrg                     {297mm}{210mm}%
   11329  1.1  mrg   %
   11330  1.1  mrg   % Must explicitly reset to 0 because we call \afourpaper.
   11331  1.1  mrg   \globaldefs = 0
   11332  1.1  mrg }}
   11333  1.1  mrg 
   11334  1.1  mrg % Use @afourwide to print on A4 paper in landscape format.
   11335  1.1  mrg \def\afourwide{{\globaldefs = 1
   11336  1.1  mrg   \afourpaper
   11337  1.1  mrg   \internalpagesizes{241mm}{165mm}%
   11338  1.1  mrg                     {\voffset}{-2.95mm}%
   11339  1.1  mrg                     {\bindingoffset}{7mm}%
   11340  1.1  mrg                     {297mm}{210mm}%
   11341  1.1  mrg   \globaldefs = 0
   11342  1.1  mrg }}
   11343  1.1  mrg 
   11344  1.1  mrg % @pagesizes TEXTHEIGHT[,TEXTWIDTH]
   11345  1.1  mrg % Perhaps we should allow setting the margins, \topskip, \parskip,
   11346  1.1  mrg % and/or leading, also. Or perhaps we should compute them somehow.
   11347  1.1  mrg %
   11348  1.1  mrg \parseargdef\pagesizes{\pagesizesyyy #1,,\finish}
   11349  1.1  mrg \def\pagesizesyyy#1,#2,#3\finish{{%
   11350  1.1  mrg   \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
   11351  1.1  mrg   \globaldefs = 1
   11352  1.1  mrg   %
   11353  1.1  mrg   \parskip = 3pt plus 2pt minus 1pt
   11354  1.1  mrg   \setleading{\textleading}%
   11355  1.1  mrg   %
   11356  1.1  mrg   \dimen0 = #1\relax
   11357  1.1  mrg   \advance\dimen0 by \voffset
   11358  1.1  mrg   \advance\dimen0 by 1in % reference point for DVI is 1 inch from top of page
   11359  1.1  mrg   %
   11360  1.1  mrg   \dimen2 = \hsize
   11361  1.1  mrg   \advance\dimen2 by \normaloffset
   11362  1.1  mrg   \advance\dimen2 by 1in % reference point is 1 inch from left edge of page
   11363  1.1  mrg   %
   11364  1.1  mrg   \internalpagesizes{#1}{\hsize}%
   11365  1.1  mrg                     {\voffset}{\normaloffset}%
   11366  1.1  mrg                     {\bindingoffset}{44pt}%
   11367  1.1  mrg                     {\dimen0}{\dimen2}%
   11368  1.1  mrg }}
   11369  1.1  mrg 
   11370  1.1  mrg % Set default to letter.
   11371  1.1  mrg %
   11372  1.1  mrg \letterpaper
   11373  1.1  mrg 
   11374  1.1  mrg % Default value of \hfuzz, for suppressing warnings about overfull hboxes.
   11375  1.1  mrg \hfuzz = 1pt
   11376  1.1  mrg 
   11377  1.1  mrg 
   11378  1.1  mrg \message{and turning on texinfo input format.}
   11379  1.1  mrg 
   11380  1.1  mrg \def^^L{\par} % remove \outer, so ^L can appear in an @comment
   11381  1.1  mrg 
   11382  1.1  mrg % DEL is a comment character, in case @c does not suffice.
   11383  1.1  mrg \catcode`\^^? = 14
   11384  1.1  mrg 
   11385  1.1  mrg % Define macros to output various characters with catcode for normal text.
   11386  1.1  mrg \catcode`\"=\other \def\normaldoublequote{"}
   11387  1.1  mrg \catcode`\$=\other \def\normaldollar{$}%$ font-lock fix
   11388  1.1  mrg \catcode`\+=\other \def\normalplus{+}
   11389  1.1  mrg \catcode`\<=\other \def\normalless{<}
   11390  1.1  mrg \catcode`\>=\other \def\normalgreater{>}
   11391  1.1  mrg \catcode`\^=\other \def\normalcaret{^}
   11392  1.1  mrg \catcode`\_=\other \def\normalunderscore{_}
   11393  1.1  mrg \catcode`\|=\other \def\normalverticalbar{|}
   11394  1.1  mrg \catcode`\~=\other \def\normaltilde{~}
   11395  1.1  mrg 
   11396  1.1  mrg % This macro is used to make a character print one way in \tt
   11397  1.1  mrg % (where it can probably be output as-is), and another way in other fonts,
   11398  1.1  mrg % where something hairier probably needs to be done.
   11399  1.1  mrg %
   11400  1.1  mrg % #1 is what to print if we are indeed using \tt; #2 is what to print
   11401  1.1  mrg % otherwise.  Since all the Computer Modern typewriter fonts have zero
   11402  1.1  mrg % interword stretch (and shrink), and it is reasonable to expect all
   11403  1.1  mrg % typewriter fonts to have this, we can check that font parameter.
   11404  1.1  mrg %
   11405  1.1  mrg \def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
   11406  1.1  mrg 
   11407  1.1  mrg % Same as above, but check for italic font.  Actually this also catches
   11408  1.1  mrg % non-italic slanted fonts since it is impossible to distinguish them from
   11409  1.1  mrg % italic fonts.  But since this is only used by $ and it uses \sl anyway
   11410  1.1  mrg % this is not a problem.
   11411  1.1  mrg \def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
   11412  1.1  mrg 
   11413  1.1  mrg % Set catcodes for Texinfo file
   11414  1.1  mrg 
   11415  1.1  mrg % Active characters for printing the wanted glyph.
   11416  1.1  mrg % Most of these we simply print from the \tt font, but for some, we can
   11417  1.1  mrg % use math or other variants that look better in normal text.
   11418  1.1  mrg %
   11419  1.1  mrg \catcode`\"=\active
   11420  1.1  mrg \def\activedoublequote{{\tt\char34}}
   11421  1.1  mrg \let"=\activedoublequote
   11422  1.1  mrg \catcode`\~=\active \def\activetilde{{\tt\char126}} \let~ = \activetilde
   11423  1.1  mrg \chardef\hatchar=`\^
   11424  1.1  mrg \catcode`\^=\active \def\activehat{{\tt \hatchar}} \let^ = \activehat
   11425  1.1  mrg 
   11426  1.1  mrg \catcode`\_=\active
   11427  1.1  mrg \def_{\ifusingtt\normalunderscore\_}
   11428  1.1  mrg \def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }
   11429  1.1  mrg \let\realunder=_
   11430  1.1  mrg 
   11431  1.1  mrg \catcode`\|=\active \def|{{\tt\char124}}
   11432  1.1  mrg 
   11433  1.1  mrg \chardef \less=`\<
   11434  1.1  mrg \catcode`\<=\active \def\activeless{{\tt \less}}\let< = \activeless
   11435  1.1  mrg \chardef \gtr=`\>
   11436  1.1  mrg \catcode`\>=\active \def\activegtr{{\tt \gtr}}\let> = \activegtr
   11437  1.1  mrg \catcode`\+=\active \def+{{\tt \char 43}}
   11438  1.1  mrg \catcode`\$=\active \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
   11439  1.1  mrg \catcode`\-=\active \let-=\normaldash
   11440  1.1  mrg 
   11441  1.1  mrg 
   11442  1.1  mrg % used for headline/footline in the output routine, in case the page
   11443  1.1  mrg % breaks in the middle of an @tex block.
   11444  1.1  mrg \def\texinfochars{%
   11445  1.1  mrg   \let< = \activeless
   11446  1.1  mrg   \let> = \activegtr
   11447  1.1  mrg   \let~ = \activetilde
   11448  1.1  mrg   \let^ = \activehat
   11449  1.1  mrg   \markupsetuplqdefault \markupsetuprqdefault
   11450  1.1  mrg   \let\b = \strong
   11451  1.1  mrg   \let\i = \smartitalic
   11452  1.1  mrg   % in principle, all other definitions in \tex have to be undone too.
   11453  1.1  mrg }
   11454  1.1  mrg 
   11455  1.1  mrg % Used sometimes to turn off (effectively) the active characters even after
   11456  1.1  mrg % parsing them.
   11457  1.1  mrg \def\turnoffactive{%
   11458  1.1  mrg   \normalturnoffactive
   11459  1.1  mrg   \otherbackslash
   11460  1.1  mrg }
   11461  1.1  mrg 
   11462  1.1  mrg \catcode`\@=0
   11463  1.1  mrg 
   11464  1.1  mrg % \backslashcurfont outputs one backslash character in current font,
   11465  1.1  mrg % as in \char`\\.
   11466  1.1  mrg \global\chardef\backslashcurfont=`\\
   11467  1.1  mrg 
   11468  1.1  mrg % \realbackslash is an actual character `\' with catcode other.
   11469  1.1  mrg {\catcode`\\=\other @gdef@realbackslash{\}}
   11470  1.1  mrg 
   11471  1.1  mrg % In Texinfo, backslash is an active character; it prints the backslash
   11472  1.1  mrg % in fixed width font.
   11473  1.1  mrg \catcode`\\=\active  % @ for escape char from now on.
   11474  1.1  mrg 
   11475  1.1  mrg % Print a typewriter backslash.  For math mode, we can't simply use
   11476  1.1  mrg % \backslashcurfont: the story here is that in math mode, the \char
   11477  1.1  mrg % of \backslashcurfont ends up printing the roman \ from the math symbol
   11478  1.1  mrg % font (because \char in math mode uses the \mathcode, and plain.tex
   11479  1.1  mrg % sets \mathcode`\\="026E).  Hence we use an explicit \mathchar,
   11480  1.1  mrg % which is the decimal equivalent of "715c (class 7, e.g., use \fam;
   11481  1.1  mrg % ignored family value; char position "5C).  We can't use " for the
   11482  1.1  mrg % usual hex value because it has already been made active.
   11483  1.1  mrg 
   11484  1.1  mrg @def@ttbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}}
   11485  1.1  mrg @let@backslashchar = @ttbackslash % @backslashchar{} is for user documents.
   11486  1.1  mrg 
   11487  1.1  mrg % \otherbackslash defines an active \ to be a literal `\' character with
   11488  1.1  mrg % catcode other.
   11489  1.1  mrg @gdef@otherbackslash{@let\=@realbackslash}
   11490  1.1  mrg 
   11491  1.1  mrg % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
   11492  1.1  mrg % the literal character `\'.
   11493  1.1  mrg %
   11494  1.1  mrg {@catcode`- = @active
   11495  1.1  mrg  @gdef@normalturnoffactive{%
   11496  1.1  mrg    @passthroughcharstrue
   11497  1.1  mrg    @let-=@normaldash
   11498  1.1  mrg    @let"=@normaldoublequote
   11499  1.1  mrg    @let$=@normaldollar %$ font-lock fix
   11500  1.1  mrg    @let+=@normalplus
   11501  1.1  mrg    @let<=@normalless
   11502  1.1  mrg    @let>=@normalgreater
   11503  1.1  mrg    @let^=@normalcaret
   11504  1.1  mrg    @let_=@normalunderscore
   11505  1.1  mrg    @let|=@normalverticalbar
   11506  1.1  mrg    @let~=@normaltilde
   11507  1.1  mrg    @let\=@ttbackslash
   11508  1.1  mrg    @markupsetuplqdefault
   11509  1.1  mrg    @markupsetuprqdefault
   11510  1.1  mrg    @unsepspaces
   11511  1.1  mrg  }
   11512  1.1  mrg }
   11513  1.1  mrg 
   11514  1.1  mrg % If a .fmt file is being used, characters that might appear in a file
   11515  1.1  mrg % name cannot be active until we have parsed the command line.
   11516  1.1  mrg % So turn them off again, and have @fixbackslash turn them back on.
   11517  1.1  mrg @catcode`+=@other @catcode`@_=@other
   11518  1.1  mrg 
   11519  1.1  mrg % \enablebackslashhack - allow file to begin `\input texinfo'
   11520  1.1  mrg %
   11521  1.1  mrg % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
   11522  1.1  mrg % That is what \eatinput is for; after that, the `\' should revert to printing
   11523  1.1  mrg % a backslash.
   11524  1.1  mrg % If the file did not have a `\input texinfo', then it is turned off after
   11525  1.1  mrg % the first line; otherwise the first `\' in the file would cause an error.
   11526  1.1  mrg % This is used on the very last line of this file, texinfo.tex.
   11527  1.1  mrg % We also use @c to call @fixbackslash, in case ends of lines are hidden.
   11528  1.1  mrg {
   11529  1.1  mrg @catcode`@^=7
   11530  1.1  mrg @catcode`@^^M=13@gdef@enablebackslashhack{%
   11531  1.1  mrg   @global@let\ = @eatinput%
   11532  1.1  mrg   @catcode`@^^M=13%
   11533  1.1  mrg   @def@c{@fixbackslash@c}%
   11534  1.1  mrg   % Definition for the newline at the end of this file.
   11535  1.1  mrg   @def ^^M{@let^^M@secondlinenl}%
   11536  1.1  mrg   % Definition for a newline in the main Texinfo file.
   11537  1.1  mrg   @gdef @secondlinenl{@fixbackslash}%
   11538  1.1  mrg   % In case the first line has a whole-line command on it
   11539  1.1  mrg   @let@originalparsearg@parsearg
   11540  1.1  mrg   @def@parsearg{@fixbackslash@originalparsearg}
   11541  1.1  mrg }}
   11542  1.1  mrg 
   11543  1.1  mrg {@catcode`@^=7 @catcode`@^^M=13%
   11544  1.1  mrg @gdef@eatinput input texinfo#1^^M{@fixbackslash}}
   11545  1.1  mrg 
   11546  1.1  mrg % Emergency active definition of newline, in case an active newline token
   11547  1.1  mrg % appears by mistake.
   11548  1.1  mrg {@catcode`@^=7 @catcode13=13%
   11549  1.1  mrg @gdef@enableemergencynewline{%
   11550  1.1  mrg   @gdef^^M{%
   11551  1.1  mrg     @par%
   11552  1.1  mrg     %<warning: active newline>@par%
   11553  1.1  mrg }}}
   11554  1.1  mrg 
   11555  1.1  mrg 
   11556  1.1  mrg @gdef@fixbackslash{%
   11557  1.1  mrg   @ifx\@eatinput @let\ = @ttbackslash @fi
   11558  1.1  mrg   @catcode13=5 % regular end of line
   11559  1.1  mrg   @enableemergencynewline
   11560  1.1  mrg   @let@c=@comment
   11561  1.1  mrg   @let@parsearg@originalparsearg
   11562  1.1  mrg   % Also turn back on active characters that might appear in the input
   11563  1.1  mrg   % file name, in case not using a pre-dumped format.
   11564  1.1  mrg   @catcode`+=@active
   11565  1.1  mrg   @catcode`@_=@active
   11566  1.1  mrg   %
   11567  1.1  mrg   % If texinfo.cnf is present on the system, read it.
   11568  1.1  mrg   % Useful for site-wide @afourpaper, etc.  This macro, @fixbackslash, gets
   11569  1.1  mrg   % called at the beginning of every Texinfo file.  Not opening texinfo.cnf
   11570  1.1  mrg   % directly in this file, texinfo.tex, makes it possible to make a format
   11571  1.1  mrg   % file for Texinfo.
   11572  1.1  mrg   %
   11573  1.1  mrg   @openin 1 texinfo.cnf
   11574  1.1  mrg   @ifeof 1 @else @input texinfo.cnf @fi
   11575  1.1  mrg   @closein 1
   11576  1.1  mrg }
   11577  1.1  mrg 
   11578  1.1  mrg 
   11579  1.1  mrg % Say @foo, not \foo, in error messages.
   11580  1.1  mrg @escapechar = `@@
   11581  1.1  mrg 
   11582  1.1  mrg % These (along with & and #) are made active for url-breaking, so need
   11583  1.1  mrg % active definitions as the normal characters.
   11584  1.1  mrg @def@normaldot{.}
   11585  1.1  mrg @def@normalquest{?}
   11586  1.1  mrg @def@normalslash{/}
   11587  1.1  mrg 
   11588  1.1  mrg % These look ok in all fonts, so just make them not special.
   11589  1.1  mrg % @hashchar{} gets its own user-level command, because of #line.
   11590  1.1  mrg @catcode`@& = @other @def@normalamp{&}
   11591  1.1  mrg @catcode`@# = @other @def@normalhash{#}
   11592  1.1  mrg @catcode`@% = @other @def@normalpercent{%}
   11593  1.1  mrg 
   11594  1.1  mrg @let @hashchar = @normalhash
   11595  1.1  mrg 
   11596  1.1  mrg @c Finally, make ` and ' active, so that txicodequoteundirected and
   11597  1.1  mrg @c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}.  If we
   11598  1.1  mrg @c don't make ` and ' active, @code will not get them as active chars.
   11599  1.1  mrg @c Do this last of all since we use ` in the previous @catcode assignments.
   11600  1.1  mrg @catcode`@'=@active
   11601  1.1  mrg @catcode`@`=@active
   11602  1.1  mrg @markupsetuplqdefault
   11603  1.1  mrg @markupsetuprqdefault
   11604  1.1  mrg 
   11605  1.1  mrg @c Local variables:
   11606  1.1  mrg @c eval: (add-hook 'before-save-hook 'time-stamp)
   11607  1.1  mrg @c page-delimiter: "^\\\\message\\|emacs-page"
   11608  1.1  mrg @c time-stamp-start: "def\\\\texinfoversion{"
   11609  1.1  mrg @c time-stamp-format: "%:y-%02m-%02d.%02H"
   11610  1.1  mrg @c time-stamp-end: "}"
   11611  1.1  mrg @c End:
   11612  1.1  mrg 
   11613  1.1  mrg @c vim:sw=2:
   11614  1.1  mrg 
   11615           @enablebackslashhack
   11616