Home | History | Annotate | Line # | Download | only in doc
texinfo.tex revision 1.1.1.3
      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.1.3  mrg \def\texinfoversion{2018-01-09.11}
      7      1.1  mrg %
      8      1.1  mrg % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
      9      1.1  mrg % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
     10  1.1.1.3  mrg % 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018
     11  1.1.1.3  mrg % Free Software Foundation, Inc.
     12      1.1  mrg %
     13      1.1  mrg % This texinfo.tex file is free software: you can redistribute it and/or
     14      1.1  mrg % modify it under the terms of the GNU General Public License as
     15      1.1  mrg % published by the Free Software Foundation, either version 3 of the
     16      1.1  mrg % License, or (at your option) any later version.
     17      1.1  mrg %
     18      1.1  mrg % This texinfo.tex file is distributed in the hope that it will be
     19      1.1  mrg % useful, but WITHOUT ANY WARRANTY; without even the implied warranty
     20      1.1  mrg % of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     21      1.1  mrg % General Public License for more details.
     22      1.1  mrg %
     23      1.1  mrg % You should have received a copy of the GNU General Public License
     24  1.1.1.3  mrg % along with this program.  If not, see <https://www.gnu.org/licenses/>.
     25      1.1  mrg %
     26      1.1  mrg % As a special exception, when this file is read by TeX when processing
     27      1.1  mrg % a Texinfo source document, you may use the result without
     28  1.1.1.2  mrg % restriction. This Exception is an additional permission under section 7
     29  1.1.1.2  mrg % of the GNU General Public License, version 3 ("GPLv3").
     30      1.1  mrg %
     31      1.1  mrg % Please try the latest version of texinfo.tex before submitting bug
     32      1.1  mrg % reports; you can get the latest version from:
     33  1.1.1.3  mrg %   https://ftp.gnu.org/gnu/texinfo/ (the Texinfo release area), or
     34  1.1.1.3  mrg %   https://ftpmirror.gnu.org/texinfo/ (same, via a mirror), or
     35  1.1.1.3  mrg %   https://www.gnu.org/software/texinfo/ (the Texinfo home page)
     36      1.1  mrg % The texinfo.tex in any given distribution could well be out
     37      1.1  mrg % of date, so if that's what you're using, please check.
     38      1.1  mrg %
     39      1.1  mrg % Send bug reports to bug-texinfo (a] gnu.org.  Please include including a
     40      1.1  mrg % complete document in each bug report with which we can reproduce the
     41      1.1  mrg % problem.  Patches are, of course, greatly appreciated.
     42      1.1  mrg %
     43      1.1  mrg % To process a Texinfo manual with TeX, it's most reliable to use the
     44      1.1  mrg % texi2dvi shell script that comes with the distribution.  For a simple
     45      1.1  mrg % manual foo.texi, however, you can get away with this:
     46      1.1  mrg %   tex foo.texi
     47      1.1  mrg %   texindex foo.??
     48      1.1  mrg %   tex foo.texi
     49      1.1  mrg %   tex foo.texi
     50      1.1  mrg %   dvips foo.dvi -o  # or whatever; this makes foo.ps.
     51      1.1  mrg % The extra TeX runs get the cross-reference information correct.
     52      1.1  mrg % Sometimes one run after texindex suffices, and sometimes you need more
     53      1.1  mrg % than two; texi2dvi does it as many times as necessary.
     54      1.1  mrg %
     55      1.1  mrg % It is possible to adapt texinfo.tex for other languages, to some
     56      1.1  mrg % extent.  You can get the existing language-specific files from the
     57      1.1  mrg % full Texinfo distribution.
     58      1.1  mrg %
     59  1.1.1.3  mrg % The GNU Texinfo home page is https://www.gnu.org/software/texinfo.
     60      1.1  mrg 
     61      1.1  mrg 
     62      1.1  mrg \message{Loading texinfo [version \texinfoversion]:}
     63      1.1  mrg 
     64      1.1  mrg % If in a .fmt file, print the version number
     65      1.1  mrg % and turn on active characters that we couldn't do earlier because
     66      1.1  mrg % they might have appeared in the input file name.
     67      1.1  mrg \everyjob{\message{[Texinfo version \texinfoversion]}%
     68      1.1  mrg   \catcode`+=\active \catcode`\_=\active}
     69      1.1  mrg 
     70  1.1.1.3  mrg % LaTeX's \typeout.  This ensures that the messages it is used for
     71  1.1.1.3  mrg % are identical in format to the corresponding ones from latex/pdflatex.
     72  1.1.1.3  mrg \def\typeout{\immediate\write17}%
     73  1.1.1.3  mrg 
     74      1.1  mrg \chardef\other=12
     75      1.1  mrg 
     76      1.1  mrg % We never want plain's \outer definition of \+ in Texinfo.
     77      1.1  mrg % For @tex, we can use \tabalign.
     78      1.1  mrg \let\+ = \relax
     79      1.1  mrg 
     80      1.1  mrg % Save some plain tex macros whose names we will redefine.
     81      1.1  mrg \let\ptexb=\b
     82      1.1  mrg \let\ptexbullet=\bullet
     83      1.1  mrg \let\ptexc=\c
     84      1.1  mrg \let\ptexcomma=\,
     85      1.1  mrg \let\ptexdot=\.
     86      1.1  mrg \let\ptexdots=\dots
     87      1.1  mrg \let\ptexend=\end
     88      1.1  mrg \let\ptexequiv=\equiv
     89      1.1  mrg \let\ptexexclam=\!
     90      1.1  mrg \let\ptexfootnote=\footnote
     91      1.1  mrg \let\ptexgtr=>
     92      1.1  mrg \let\ptexhat=^
     93      1.1  mrg \let\ptexi=\i
     94      1.1  mrg \let\ptexindent=\indent
     95      1.1  mrg \let\ptexinsert=\insert
     96      1.1  mrg \let\ptexlbrace=\{
     97      1.1  mrg \let\ptexless=<
     98      1.1  mrg \let\ptexnewwrite\newwrite
     99      1.1  mrg \let\ptexnoindent=\noindent
    100      1.1  mrg \let\ptexplus=+
    101      1.1  mrg \let\ptexraggedright=\raggedright
    102      1.1  mrg \let\ptexrbrace=\}
    103      1.1  mrg \let\ptexslash=\/
    104  1.1.1.3  mrg \let\ptexsp=\sp
    105      1.1  mrg \let\ptexstar=\*
    106  1.1.1.3  mrg \let\ptexsup=\sup
    107      1.1  mrg \let\ptext=\t
    108      1.1  mrg \let\ptextop=\top
    109      1.1  mrg {\catcode`\'=\active \global\let\ptexquoteright'}% active in plain's math mode
    110      1.1  mrg 
    111      1.1  mrg % If this character appears in an error message or help string, it
    112      1.1  mrg % starts a new line in the output.
    113      1.1  mrg \newlinechar = `^^J
    114      1.1  mrg 
    115      1.1  mrg % Use TeX 3.0's \inputlineno to get the line number, for better error
    116      1.1  mrg % messages, but if we're using an old version of TeX, don't do anything.
    117      1.1  mrg %
    118      1.1  mrg \ifx\inputlineno\thisisundefined
    119      1.1  mrg   \let\linenumber = \empty % Pre-3.0.
    120      1.1  mrg \else
    121      1.1  mrg   \def\linenumber{l.\the\inputlineno:\space}
    122      1.1  mrg \fi
    123      1.1  mrg 
    124      1.1  mrg % Set up fixed words for English if not already set.
    125      1.1  mrg \ifx\putwordAppendix\undefined  \gdef\putwordAppendix{Appendix}\fi
    126      1.1  mrg \ifx\putwordChapter\undefined   \gdef\putwordChapter{Chapter}\fi
    127      1.1  mrg \ifx\putworderror\undefined     \gdef\putworderror{error}\fi
    128      1.1  mrg \ifx\putwordfile\undefined      \gdef\putwordfile{file}\fi
    129      1.1  mrg \ifx\putwordin\undefined        \gdef\putwordin{in}\fi
    130      1.1  mrg \ifx\putwordIndexIsEmpty\undefined       \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
    131      1.1  mrg \ifx\putwordIndexNonexistent\undefined   \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
    132      1.1  mrg \ifx\putwordInfo\undefined      \gdef\putwordInfo{Info}\fi
    133      1.1  mrg \ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
    134      1.1  mrg \ifx\putwordMethodon\undefined  \gdef\putwordMethodon{Method on}\fi
    135      1.1  mrg \ifx\putwordNoTitle\undefined   \gdef\putwordNoTitle{No Title}\fi
    136      1.1  mrg \ifx\putwordof\undefined        \gdef\putwordof{of}\fi
    137      1.1  mrg \ifx\putwordon\undefined        \gdef\putwordon{on}\fi
    138      1.1  mrg \ifx\putwordpage\undefined      \gdef\putwordpage{page}\fi
    139      1.1  mrg \ifx\putwordsection\undefined   \gdef\putwordsection{section}\fi
    140      1.1  mrg \ifx\putwordSection\undefined   \gdef\putwordSection{Section}\fi
    141      1.1  mrg \ifx\putwordsee\undefined       \gdef\putwordsee{see}\fi
    142      1.1  mrg \ifx\putwordSee\undefined       \gdef\putwordSee{See}\fi
    143      1.1  mrg \ifx\putwordShortTOC\undefined  \gdef\putwordShortTOC{Short Contents}\fi
    144      1.1  mrg \ifx\putwordTOC\undefined       \gdef\putwordTOC{Table of Contents}\fi
    145      1.1  mrg %
    146      1.1  mrg \ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
    147      1.1  mrg \ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
    148      1.1  mrg \ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
    149      1.1  mrg \ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
    150      1.1  mrg \ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
    151      1.1  mrg \ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
    152      1.1  mrg \ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
    153      1.1  mrg \ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
    154      1.1  mrg \ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
    155      1.1  mrg \ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
    156      1.1  mrg \ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
    157      1.1  mrg \ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
    158      1.1  mrg %
    159      1.1  mrg \ifx\putwordDefmac\undefined    \gdef\putwordDefmac{Macro}\fi
    160      1.1  mrg \ifx\putwordDefspec\undefined   \gdef\putwordDefspec{Special Form}\fi
    161      1.1  mrg \ifx\putwordDefvar\undefined    \gdef\putwordDefvar{Variable}\fi
    162      1.1  mrg \ifx\putwordDefopt\undefined    \gdef\putwordDefopt{User Option}\fi
    163      1.1  mrg \ifx\putwordDeffunc\undefined   \gdef\putwordDeffunc{Function}\fi
    164      1.1  mrg 
    165  1.1.1.3  mrg % Give the space character the catcode for a space.
    166  1.1.1.3  mrg \def\spaceisspace{\catcode`\ =10\relax}
    167  1.1.1.3  mrg 
    168  1.1.1.3  mrg % Likewise for ^^M, the end of line character.
    169  1.1.1.3  mrg \def\endlineisspace{\catcode13=10\relax}
    170  1.1.1.3  mrg 
    171      1.1  mrg \chardef\dashChar  = `\-
    172      1.1  mrg \chardef\slashChar = `\/
    173      1.1  mrg \chardef\underChar = `\_
    174      1.1  mrg 
    175      1.1  mrg % Ignore a token.
    176      1.1  mrg %
    177      1.1  mrg \def\gobble#1{}
    178      1.1  mrg 
    179      1.1  mrg % The following is used inside several \edef's.
    180      1.1  mrg \def\makecsname#1{\expandafter\noexpand\csname#1\endcsname}
    181      1.1  mrg 
    182      1.1  mrg % Hyphenation fixes.
    183      1.1  mrg \hyphenation{
    184      1.1  mrg   Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script
    185      1.1  mrg   ap-pen-dix bit-map bit-maps
    186      1.1  mrg   data-base data-bases eshell fall-ing half-way long-est man-u-script
    187      1.1  mrg   man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm
    188      1.1  mrg   par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces
    189      1.1  mrg   spell-ing spell-ings
    190      1.1  mrg   stand-alone strong-est time-stamp time-stamps which-ever white-space
    191      1.1  mrg   wide-spread wrap-around
    192      1.1  mrg }
    193      1.1  mrg 
    194      1.1  mrg % Sometimes it is convenient to have everything in the transcript file
    195      1.1  mrg % and nothing on the terminal.  We don't just call \tracingall here,
    196      1.1  mrg % since that produces some useless output on the terminal.  We also make
    197      1.1  mrg % some effort to order the tracing commands to reduce output in the log
    198      1.1  mrg % file; cf. trace.sty in LaTeX.
    199      1.1  mrg %
    200      1.1  mrg \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
    201      1.1  mrg \def\loggingall{%
    202      1.1  mrg   \tracingstats2
    203      1.1  mrg   \tracingpages1
    204      1.1  mrg   \tracinglostchars2  % 2 gives us more in etex
    205      1.1  mrg   \tracingparagraphs1
    206      1.1  mrg   \tracingoutput1
    207      1.1  mrg   \tracingmacros2
    208      1.1  mrg   \tracingrestores1
    209      1.1  mrg   \showboxbreadth\maxdimen \showboxdepth\maxdimen
    210      1.1  mrg   \ifx\eTeXversion\thisisundefined\else % etex gives us more logging
    211      1.1  mrg     \tracingscantokens1
    212      1.1  mrg     \tracingifs1
    213      1.1  mrg     \tracinggroups1
    214      1.1  mrg     \tracingnesting2
    215      1.1  mrg     \tracingassigns1
    216      1.1  mrg   \fi
    217      1.1  mrg   \tracingcommands3  % 3 gives us more in etex
    218      1.1  mrg   \errorcontextlines16
    219      1.1  mrg }%
    220      1.1  mrg 
    221      1.1  mrg % @errormsg{MSG}.  Do the index-like expansions on MSG, but if things
    222      1.1  mrg % aren't perfect, it's not the end of the world, being an error message,
    223      1.1  mrg % after all.
    224      1.1  mrg % 
    225      1.1  mrg \def\errormsg{\begingroup \indexnofonts \doerrormsg}
    226      1.1  mrg \def\doerrormsg#1{\errmessage{#1}}
    227      1.1  mrg 
    228      1.1  mrg % add check for \lastpenalty to plain's definitions.  If the last thing
    229      1.1  mrg % we did was a \nobreak, we don't want to insert more space.
    230      1.1  mrg %
    231      1.1  mrg \def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount
    232      1.1  mrg   \removelastskip\penalty-50\smallskip\fi\fi}
    233      1.1  mrg \def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount
    234      1.1  mrg   \removelastskip\penalty-100\medskip\fi\fi}
    235      1.1  mrg \def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
    236      1.1  mrg   \removelastskip\penalty-200\bigskip\fi\fi}
    237      1.1  mrg 
    238  1.1.1.3  mrg % Output routine
    240  1.1.1.3  mrg %
    241  1.1.1.3  mrg 
    242  1.1.1.3  mrg % For a final copy, take out the rectangles
    243  1.1.1.3  mrg % that mark overfull boxes (in case you have decided
    244  1.1.1.3  mrg % that the text looks ok even though it passes the margin).
    245  1.1.1.3  mrg %
    246  1.1.1.3  mrg \def\finalout{\overfullrule=0pt }
    247      1.1  mrg 
    248      1.1  mrg % Do @cropmarks to get crop marks.
    249      1.1  mrg %
    250      1.1  mrg \newif\ifcropmarks
    251      1.1  mrg \let\cropmarks = \cropmarkstrue
    252      1.1  mrg %
    253      1.1  mrg % Dimensions to add cropmarks at corners.
    254      1.1  mrg % Added by P. A. MacKay, 12 Nov. 1986
    255      1.1  mrg %
    256      1.1  mrg \newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
    257      1.1  mrg \newdimen\cornerlong  \cornerlong=1pc
    258      1.1  mrg \newdimen\cornerthick \cornerthick=.3pt
    259      1.1  mrg \newdimen\topandbottommargin \topandbottommargin=.75in
    260      1.1  mrg 
    261      1.1  mrg % Output a mark which sets \thischapter, \thissection and \thiscolor.
    262      1.1  mrg % We dump everything together because we only have one kind of mark.
    263      1.1  mrg % This works because we only use \botmark / \topmark, not \firstmark.
    264      1.1  mrg %
    265      1.1  mrg % A mark contains a subexpression of the \ifcase ... \fi construct.
    266      1.1  mrg % \get*marks macros below extract the needed part using \ifcase.
    267      1.1  mrg %
    268      1.1  mrg % Another complication is to let the user choose whether \thischapter
    269  1.1.1.3  mrg % (\thissection) refers to the chapter (section) in effect at the top
    270  1.1.1.3  mrg % of a page, or that at the bottom of a page.
    271  1.1.1.3  mrg 
    272  1.1.1.3  mrg % \domark is called twice inside \chapmacro, to add one
    273  1.1.1.3  mrg % mark before the section break, and one after.
    274  1.1.1.3  mrg %   In the second call \prevchapterdefs is the same as \lastchapterdefs,
    275  1.1.1.3  mrg % and \prevsectiondefs is the same as \lastsectiondefs.
    276  1.1.1.3  mrg %   Then if the page is not broken at the mark, some of the previous
    277  1.1.1.3  mrg % section appears on the page, and we can get the name of this section
    278  1.1.1.3  mrg % from \firstmark for @everyheadingmarks top.
    279  1.1.1.3  mrg %   @everyheadingmarks bottom uses \botmark.
    280  1.1.1.3  mrg %
    281      1.1  mrg % See page 260 of The TeXbook.
    282      1.1  mrg \def\domark{%
    283      1.1  mrg   \toks0=\expandafter{\lastchapterdefs}%
    284      1.1  mrg   \toks2=\expandafter{\lastsectiondefs}%
    285      1.1  mrg   \toks4=\expandafter{\prevchapterdefs}%
    286      1.1  mrg   \toks6=\expandafter{\prevsectiondefs}%
    287      1.1  mrg   \toks8=\expandafter{\lastcolordefs}%
    288  1.1.1.3  mrg   \mark{%
    289  1.1.1.3  mrg                    \the\toks0 \the\toks2  % 0: marks for @everyheadingmarks top
    290  1.1.1.3  mrg       \noexpand\or \the\toks4 \the\toks6  % 1: for @everyheadingmarks bottom
    291      1.1  mrg     \noexpand\else \the\toks8             % 2: color marks
    292      1.1  mrg   }%
    293  1.1.1.3  mrg }
    294  1.1.1.3  mrg 
    295  1.1.1.3  mrg % \gettopheadingmarks, \getbottomheadingmarks,
    296  1.1.1.3  mrg % \getcolormarks - extract needed part of mark.
    297      1.1  mrg %
    298      1.1  mrg % \topmark doesn't work for the very first chapter (after the title
    299      1.1  mrg % page or the contents), so we use \firstmark there -- this gets us
    300      1.1  mrg % the mark with the chapter defs, unless the user sneaks in, e.g.,
    301      1.1  mrg % @setcolor (or @url, or @link, etc.) between @contents and the very
    302      1.1  mrg % first @chapter.
    303      1.1  mrg \def\gettopheadingmarks{%
    304      1.1  mrg   \ifcase0\topmark\fi
    305      1.1  mrg   \ifx\thischapter\empty \ifcase0\firstmark\fi \fi
    306      1.1  mrg }
    307      1.1  mrg \def\getbottomheadingmarks{\ifcase1\botmark\fi}
    308      1.1  mrg \def\getcolormarks{\ifcase2\topmark\fi}
    309      1.1  mrg 
    310      1.1  mrg % Avoid "undefined control sequence" errors.
    311      1.1  mrg \def\lastchapterdefs{}
    312  1.1.1.3  mrg \def\lastsectiondefs{}
    313      1.1  mrg \def\lastsection{}
    314      1.1  mrg \def\prevchapterdefs{}
    315      1.1  mrg \def\prevsectiondefs{}
    316      1.1  mrg \def\lastcolordefs{}
    317  1.1.1.3  mrg 
    318  1.1.1.3  mrg % Margin to add to right of even pages, to left of odd pages.
    319  1.1.1.3  mrg \newdimen\bindingoffset
    320  1.1.1.3  mrg \newdimen\normaloffset
    321  1.1.1.3  mrg \newdimen\txipagewidth \newdimen\txipageheight
    322      1.1  mrg 
    323  1.1.1.3  mrg % Main output routine.
    324      1.1  mrg %
    325      1.1  mrg \chardef\PAGE = 255
    326      1.1  mrg \output = {\onepageout{\pagecontents\PAGE}}
    327      1.1  mrg 
    328      1.1  mrg \newbox\headlinebox
    329      1.1  mrg \newbox\footlinebox
    330  1.1.1.3  mrg 
    331  1.1.1.3  mrg % \onepageout takes a vbox as an argument.
    332  1.1.1.3  mrg % \shipout a vbox for a single page, adding an optional header, footer,
    333  1.1.1.3  mrg % cropmarks, and footnote.  This also causes index entries for this page
    334  1.1.1.3  mrg % to be written to the auxiliary files.
    335      1.1  mrg %
    336      1.1  mrg \def\onepageout#1{%
    337      1.1  mrg   \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
    338      1.1  mrg   %
    339      1.1  mrg   \ifodd\pageno  \advance\hoffset by \bindingoffset
    340      1.1  mrg   \else \advance\hoffset by -\bindingoffset\fi
    341  1.1.1.3  mrg   %
    342      1.1  mrg   % Common context changes for both heading and footing.
    343      1.1  mrg   % Do this outside of the \shipout so @code etc. will be expanded in
    344  1.1.1.3  mrg   % the headline as they should be, not taken literally (outputting ''code).
    345  1.1.1.3  mrg   \def\commmonheadfootline{\let\hsize=\txipagewidth \texinfochars}
    346  1.1.1.3  mrg   %
    347  1.1.1.3  mrg   % Retrieve the information for the headings from the marks in the page,
    348  1.1.1.3  mrg   % and call Plain TeX's \makeheadline and \makefootline, which use the
    349  1.1.1.3  mrg   % values in \headline and \footline.
    350  1.1.1.3  mrg   %
    351  1.1.1.3  mrg   % This is used to check if we are on the first page of a chapter.
    352  1.1.1.3  mrg   \ifcase1\topmark\fi
    353  1.1.1.3  mrg   \let\prevchaptername\thischaptername
    354  1.1.1.3  mrg   \ifcase0\firstmark\fi
    355  1.1.1.3  mrg   \let\curchaptername\thischaptername
    356      1.1  mrg   %
    357      1.1  mrg   \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
    358  1.1.1.3  mrg   \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi
    359  1.1.1.3  mrg   %
    360  1.1.1.3  mrg   \ifx\curchaptername\prevchaptername
    361  1.1.1.3  mrg     \let\thischapterheading\thischapter
    362  1.1.1.3  mrg   \else
    363  1.1.1.3  mrg     % \thischapterheading is the same as \thischapter except it is blank
    364  1.1.1.3  mrg     % for the first page of a chapter.  This is to prevent the chapter name 
    365  1.1.1.3  mrg     % being shown twice.
    366  1.1.1.3  mrg     \def\thischapterheading{}%
    367  1.1.1.3  mrg   \fi
    368  1.1.1.3  mrg   %
    369  1.1.1.3  mrg   \global\setbox\headlinebox = \vbox{\commmonheadfootline \makeheadline}%
    370      1.1  mrg   \global\setbox\footlinebox = \vbox{\commmonheadfootline \makefootline}%
    371      1.1  mrg   %
    372  1.1.1.3  mrg   {%
    373      1.1  mrg     % Set context for writing to auxiliary files like index files.
    374      1.1  mrg     % Have to do this stuff outside the \shipout because we want it to
    375      1.1  mrg     % take effect in \write's, yet the group defined by the \vbox ends
    376      1.1  mrg     % before the \shipout runs.
    377      1.1  mrg     %
    378      1.1  mrg     \indexdummies         % don't expand commands in the output.
    379      1.1  mrg     \normalturnoffactive  % \ in index entries must not stay \, e.g., if
    380      1.1  mrg                % the page break happens to be in the middle of an example.
    381  1.1.1.3  mrg                % We don't want .vr (or whatever) entries like this:
    382      1.1  mrg                % \entry{{\indexbackslash }acronym}{32}{\code {\acronym}}
    383      1.1  mrg                % "\acronym" won't work when it's read back in;
    384  1.1.1.3  mrg                % it needs to be
    385      1.1  mrg                % {\code {{\backslashcurfont }acronym}
    386      1.1  mrg     \shipout\vbox{%
    387      1.1  mrg       % Do this early so pdf references go to the beginning of the page.
    388      1.1  mrg       \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi
    389      1.1  mrg       %
    390      1.1  mrg       \ifcropmarks \vbox to \outervsize\bgroup
    391      1.1  mrg         \hsize = \outerhsize
    392      1.1  mrg         \vskip-\topandbottommargin
    393      1.1  mrg         \vtop to0pt{%
    394      1.1  mrg           \line{\ewtop\hfil\ewtop}%
    395      1.1  mrg           \nointerlineskip
    396      1.1  mrg           \line{%
    397      1.1  mrg             \vbox{\moveleft\cornerthick\nstop}%
    398      1.1  mrg             \hfill
    399      1.1  mrg             \vbox{\moveright\cornerthick\nstop}%
    400      1.1  mrg           }%
    401      1.1  mrg           \vss}%
    402      1.1  mrg         \vskip\topandbottommargin
    403      1.1  mrg         \line\bgroup
    404      1.1  mrg           \hfil % center the page within the outer (page) hsize.
    405      1.1  mrg           \ifodd\pageno\hskip\bindingoffset\fi
    406      1.1  mrg           \vbox\bgroup
    407      1.1  mrg       \fi
    408      1.1  mrg       %
    409      1.1  mrg       \unvbox\headlinebox
    410      1.1  mrg       \pagebody{#1}%
    411      1.1  mrg       \ifdim\ht\footlinebox > 0pt
    412      1.1  mrg         % Only leave this space if the footline is nonempty.
    413      1.1  mrg         % (We lessened \vsize for it in \oddfootingyyy.)
    414      1.1  mrg         % The \baselineskip=24pt in plain's \makefootline has no effect.
    415      1.1  mrg         \vskip 24pt
    416      1.1  mrg         \unvbox\footlinebox
    417      1.1  mrg       \fi
    418      1.1  mrg       %
    419      1.1  mrg       \ifcropmarks
    420      1.1  mrg           \egroup % end of \vbox\bgroup
    421      1.1  mrg         \hfil\egroup % end of (centering) \line\bgroup
    422      1.1  mrg         \vskip\topandbottommargin plus1fill minus1fill
    423      1.1  mrg         \boxmaxdepth = \cornerthick
    424      1.1  mrg         \vbox to0pt{\vss
    425      1.1  mrg           \line{%
    426      1.1  mrg             \vbox{\moveleft\cornerthick\nsbot}%
    427      1.1  mrg             \hfill
    428      1.1  mrg             \vbox{\moveright\cornerthick\nsbot}%
    429      1.1  mrg           }%
    430      1.1  mrg           \nointerlineskip
    431      1.1  mrg           \line{\ewbot\hfil\ewbot}%
    432      1.1  mrg         }%
    433      1.1  mrg       \egroup % \vbox from first cropmarks clause
    434      1.1  mrg       \fi
    435      1.1  mrg     }% end of \shipout\vbox
    436      1.1  mrg   }% end of group with \indexdummies
    437      1.1  mrg   \advancepageno
    438      1.1  mrg   \ifnum\outputpenalty>-20000 \else\dosupereject\fi
    439      1.1  mrg }
    440      1.1  mrg 
    441      1.1  mrg \newinsert\margin \dimen\margin=\maxdimen
    442  1.1.1.3  mrg 
    443  1.1.1.3  mrg % Main part of page, including any footnotes
    444      1.1  mrg \def\pagebody#1{\vbox to\txipageheight{\boxmaxdepth=\maxdepth #1}}
    445      1.1  mrg {\catcode`\@ =11
    446      1.1  mrg \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
    447      1.1  mrg % marginal hacks, juha (a] viisa.uucp (Juha Takala)
    448      1.1  mrg \ifvoid\margin\else % marginal info is present
    449      1.1  mrg   \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
    450      1.1  mrg \dimen@=\dp#1\relax \unvbox#1\relax
    451      1.1  mrg \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
    452      1.1  mrg \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
    453      1.1  mrg }
    454      1.1  mrg 
    455      1.1  mrg % Here are the rules for the cropmarks.  Note that they are
    456      1.1  mrg % offset so that the space between them is truly \outerhsize or \outervsize
    457      1.1  mrg % (P. A. MacKay, 12 November, 1986)
    458      1.1  mrg %
    459      1.1  mrg \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
    460      1.1  mrg \def\nstop{\vbox
    461      1.1  mrg   {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
    462      1.1  mrg \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
    463      1.1  mrg \def\nsbot{\vbox
    464      1.1  mrg   {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
    465  1.1.1.3  mrg 
    466  1.1.1.3  mrg 
    467  1.1.1.3  mrg % Argument parsing
    468      1.1  mrg 
    469      1.1  mrg % Parse an argument, then pass it to #1.  The argument is the rest of
    470      1.1  mrg % the input line (except we remove a trailing comment).  #1 should be a
    471  1.1.1.3  mrg % macro which expects an ordinary undelimited TeX argument.
    472      1.1  mrg % For example, \def\foo{\parsearg\fooxxx}.
    473      1.1  mrg %
    474      1.1  mrg \def\parsearg{\parseargusing{}}
    475      1.1  mrg \def\parseargusing#1#2{%
    476      1.1  mrg   \def\argtorun{#2}%
    477      1.1  mrg   \begingroup
    478      1.1  mrg     \obeylines
    479      1.1  mrg     \spaceisspace
    480      1.1  mrg     #1%
    481      1.1  mrg     \parseargline\empty% Insert the \empty token, see \finishparsearg below.
    482      1.1  mrg }
    483      1.1  mrg 
    484      1.1  mrg {\obeylines %
    485      1.1  mrg   \gdef\parseargline#1^^M{%
    486      1.1  mrg     \endgroup % End of the group started in \parsearg.
    487      1.1  mrg     \argremovecomment #1\comment\ArgTerm%
    488      1.1  mrg   }%
    489      1.1  mrg }
    490  1.1.1.3  mrg 
    491  1.1.1.3  mrg % First remove any @comment, then any @c comment.  Also remove a @texinfoc
    492      1.1  mrg % comment (see \scanmacro for details).  Pass the result on to \argcheckspaces.
    493  1.1.1.3  mrg \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
    494  1.1.1.3  mrg \def\argremovec#1\c#2\ArgTerm{\argremovetexinfoc #1\texinfoc\ArgTerm}
    495      1.1  mrg \def\argremovetexinfoc#1\texinfoc#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
    496      1.1  mrg 
    497      1.1  mrg % Each occurrence of `\^^M' or `<space>\^^M' is replaced by a single space.
    498      1.1  mrg %
    499      1.1  mrg % \argremovec might leave us with trailing space, e.g.,
    500      1.1  mrg %    @end itemize  @c foo
    501      1.1  mrg % This space token undergoes the same procedure and is eventually removed
    502      1.1  mrg % by \finishparsearg.
    503      1.1  mrg %
    504      1.1  mrg \def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M}
    505      1.1  mrg \def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M}
    506      1.1  mrg \def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{%
    507      1.1  mrg   \def\temp{#3}%
    508      1.1  mrg   \ifx\temp\empty
    509      1.1  mrg     % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp:
    510      1.1  mrg     \let\temp\finishparsearg
    511      1.1  mrg   \else
    512      1.1  mrg     \let\temp\argcheckspaces
    513      1.1  mrg   \fi
    514      1.1  mrg   % Put the space token in:
    515      1.1  mrg   \temp#1 #3\ArgTerm
    516      1.1  mrg }
    517      1.1  mrg 
    518      1.1  mrg % If a _delimited_ argument is enclosed in braces, they get stripped; so
    519      1.1  mrg % to get _exactly_ the rest of the line, we had to prevent such situation.
    520      1.1  mrg % We prepended an \empty token at the very beginning and we expand it now,
    521      1.1  mrg % just before passing the control to \argtorun.
    522      1.1  mrg % (Similarly, we have to think about #3 of \argcheckspacesY above: it is
    523      1.1  mrg % either the null string, or it ends with \^^M---thus there is no danger
    524      1.1  mrg % that a pair of braces would be stripped.
    525      1.1  mrg %
    526      1.1  mrg % But first, we have to remove the trailing space token.
    527      1.1  mrg %
    528      1.1  mrg \def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}}
    529  1.1.1.3  mrg 
    530  1.1.1.3  mrg 
    531  1.1.1.3  mrg % \parseargdef - define a command taking an argument on the line
    532      1.1  mrg %
    533      1.1  mrg % \parseargdef\foo{...}
    534      1.1  mrg %	is roughly equivalent to
    535      1.1  mrg % \def\foo{\parsearg\Xfoo}
    536      1.1  mrg % \def\Xfoo#1{...}
    537      1.1  mrg \def\parseargdef#1{%
    538      1.1  mrg   \expandafter \doparseargdef \csname\string#1\endcsname #1%
    539      1.1  mrg }
    540      1.1  mrg \def\doparseargdef#1#2{%
    541      1.1  mrg   \def#2{\parsearg#1}%
    542      1.1  mrg   \def#1##1%
    543      1.1  mrg }
    544      1.1  mrg 
    545      1.1  mrg % Several utility definitions with active space:
    546      1.1  mrg {
    547      1.1  mrg   \obeyspaces
    548      1.1  mrg   \gdef\obeyedspace{ }
    549      1.1  mrg 
    550      1.1  mrg   % Make each space character in the input produce a normal interword
    551      1.1  mrg   % space in the output.  Don't allow a line break at this space, as this
    552      1.1  mrg   % is used only in environments like @example, where each line of input
    553      1.1  mrg   % should produce a line of output anyway.
    554      1.1  mrg   %
    555      1.1  mrg   \gdef\sepspaces{\obeyspaces\let =\tie}
    556      1.1  mrg 
    557      1.1  mrg   % If an index command is used in an @example environment, any spaces
    558      1.1  mrg   % therein should become regular spaces in the raw index file, not the
    559      1.1  mrg   % expansion of \tie (\leavevmode \penalty \@M \ ).
    560      1.1  mrg   \gdef\unsepspaces{\let =\space}
    561      1.1  mrg }
    562      1.1  mrg 
    563      1.1  mrg 
    564      1.1  mrg \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
    565      1.1  mrg 
    566      1.1  mrg % Define the framework for environments in texinfo.tex.  It's used like this:
    567      1.1  mrg %
    568      1.1  mrg %   \envdef\foo{...}
    569      1.1  mrg %   \def\Efoo{...}
    570      1.1  mrg %
    571      1.1  mrg % It's the responsibility of \envdef to insert \begingroup before the
    572      1.1  mrg % actual body; @end closes the group after calling \Efoo.  \envdef also
    573      1.1  mrg % defines \thisenv, so the current environment is known; @end checks
    574      1.1  mrg % whether the environment name matches.  The \checkenv macro can also be
    575      1.1  mrg % used to check whether the current environment is the one expected.
    576      1.1  mrg %
    577      1.1  mrg % Non-false conditionals (@iftex, @ifset) don't fit into this, so they
    578      1.1  mrg % are not treated as environments; they don't open a group.  (The
    579      1.1  mrg % implementation of @end takes care not to call \endgroup in this
    580      1.1  mrg % special case.)
    581      1.1  mrg 
    582      1.1  mrg 
    583      1.1  mrg % At run-time, environments start with this:
    584      1.1  mrg \def\startenvironment#1{\begingroup\def\thisenv{#1}}
    585      1.1  mrg % initialize
    586      1.1  mrg \let\thisenv\empty
    587      1.1  mrg 
    588      1.1  mrg % ... but they get defined via ``\envdef\foo{...}'':
    589      1.1  mrg \long\def\envdef#1#2{\def#1{\startenvironment#1#2}}
    590      1.1  mrg \def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}}
    591      1.1  mrg 
    592      1.1  mrg % Check whether we're in the right environment:
    593      1.1  mrg \def\checkenv#1{%
    594      1.1  mrg   \def\temp{#1}%
    595      1.1  mrg   \ifx\thisenv\temp
    596      1.1  mrg   \else
    597      1.1  mrg     \badenverr
    598      1.1  mrg   \fi
    599      1.1  mrg }
    600      1.1  mrg 
    601      1.1  mrg % Environment mismatch, #1 expected:
    602      1.1  mrg \def\badenverr{%
    603      1.1  mrg   \errhelp = \EMsimple
    604      1.1  mrg   \errmessage{This command can appear only \inenvironment\temp,
    605      1.1  mrg     not \inenvironment\thisenv}%
    606      1.1  mrg }
    607      1.1  mrg \def\inenvironment#1{%
    608      1.1  mrg   \ifx#1\empty
    609      1.1  mrg     outside of any environment%
    610      1.1  mrg   \else
    611      1.1  mrg     in environment \expandafter\string#1%
    612      1.1  mrg   \fi
    613      1.1  mrg }
    614      1.1  mrg 
    615      1.1  mrg % @end foo executes the definition of \Efoo.
    616      1.1  mrg % But first, it executes a specialized version of \checkenv
    617      1.1  mrg %
    618      1.1  mrg \parseargdef\end{%
    619      1.1  mrg   \if 1\csname iscond.#1\endcsname
    620      1.1  mrg   \else
    621      1.1  mrg     % The general wording of \badenverr may not be ideal.
    622      1.1  mrg     \expandafter\checkenv\csname#1\endcsname
    623      1.1  mrg     \csname E#1\endcsname
    624      1.1  mrg     \endgroup
    625      1.1  mrg   \fi
    626      1.1  mrg }
    627      1.1  mrg 
    628      1.1  mrg \newhelp\EMsimple{Press RETURN to continue.}
    629      1.1  mrg 
    630      1.1  mrg 
    631      1.1  mrg % Be sure we're in horizontal mode when doing a tie, since we make space
    632      1.1  mrg % equivalent to this in @example-like environments. Otherwise, a space
    633      1.1  mrg % at the beginning of a line will start with \penalty -- and
    634      1.1  mrg % since \penalty is valid in vertical mode, we'd end up putting the
    635      1.1  mrg % penalty on the vertical list instead of in the new paragraph.
    636      1.1  mrg {\catcode`@ = 11
    637      1.1  mrg  % Avoid using \@M directly, because that causes trouble
    638      1.1  mrg  % if the definition is written into an index file.
    639      1.1  mrg  \global\let\tiepenalty = \@M
    640      1.1  mrg  \gdef\tie{\leavevmode\penalty\tiepenalty\ }
    641      1.1  mrg }
    642      1.1  mrg 
    643      1.1  mrg % @: forces normal size whitespace following.
    644      1.1  mrg \def\:{\spacefactor=1000 }
    645      1.1  mrg 
    646  1.1.1.2  mrg % @* forces a line break.
    647      1.1  mrg \def\*{\unskip\hfil\break\hbox{}\ignorespaces}
    648      1.1  mrg 
    649      1.1  mrg % @/ allows a line break.
    650      1.1  mrg \let\/=\allowbreak
    651      1.1  mrg 
    652      1.1  mrg % @. is an end-of-sentence period.
    653      1.1  mrg \def\.{.\spacefactor=\endofsentencespacefactor\space}
    654      1.1  mrg 
    655      1.1  mrg % @! is an end-of-sentence bang.
    656      1.1  mrg \def\!{!\spacefactor=\endofsentencespacefactor\space}
    657      1.1  mrg 
    658      1.1  mrg % @? is an end-of-sentence query.
    659      1.1  mrg \def\?{?\spacefactor=\endofsentencespacefactor\space}
    660      1.1  mrg 
    661      1.1  mrg % @frenchspacing on|off  says whether to put extra space after punctuation.
    662      1.1  mrg %
    663      1.1  mrg \def\onword{on}
    664      1.1  mrg \def\offword{off}
    665      1.1  mrg %
    666      1.1  mrg \parseargdef\frenchspacing{%
    667      1.1  mrg   \def\temp{#1}%
    668      1.1  mrg   \ifx\temp\onword \plainfrenchspacing
    669      1.1  mrg   \else\ifx\temp\offword \plainnonfrenchspacing
    670      1.1  mrg   \else
    671      1.1  mrg     \errhelp = \EMsimple
    672      1.1  mrg     \errmessage{Unknown @frenchspacing option `\temp', must be on|off}%
    673      1.1  mrg   \fi\fi
    674      1.1  mrg }
    675      1.1  mrg 
    676      1.1  mrg % @w prevents a word break.  Without the \leavevmode, @w at the
    677      1.1  mrg % beginning of a paragraph, when TeX is still in vertical mode, would
    678      1.1  mrg % produce a whole line of output instead of starting the paragraph.
    679      1.1  mrg \def\w#1{\leavevmode\hbox{#1}}
    680      1.1  mrg 
    681      1.1  mrg % @group ... @end group forces ... to be all on one page, by enclosing
    682      1.1  mrg % it in a TeX vbox.  We use \vtop instead of \vbox to construct the box
    683      1.1  mrg % to keep its height that of a normal line.  According to the rules for
    684      1.1  mrg % \topskip (p.114 of the TeXbook), the glue inserted is
    685      1.1  mrg % max (\topskip - \ht (first item), 0).  If that height is large,
    686      1.1  mrg % therefore, no glue is inserted, and the space between the headline and
    687      1.1  mrg % the text is small, which looks bad.
    688      1.1  mrg %
    689      1.1  mrg % Another complication is that the group might be very large.  This can
    690      1.1  mrg % cause the glue on the previous page to be unduly stretched, because it
    691      1.1  mrg % does not have much material.  In this case, it's better to add an
    692      1.1  mrg % explicit \vfill so that the extra space is at the bottom.  The
    693      1.1  mrg % threshold for doing this is if the group is more than \vfilllimit
    694      1.1  mrg % percent of a page (\vfilllimit can be changed inside of @tex).
    695      1.1  mrg %
    696      1.1  mrg \newbox\groupbox
    697      1.1  mrg \def\vfilllimit{0.7}
    698      1.1  mrg %
    699      1.1  mrg \envdef\group{%
    700      1.1  mrg   \ifnum\catcode`\^^M=\active \else
    701      1.1  mrg     \errhelp = \groupinvalidhelp
    702      1.1  mrg     \errmessage{@group invalid in context where filling is enabled}%
    703      1.1  mrg   \fi
    704      1.1  mrg   \startsavinginserts
    705      1.1  mrg   %
    706      1.1  mrg   \setbox\groupbox = \vtop\bgroup
    707      1.1  mrg     % Do @comment since we are called inside an environment such as
    708      1.1  mrg     % @example, where each end-of-line in the input causes an
    709      1.1  mrg     % end-of-line in the output.  We don't want the end-of-line after
    710      1.1  mrg     % the `@group' to put extra space in the output.  Since @group
    711      1.1  mrg     % should appear on a line by itself (according to the Texinfo
    712      1.1  mrg     % manual), we don't worry about eating any user text.
    713      1.1  mrg     \comment
    714      1.1  mrg }
    715      1.1  mrg %
    716      1.1  mrg % The \vtop produces a box with normal height and large depth; thus, TeX puts
    717      1.1  mrg % \baselineskip glue before it, and (when the next line of text is done)
    718      1.1  mrg % \lineskip glue after it.  Thus, space below is not quite equal to space
    719      1.1  mrg % above.  But it's pretty close.
    720      1.1  mrg \def\Egroup{%
    721      1.1  mrg     % To get correct interline space between the last line of the group
    722      1.1  mrg     % and the first line afterwards, we have to propagate \prevdepth.
    723      1.1  mrg     \endgraf % Not \par, as it may have been set to \lisppar.
    724      1.1  mrg     \global\dimen1 = \prevdepth
    725  1.1.1.3  mrg   \egroup           % End the \vtop.
    726  1.1.1.3  mrg   \addgroupbox
    727  1.1.1.3  mrg   \prevdepth = \dimen1
    728  1.1.1.3  mrg   \checkinserts
    729  1.1.1.3  mrg }
    730  1.1.1.3  mrg 
    731      1.1  mrg \def\addgroupbox{
    732      1.1  mrg   % \dimen0 is the vertical size of the group's box.
    733      1.1  mrg   \dimen0 = \ht\groupbox  \advance\dimen0 by \dp\groupbox
    734  1.1.1.3  mrg   % \dimen2 is how much space is left on the page (more or less).
    735      1.1  mrg   \dimen2 = \txipageheight   \advance\dimen2 by -\pagetotal
    736      1.1  mrg   % if the group doesn't fit on the current page, and it's a big big
    737      1.1  mrg   % group, force a page break.
    738  1.1.1.3  mrg   \ifdim \dimen0 > \dimen2
    739      1.1  mrg     \ifdim \pagetotal < \vfilllimit\txipageheight
    740      1.1  mrg       \page
    741      1.1  mrg     \fi
    742      1.1  mrg   \fi
    743      1.1  mrg   \box\groupbox
    744  1.1.1.3  mrg }
    745      1.1  mrg 
    746      1.1  mrg %
    747      1.1  mrg % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
    748      1.1  mrg % message, so this ends up printing `@group can only ...'.
    749      1.1  mrg %
    750      1.1  mrg \newhelp\groupinvalidhelp{%
    751      1.1  mrg group can only be used in environments such as @example,^^J%
    752      1.1  mrg where each line of input produces a line of output.}
    753      1.1  mrg 
    754      1.1  mrg % @need space-in-mils
    755      1.1  mrg % forces a page break if there is not space-in-mils remaining.
    756      1.1  mrg 
    757      1.1  mrg \newdimen\mil  \mil=0.001in
    758      1.1  mrg 
    759      1.1  mrg \parseargdef\need{%
    760      1.1  mrg   % Ensure vertical mode, so we don't make a big box in the middle of a
    761      1.1  mrg   % paragraph.
    762      1.1  mrg   \par
    763      1.1  mrg   %
    764      1.1  mrg   % If the @need value is less than one line space, it's useless.
    765      1.1  mrg   \dimen0 = #1\mil
    766      1.1  mrg   \dimen2 = \ht\strutbox
    767      1.1  mrg   \advance\dimen2 by \dp\strutbox
    768      1.1  mrg   \ifdim\dimen0 > \dimen2
    769      1.1  mrg     %
    770      1.1  mrg     % Do a \strut just to make the height of this box be normal, so the
    771      1.1  mrg     % normal leading is inserted relative to the preceding line.
    772      1.1  mrg     % And a page break here is fine.
    773      1.1  mrg     \vtop to #1\mil{\strut\vfil}%
    774      1.1  mrg     %
    775      1.1  mrg     % TeX does not even consider page breaks if a penalty added to the
    776      1.1  mrg     % main vertical list is 10000 or more.  But in order to see if the
    777      1.1  mrg     % empty box we just added fits on the page, we must make it consider
    778      1.1  mrg     % page breaks.  On the other hand, we don't want to actually break the
    779      1.1  mrg     % page after the empty box.  So we use a penalty of 9999.
    780      1.1  mrg     %
    781      1.1  mrg     % There is an extremely small chance that TeX will actually break the
    782      1.1  mrg     % page at this \penalty, if there are no other feasible breakpoints in
    783      1.1  mrg     % sight.  (If the user is using lots of big @group commands, which
    784      1.1  mrg     % almost-but-not-quite fill up a page, TeX will have a hard time doing
    785      1.1  mrg     % good page breaking, for example.)  However, I could not construct an
    786      1.1  mrg     % example where a page broke at this \penalty; if it happens in a real
    787      1.1  mrg     % document, then we can reconsider our strategy.
    788      1.1  mrg     \penalty9999
    789      1.1  mrg     %
    790      1.1  mrg     % Back up by the size of the box, whether we did a page break or not.
    791      1.1  mrg     \kern -#1\mil
    792      1.1  mrg     %
    793      1.1  mrg     % Do not allow a page break right after this kern.
    794      1.1  mrg     \nobreak
    795      1.1  mrg   \fi
    796      1.1  mrg }
    797      1.1  mrg 
    798      1.1  mrg % @br   forces paragraph break (and is undocumented).
    799      1.1  mrg 
    800      1.1  mrg \let\br = \par
    801      1.1  mrg 
    802      1.1  mrg % @page forces the start of a new page.
    803      1.1  mrg %
    804      1.1  mrg \def\page{\par\vfill\supereject}
    805      1.1  mrg 
    806      1.1  mrg % @exdent text....
    807      1.1  mrg % outputs text on separate line in roman font, starting at standard page margin
    808      1.1  mrg 
    809      1.1  mrg % This records the amount of indent in the innermost environment.
    810      1.1  mrg % That's how much \exdent should take out.
    811      1.1  mrg \newskip\exdentamount
    812      1.1  mrg 
    813      1.1  mrg % This defn is used inside fill environments such as @defun.
    814      1.1  mrg \parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}
    815      1.1  mrg 
    816      1.1  mrg % This defn is used inside nofill environments such as @example.
    817      1.1  mrg \parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount
    818      1.1  mrg   \leftline{\hskip\leftskip{\rm#1}}}}
    819      1.1  mrg 
    820      1.1  mrg % @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
    821      1.1  mrg % paragraph.  For more general purposes, use the \margin insertion
    822      1.1  mrg % class.  WHICH is `l' or `r'.  Not documented, written for gawk manual.
    823      1.1  mrg %
    824      1.1  mrg \newskip\inmarginspacing \inmarginspacing=1cm
    825      1.1  mrg \def\strutdepth{\dp\strutbox}
    826      1.1  mrg %
    827      1.1  mrg \def\doinmargin#1#2{\strut\vadjust{%
    828      1.1  mrg   \nobreak
    829      1.1  mrg   \kern-\strutdepth
    830      1.1  mrg   \vtop to \strutdepth{%
    831      1.1  mrg     \baselineskip=\strutdepth
    832      1.1  mrg     \vss
    833      1.1  mrg     % if you have multiple lines of stuff to put here, you'll need to
    834      1.1  mrg     % make the vbox yourself of the appropriate size.
    835      1.1  mrg     \ifx#1l%
    836      1.1  mrg       \llap{\ignorespaces #2\hskip\inmarginspacing}%
    837      1.1  mrg     \else
    838      1.1  mrg       \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
    839      1.1  mrg     \fi
    840      1.1  mrg     \null
    841      1.1  mrg   }%
    842      1.1  mrg }}
    843      1.1  mrg \def\inleftmargin{\doinmargin l}
    844      1.1  mrg \def\inrightmargin{\doinmargin r}
    845      1.1  mrg %
    846      1.1  mrg % @inmargin{TEXT [, RIGHT-TEXT]}
    847      1.1  mrg % (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
    848      1.1  mrg % else use TEXT for both).
    849      1.1  mrg %
    850      1.1  mrg \def\inmargin#1{\parseinmargin #1,,\finish}
    851      1.1  mrg \def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
    852      1.1  mrg   \setbox0 = \hbox{\ignorespaces #2}%
    853      1.1  mrg   \ifdim\wd0 > 0pt
    854      1.1  mrg     \def\lefttext{#1}%  have both texts
    855      1.1  mrg     \def\righttext{#2}%
    856      1.1  mrg   \else
    857      1.1  mrg     \def\lefttext{#1}%  have only one text
    858      1.1  mrg     \def\righttext{#1}%
    859      1.1  mrg   \fi
    860      1.1  mrg   %
    861      1.1  mrg   \ifodd\pageno
    862      1.1  mrg     \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
    863      1.1  mrg   \else
    864      1.1  mrg     \def\temp{\inleftmargin\lefttext}%
    865      1.1  mrg   \fi
    866      1.1  mrg   \temp
    867      1.1  mrg }
    868      1.1  mrg 
    869      1.1  mrg % @include FILE -- \input text of FILE.
    870      1.1  mrg %
    871      1.1  mrg \def\include{\parseargusing\filenamecatcodes\includezzz}
    872      1.1  mrg \def\includezzz#1{%
    873      1.1  mrg   \pushthisfilestack
    874      1.1  mrg   \def\thisfile{#1}%
    875      1.1  mrg   {%
    876      1.1  mrg     \makevalueexpandable  % we want to expand any @value in FILE.
    877      1.1  mrg     \turnoffactive        % and allow special characters in the expansion
    878      1.1  mrg     \indexnofonts         % Allow `@@' and other weird things in file names.
    879      1.1  mrg     \wlog{texinfo.tex: doing @include of #1^^J}%
    880      1.1  mrg     \edef\temp{\noexpand\input #1 }%
    881      1.1  mrg     %
    882      1.1  mrg     % This trickery is to read FILE outside of a group, in case it makes
    883      1.1  mrg     % definitions, etc.
    884      1.1  mrg     \expandafter
    885      1.1  mrg   }\temp
    886      1.1  mrg   \popthisfilestack
    887      1.1  mrg }
    888      1.1  mrg \def\filenamecatcodes{%
    889      1.1  mrg   \catcode`\\=\other
    890      1.1  mrg   \catcode`~=\other
    891      1.1  mrg   \catcode`^=\other
    892      1.1  mrg   \catcode`_=\other
    893      1.1  mrg   \catcode`|=\other
    894      1.1  mrg   \catcode`<=\other
    895      1.1  mrg   \catcode`>=\other
    896      1.1  mrg   \catcode`+=\other
    897      1.1  mrg   \catcode`-=\other
    898      1.1  mrg   \catcode`\`=\other
    899      1.1  mrg   \catcode`\'=\other
    900      1.1  mrg }
    901      1.1  mrg 
    902      1.1  mrg \def\pushthisfilestack{%
    903      1.1  mrg   \expandafter\pushthisfilestackX\popthisfilestack\StackTerm
    904      1.1  mrg }
    905      1.1  mrg \def\pushthisfilestackX{%
    906      1.1  mrg   \expandafter\pushthisfilestackY\thisfile\StackTerm
    907      1.1  mrg }
    908      1.1  mrg \def\pushthisfilestackY #1\StackTerm #2\StackTerm {%
    909      1.1  mrg   \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}%
    910      1.1  mrg }
    911      1.1  mrg 
    912      1.1  mrg \def\popthisfilestack{\errthisfilestackempty}
    913      1.1  mrg \def\errthisfilestackempty{\errmessage{Internal error:
    914      1.1  mrg   the stack of filenames is empty.}}
    915      1.1  mrg %
    916      1.1  mrg \def\thisfile{}
    917      1.1  mrg 
    918      1.1  mrg % @center line
    919      1.1  mrg % outputs that line, centered.
    920      1.1  mrg %
    921      1.1  mrg \parseargdef\center{%
    922      1.1  mrg   \ifhmode
    923      1.1  mrg     \let\centersub\centerH
    924      1.1  mrg   \else
    925      1.1  mrg     \let\centersub\centerV
    926      1.1  mrg   \fi
    927      1.1  mrg   \centersub{\hfil \ignorespaces#1\unskip \hfil}%
    928      1.1  mrg   \let\centersub\relax % don't let the definition persist, just in case
    929      1.1  mrg }
    930      1.1  mrg \def\centerH#1{{%
    931      1.1  mrg   \hfil\break
    932      1.1  mrg   \advance\hsize by -\leftskip
    933      1.1  mrg   \advance\hsize by -\rightskip
    934      1.1  mrg   \line{#1}%
    935      1.1  mrg   \break
    936      1.1  mrg }}
    937      1.1  mrg %
    938      1.1  mrg \newcount\centerpenalty
    939      1.1  mrg \def\centerV#1{%
    940      1.1  mrg   % The idea here is the same as in \startdefun, \cartouche, etc.: if
    941      1.1  mrg   % @center is the first thing after a section heading, we need to wipe
    942      1.1  mrg   % out the negative parskip inserted by \sectionheading, but still
    943      1.1  mrg   % prevent a page break here.
    944      1.1  mrg   \centerpenalty = \lastpenalty
    945      1.1  mrg   \ifnum\centerpenalty>10000 \vskip\parskip \fi
    946      1.1  mrg   \ifnum\centerpenalty>9999 \penalty\centerpenalty \fi
    947      1.1  mrg   \line{\kern\leftskip #1\kern\rightskip}%
    948      1.1  mrg }
    949      1.1  mrg 
    950      1.1  mrg % @sp n   outputs n lines of vertical space
    951      1.1  mrg %
    952      1.1  mrg \parseargdef\sp{\vskip #1\baselineskip}
    953      1.1  mrg 
    954      1.1  mrg % @comment ...line which is ignored...
    955      1.1  mrg % @c is the same as @comment
    956  1.1.1.3  mrg % @ignore ... @end ignore  is another way to write a comment
    957  1.1.1.3  mrg 
    958  1.1.1.3  mrg 
    959      1.1  mrg \def\c{\begingroup \catcode`\^^M=\active%
    960  1.1.1.3  mrg \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
    961  1.1.1.3  mrg \cxxx}
    962      1.1  mrg {\catcode`\^^M=\active \gdef\cxxx#1^^M{\endgroup}}
    963  1.1.1.3  mrg %
    964      1.1  mrg \let\comment\c
    965      1.1  mrg 
    966      1.1  mrg % @paragraphindent NCHARS
    967      1.1  mrg % We'll use ems for NCHARS, close enough.
    968      1.1  mrg % NCHARS can also be the word `asis' or `none'.
    969      1.1  mrg % We cannot feasibly implement @paragraphindent asis, though.
    970      1.1  mrg %
    971      1.1  mrg \def\asisword{asis} % no translation, these are keywords
    972      1.1  mrg \def\noneword{none}
    973      1.1  mrg %
    974      1.1  mrg \parseargdef\paragraphindent{%
    975      1.1  mrg   \def\temp{#1}%
    976      1.1  mrg   \ifx\temp\asisword
    977      1.1  mrg   \else
    978      1.1  mrg     \ifx\temp\noneword
    979      1.1  mrg       \defaultparindent = 0pt
    980      1.1  mrg     \else
    981      1.1  mrg       \defaultparindent = #1em
    982      1.1  mrg     \fi
    983      1.1  mrg   \fi
    984      1.1  mrg   \parindent = \defaultparindent
    985      1.1  mrg }
    986      1.1  mrg 
    987      1.1  mrg % @exampleindent NCHARS
    988      1.1  mrg % We'll use ems for NCHARS like @paragraphindent.
    989      1.1  mrg % It seems @exampleindent asis isn't necessary, but
    990      1.1  mrg % I preserve it to make it similar to @paragraphindent.
    991      1.1  mrg \parseargdef\exampleindent{%
    992      1.1  mrg   \def\temp{#1}%
    993      1.1  mrg   \ifx\temp\asisword
    994      1.1  mrg   \else
    995      1.1  mrg     \ifx\temp\noneword
    996      1.1  mrg       \lispnarrowing = 0pt
    997      1.1  mrg     \else
    998      1.1  mrg       \lispnarrowing = #1em
    999      1.1  mrg     \fi
   1000      1.1  mrg   \fi
   1001      1.1  mrg }
   1002      1.1  mrg 
   1003      1.1  mrg % @firstparagraphindent WORD
   1004      1.1  mrg % If WORD is `none', then suppress indentation of the first paragraph
   1005      1.1  mrg % after a section heading.  If WORD is `insert', then do indent at such
   1006      1.1  mrg % paragraphs.
   1007      1.1  mrg %
   1008      1.1  mrg % The paragraph indentation is suppressed or not by calling
   1009      1.1  mrg % \suppressfirstparagraphindent, which the sectioning commands do.
   1010      1.1  mrg % We switch the definition of this back and forth according to WORD.
   1011      1.1  mrg % By default, we suppress indentation.
   1012      1.1  mrg %
   1013      1.1  mrg \def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
   1014      1.1  mrg \def\insertword{insert}
   1015      1.1  mrg %
   1016      1.1  mrg \parseargdef\firstparagraphindent{%
   1017      1.1  mrg   \def\temp{#1}%
   1018      1.1  mrg   \ifx\temp\noneword
   1019      1.1  mrg     \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
   1020      1.1  mrg   \else\ifx\temp\insertword
   1021      1.1  mrg     \let\suppressfirstparagraphindent = \relax
   1022      1.1  mrg   \else
   1023      1.1  mrg     \errhelp = \EMsimple
   1024      1.1  mrg     \errmessage{Unknown @firstparagraphindent option `\temp'}%
   1025      1.1  mrg   \fi\fi
   1026      1.1  mrg }
   1027      1.1  mrg 
   1028      1.1  mrg % Here is how we actually suppress indentation.  Redefine \everypar to
   1029      1.1  mrg % \kern backwards by \parindent, and then reset itself to empty.
   1030      1.1  mrg %
   1031      1.1  mrg % We also make \indent itself not actually do anything until the next
   1032      1.1  mrg % paragraph.
   1033      1.1  mrg %
   1034  1.1.1.3  mrg \gdef\dosuppressfirstparagraphindent{%
   1035  1.1.1.3  mrg   \gdef\indent  {\restorefirstparagraphindent \indent}%
   1036  1.1.1.3  mrg   \gdef\noindent{\restorefirstparagraphindent \noindent}%
   1037      1.1  mrg   \global\everypar = {\kern -\parindent \restorefirstparagraphindent}%
   1038  1.1.1.3  mrg }
   1039      1.1  mrg %
   1040  1.1.1.3  mrg \gdef\restorefirstparagraphindent{%
   1041  1.1.1.3  mrg   \global\let\indent = \ptexindent
   1042  1.1.1.3  mrg   \global\let\noindent = \ptexnoindent
   1043      1.1  mrg   \global\everypar = {}%
   1044      1.1  mrg }
   1045      1.1  mrg 
   1046      1.1  mrg 
   1047      1.1  mrg % @refill is a no-op.
   1048      1.1  mrg \let\refill=\relax
   1049  1.1.1.3  mrg 
   1050  1.1.1.3  mrg % @setfilename INFO-FILENAME - ignored
   1051      1.1  mrg \let\setfilename=\comment
   1052      1.1  mrg 
   1053      1.1  mrg % @bye.
   1054      1.1  mrg \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
   1055      1.1  mrg 
   1056      1.1  mrg 
   1057      1.1  mrg \message{pdf,}
   1058      1.1  mrg % adobe `portable' document format
   1059      1.1  mrg \newcount\tempnum
   1060      1.1  mrg \newcount\lnkcount
   1061      1.1  mrg \newtoks\filename
   1062      1.1  mrg \newcount\filenamelength
   1063      1.1  mrg \newcount\pgn
   1064      1.1  mrg \newtoks\toksA
   1065      1.1  mrg \newtoks\toksB
   1066      1.1  mrg \newtoks\toksC
   1067      1.1  mrg \newtoks\toksD
   1068  1.1.1.3  mrg \newbox\boxA
   1069      1.1  mrg \newbox\boxB
   1070      1.1  mrg \newcount\countA
   1071      1.1  mrg \newif\ifpdf
   1072      1.1  mrg \newif\ifpdfmakepagedest
   1073  1.1.1.3  mrg 
   1074  1.1.1.3  mrg %
   1075  1.1.1.3  mrg % For LuaTeX
   1076  1.1.1.3  mrg %
   1077  1.1.1.3  mrg 
   1078  1.1.1.3  mrg \newif\iftxiuseunicodedestname
   1079  1.1.1.3  mrg \txiuseunicodedestnamefalse % For pdfTeX etc.
   1080  1.1.1.3  mrg 
   1081  1.1.1.3  mrg \ifx\luatexversion\thisisundefined
   1082  1.1.1.3  mrg \else
   1083  1.1.1.3  mrg   % Use Unicode destination names
   1084  1.1.1.3  mrg   \txiuseunicodedestnametrue
   1085  1.1.1.3  mrg   % Escape PDF strings with converting UTF-16 from UTF-8
   1086  1.1.1.3  mrg   \begingroup
   1087  1.1.1.3  mrg     \catcode`\%=12
   1088  1.1.1.3  mrg     \directlua{
   1089  1.1.1.3  mrg       function UTF16oct(str)
   1090  1.1.1.3  mrg         tex.sprint(string.char(0x5c) .. '376' .. string.char(0x5c) .. '377')
   1091  1.1.1.3  mrg         for c in string.utfvalues(str) do
   1092  1.1.1.3  mrg           if c < 0x10000 then
   1093  1.1.1.3  mrg             tex.sprint(
   1094  1.1.1.3  mrg               string.format(string.char(0x5c) .. string.char(0x25) .. '03o' ..
   1095  1.1.1.3  mrg                             string.char(0x5c) .. string.char(0x25) .. '03o',
   1096  1.1.1.3  mrg                             (c / 256), (c % 256)))
   1097  1.1.1.3  mrg           else
   1098  1.1.1.3  mrg             c = c - 0x10000
   1099  1.1.1.3  mrg             local c_hi = c / 1024 + 0xd800
   1100  1.1.1.3  mrg             local c_lo = c % 1024 + 0xdc00
   1101  1.1.1.3  mrg             tex.sprint(
   1102  1.1.1.3  mrg               string.format(string.char(0x5c) .. string.char(0x25) .. '03o' ..
   1103  1.1.1.3  mrg                             string.char(0x5c) .. string.char(0x25) .. '03o' ..
   1104  1.1.1.3  mrg                             string.char(0x5c) .. string.char(0x25) .. '03o' ..
   1105  1.1.1.3  mrg                             string.char(0x5c) .. string.char(0x25) .. '03o',
   1106  1.1.1.3  mrg                             (c_hi / 256), (c_hi % 256),
   1107  1.1.1.3  mrg                             (c_lo / 256), (c_lo % 256)))
   1108  1.1.1.3  mrg           end
   1109  1.1.1.3  mrg         end
   1110  1.1.1.3  mrg       end
   1111  1.1.1.3  mrg     }
   1112  1.1.1.3  mrg   \endgroup
   1113  1.1.1.3  mrg   \def\pdfescapestrutfsixteen#1{\directlua{UTF16oct('\luaescapestring{#1}')}}
   1114  1.1.1.3  mrg   % Escape PDF strings without converting
   1115  1.1.1.3  mrg   \begingroup
   1116  1.1.1.3  mrg     \directlua{
   1117  1.1.1.3  mrg       function PDFescstr(str)
   1118  1.1.1.3  mrg         for c in string.bytes(str) do
   1119  1.1.1.3  mrg           if c <= 0x20 or c >= 0x80 or c == 0x28 or c == 0x29 or c == 0x5c then
   1120  1.1.1.3  mrg             tex.sprint(
   1121  1.1.1.3  mrg               string.format(string.char(0x5c) .. string.char(0x25) .. '03o',
   1122  1.1.1.3  mrg                             c))
   1123  1.1.1.3  mrg           else
   1124  1.1.1.3  mrg             tex.sprint(string.char(c))
   1125  1.1.1.3  mrg           end
   1126  1.1.1.3  mrg         end
   1127  1.1.1.3  mrg       end
   1128  1.1.1.3  mrg     }
   1129  1.1.1.3  mrg   \endgroup
   1130  1.1.1.3  mrg   \def\pdfescapestring#1{\directlua{PDFescstr('\luaescapestring{#1}')}}
   1131  1.1.1.3  mrg   \ifnum\luatexversion>84
   1132  1.1.1.3  mrg     % For LuaTeX >= 0.85
   1133  1.1.1.3  mrg     \def\pdfdest{\pdfextension dest}
   1134  1.1.1.3  mrg     \let\pdfoutput\outputmode
   1135  1.1.1.3  mrg     \def\pdfliteral{\pdfextension literal}
   1136  1.1.1.3  mrg     \def\pdfcatalog{\pdfextension catalog}
   1137  1.1.1.3  mrg     \def\pdftexversion{\numexpr\pdffeedback version\relax}
   1138  1.1.1.3  mrg     \let\pdfximage\saveimageresource
   1139  1.1.1.3  mrg     \let\pdfrefximage\useimageresource
   1140  1.1.1.3  mrg     \let\pdflastximage\lastsavedimageresourceindex
   1141  1.1.1.3  mrg     \def\pdfendlink{\pdfextension endlink\relax}
   1142  1.1.1.3  mrg     \def\pdfoutline{\pdfextension outline}
   1143  1.1.1.3  mrg     \def\pdfstartlink{\pdfextension startlink}
   1144  1.1.1.3  mrg     \def\pdffontattr{\pdfextension fontattr}
   1145  1.1.1.3  mrg     \def\pdfobj{\pdfextension obj}
   1146  1.1.1.3  mrg     \def\pdflastobj{\numexpr\pdffeedback lastobj\relax}
   1147  1.1.1.3  mrg     \let\pdfpagewidth\pagewidth
   1148  1.1.1.3  mrg     \let\pdfpageheight\pageheight
   1149  1.1.1.3  mrg     \edef\pdfhorigin{\pdfvariable horigin}
   1150  1.1.1.3  mrg     \edef\pdfvorigin{\pdfvariable vorigin}
   1151  1.1.1.3  mrg   \fi
   1152  1.1.1.3  mrg \fi
   1153      1.1  mrg 
   1154      1.1  mrg % when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
   1155      1.1  mrg % can be set).  So we test for \relax and 0 as well as being undefined.
   1156      1.1  mrg \ifx\pdfoutput\thisisundefined
   1157      1.1  mrg \else
   1158      1.1  mrg   \ifx\pdfoutput\relax
   1159      1.1  mrg   \else
   1160      1.1  mrg     \ifcase\pdfoutput
   1161      1.1  mrg     \else
   1162      1.1  mrg       \pdftrue
   1163      1.1  mrg     \fi
   1164      1.1  mrg   \fi
   1165      1.1  mrg \fi
   1166      1.1  mrg 
   1167      1.1  mrg % PDF uses PostScript string constants for the names of xref targets,
   1168      1.1  mrg % for display in the outlines, and in other places.  Thus, we have to
   1169      1.1  mrg % double any backslashes.  Otherwise, a name like "\node" will be
   1170      1.1  mrg % interpreted as a newline (\n), followed by o, d, e.  Not good.
   1171      1.1  mrg % 
   1172      1.1  mrg % See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and
   1173      1.1  mrg % related messages.  The final outcome is that it is up to the TeX user
   1174      1.1  mrg % to double the backslashes and otherwise make the string valid, so
   1175      1.1  mrg % that's what we do.  pdftex 1.30.0 (ca.2005) introduced a primitive to
   1176      1.1  mrg % do this reliably, so we use it.
   1177      1.1  mrg 
   1178      1.1  mrg % #1 is a control sequence in which to do the replacements,
   1179      1.1  mrg % which we \xdef.
   1180  1.1.1.2  mrg \def\txiescapepdf#1{%
   1181      1.1  mrg   \ifx\pdfescapestring\thisisundefined
   1182      1.1  mrg     % No primitive available; should we give a warning or log?
   1183  1.1.1.3  mrg     % Many times it won't matter.
   1184      1.1  mrg     \xdef#1{#1}%
   1185      1.1  mrg   \else
   1186      1.1  mrg     % The expandable \pdfescapestring primitive escapes parentheses,
   1187      1.1  mrg     % backslashes, and other special chars.
   1188      1.1  mrg     \xdef#1{\pdfescapestring{#1}}%
   1189      1.1  mrg   \fi
   1190  1.1.1.3  mrg }
   1191  1.1.1.3  mrg \def\txiescapepdfutfsixteen#1{%
   1192  1.1.1.3  mrg   \ifx\pdfescapestrutfsixteen\thisisundefined
   1193  1.1.1.3  mrg     % No UTF-16 converting macro available.
   1194  1.1.1.3  mrg     \txiescapepdf{#1}%
   1195  1.1.1.3  mrg   \else
   1196  1.1.1.3  mrg     \xdef#1{\pdfescapestrutfsixteen{#1}}%
   1197  1.1.1.3  mrg   \fi
   1198      1.1  mrg }
   1199      1.1  mrg 
   1200      1.1  mrg \newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images
   1201      1.1  mrg with PDF output, and none of those formats could be found.  (.eps cannot
   1202      1.1  mrg be supported due to the design of the PDF format; use regular TeX (DVI
   1203      1.1  mrg output) for that.)}
   1204      1.1  mrg 
   1205      1.1  mrg \ifpdf
   1206  1.1.1.3  mrg   %
   1207      1.1  mrg   % Color manipulation macros using ideas from pdfcolor.tex,
   1208      1.1  mrg   % except using rgb instead of cmyk; the latter is said to render as a
   1209  1.1.1.3  mrg   % very dark gray on-screen and a very dark halftone in print, instead
   1210  1.1.1.3  mrg   % of actual black. The dark red here is dark enough to print on paper as
   1211  1.1.1.3  mrg   % nearly black, but still distinguishable for online viewing.  We use
   1212      1.1  mrg   % black by default, though.
   1213      1.1  mrg   \def\rgbDarkRed{0.50 0.09 0.12}
   1214      1.1  mrg   \def\rgbBlack{0 0 0}
   1215  1.1.1.3  mrg   %
   1216  1.1.1.3  mrg   % rg sets the color for filling (usual text, etc.);
   1217      1.1  mrg   % RG sets the color for stroking (thin rules, e.g., normal _'s).
   1218      1.1  mrg   \def\pdfsetcolor#1{\pdfliteral{#1 rg  #1 RG}}
   1219      1.1  mrg   %
   1220      1.1  mrg   % Set color, and create a mark which defines \thiscolor accordingly,
   1221      1.1  mrg   % so that \makeheadline knows which color to restore.
   1222      1.1  mrg   \def\setcolor#1{%
   1223      1.1  mrg     \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}%
   1224      1.1  mrg     \domark
   1225      1.1  mrg     \pdfsetcolor{#1}%
   1226      1.1  mrg   }
   1227      1.1  mrg   %
   1228      1.1  mrg   \def\maincolor{\rgbBlack}
   1229      1.1  mrg   \pdfsetcolor{\maincolor}
   1230      1.1  mrg   \edef\thiscolor{\maincolor}
   1231      1.1  mrg   \def\lastcolordefs{}
   1232      1.1  mrg   %
   1233      1.1  mrg   \def\makefootline{%
   1234      1.1  mrg     \baselineskip24pt
   1235      1.1  mrg     \line{\pdfsetcolor{\maincolor}\the\footline}%
   1236      1.1  mrg   }
   1237      1.1  mrg   %
   1238      1.1  mrg   \def\makeheadline{%
   1239      1.1  mrg     \vbox to 0pt{%
   1240      1.1  mrg       \vskip-22.5pt
   1241      1.1  mrg       \line{%
   1242      1.1  mrg         \vbox to8.5pt{}%
   1243      1.1  mrg         % Extract \thiscolor definition from the marks.
   1244      1.1  mrg         \getcolormarks
   1245      1.1  mrg         % Typeset the headline with \maincolor, then restore the color.
   1246      1.1  mrg         \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
   1247      1.1  mrg       }%
   1248      1.1  mrg       \vss
   1249      1.1  mrg     }%
   1250      1.1  mrg     \nointerlineskip
   1251      1.1  mrg   }
   1252      1.1  mrg   %
   1253      1.1  mrg   %
   1254      1.1  mrg   \pdfcatalog{/PageMode /UseOutlines}
   1255      1.1  mrg   %
   1256      1.1  mrg   % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
   1257      1.1  mrg   \def\dopdfimage#1#2#3{%
   1258      1.1  mrg     \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
   1259      1.1  mrg     \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
   1260      1.1  mrg     %
   1261      1.1  mrg     % pdftex (and the PDF format) support .pdf, .png, .jpg (among
   1262      1.1  mrg     % others).  Let's try in that order, PDF first since if
   1263      1.1  mrg     % someone has a scalable image, presumably better to use that than a
   1264      1.1  mrg     % bitmap.
   1265      1.1  mrg     \let\pdfimgext=\empty
   1266      1.1  mrg     \begingroup
   1267      1.1  mrg       \openin 1 #1.pdf \ifeof 1
   1268      1.1  mrg         \openin 1 #1.PDF \ifeof 1
   1269      1.1  mrg           \openin 1 #1.png \ifeof 1
   1270      1.1  mrg             \openin 1 #1.jpg \ifeof 1
   1271      1.1  mrg               \openin 1 #1.jpeg \ifeof 1
   1272      1.1  mrg                 \openin 1 #1.JPG \ifeof 1
   1273      1.1  mrg                   \errhelp = \nopdfimagehelp
   1274      1.1  mrg                   \errmessage{Could not find image file #1 for pdf}%
   1275      1.1  mrg                 \else \gdef\pdfimgext{JPG}%
   1276      1.1  mrg                 \fi
   1277      1.1  mrg               \else \gdef\pdfimgext{jpeg}%
   1278      1.1  mrg               \fi
   1279      1.1  mrg             \else \gdef\pdfimgext{jpg}%
   1280      1.1  mrg             \fi
   1281      1.1  mrg           \else \gdef\pdfimgext{png}%
   1282      1.1  mrg           \fi
   1283      1.1  mrg         \else \gdef\pdfimgext{PDF}%
   1284      1.1  mrg         \fi
   1285      1.1  mrg       \else \gdef\pdfimgext{pdf}%
   1286      1.1  mrg       \fi
   1287      1.1  mrg       \closein 1
   1288      1.1  mrg     \endgroup
   1289      1.1  mrg     %
   1290      1.1  mrg     % without \immediate, ancient pdftex seg faults when the same image is
   1291      1.1  mrg     % included twice.  (Version 3.14159-pre-1.0-unofficial-20010704.)
   1292      1.1  mrg     \ifnum\pdftexversion < 14
   1293      1.1  mrg       \immediate\pdfimage
   1294      1.1  mrg     \else
   1295      1.1  mrg       \immediate\pdfximage
   1296      1.1  mrg     \fi
   1297      1.1  mrg       \ifdim \wd0 >0pt width \pdfimagewidth \fi
   1298      1.1  mrg       \ifdim \wd2 >0pt height \pdfimageheight \fi
   1299      1.1  mrg       \ifnum\pdftexversion<13
   1300      1.1  mrg          #1.\pdfimgext
   1301      1.1  mrg        \else
   1302      1.1  mrg          {#1.\pdfimgext}%
   1303      1.1  mrg        \fi
   1304      1.1  mrg     \ifnum\pdftexversion < 14 \else
   1305      1.1  mrg       \pdfrefximage \pdflastximage
   1306      1.1  mrg     \fi}
   1307  1.1.1.3  mrg   %
   1308      1.1  mrg   \def\setpdfdestname#1{{%
   1309      1.1  mrg     % We have to set dummies so commands such as @code, and characters
   1310      1.1  mrg     % such as \, aren't expanded when present in a section title.
   1311      1.1  mrg     \indexnofonts
   1312  1.1.1.3  mrg     \makevalueexpandable
   1313  1.1.1.3  mrg     \turnoffactive
   1314  1.1.1.3  mrg     \iftxiuseunicodedestname
   1315  1.1.1.3  mrg       \ifx \declaredencoding \latone
   1316  1.1.1.3  mrg         % Pass through Latin-1 characters.
   1317  1.1.1.3  mrg         % LuaTeX with byte wise I/O converts Latin-1 characters to Unicode.
   1318  1.1.1.3  mrg       \else
   1319  1.1.1.3  mrg         \ifx \declaredencoding \utfeight
   1320  1.1.1.3  mrg           % Pass through Unicode characters.
   1321  1.1.1.3  mrg         \else
   1322  1.1.1.3  mrg           % Use ASCII approximations in destination names.
   1323  1.1.1.3  mrg           \passthroughcharsfalse
   1324  1.1.1.3  mrg         \fi
   1325  1.1.1.3  mrg       \fi
   1326  1.1.1.3  mrg     \else
   1327  1.1.1.3  mrg       % Use ASCII approximations in destination names.
   1328  1.1.1.3  mrg       \passthroughcharsfalse
   1329      1.1  mrg     \fi
   1330      1.1  mrg     \def\pdfdestname{#1}%
   1331      1.1  mrg     \txiescapepdf\pdfdestname
   1332      1.1  mrg   }}
   1333  1.1.1.3  mrg   %
   1334  1.1.1.3  mrg   \def\setpdfoutlinetext#1{{%
   1335  1.1.1.3  mrg     \indexnofonts
   1336  1.1.1.3  mrg     \makevalueexpandable
   1337  1.1.1.3  mrg     \turnoffactive
   1338  1.1.1.3  mrg     \ifx \declaredencoding \latone
   1339  1.1.1.3  mrg       % The PDF format can use an extended form of Latin-1 in bookmark
   1340  1.1.1.3  mrg       % strings.  See Appendix D of the PDF Reference, Sixth Edition, for
   1341  1.1.1.3  mrg       % the "PDFDocEncoding".
   1342  1.1.1.3  mrg       \passthroughcharstrue
   1343  1.1.1.3  mrg       % Pass through Latin-1 characters.
   1344  1.1.1.3  mrg       %   LuaTeX: Convert to Unicode
   1345  1.1.1.3  mrg       %   pdfTeX: Use Latin-1 as PDFDocEncoding
   1346  1.1.1.3  mrg       \def\pdfoutlinetext{#1}%
   1347  1.1.1.3  mrg     \else
   1348  1.1.1.3  mrg       \ifx \declaredencoding \utfeight
   1349  1.1.1.3  mrg         \ifx\luatexversion\thisisundefined
   1350  1.1.1.3  mrg           % For pdfTeX  with UTF-8.
   1351  1.1.1.3  mrg           % TODO: the PDF format can use UTF-16 in bookmark strings,
   1352  1.1.1.3  mrg           % but the code for this isn't done yet.
   1353  1.1.1.3  mrg           % Use ASCII approximations.
   1354  1.1.1.3  mrg           \passthroughcharsfalse
   1355  1.1.1.3  mrg           \def\pdfoutlinetext{#1}%
   1356  1.1.1.3  mrg         \else
   1357  1.1.1.3  mrg           % For LuaTeX with UTF-8.
   1358  1.1.1.3  mrg           % Pass through Unicode characters for title texts.
   1359  1.1.1.3  mrg           \passthroughcharstrue
   1360  1.1.1.3  mrg           \def\pdfoutlinetext{#1}%
   1361  1.1.1.3  mrg         \fi
   1362  1.1.1.3  mrg       \else
   1363  1.1.1.3  mrg         % For non-Latin-1 or non-UTF-8 encodings.
   1364  1.1.1.3  mrg         % Use ASCII approximations.
   1365  1.1.1.3  mrg         \passthroughcharsfalse
   1366  1.1.1.3  mrg         \def\pdfoutlinetext{#1}%
   1367  1.1.1.3  mrg       \fi
   1368  1.1.1.3  mrg     \fi
   1369  1.1.1.3  mrg     % LuaTeX: Convert to UTF-16
   1370  1.1.1.3  mrg     % pdfTeX: Use Latin-1 as PDFDocEncoding
   1371  1.1.1.3  mrg     \txiescapepdfutfsixteen\pdfoutlinetext
   1372  1.1.1.3  mrg   }}
   1373  1.1.1.3  mrg   %
   1374  1.1.1.3  mrg   \def\pdfmkdest#1{%
   1375  1.1.1.3  mrg     \setpdfdestname{#1}%
   1376  1.1.1.3  mrg     \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
   1377  1.1.1.3  mrg   }
   1378      1.1  mrg   %
   1379      1.1  mrg   % used to mark target names; must be expandable.
   1380      1.1  mrg   \def\pdfmkpgn#1{#1}
   1381  1.1.1.3  mrg   %
   1382  1.1.1.3  mrg   % by default, use black for everything.
   1383  1.1.1.3  mrg   \def\urlcolor{\rgbBlack}
   1384      1.1  mrg   \def\linkcolor{\rgbBlack}
   1385      1.1  mrg   \def\endlink{\setcolor{\maincolor}\pdfendlink}
   1386      1.1  mrg   %
   1387      1.1  mrg   % Adding outlines to PDF; macros for calculating structure of outlines
   1388      1.1  mrg   % come from Petr Olsak
   1389      1.1  mrg   \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
   1390      1.1  mrg     \else \csname#1\endcsname \fi}
   1391      1.1  mrg   \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
   1392      1.1  mrg     \advance\tempnum by 1
   1393      1.1  mrg     \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
   1394      1.1  mrg   %
   1395      1.1  mrg   % #1 is the section text, which is what will be displayed in the
   1396      1.1  mrg   % outline by the pdf viewer.  #2 is the pdf expression for the number
   1397      1.1  mrg   % of subentries (or empty, for subsubsections).  #3 is the node text,
   1398      1.1  mrg   % which might be empty if this toc entry had no corresponding node.
   1399      1.1  mrg   % #4 is the page number
   1400      1.1  mrg   %
   1401      1.1  mrg   \def\dopdfoutline#1#2#3#4{%
   1402      1.1  mrg     % Generate a link to the node text if that exists; else, use the
   1403      1.1  mrg     % page number.  We could generate a destination for the section
   1404      1.1  mrg     % text in the case where a section has no node, but it doesn't
   1405  1.1.1.3  mrg     % seem worth the trouble, since most documents are normally structured.
   1406  1.1.1.3  mrg     \setpdfoutlinetext{#1}
   1407  1.1.1.3  mrg     \setpdfdestname{#3}
   1408  1.1.1.3  mrg     \ifx\pdfdestname\empty
   1409      1.1  mrg       \def\pdfdestname{#4}%
   1410      1.1  mrg     \fi
   1411  1.1.1.3  mrg     %
   1412      1.1  mrg     \pdfoutline goto name{\pdfmkpgn{\pdfdestname}}#2{\pdfoutlinetext}%
   1413      1.1  mrg   }
   1414      1.1  mrg   %
   1415      1.1  mrg   \def\pdfmakeoutlines{%
   1416      1.1  mrg     \begingroup
   1417      1.1  mrg       % Read toc silently, to get counts of subentries for \pdfoutline.
   1418      1.1  mrg       \def\partentry##1##2##3##4{}% ignore parts in the outlines
   1419      1.1  mrg       \def\numchapentry##1##2##3##4{%
   1420      1.1  mrg 	\def\thischapnum{##2}%
   1421      1.1  mrg 	\def\thissecnum{0}%
   1422      1.1  mrg 	\def\thissubsecnum{0}%
   1423      1.1  mrg       }%
   1424      1.1  mrg       \def\numsecentry##1##2##3##4{%
   1425      1.1  mrg 	\advancenumber{chap\thischapnum}%
   1426      1.1  mrg 	\def\thissecnum{##2}%
   1427      1.1  mrg 	\def\thissubsecnum{0}%
   1428      1.1  mrg       }%
   1429      1.1  mrg       \def\numsubsecentry##1##2##3##4{%
   1430      1.1  mrg 	\advancenumber{sec\thissecnum}%
   1431      1.1  mrg 	\def\thissubsecnum{##2}%
   1432      1.1  mrg       }%
   1433      1.1  mrg       \def\numsubsubsecentry##1##2##3##4{%
   1434      1.1  mrg 	\advancenumber{subsec\thissubsecnum}%
   1435      1.1  mrg       }%
   1436      1.1  mrg       \def\thischapnum{0}%
   1437      1.1  mrg       \def\thissecnum{0}%
   1438      1.1  mrg       \def\thissubsecnum{0}%
   1439      1.1  mrg       %
   1440      1.1  mrg       % use \def rather than \let here because we redefine \chapentry et
   1441      1.1  mrg       % al. a second time, below.
   1442      1.1  mrg       \def\appentry{\numchapentry}%
   1443      1.1  mrg       \def\appsecentry{\numsecentry}%
   1444      1.1  mrg       \def\appsubsecentry{\numsubsecentry}%
   1445      1.1  mrg       \def\appsubsubsecentry{\numsubsubsecentry}%
   1446      1.1  mrg       \def\unnchapentry{\numchapentry}%
   1447      1.1  mrg       \def\unnsecentry{\numsecentry}%
   1448      1.1  mrg       \def\unnsubsecentry{\numsubsecentry}%
   1449      1.1  mrg       \def\unnsubsubsecentry{\numsubsubsecentry}%
   1450      1.1  mrg       \readdatafile{toc}%
   1451      1.1  mrg       %
   1452      1.1  mrg       % Read toc second time, this time actually producing the outlines.
   1453      1.1  mrg       % The `-' means take the \expnumber as the absolute number of
   1454      1.1  mrg       % subentries, which we calculated on our first read of the .toc above.
   1455      1.1  mrg       %
   1456      1.1  mrg       % We use the node names as the destinations.
   1457      1.1  mrg       \def\numchapentry##1##2##3##4{%
   1458      1.1  mrg         \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}%
   1459      1.1  mrg       \def\numsecentry##1##2##3##4{%
   1460      1.1  mrg         \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}%
   1461      1.1  mrg       \def\numsubsecentry##1##2##3##4{%
   1462      1.1  mrg         \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}%
   1463      1.1  mrg       \def\numsubsubsecentry##1##2##3##4{% count is always zero
   1464      1.1  mrg         \dopdfoutline{##1}{}{##3}{##4}}%
   1465      1.1  mrg       %
   1466      1.1  mrg       % PDF outlines are displayed using system fonts, instead of
   1467      1.1  mrg       % document fonts.  Therefore we cannot use special characters,
   1468      1.1  mrg       % since the encoding is unknown.  For example, the eogonek from
   1469      1.1  mrg       % Latin 2 (0xea) gets translated to a | character.  Info from
   1470      1.1  mrg       % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
   1471      1.1  mrg       %
   1472      1.1  mrg       % TODO this right, we have to translate 8-bit characters to
   1473      1.1  mrg       % their "best" equivalent, based on the @documentencoding.  Too
   1474      1.1  mrg       % much work for too little return.  Just use the ASCII equivalents
   1475      1.1  mrg       % we use for the index sort strings.
   1476      1.1  mrg       % 
   1477      1.1  mrg       \indexnofonts
   1478      1.1  mrg       \setupdatafile
   1479      1.1  mrg       % We can have normal brace characters in the PDF outlines, unlike
   1480      1.1  mrg       % Texinfo index files.  So set that up.
   1481      1.1  mrg       \def\{{\lbracecharliteral}%
   1482      1.1  mrg       \def\}{\rbracecharliteral}%
   1483      1.1  mrg       \catcode`\\=\active \otherbackslash
   1484      1.1  mrg       \input \tocreadfilename
   1485      1.1  mrg     \endgroup
   1486      1.1  mrg   }
   1487      1.1  mrg   {\catcode`[=1 \catcode`]=2
   1488      1.1  mrg    \catcode`{=\other \catcode`}=\other
   1489      1.1  mrg    \gdef\lbracecharliteral[{]%
   1490      1.1  mrg    \gdef\rbracecharliteral[}]%
   1491      1.1  mrg   ]
   1492      1.1  mrg   %
   1493      1.1  mrg   \def\skipspaces#1{\def\PP{#1}\def\D{|}%
   1494      1.1  mrg     \ifx\PP\D\let\nextsp\relax
   1495  1.1.1.2  mrg     \else\let\nextsp\skipspaces
   1496  1.1.1.2  mrg       \addtokens{\filename}{\PP}%
   1497      1.1  mrg       \advance\filenamelength by 1
   1498      1.1  mrg     \fi
   1499      1.1  mrg     \nextsp}
   1500      1.1  mrg   \def\getfilename#1{%
   1501      1.1  mrg     \filenamelength=0
   1502      1.1  mrg     % If we don't expand the argument now, \skipspaces will get
   1503      1.1  mrg     % snagged on things like "@value{foo}".
   1504      1.1  mrg     \edef\temp{#1}%
   1505      1.1  mrg     \expandafter\skipspaces\temp|\relax
   1506      1.1  mrg   }
   1507      1.1  mrg   \ifnum\pdftexversion < 14
   1508      1.1  mrg     \let \startlink \pdfannotlink
   1509      1.1  mrg   \else
   1510      1.1  mrg     \let \startlink \pdfstartlink
   1511      1.1  mrg   \fi
   1512      1.1  mrg   % make a live url in pdf output.
   1513      1.1  mrg   \def\pdfurl#1{%
   1514      1.1  mrg     \begingroup
   1515      1.1  mrg       % it seems we really need yet another set of dummies; have not
   1516      1.1  mrg       % tried to figure out what each command should do in the context
   1517      1.1  mrg       % of @url.  for now, just make @/ a no-op, that's the only one
   1518      1.1  mrg       % people have actually reported a problem with.
   1519      1.1  mrg       %
   1520      1.1  mrg       \normalturnoffactive
   1521      1.1  mrg       \def\@{@}%
   1522      1.1  mrg       \let\/=\empty
   1523      1.1  mrg       \makevalueexpandable
   1524      1.1  mrg       % do we want to go so far as to use \indexnofonts instead of just
   1525      1.1  mrg       % special-casing \var here?
   1526      1.1  mrg       \def\var##1{##1}%
   1527      1.1  mrg       %
   1528      1.1  mrg       \leavevmode\setcolor{\urlcolor}%
   1529      1.1  mrg       \startlink attr{/Border [0 0 0]}%
   1530      1.1  mrg         user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
   1531      1.1  mrg     \endgroup}
   1532      1.1  mrg   \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
   1533      1.1  mrg   \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
   1534      1.1  mrg   \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
   1535      1.1  mrg   \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
   1536      1.1  mrg   \def\maketoks{%
   1537      1.1  mrg     \expandafter\poptoks\the\toksA|ENDTOKS|\relax
   1538      1.1  mrg     \ifx\first0\adn0
   1539      1.1  mrg     \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
   1540      1.1  mrg     \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
   1541      1.1  mrg     \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
   1542      1.1  mrg     \else
   1543      1.1  mrg       \ifnum0=\countA\else\makelink\fi
   1544      1.1  mrg       \ifx\first.\let\next=\done\else
   1545      1.1  mrg         \let\next=\maketoks
   1546      1.1  mrg         \addtokens{\toksB}{\the\toksD}
   1547      1.1  mrg         \ifx\first,\addtokens{\toksB}{\space}\fi
   1548      1.1  mrg       \fi
   1549      1.1  mrg     \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
   1550      1.1  mrg     \next}
   1551      1.1  mrg   \def\makelink{\addtokens{\toksB}%
   1552      1.1  mrg     {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
   1553      1.1  mrg   \def\pdflink#1{%
   1554      1.1  mrg     \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
   1555      1.1  mrg     \setcolor{\linkcolor}#1\endlink}
   1556      1.1  mrg   \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
   1557      1.1  mrg \else
   1558      1.1  mrg   % non-pdf mode
   1559      1.1  mrg   \let\pdfmkdest = \gobble
   1560      1.1  mrg   \let\pdfurl = \gobble
   1561      1.1  mrg   \let\endlink = \relax
   1562      1.1  mrg   \let\setcolor = \gobble
   1563      1.1  mrg   \let\pdfsetcolor = \gobble
   1564      1.1  mrg   \let\pdfmakeoutlines = \relax
   1565      1.1  mrg \fi  % \ifx\pdfoutput
   1566      1.1  mrg 
   1567  1.1.1.3  mrg %
   1568      1.1  mrg % For XeTeX
   1569  1.1.1.3  mrg %
   1570  1.1.1.3  mrg \ifx\XeTeXrevision\thisisundefined
   1571  1.1.1.3  mrg \else
   1572  1.1.1.3  mrg   %
   1573  1.1.1.3  mrg   % XeTeX version check
   1574  1.1.1.3  mrg   %
   1575  1.1.1.3  mrg   \ifnum\strcmp{\the\XeTeXversion\XeTeXrevision}{0.99996}>-1
   1576  1.1.1.3  mrg     % TeX Live 2016 contains XeTeX 0.99996 and xdvipdfmx 20160307.
   1577  1.1.1.3  mrg     % It can use the `dvipdfmx:config' special (from TeX Live SVN r40941).
   1578  1.1.1.3  mrg     % For avoiding PDF destination name replacement, we use this special
   1579  1.1.1.3  mrg     % instead of xdvipdfmx's command line option `-C 0x0010'.
   1580  1.1.1.3  mrg     \special{dvipdfmx:config C 0x0010}
   1581  1.1.1.3  mrg     % XeTeX 0.99995+ comes with xdvipdfmx 20160307+.
   1582  1.1.1.3  mrg     % It can handle Unicode destination names for PDF.
   1583  1.1.1.3  mrg     \txiuseunicodedestnametrue
   1584  1.1.1.3  mrg   \else
   1585  1.1.1.3  mrg     % XeTeX < 0.99996 (TeX Live < 2016) cannot use the
   1586  1.1.1.3  mrg     % `dvipdfmx:config' special.
   1587  1.1.1.3  mrg     % So for avoiding PDF destination name replacement,
   1588  1.1.1.3  mrg     % xdvipdfmx's command line option `-C 0x0010' is necessary.
   1589  1.1.1.3  mrg     %
   1590  1.1.1.3  mrg     % XeTeX < 0.99995 can not handle Unicode destination names for PDF
   1591  1.1.1.3  mrg     % because xdvipdfmx 20150315 has a UTF-16 conversion issue.
   1592  1.1.1.3  mrg     % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753).
   1593  1.1.1.3  mrg     \txiuseunicodedestnamefalse
   1594  1.1.1.3  mrg   \fi
   1595  1.1.1.3  mrg   %
   1596  1.1.1.3  mrg   % Color support
   1597  1.1.1.3  mrg   %
   1598  1.1.1.3  mrg   \def\rgbDarkRed{0.50 0.09 0.12}
   1599  1.1.1.3  mrg   \def\rgbBlack{0 0 0}
   1600  1.1.1.3  mrg   %
   1601  1.1.1.3  mrg   \def\pdfsetcolor#1{\special{pdf:scolor [#1]}}
   1602  1.1.1.3  mrg   %
   1603  1.1.1.3  mrg   % Set color, and create a mark which defines \thiscolor accordingly,
   1604  1.1.1.3  mrg   % so that \makeheadline knows which color to restore.
   1605  1.1.1.3  mrg   \def\setcolor#1{%
   1606  1.1.1.3  mrg     \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}%
   1607  1.1.1.3  mrg     \domark
   1608  1.1.1.3  mrg     \pdfsetcolor{#1}%
   1609  1.1.1.3  mrg   }
   1610  1.1.1.3  mrg   %
   1611  1.1.1.3  mrg   \def\maincolor{\rgbBlack}
   1612  1.1.1.3  mrg   \pdfsetcolor{\maincolor}
   1613  1.1.1.3  mrg   \edef\thiscolor{\maincolor}
   1614  1.1.1.3  mrg   \def\lastcolordefs{}
   1615  1.1.1.3  mrg   %
   1616  1.1.1.3  mrg   \def\makefootline{%
   1617  1.1.1.3  mrg     \baselineskip24pt
   1618  1.1.1.3  mrg     \line{\pdfsetcolor{\maincolor}\the\footline}%
   1619  1.1.1.3  mrg   }
   1620  1.1.1.3  mrg   %
   1621  1.1.1.3  mrg   \def\makeheadline{%
   1622  1.1.1.3  mrg     \vbox to 0pt{%
   1623  1.1.1.3  mrg       \vskip-22.5pt
   1624  1.1.1.3  mrg       \line{%
   1625  1.1.1.3  mrg         \vbox to8.5pt{}%
   1626  1.1.1.3  mrg         % Extract \thiscolor definition from the marks.
   1627  1.1.1.3  mrg         \getcolormarks
   1628  1.1.1.3  mrg         % Typeset the headline with \maincolor, then restore the color.
   1629  1.1.1.3  mrg         \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
   1630  1.1.1.3  mrg       }%
   1631  1.1.1.3  mrg       \vss
   1632  1.1.1.3  mrg     }%
   1633  1.1.1.3  mrg     \nointerlineskip
   1634  1.1.1.3  mrg   }
   1635  1.1.1.3  mrg   %
   1636  1.1.1.3  mrg   % PDF outline support
   1637  1.1.1.3  mrg   %
   1638  1.1.1.3  mrg   % Emulate pdfTeX primitive
   1639  1.1.1.3  mrg   \def\pdfdest name#1 xyz{%
   1640  1.1.1.3  mrg     \special{pdf:dest (#1) [@thispage /XYZ @xpos @ypos null]}%
   1641  1.1.1.3  mrg   }
   1642  1.1.1.3  mrg   %
   1643  1.1.1.3  mrg   \def\setpdfdestname#1{{%
   1644  1.1.1.3  mrg     % We have to set dummies so commands such as @code, and characters
   1645  1.1.1.3  mrg     % such as \, aren't expanded when present in a section title.
   1646  1.1.1.3  mrg     \indexnofonts
   1647  1.1.1.3  mrg     \makevalueexpandable
   1648  1.1.1.3  mrg     \turnoffactive
   1649  1.1.1.3  mrg     \iftxiuseunicodedestname
   1650  1.1.1.3  mrg       % Pass through Unicode characters.
   1651  1.1.1.3  mrg     \else
   1652  1.1.1.3  mrg       % Use ASCII approximations in destination names.
   1653  1.1.1.3  mrg       \passthroughcharsfalse
   1654  1.1.1.3  mrg     \fi
   1655  1.1.1.3  mrg     \def\pdfdestname{#1}%
   1656  1.1.1.3  mrg     \txiescapepdf\pdfdestname
   1657  1.1.1.3  mrg   }}
   1658  1.1.1.3  mrg   %
   1659  1.1.1.3  mrg   \def\setpdfoutlinetext#1{{%
   1660  1.1.1.3  mrg     \turnoffactive
   1661  1.1.1.3  mrg     % Always use Unicode characters in title texts.
   1662  1.1.1.3  mrg     \def\pdfoutlinetext{#1}%
   1663  1.1.1.3  mrg     % For XeTeX, xdvipdfmx converts to UTF-16.
   1664  1.1.1.3  mrg     % So we do not convert.
   1665  1.1.1.3  mrg     \txiescapepdf\pdfoutlinetext
   1666  1.1.1.3  mrg   }}
   1667  1.1.1.3  mrg   %
   1668  1.1.1.3  mrg   \def\pdfmkdest#1{%
   1669  1.1.1.3  mrg     \setpdfdestname{#1}%
   1670  1.1.1.3  mrg     \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
   1671  1.1.1.3  mrg   }
   1672  1.1.1.3  mrg   %
   1673  1.1.1.3  mrg   % by default, use black for everything.
   1674  1.1.1.3  mrg   \def\urlcolor{\rgbBlack}
   1675  1.1.1.3  mrg   \def\linkcolor{\rgbBlack}
   1676  1.1.1.3  mrg   \def\endlink{\setcolor{\maincolor}\pdfendlink}
   1677  1.1.1.3  mrg   %
   1678  1.1.1.3  mrg   \def\dopdfoutline#1#2#3#4{%
   1679  1.1.1.3  mrg     \setpdfoutlinetext{#1}
   1680  1.1.1.3  mrg     \setpdfdestname{#3}
   1681  1.1.1.3  mrg     \ifx\pdfdestname\empty
   1682  1.1.1.3  mrg       \def\pdfdestname{#4}%
   1683  1.1.1.3  mrg     \fi
   1684  1.1.1.3  mrg     %
   1685  1.1.1.3  mrg     \special{pdf:out [-] #2 << /Title (\pdfoutlinetext) /A
   1686  1.1.1.3  mrg       << /S /GoTo /D (\pdfdestname) >> >> }%
   1687  1.1.1.3  mrg   }
   1688  1.1.1.3  mrg   %
   1689  1.1.1.3  mrg   \def\pdfmakeoutlines{%
   1690  1.1.1.3  mrg     \begingroup
   1691  1.1.1.3  mrg       %
   1692  1.1.1.3  mrg       % For XeTeX, counts of subentries are not necessary.
   1693  1.1.1.3  mrg       % Therefore, we read toc only once.
   1694  1.1.1.3  mrg       %
   1695  1.1.1.3  mrg       % We use node names as destinations.
   1696  1.1.1.3  mrg       \def\partentry##1##2##3##4{}% ignore parts in the outlines
   1697  1.1.1.3  mrg       \def\numchapentry##1##2##3##4{%
   1698  1.1.1.3  mrg         \dopdfoutline{##1}{1}{##3}{##4}}%
   1699  1.1.1.3  mrg       \def\numsecentry##1##2##3##4{%
   1700  1.1.1.3  mrg         \dopdfoutline{##1}{2}{##3}{##4}}%
   1701  1.1.1.3  mrg       \def\numsubsecentry##1##2##3##4{%
   1702  1.1.1.3  mrg         \dopdfoutline{##1}{3}{##3}{##4}}%
   1703  1.1.1.3  mrg       \def\numsubsubsecentry##1##2##3##4{%
   1704  1.1.1.3  mrg         \dopdfoutline{##1}{4}{##3}{##4}}%
   1705  1.1.1.3  mrg       %
   1706  1.1.1.3  mrg       \let\appentry\numchapentry%
   1707  1.1.1.3  mrg       \let\appsecentry\numsecentry%
   1708  1.1.1.3  mrg       \let\appsubsecentry\numsubsecentry%
   1709  1.1.1.3  mrg       \let\appsubsubsecentry\numsubsubsecentry%
   1710  1.1.1.3  mrg       \let\unnchapentry\numchapentry%
   1711  1.1.1.3  mrg       \let\unnsecentry\numsecentry%
   1712  1.1.1.3  mrg       \let\unnsubsecentry\numsubsecentry%
   1713  1.1.1.3  mrg       \let\unnsubsubsecentry\numsubsubsecentry%
   1714  1.1.1.3  mrg       %
   1715  1.1.1.3  mrg       % For XeTeX, xdvipdfmx converts strings to UTF-16.
   1716  1.1.1.3  mrg       % Therefore, the encoding and the language may not be considered.
   1717  1.1.1.3  mrg       %
   1718  1.1.1.3  mrg       \indexnofonts
   1719  1.1.1.3  mrg       \setupdatafile
   1720  1.1.1.3  mrg       % We can have normal brace characters in the PDF outlines, unlike
   1721  1.1.1.3  mrg       % Texinfo index files.  So set that up.
   1722  1.1.1.3  mrg       \def\{{\lbracecharliteral}%
   1723  1.1.1.3  mrg       \def\}{\rbracecharliteral}%
   1724  1.1.1.3  mrg       \catcode`\\=\active \otherbackslash
   1725  1.1.1.3  mrg       \input \tocreadfilename
   1726  1.1.1.3  mrg     \endgroup
   1727  1.1.1.3  mrg   }
   1728  1.1.1.3  mrg   {\catcode`[=1 \catcode`]=2
   1729  1.1.1.3  mrg    \catcode`{=\other \catcode`}=\other
   1730  1.1.1.3  mrg    \gdef\lbracecharliteral[{]%
   1731  1.1.1.3  mrg    \gdef\rbracecharliteral[}]%
   1732      1.1  mrg   ]
   1733  1.1.1.3  mrg 
   1734  1.1.1.3  mrg   \special{pdf:docview << /PageMode /UseOutlines >> }
   1735  1.1.1.3  mrg   % ``\special{pdf:tounicode ...}'' is not necessary
   1736  1.1.1.3  mrg   % because xdvipdfmx converts strings from UTF-8 to UTF-16 without it.
   1737  1.1.1.3  mrg   % However, due to a UTF-16 conversion issue of xdvipdfmx 20150315,
   1738  1.1.1.3  mrg   % ``\special{pdf:dest ...}'' cannot handle non-ASCII strings.
   1739  1.1.1.3  mrg   % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753).
   1740  1.1.1.3  mrg %
   1741  1.1.1.3  mrg   \def\skipspaces#1{\def\PP{#1}\def\D{|}%
   1742  1.1.1.3  mrg     \ifx\PP\D\let\nextsp\relax
   1743  1.1.1.3  mrg     \else\let\nextsp\skipspaces
   1744  1.1.1.3  mrg       \addtokens{\filename}{\PP}%
   1745  1.1.1.3  mrg       \advance\filenamelength by 1
   1746  1.1.1.3  mrg     \fi
   1747  1.1.1.3  mrg     \nextsp}
   1748  1.1.1.3  mrg   \def\getfilename#1{%
   1749  1.1.1.3  mrg     \filenamelength=0
   1750  1.1.1.3  mrg     % If we don't expand the argument now, \skipspaces will get
   1751  1.1.1.3  mrg     % snagged on things like "@value{foo}".
   1752  1.1.1.3  mrg     \edef\temp{#1}%
   1753  1.1.1.3  mrg     \expandafter\skipspaces\temp|\relax
   1754  1.1.1.3  mrg   }
   1755  1.1.1.3  mrg   % make a live url in pdf output.
   1756  1.1.1.3  mrg   \def\pdfurl#1{%
   1757  1.1.1.3  mrg     \begingroup
   1758  1.1.1.3  mrg       % it seems we really need yet another set of dummies; have not
   1759  1.1.1.3  mrg       % tried to figure out what each command should do in the context
   1760  1.1.1.3  mrg       % of @url.  for now, just make @/ a no-op, that's the only one
   1761  1.1.1.3  mrg       % people have actually reported a problem with.
   1762  1.1.1.3  mrg       %
   1763  1.1.1.3  mrg       \normalturnoffactive
   1764  1.1.1.3  mrg       \def\@{@}%
   1765  1.1.1.3  mrg       \let\/=\empty
   1766  1.1.1.3  mrg       \makevalueexpandable
   1767  1.1.1.3  mrg       % do we want to go so far as to use \indexnofonts instead of just
   1768  1.1.1.3  mrg       % special-casing \var here?
   1769  1.1.1.3  mrg       \def\var##1{##1}%
   1770  1.1.1.3  mrg       %
   1771  1.1.1.3  mrg       \leavevmode\setcolor{\urlcolor}%
   1772  1.1.1.3  mrg       \special{pdf:bann << /Border [0 0 0]
   1773  1.1.1.3  mrg         /Subtype /Link /A << /S /URI /URI (#1) >> >>}%
   1774  1.1.1.3  mrg     \endgroup}
   1775  1.1.1.3  mrg   \def\endlink{\setcolor{\maincolor}\special{pdf:eann}}
   1776  1.1.1.3  mrg   \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
   1777  1.1.1.3  mrg   \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
   1778  1.1.1.3  mrg   \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
   1779  1.1.1.3  mrg   \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
   1780  1.1.1.3  mrg   \def\maketoks{%
   1781  1.1.1.3  mrg     \expandafter\poptoks\the\toksA|ENDTOKS|\relax
   1782  1.1.1.3  mrg     \ifx\first0\adn0
   1783  1.1.1.3  mrg     \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
   1784  1.1.1.3  mrg     \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
   1785  1.1.1.3  mrg     \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
   1786  1.1.1.3  mrg     \else
   1787  1.1.1.3  mrg       \ifnum0=\countA\else\makelink\fi
   1788  1.1.1.3  mrg       \ifx\first.\let\next=\done\else
   1789  1.1.1.3  mrg         \let\next=\maketoks
   1790  1.1.1.3  mrg         \addtokens{\toksB}{\the\toksD}
   1791  1.1.1.3  mrg         \ifx\first,\addtokens{\toksB}{\space}\fi
   1792  1.1.1.3  mrg       \fi
   1793  1.1.1.3  mrg     \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
   1794  1.1.1.3  mrg     \next}
   1795  1.1.1.3  mrg   \def\makelink{\addtokens{\toksB}%
   1796  1.1.1.3  mrg     {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
   1797  1.1.1.3  mrg   \def\pdflink#1{%
   1798  1.1.1.3  mrg     \special{pdf:bann << /Border [0 0 0]
   1799  1.1.1.3  mrg       /Type /Annot /Subtype /Link /A << /S /GoTo /D (#1) >> >>}%
   1800  1.1.1.3  mrg     \setcolor{\linkcolor}#1\endlink}
   1801  1.1.1.3  mrg   \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
   1802  1.1.1.3  mrg %
   1803  1.1.1.3  mrg   %
   1804  1.1.1.3  mrg   % @image support
   1805  1.1.1.3  mrg   %
   1806  1.1.1.3  mrg   % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
   1807  1.1.1.3  mrg   \def\doxeteximage#1#2#3{%
   1808  1.1.1.3  mrg     \def\xeteximagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
   1809  1.1.1.3  mrg     \def\xeteximageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
   1810  1.1.1.3  mrg     %
   1811  1.1.1.3  mrg     % XeTeX (and the PDF format) supports .pdf, .png, .jpg (among
   1812  1.1.1.3  mrg     % others).  Let's try in that order, PDF first since if
   1813  1.1.1.3  mrg     % someone has a scalable image, presumably better to use that than a
   1814  1.1.1.3  mrg     % bitmap.
   1815  1.1.1.3  mrg     \let\xeteximgext=\empty
   1816  1.1.1.3  mrg     \begingroup
   1817  1.1.1.3  mrg       \openin 1 #1.pdf \ifeof 1
   1818  1.1.1.3  mrg         \openin 1 #1.PDF \ifeof 1
   1819  1.1.1.3  mrg           \openin 1 #1.png \ifeof 1
   1820  1.1.1.3  mrg             \openin 1 #1.jpg \ifeof 1
   1821  1.1.1.3  mrg               \openin 1 #1.jpeg \ifeof 1
   1822  1.1.1.3  mrg                 \openin 1 #1.JPG \ifeof 1
   1823  1.1.1.3  mrg                   \errmessage{Could not find image file #1 for XeTeX}%
   1824  1.1.1.3  mrg                 \else \gdef\xeteximgext{JPG}%
   1825  1.1.1.3  mrg                 \fi
   1826  1.1.1.3  mrg               \else \gdef\xeteximgext{jpeg}%
   1827  1.1.1.3  mrg               \fi
   1828  1.1.1.3  mrg             \else \gdef\xeteximgext{jpg}%
   1829  1.1.1.3  mrg             \fi
   1830  1.1.1.3  mrg           \else \gdef\xeteximgext{png}%
   1831  1.1.1.3  mrg           \fi
   1832  1.1.1.3  mrg         \else \gdef\xeteximgext{PDF}%
   1833  1.1.1.3  mrg         \fi
   1834  1.1.1.3  mrg       \else \gdef\xeteximgext{pdf}%
   1835  1.1.1.3  mrg       \fi
   1836  1.1.1.3  mrg       \closein 1
   1837  1.1.1.3  mrg     \endgroup
   1838  1.1.1.3  mrg     %
   1839  1.1.1.3  mrg     \def\xetexpdfext{pdf}%
   1840  1.1.1.3  mrg     \ifx\xeteximgext\xetexpdfext
   1841  1.1.1.3  mrg       \XeTeXpdffile "#1".\xeteximgext ""
   1842  1.1.1.3  mrg     \else
   1843  1.1.1.3  mrg       \def\xetexpdfext{PDF}%
   1844  1.1.1.3  mrg       \ifx\xeteximgext\xetexpdfext
   1845  1.1.1.3  mrg         \XeTeXpdffile "#1".\xeteximgext ""
   1846  1.1.1.3  mrg       \else
   1847  1.1.1.3  mrg         \XeTeXpicfile "#1".\xeteximgext ""
   1848  1.1.1.3  mrg       \fi
   1849  1.1.1.3  mrg     \fi
   1850  1.1.1.3  mrg     \ifdim \wd0 >0pt width \xeteximagewidth \fi
   1851  1.1.1.3  mrg     \ifdim \wd2 >0pt height \xeteximageheight \fi \relax
   1852  1.1.1.3  mrg   }
   1853      1.1  mrg \fi
   1854      1.1  mrg 
   1855  1.1.1.3  mrg 
   1856  1.1.1.3  mrg %
   1857      1.1  mrg \message{fonts,}
   1858      1.1  mrg 
   1859      1.1  mrg % Set the baselineskip to #1, and the lineskip and strut size
   1860      1.1  mrg % correspondingly.  There is no deep meaning behind these magic numbers
   1861      1.1  mrg % used as factors; they just match (closely enough) what Knuth defined.
   1862      1.1  mrg %
   1863      1.1  mrg \def\lineskipfactor{.08333}
   1864      1.1  mrg \def\strutheightpercent{.70833}
   1865      1.1  mrg \def\strutdepthpercent {.29167}
   1866      1.1  mrg %
   1867      1.1  mrg % can get a sort of poor man's double spacing by redefining this.
   1868      1.1  mrg \def\baselinefactor{1}
   1869  1.1.1.2  mrg %
   1870      1.1  mrg \newdimen\textleading
   1871      1.1  mrg \def\setleading#1{%
   1872      1.1  mrg   \dimen0 = #1\relax
   1873      1.1  mrg   \normalbaselineskip = \baselinefactor\dimen0
   1874      1.1  mrg   \normallineskip = \lineskipfactor\normalbaselineskip
   1875      1.1  mrg   \normalbaselines
   1876      1.1  mrg   \setbox\strutbox =\hbox{%
   1877      1.1  mrg     \vrule width0pt height\strutheightpercent\baselineskip
   1878      1.1  mrg                     depth \strutdepthpercent \baselineskip
   1879      1.1  mrg   }%
   1880      1.1  mrg }
   1881      1.1  mrg 
   1882      1.1  mrg % PDF CMaps.  See also LaTeX's t1.cmap.
   1883      1.1  mrg %
   1884      1.1  mrg % do nothing with this by default.
   1885      1.1  mrg \expandafter\let\csname cmapOT1\endcsname\gobble
   1886      1.1  mrg \expandafter\let\csname cmapOT1IT\endcsname\gobble
   1887      1.1  mrg \expandafter\let\csname cmapOT1TT\endcsname\gobble
   1888      1.1  mrg 
   1889      1.1  mrg % if we are producing pdf, and we have \pdffontattr, then define cmaps.
   1890      1.1  mrg % (\pdffontattr was introduced many years ago, but people still run
   1891      1.1  mrg % older pdftex's; it's easy to conditionalize, so we do.)
   1892      1.1  mrg \ifpdf \ifx\pdffontattr\thisisundefined \else
   1893      1.1  mrg   \begingroup
   1894      1.1  mrg     \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
   1895      1.1  mrg     \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
   1896      1.1  mrg %%DocumentNeededResources: ProcSet (CIDInit)
   1897      1.1  mrg %%IncludeResource: ProcSet (CIDInit)
   1898      1.1  mrg %%BeginResource: CMap (TeX-OT1-0)
   1899      1.1  mrg %%Title: (TeX-OT1-0 TeX OT1 0)
   1900      1.1  mrg %%Version: 1.000
   1901      1.1  mrg %%EndComments
   1902      1.1  mrg /CIDInit /ProcSet findresource begin
   1903      1.1  mrg 12 dict begin
   1904      1.1  mrg begincmap
   1905      1.1  mrg /CIDSystemInfo
   1906      1.1  mrg << /Registry (TeX)
   1907      1.1  mrg /Ordering (OT1)
   1908      1.1  mrg /Supplement 0
   1909      1.1  mrg >> def
   1910      1.1  mrg /CMapName /TeX-OT1-0 def
   1911      1.1  mrg /CMapType 2 def
   1912      1.1  mrg 1 begincodespacerange
   1913      1.1  mrg <00> <7F>
   1914      1.1  mrg endcodespacerange
   1915      1.1  mrg 8 beginbfrange
   1916      1.1  mrg <00> <01> <0393>
   1917      1.1  mrg <09> <0A> <03A8>
   1918      1.1  mrg <23> <26> <0023>
   1919      1.1  mrg <28> <3B> <0028>
   1920      1.1  mrg <3F> <5B> <003F>
   1921      1.1  mrg <5D> <5E> <005D>
   1922      1.1  mrg <61> <7A> <0061>
   1923      1.1  mrg <7B> <7C> <2013>
   1924      1.1  mrg endbfrange
   1925      1.1  mrg 40 beginbfchar
   1926      1.1  mrg <02> <0398>
   1927      1.1  mrg <03> <039B>
   1928      1.1  mrg <04> <039E>
   1929      1.1  mrg <05> <03A0>
   1930      1.1  mrg <06> <03A3>
   1931      1.1  mrg <07> <03D2>
   1932      1.1  mrg <08> <03A6>
   1933      1.1  mrg <0B> <00660066>
   1934      1.1  mrg <0C> <00660069>
   1935      1.1  mrg <0D> <0066006C>
   1936      1.1  mrg <0E> <006600660069>
   1937      1.1  mrg <0F> <00660066006C>
   1938      1.1  mrg <10> <0131>
   1939      1.1  mrg <11> <0237>
   1940      1.1  mrg <12> <0060>
   1941      1.1  mrg <13> <00B4>
   1942      1.1  mrg <14> <02C7>
   1943      1.1  mrg <15> <02D8>
   1944      1.1  mrg <16> <00AF>
   1945      1.1  mrg <17> <02DA>
   1946      1.1  mrg <18> <00B8>
   1947      1.1  mrg <19> <00DF>
   1948      1.1  mrg <1A> <00E6>
   1949      1.1  mrg <1B> <0153>
   1950      1.1  mrg <1C> <00F8>
   1951      1.1  mrg <1D> <00C6>
   1952      1.1  mrg <1E> <0152>
   1953      1.1  mrg <1F> <00D8>
   1954      1.1  mrg <21> <0021>
   1955      1.1  mrg <22> <201D>
   1956      1.1  mrg <27> <2019>
   1957      1.1  mrg <3C> <00A1>
   1958      1.1  mrg <3D> <003D>
   1959      1.1  mrg <3E> <00BF>
   1960      1.1  mrg <5C> <201C>
   1961      1.1  mrg <5F> <02D9>
   1962      1.1  mrg <60> <2018>
   1963      1.1  mrg <7D> <02DD>
   1964      1.1  mrg <7E> <007E>
   1965      1.1  mrg <7F> <00A8>
   1966      1.1  mrg endbfchar
   1967      1.1  mrg endcmap
   1968      1.1  mrg CMapName currentdict /CMap defineresource pop
   1969      1.1  mrg end
   1970      1.1  mrg end
   1971      1.1  mrg %%EndResource
   1972      1.1  mrg %%EOF
   1973      1.1  mrg     }\endgroup
   1974      1.1  mrg   \expandafter\edef\csname cmapOT1\endcsname#1{%
   1975      1.1  mrg     \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
   1976      1.1  mrg   }%
   1977      1.1  mrg %
   1978      1.1  mrg % \cmapOT1IT
   1979      1.1  mrg   \begingroup
   1980      1.1  mrg     \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
   1981      1.1  mrg     \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
   1982      1.1  mrg %%DocumentNeededResources: ProcSet (CIDInit)
   1983      1.1  mrg %%IncludeResource: ProcSet (CIDInit)
   1984      1.1  mrg %%BeginResource: CMap (TeX-OT1IT-0)
   1985      1.1  mrg %%Title: (TeX-OT1IT-0 TeX OT1IT 0)
   1986      1.1  mrg %%Version: 1.000
   1987      1.1  mrg %%EndComments
   1988      1.1  mrg /CIDInit /ProcSet findresource begin
   1989      1.1  mrg 12 dict begin
   1990      1.1  mrg begincmap
   1991      1.1  mrg /CIDSystemInfo
   1992      1.1  mrg << /Registry (TeX)
   1993      1.1  mrg /Ordering (OT1IT)
   1994      1.1  mrg /Supplement 0
   1995      1.1  mrg >> def
   1996      1.1  mrg /CMapName /TeX-OT1IT-0 def
   1997      1.1  mrg /CMapType 2 def
   1998      1.1  mrg 1 begincodespacerange
   1999      1.1  mrg <00> <7F>
   2000      1.1  mrg endcodespacerange
   2001      1.1  mrg 8 beginbfrange
   2002      1.1  mrg <00> <01> <0393>
   2003      1.1  mrg <09> <0A> <03A8>
   2004      1.1  mrg <25> <26> <0025>
   2005      1.1  mrg <28> <3B> <0028>
   2006      1.1  mrg <3F> <5B> <003F>
   2007      1.1  mrg <5D> <5E> <005D>
   2008      1.1  mrg <61> <7A> <0061>
   2009      1.1  mrg <7B> <7C> <2013>
   2010      1.1  mrg endbfrange
   2011      1.1  mrg 42 beginbfchar
   2012      1.1  mrg <02> <0398>
   2013      1.1  mrg <03> <039B>
   2014      1.1  mrg <04> <039E>
   2015      1.1  mrg <05> <03A0>
   2016      1.1  mrg <06> <03A3>
   2017      1.1  mrg <07> <03D2>
   2018      1.1  mrg <08> <03A6>
   2019      1.1  mrg <0B> <00660066>
   2020      1.1  mrg <0C> <00660069>
   2021      1.1  mrg <0D> <0066006C>
   2022      1.1  mrg <0E> <006600660069>
   2023      1.1  mrg <0F> <00660066006C>
   2024      1.1  mrg <10> <0131>
   2025      1.1  mrg <11> <0237>
   2026      1.1  mrg <12> <0060>
   2027      1.1  mrg <13> <00B4>
   2028      1.1  mrg <14> <02C7>
   2029      1.1  mrg <15> <02D8>
   2030      1.1  mrg <16> <00AF>
   2031      1.1  mrg <17> <02DA>
   2032      1.1  mrg <18> <00B8>
   2033      1.1  mrg <19> <00DF>
   2034      1.1  mrg <1A> <00E6>
   2035      1.1  mrg <1B> <0153>
   2036      1.1  mrg <1C> <00F8>
   2037      1.1  mrg <1D> <00C6>
   2038      1.1  mrg <1E> <0152>
   2039      1.1  mrg <1F> <00D8>
   2040      1.1  mrg <21> <0021>
   2041      1.1  mrg <22> <201D>
   2042      1.1  mrg <23> <0023>
   2043      1.1  mrg <24> <00A3>
   2044      1.1  mrg <27> <2019>
   2045      1.1  mrg <3C> <00A1>
   2046      1.1  mrg <3D> <003D>
   2047      1.1  mrg <3E> <00BF>
   2048      1.1  mrg <5C> <201C>
   2049      1.1  mrg <5F> <02D9>
   2050      1.1  mrg <60> <2018>
   2051      1.1  mrg <7D> <02DD>
   2052      1.1  mrg <7E> <007E>
   2053      1.1  mrg <7F> <00A8>
   2054      1.1  mrg endbfchar
   2055      1.1  mrg endcmap
   2056      1.1  mrg CMapName currentdict /CMap defineresource pop
   2057      1.1  mrg end
   2058      1.1  mrg end
   2059      1.1  mrg %%EndResource
   2060      1.1  mrg %%EOF
   2061      1.1  mrg     }\endgroup
   2062      1.1  mrg   \expandafter\edef\csname cmapOT1IT\endcsname#1{%
   2063      1.1  mrg     \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
   2064      1.1  mrg   }%
   2065      1.1  mrg %
   2066      1.1  mrg % \cmapOT1TT
   2067      1.1  mrg   \begingroup
   2068      1.1  mrg     \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
   2069      1.1  mrg     \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
   2070      1.1  mrg %%DocumentNeededResources: ProcSet (CIDInit)
   2071      1.1  mrg %%IncludeResource: ProcSet (CIDInit)
   2072      1.1  mrg %%BeginResource: CMap (TeX-OT1TT-0)
   2073      1.1  mrg %%Title: (TeX-OT1TT-0 TeX OT1TT 0)
   2074      1.1  mrg %%Version: 1.000
   2075      1.1  mrg %%EndComments
   2076      1.1  mrg /CIDInit /ProcSet findresource begin
   2077      1.1  mrg 12 dict begin
   2078      1.1  mrg begincmap
   2079      1.1  mrg /CIDSystemInfo
   2080      1.1  mrg << /Registry (TeX)
   2081      1.1  mrg /Ordering (OT1TT)
   2082      1.1  mrg /Supplement 0
   2083      1.1  mrg >> def
   2084      1.1  mrg /CMapName /TeX-OT1TT-0 def
   2085      1.1  mrg /CMapType 2 def
   2086      1.1  mrg 1 begincodespacerange
   2087      1.1  mrg <00> <7F>
   2088      1.1  mrg endcodespacerange
   2089      1.1  mrg 5 beginbfrange
   2090      1.1  mrg <00> <01> <0393>
   2091      1.1  mrg <09> <0A> <03A8>
   2092      1.1  mrg <21> <26> <0021>
   2093      1.1  mrg <28> <5F> <0028>
   2094      1.1  mrg <61> <7E> <0061>
   2095      1.1  mrg endbfrange
   2096      1.1  mrg 32 beginbfchar
   2097      1.1  mrg <02> <0398>
   2098      1.1  mrg <03> <039B>
   2099      1.1  mrg <04> <039E>
   2100      1.1  mrg <05> <03A0>
   2101      1.1  mrg <06> <03A3>
   2102      1.1  mrg <07> <03D2>
   2103      1.1  mrg <08> <03A6>
   2104      1.1  mrg <0B> <2191>
   2105      1.1  mrg <0C> <2193>
   2106      1.1  mrg <0D> <0027>
   2107      1.1  mrg <0E> <00A1>
   2108      1.1  mrg <0F> <00BF>
   2109      1.1  mrg <10> <0131>
   2110      1.1  mrg <11> <0237>
   2111      1.1  mrg <12> <0060>
   2112      1.1  mrg <13> <00B4>
   2113      1.1  mrg <14> <02C7>
   2114      1.1  mrg <15> <02D8>
   2115      1.1  mrg <16> <00AF>
   2116      1.1  mrg <17> <02DA>
   2117      1.1  mrg <18> <00B8>
   2118      1.1  mrg <19> <00DF>
   2119      1.1  mrg <1A> <00E6>
   2120      1.1  mrg <1B> <0153>
   2121      1.1  mrg <1C> <00F8>
   2122      1.1  mrg <1D> <00C6>
   2123      1.1  mrg <1E> <0152>
   2124      1.1  mrg <1F> <00D8>
   2125      1.1  mrg <20> <2423>
   2126      1.1  mrg <27> <2019>
   2127      1.1  mrg <60> <2018>
   2128      1.1  mrg <7F> <00A8>
   2129      1.1  mrg endbfchar
   2130      1.1  mrg endcmap
   2131      1.1  mrg CMapName currentdict /CMap defineresource pop
   2132      1.1  mrg end
   2133      1.1  mrg end
   2134      1.1  mrg %%EndResource
   2135      1.1  mrg %%EOF
   2136      1.1  mrg     }\endgroup
   2137      1.1  mrg   \expandafter\edef\csname cmapOT1TT\endcsname#1{%
   2138      1.1  mrg     \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
   2139      1.1  mrg   }%
   2140      1.1  mrg \fi\fi
   2141      1.1  mrg 
   2142  1.1.1.2  mrg 
   2143      1.1  mrg % Set the font macro #1 to the font named \fontprefix#2.
   2144  1.1.1.2  mrg % #3 is the font's design size, #4 is a scale factor, #5 is the CMap
   2145  1.1.1.2  mrg % encoding (only OT1, OT1IT and OT1TT are allowed, or empty to omit).
   2146  1.1.1.2  mrg % Example:
   2147  1.1.1.2  mrg % #1 = \textrm
   2148  1.1.1.2  mrg % #2 = \rmshape
   2149  1.1.1.2  mrg % #3 = 10
   2150  1.1.1.2  mrg % #4 = \mainmagstep
   2151  1.1.1.2  mrg % #5 = OT1
   2152      1.1  mrg %
   2153      1.1  mrg \def\setfont#1#2#3#4#5{%
   2154      1.1  mrg   \font#1=\fontprefix#2#3 scaled #4
   2155      1.1  mrg   \csname cmap#5\endcsname#1%
   2156      1.1  mrg }
   2157      1.1  mrg % This is what gets called when #5 of \setfont is empty.
   2158  1.1.1.2  mrg \let\cmap\gobble
   2159  1.1.1.2  mrg %
   2160      1.1  mrg % (end of cmaps)
   2161      1.1  mrg 
   2162      1.1  mrg % Use cm as the default font prefix.
   2163      1.1  mrg % To specify the font prefix, you must define \fontprefix
   2164      1.1  mrg % before you read in texinfo.tex.
   2165      1.1  mrg \ifx\fontprefix\thisisundefined
   2166      1.1  mrg \def\fontprefix{cm}
   2167      1.1  mrg \fi
   2168      1.1  mrg % Support font families that don't use the same naming scheme as CM.
   2169  1.1.1.2  mrg \def\rmshape{r}
   2170      1.1  mrg \def\rmbshape{bx}               % where the normal face is bold
   2171      1.1  mrg \def\bfshape{b}
   2172      1.1  mrg \def\bxshape{bx}
   2173      1.1  mrg \def\ttshape{tt}
   2174      1.1  mrg \def\ttbshape{tt}
   2175      1.1  mrg \def\ttslshape{sltt}
   2176      1.1  mrg \def\itshape{ti}
   2177      1.1  mrg \def\itbshape{bxti}
   2178      1.1  mrg \def\slshape{sl}
   2179      1.1  mrg \def\slbshape{bxsl}
   2180      1.1  mrg \def\sfshape{ss}
   2181      1.1  mrg \def\sfbshape{ss}
   2182      1.1  mrg \def\scshape{csc}
   2183      1.1  mrg \def\scbshape{csc}
   2184  1.1.1.2  mrg 
   2185      1.1  mrg % Definitions for a main text size of 11pt.  (The default in Texinfo.)
   2186      1.1  mrg %
   2187      1.1  mrg \def\definetextfontsizexi{%
   2188      1.1  mrg % Text fonts (11.2pt, magstep1).
   2189      1.1  mrg \def\textnominalsize{11pt}
   2190      1.1  mrg \edef\mainmagstep{\magstephalf}
   2191      1.1  mrg \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
   2192      1.1  mrg \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
   2193      1.1  mrg \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
   2194      1.1  mrg \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
   2195      1.1  mrg \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
   2196      1.1  mrg \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
   2197      1.1  mrg \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
   2198      1.1  mrg \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
   2199      1.1  mrg \font\texti=cmmi10 scaled \mainmagstep
   2200      1.1  mrg \font\textsy=cmsy10 scaled \mainmagstep
   2201      1.1  mrg \def\textecsize{1095}
   2202      1.1  mrg 
   2203      1.1  mrg % A few fonts for @defun names and args.
   2204      1.1  mrg \setfont\defbf\bfshape{10}{\magstep1}{OT1}
   2205  1.1.1.3  mrg \setfont\deftt\ttshape{10}{\magstep1}{OT1TT}
   2206      1.1  mrg \setfont\defsl\slshape{10}{\magstep1}{OT1TT}
   2207  1.1.1.3  mrg \setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT}
   2208  1.1.1.3  mrg \def\df{\let\ttfont=\deftt \let\bffont = \defbf
   2209      1.1  mrg \let\ttslfont=\defttsl \let\slfont=\defsl \bf}
   2210      1.1  mrg 
   2211      1.1  mrg % Fonts for indices, footnotes, small examples (9pt).
   2212      1.1  mrg \def\smallnominalsize{9pt}
   2213      1.1  mrg \setfont\smallrm\rmshape{9}{1000}{OT1}
   2214      1.1  mrg \setfont\smalltt\ttshape{9}{1000}{OT1TT}
   2215      1.1  mrg \setfont\smallbf\bfshape{10}{900}{OT1}
   2216      1.1  mrg \setfont\smallit\itshape{9}{1000}{OT1IT}
   2217      1.1  mrg \setfont\smallsl\slshape{9}{1000}{OT1}
   2218      1.1  mrg \setfont\smallsf\sfshape{9}{1000}{OT1}
   2219      1.1  mrg \setfont\smallsc\scshape{10}{900}{OT1}
   2220      1.1  mrg \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
   2221      1.1  mrg \font\smalli=cmmi9
   2222      1.1  mrg \font\smallsy=cmsy9
   2223      1.1  mrg \def\smallecsize{0900}
   2224      1.1  mrg 
   2225      1.1  mrg % Fonts for small examples (8pt).
   2226      1.1  mrg \def\smallernominalsize{8pt}
   2227      1.1  mrg \setfont\smallerrm\rmshape{8}{1000}{OT1}
   2228      1.1  mrg \setfont\smallertt\ttshape{8}{1000}{OT1TT}
   2229      1.1  mrg \setfont\smallerbf\bfshape{10}{800}{OT1}
   2230      1.1  mrg \setfont\smallerit\itshape{8}{1000}{OT1IT}
   2231      1.1  mrg \setfont\smallersl\slshape{8}{1000}{OT1}
   2232      1.1  mrg \setfont\smallersf\sfshape{8}{1000}{OT1}
   2233      1.1  mrg \setfont\smallersc\scshape{10}{800}{OT1}
   2234      1.1  mrg \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
   2235      1.1  mrg \font\smalleri=cmmi8
   2236      1.1  mrg \font\smallersy=cmsy8
   2237      1.1  mrg \def\smallerecsize{0800}
   2238  1.1.1.3  mrg 
   2239  1.1.1.3  mrg % Fonts for math mode superscripts (7pt).
   2240  1.1.1.3  mrg \def\sevennominalsize{7pt}
   2241  1.1.1.3  mrg \setfont\sevenrm\rmshape{7}{1000}{OT1}
   2242  1.1.1.3  mrg \setfont\seventt\ttshape{10}{700}{OT1TT}
   2243  1.1.1.3  mrg \setfont\sevenbf\bfshape{10}{700}{OT1}
   2244  1.1.1.3  mrg \setfont\sevenit\itshape{7}{1000}{OT1IT}
   2245  1.1.1.3  mrg \setfont\sevensl\slshape{10}{700}{OT1}
   2246  1.1.1.3  mrg \setfont\sevensf\sfshape{10}{700}{OT1}
   2247  1.1.1.3  mrg \setfont\sevensc\scshape{10}{700}{OT1}
   2248  1.1.1.3  mrg \setfont\seventtsl\ttslshape{10}{700}{OT1TT}
   2249  1.1.1.3  mrg \font\seveni=cmmi7
   2250  1.1.1.3  mrg \font\sevensy=cmsy7
   2251  1.1.1.3  mrg \def\sevenecsize{0700}
   2252      1.1  mrg 
   2253      1.1  mrg % Fonts for title page (20.4pt):
   2254      1.1  mrg \def\titlenominalsize{20pt}
   2255      1.1  mrg \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
   2256      1.1  mrg \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
   2257      1.1  mrg \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
   2258      1.1  mrg \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
   2259      1.1  mrg \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
   2260      1.1  mrg \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
   2261      1.1  mrg \let\titlebf=\titlerm
   2262      1.1  mrg \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
   2263      1.1  mrg \font\titlei=cmmi12 scaled \magstep3
   2264      1.1  mrg \font\titlesy=cmsy10 scaled \magstep4
   2265      1.1  mrg \def\titleecsize{2074}
   2266      1.1  mrg 
   2267      1.1  mrg % Chapter (and unnumbered) fonts (17.28pt).
   2268      1.1  mrg \def\chapnominalsize{17pt}
   2269      1.1  mrg \setfont\chaprm\rmbshape{12}{\magstep2}{OT1}
   2270      1.1  mrg \setfont\chapit\itbshape{10}{\magstep3}{OT1IT}
   2271      1.1  mrg \setfont\chapsl\slbshape{10}{\magstep3}{OT1}
   2272      1.1  mrg \setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT}
   2273      1.1  mrg \setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT}
   2274      1.1  mrg \setfont\chapsf\sfbshape{17}{1000}{OT1}
   2275      1.1  mrg \let\chapbf=\chaprm
   2276      1.1  mrg \setfont\chapsc\scbshape{10}{\magstep3}{OT1}
   2277      1.1  mrg \font\chapi=cmmi12 scaled \magstep2
   2278      1.1  mrg \font\chapsy=cmsy10 scaled \magstep3
   2279      1.1  mrg \def\chapecsize{1728}
   2280      1.1  mrg 
   2281      1.1  mrg % Section fonts (14.4pt).
   2282      1.1  mrg \def\secnominalsize{14pt}
   2283  1.1.1.3  mrg \setfont\secrm\rmbshape{12}{\magstep1}{OT1}
   2284      1.1  mrg \setfont\secrmnotbold\rmshape{12}{\magstep1}{OT1}
   2285      1.1  mrg \setfont\secit\itbshape{10}{\magstep2}{OT1IT}
   2286      1.1  mrg \setfont\secsl\slbshape{10}{\magstep2}{OT1}
   2287      1.1  mrg \setfont\sectt\ttbshape{12}{\magstep1}{OT1TT}
   2288      1.1  mrg \setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT}
   2289      1.1  mrg \setfont\secsf\sfbshape{12}{\magstep1}{OT1}
   2290      1.1  mrg \let\secbf\secrm
   2291      1.1  mrg \setfont\secsc\scbshape{10}{\magstep2}{OT1}
   2292      1.1  mrg \font\seci=cmmi12 scaled \magstep1
   2293      1.1  mrg \font\secsy=cmsy10 scaled \magstep2
   2294      1.1  mrg \def\sececsize{1440}
   2295      1.1  mrg 
   2296      1.1  mrg % Subsection fonts (13.15pt).
   2297      1.1  mrg \def\ssecnominalsize{13pt}
   2298      1.1  mrg \setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1}
   2299      1.1  mrg \setfont\ssecit\itbshape{10}{1315}{OT1IT}
   2300      1.1  mrg \setfont\ssecsl\slbshape{10}{1315}{OT1}
   2301      1.1  mrg \setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT}
   2302      1.1  mrg \setfont\ssecttsl\ttslshape{10}{1315}{OT1TT}
   2303      1.1  mrg \setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1}
   2304      1.1  mrg \let\ssecbf\ssecrm
   2305      1.1  mrg \setfont\ssecsc\scbshape{10}{1315}{OT1}
   2306      1.1  mrg \font\sseci=cmmi12 scaled \magstephalf
   2307      1.1  mrg \font\ssecsy=cmsy10 scaled 1315
   2308      1.1  mrg \def\ssececsize{1200}
   2309  1.1.1.3  mrg 
   2310      1.1  mrg % Reduced fonts for @acronym in text (10pt).
   2311      1.1  mrg \def\reducednominalsize{10pt}
   2312      1.1  mrg \setfont\reducedrm\rmshape{10}{1000}{OT1}
   2313      1.1  mrg \setfont\reducedtt\ttshape{10}{1000}{OT1TT}
   2314      1.1  mrg \setfont\reducedbf\bfshape{10}{1000}{OT1}
   2315      1.1  mrg \setfont\reducedit\itshape{10}{1000}{OT1IT}
   2316      1.1  mrg \setfont\reducedsl\slshape{10}{1000}{OT1}
   2317      1.1  mrg \setfont\reducedsf\sfshape{10}{1000}{OT1}
   2318      1.1  mrg \setfont\reducedsc\scshape{10}{1000}{OT1}
   2319      1.1  mrg \setfont\reducedttsl\ttslshape{10}{1000}{OT1TT}
   2320      1.1  mrg \font\reducedi=cmmi10
   2321      1.1  mrg \font\reducedsy=cmsy10
   2322      1.1  mrg \def\reducedecsize{1000}
   2323      1.1  mrg 
   2324      1.1  mrg \textleading = 13.2pt % line spacing for 11pt CM
   2325      1.1  mrg \textfonts            % reset the current fonts
   2326  1.1.1.2  mrg \rm
   2327      1.1  mrg } % end of 11pt text font size definitions, \definetextfontsizexi
   2328      1.1  mrg 
   2329      1.1  mrg 
   2330      1.1  mrg % Definitions to make the main text be 10pt Computer Modern, with
   2331      1.1  mrg % section, chapter, etc., sizes following suit.  This is for the GNU
   2332      1.1  mrg % Press printing of the Emacs 22 manual.  Maybe other manuals in the
   2333      1.1  mrg % future.  Used with @smallbook, which sets the leading to 12pt.
   2334      1.1  mrg %
   2335      1.1  mrg \def\definetextfontsizex{%
   2336      1.1  mrg % Text fonts (10pt).
   2337      1.1  mrg \def\textnominalsize{10pt}
   2338      1.1  mrg \edef\mainmagstep{1000}
   2339      1.1  mrg \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
   2340      1.1  mrg \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
   2341      1.1  mrg \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
   2342      1.1  mrg \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
   2343      1.1  mrg \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
   2344      1.1  mrg \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
   2345      1.1  mrg \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
   2346      1.1  mrg \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
   2347      1.1  mrg \font\texti=cmmi10 scaled \mainmagstep
   2348      1.1  mrg \font\textsy=cmsy10 scaled \mainmagstep
   2349      1.1  mrg \def\textecsize{1000}
   2350      1.1  mrg 
   2351      1.1  mrg % A few fonts for @defun names and args.
   2352      1.1  mrg \setfont\defbf\bfshape{10}{\magstephalf}{OT1}
   2353  1.1.1.3  mrg \setfont\deftt\ttshape{10}{\magstephalf}{OT1TT}
   2354      1.1  mrg \setfont\defsl\slshape{10}{\magstephalf}{OT1TT}
   2355  1.1.1.3  mrg \setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT}
   2356  1.1.1.3  mrg \def\df{\let\ttfont=\deftt \let\bffont = \defbf
   2357      1.1  mrg \let\slfont=\defsl \let\ttslfont=\defttsl \bf}
   2358      1.1  mrg 
   2359      1.1  mrg % Fonts for indices, footnotes, small examples (9pt).
   2360      1.1  mrg \def\smallnominalsize{9pt}
   2361      1.1  mrg \setfont\smallrm\rmshape{9}{1000}{OT1}
   2362      1.1  mrg \setfont\smalltt\ttshape{9}{1000}{OT1TT}
   2363      1.1  mrg \setfont\smallbf\bfshape{10}{900}{OT1}
   2364      1.1  mrg \setfont\smallit\itshape{9}{1000}{OT1IT}
   2365      1.1  mrg \setfont\smallsl\slshape{9}{1000}{OT1}
   2366      1.1  mrg \setfont\smallsf\sfshape{9}{1000}{OT1}
   2367      1.1  mrg \setfont\smallsc\scshape{10}{900}{OT1}
   2368      1.1  mrg \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
   2369      1.1  mrg \font\smalli=cmmi9
   2370      1.1  mrg \font\smallsy=cmsy9
   2371      1.1  mrg \def\smallecsize{0900}
   2372      1.1  mrg 
   2373      1.1  mrg % Fonts for small examples (8pt).
   2374      1.1  mrg \def\smallernominalsize{8pt}
   2375      1.1  mrg \setfont\smallerrm\rmshape{8}{1000}{OT1}
   2376      1.1  mrg \setfont\smallertt\ttshape{8}{1000}{OT1TT}
   2377      1.1  mrg \setfont\smallerbf\bfshape{10}{800}{OT1}
   2378      1.1  mrg \setfont\smallerit\itshape{8}{1000}{OT1IT}
   2379      1.1  mrg \setfont\smallersl\slshape{8}{1000}{OT1}
   2380      1.1  mrg \setfont\smallersf\sfshape{8}{1000}{OT1}
   2381      1.1  mrg \setfont\smallersc\scshape{10}{800}{OT1}
   2382      1.1  mrg \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
   2383      1.1  mrg \font\smalleri=cmmi8
   2384      1.1  mrg \font\smallersy=cmsy8
   2385      1.1  mrg \def\smallerecsize{0800}
   2386  1.1.1.3  mrg 
   2387  1.1.1.3  mrg % Fonts for math mode superscripts (7pt).
   2388  1.1.1.3  mrg \def\sevennominalsize{7pt}
   2389  1.1.1.3  mrg \setfont\sevenrm\rmshape{7}{1000}{OT1}
   2390  1.1.1.3  mrg \setfont\seventt\ttshape{10}{700}{OT1TT}
   2391  1.1.1.3  mrg \setfont\sevenbf\bfshape{10}{700}{OT1}
   2392  1.1.1.3  mrg \setfont\sevenit\itshape{7}{1000}{OT1IT}
   2393  1.1.1.3  mrg \setfont\sevensl\slshape{10}{700}{OT1}
   2394  1.1.1.3  mrg \setfont\sevensf\sfshape{10}{700}{OT1}
   2395  1.1.1.3  mrg \setfont\sevensc\scshape{10}{700}{OT1}
   2396  1.1.1.3  mrg \setfont\seventtsl\ttslshape{10}{700}{OT1TT}
   2397  1.1.1.3  mrg \font\seveni=cmmi7
   2398  1.1.1.3  mrg \font\sevensy=cmsy7
   2399  1.1.1.3  mrg \def\sevenecsize{0700}
   2400      1.1  mrg 
   2401      1.1  mrg % Fonts for title page (20.4pt):
   2402      1.1  mrg \def\titlenominalsize{20pt}
   2403      1.1  mrg \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
   2404      1.1  mrg \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
   2405      1.1  mrg \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
   2406      1.1  mrg \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
   2407      1.1  mrg \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
   2408      1.1  mrg \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
   2409      1.1  mrg \let\titlebf=\titlerm
   2410      1.1  mrg \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
   2411      1.1  mrg \font\titlei=cmmi12 scaled \magstep3
   2412      1.1  mrg \font\titlesy=cmsy10 scaled \magstep4
   2413      1.1  mrg \def\titleecsize{2074}
   2414      1.1  mrg 
   2415      1.1  mrg % Chapter fonts (14.4pt).
   2416      1.1  mrg \def\chapnominalsize{14pt}
   2417      1.1  mrg \setfont\chaprm\rmbshape{12}{\magstep1}{OT1}
   2418      1.1  mrg \setfont\chapit\itbshape{10}{\magstep2}{OT1IT}
   2419      1.1  mrg \setfont\chapsl\slbshape{10}{\magstep2}{OT1}
   2420      1.1  mrg \setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT}
   2421      1.1  mrg \setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT}
   2422      1.1  mrg \setfont\chapsf\sfbshape{12}{\magstep1}{OT1}
   2423      1.1  mrg \let\chapbf\chaprm
   2424      1.1  mrg \setfont\chapsc\scbshape{10}{\magstep2}{OT1}
   2425      1.1  mrg \font\chapi=cmmi12 scaled \magstep1
   2426      1.1  mrg \font\chapsy=cmsy10 scaled \magstep2
   2427      1.1  mrg \def\chapecsize{1440}
   2428      1.1  mrg 
   2429      1.1  mrg % Section fonts (12pt).
   2430      1.1  mrg \def\secnominalsize{12pt}
   2431      1.1  mrg \setfont\secrm\rmbshape{12}{1000}{OT1}
   2432      1.1  mrg \setfont\secit\itbshape{10}{\magstep1}{OT1IT}
   2433      1.1  mrg \setfont\secsl\slbshape{10}{\magstep1}{OT1}
   2434      1.1  mrg \setfont\sectt\ttbshape{12}{1000}{OT1TT}
   2435      1.1  mrg \setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT}
   2436      1.1  mrg \setfont\secsf\sfbshape{12}{1000}{OT1}
   2437      1.1  mrg \let\secbf\secrm
   2438      1.1  mrg \setfont\secsc\scbshape{10}{\magstep1}{OT1}
   2439      1.1  mrg \font\seci=cmmi12
   2440      1.1  mrg \font\secsy=cmsy10 scaled \magstep1
   2441      1.1  mrg \def\sececsize{1200}
   2442      1.1  mrg 
   2443      1.1  mrg % Subsection fonts (10pt).
   2444      1.1  mrg \def\ssecnominalsize{10pt}
   2445      1.1  mrg \setfont\ssecrm\rmbshape{10}{1000}{OT1}
   2446      1.1  mrg \setfont\ssecit\itbshape{10}{1000}{OT1IT}
   2447      1.1  mrg \setfont\ssecsl\slbshape{10}{1000}{OT1}
   2448      1.1  mrg \setfont\ssectt\ttbshape{10}{1000}{OT1TT}
   2449      1.1  mrg \setfont\ssecttsl\ttslshape{10}{1000}{OT1TT}
   2450      1.1  mrg \setfont\ssecsf\sfbshape{10}{1000}{OT1}
   2451      1.1  mrg \let\ssecbf\ssecrm
   2452      1.1  mrg \setfont\ssecsc\scbshape{10}{1000}{OT1}
   2453      1.1  mrg \font\sseci=cmmi10
   2454      1.1  mrg \font\ssecsy=cmsy10
   2455      1.1  mrg \def\ssececsize{1000}
   2456  1.1.1.3  mrg 
   2457      1.1  mrg % Reduced fonts for @acronym in text (9pt).
   2458      1.1  mrg \def\reducednominalsize{9pt}
   2459      1.1  mrg \setfont\reducedrm\rmshape{9}{1000}{OT1}
   2460      1.1  mrg \setfont\reducedtt\ttshape{9}{1000}{OT1TT}
   2461      1.1  mrg \setfont\reducedbf\bfshape{10}{900}{OT1}
   2462      1.1  mrg \setfont\reducedit\itshape{9}{1000}{OT1IT}
   2463      1.1  mrg \setfont\reducedsl\slshape{9}{1000}{OT1}
   2464      1.1  mrg \setfont\reducedsf\sfshape{9}{1000}{OT1}
   2465      1.1  mrg \setfont\reducedsc\scshape{10}{900}{OT1}
   2466      1.1  mrg \setfont\reducedttsl\ttslshape{10}{900}{OT1TT}
   2467      1.1  mrg \font\reducedi=cmmi9
   2468      1.1  mrg \font\reducedsy=cmsy9
   2469      1.1  mrg \def\reducedecsize{0900}
   2470      1.1  mrg 
   2471      1.1  mrg \divide\parskip by 2  % reduce space between paragraphs
   2472      1.1  mrg \textleading = 12pt   % line spacing for 10pt CM
   2473      1.1  mrg \textfonts            % reset the current fonts
   2474  1.1.1.2  mrg \rm
   2475      1.1  mrg } % end of 10pt text font size definitions, \definetextfontsizex
   2476  1.1.1.3  mrg 
   2477  1.1.1.3  mrg % Fonts for short table of contents.
   2478  1.1.1.3  mrg \setfont\shortcontrm\rmshape{12}{1000}{OT1}
   2479  1.1.1.3  mrg \setfont\shortcontbf\bfshape{10}{\magstep1}{OT1}  % no cmb12
   2480  1.1.1.3  mrg \setfont\shortcontsl\slshape{12}{1000}{OT1}
   2481  1.1.1.3  mrg \setfont\shortconttt\ttshape{12}{1000}{OT1TT}
   2482      1.1  mrg 
   2483      1.1  mrg 
   2484      1.1  mrg % We provide the user-level command
   2485      1.1  mrg %   @fonttextsize 10
   2486      1.1  mrg % (or 11) to redefine the text font size.  pt is assumed.
   2487      1.1  mrg %
   2488      1.1  mrg \def\xiword{11}
   2489      1.1  mrg \def\xword{10}
   2490      1.1  mrg \def\xwordpt{10pt}
   2491      1.1  mrg %
   2492      1.1  mrg \parseargdef\fonttextsize{%
   2493      1.1  mrg   \def\textsizearg{#1}%
   2494      1.1  mrg   %\wlog{doing @fonttextsize \textsizearg}%
   2495      1.1  mrg   %
   2496      1.1  mrg   % Set \globaldefs so that documents can use this inside @tex, since
   2497      1.1  mrg   % makeinfo 4.8 does not support it, but we need it nonetheless.
   2498      1.1  mrg   %
   2499      1.1  mrg  \begingroup \globaldefs=1
   2500      1.1  mrg   \ifx\textsizearg\xword \definetextfontsizex
   2501      1.1  mrg   \else \ifx\textsizearg\xiword \definetextfontsizexi
   2502      1.1  mrg   \else
   2503      1.1  mrg     \errhelp=\EMsimple
   2504      1.1  mrg     \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'}
   2505      1.1  mrg   \fi\fi
   2506      1.1  mrg  \endgroup
   2507      1.1  mrg }
   2508  1.1.1.3  mrg 
   2509  1.1.1.3  mrg %
   2510  1.1.1.3  mrg % Change the current font style to #1, remembering it in \curfontstyle.
   2511  1.1.1.3  mrg % For now, we do not accumulate font styles: @b{@i{foo}} prints foo in
   2512  1.1.1.3  mrg % italics, not bold italics.
   2513  1.1.1.3  mrg %
   2514  1.1.1.3  mrg \def\setfontstyle#1{%
   2515  1.1.1.3  mrg   \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd.
   2516  1.1.1.3  mrg   \csname #1font\endcsname  % change the current font
   2517  1.1.1.3  mrg }
   2518  1.1.1.3  mrg 
   2519  1.1.1.3  mrg \def\rm{\fam=0 \setfontstyle{rm}}
   2520  1.1.1.3  mrg \def\it{\fam=\itfam \setfontstyle{it}}
   2521  1.1.1.3  mrg \def\sl{\fam=\slfam \setfontstyle{sl}}
   2522  1.1.1.3  mrg \def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
   2523  1.1.1.3  mrg \def\tt{\fam=\ttfam \setfontstyle{tt}}
   2524  1.1.1.3  mrg 
   2525  1.1.1.3  mrg % Texinfo sort of supports the sans serif font style, which plain TeX does not.
   2526  1.1.1.3  mrg % So we set up a \sf.
   2527  1.1.1.3  mrg \newfam\sffam
   2528  1.1.1.3  mrg \def\sf{\fam=\sffam \setfontstyle{sf}}
   2529  1.1.1.3  mrg 
   2530  1.1.1.3  mrg % We don't need math for this font style.
   2531  1.1.1.3  mrg \def\ttsl{\setfontstyle{ttsl}}
   2532      1.1  mrg 
   2533      1.1  mrg 
   2534  1.1.1.3  mrg % In order for the font changes to affect most math symbols and letters,
   2535  1.1.1.3  mrg % we have to define the \textfont of the standard families.
   2536      1.1  mrg % We don't bother to reset \scriptscriptfont; awaiting user need.
   2537      1.1  mrg %
   2538  1.1.1.3  mrg \def\resetmathfonts{%
   2539  1.1.1.3  mrg   \textfont0=\rmfont \textfont1=\ifont \textfont2=\syfont
   2540  1.1.1.3  mrg   \textfont\itfam=\itfont \textfont\slfam=\slfont \textfont\bffam=\bffont
   2541  1.1.1.3  mrg   \textfont\ttfam=\ttfont \textfont\sffam=\sffont
   2542  1.1.1.3  mrg   %
   2543  1.1.1.3  mrg   % Fonts for superscript.  Note that the 7pt fonts are used regardless
   2544  1.1.1.3  mrg   % of the current font size.
   2545  1.1.1.3  mrg   \scriptfont0=\sevenrm \scriptfont1=\seveni \scriptfont2=\sevensy
   2546  1.1.1.3  mrg   \scriptfont\itfam=\sevenit \scriptfont\slfam=\sevensl
   2547  1.1.1.3  mrg   \scriptfont\bffam=\sevenbf \scriptfont\ttfam=\seventt
   2548      1.1  mrg   \scriptfont\sffam=\sevensf
   2549      1.1  mrg }
   2550  1.1.1.3  mrg 
   2551  1.1.1.3  mrg %
   2552  1.1.1.3  mrg 
   2553  1.1.1.3  mrg % The font-changing commands (all called \...fonts) redefine the meanings
   2554  1.1.1.3  mrg % of \STYLEfont, instead of just \STYLE.  We do this because \STYLE needs
   2555  1.1.1.3  mrg % to also set the current \fam for math mode.  Our \STYLE (e.g., \rm)
   2556  1.1.1.3  mrg % commands hardwire \STYLEfont to set the current font.
   2557  1.1.1.3  mrg %
   2558  1.1.1.3  mrg % The fonts used for \ifont are for "math italics"  (\itfont is for italics
   2559      1.1  mrg % in regular text).  \syfont is also used in math mode only.
   2560      1.1  mrg %
   2561  1.1.1.3  mrg % Each font-changing command also sets the names \lsize (one size lower)
   2562  1.1.1.3  mrg % and \lllsize (three sizes lower).  These relative commands are used
   2563      1.1  mrg % in, e.g., the LaTeX logo and acronyms.
   2564      1.1  mrg %
   2565      1.1  mrg % This all needs generalizing, badly.
   2566      1.1  mrg %
   2567  1.1.1.3  mrg 
   2568  1.1.1.3  mrg \def\assignfonts#1{%
   2569  1.1.1.3  mrg   \expandafter\let\expandafter\rmfont\csname #1rm\endcsname
   2570  1.1.1.3  mrg   \expandafter\let\expandafter\itfont\csname #1it\endcsname
   2571  1.1.1.3  mrg   \expandafter\let\expandafter\slfont\csname #1sl\endcsname
   2572  1.1.1.3  mrg   \expandafter\let\expandafter\bffont\csname #1bf\endcsname
   2573  1.1.1.3  mrg   \expandafter\let\expandafter\ttfont\csname #1tt\endcsname
   2574  1.1.1.3  mrg   \expandafter\let\expandafter\smallcaps\csname #1sc\endcsname
   2575  1.1.1.3  mrg   \expandafter\let\expandafter\sffont  \csname #1sf\endcsname
   2576  1.1.1.3  mrg   \expandafter\let\expandafter\ifont   \csname #1i\endcsname
   2577  1.1.1.3  mrg   \expandafter\let\expandafter\syfont  \csname #1sy\endcsname
   2578  1.1.1.3  mrg   \expandafter\let\expandafter\ttslfont\csname #1ttsl\endcsname
   2579  1.1.1.3  mrg }
   2580  1.1.1.3  mrg 
   2581  1.1.1.3  mrg \newif\ifrmisbold
   2582  1.1.1.3  mrg 
   2583  1.1.1.3  mrg % Select smaller font size with the current style.  Used to change font size
   2584  1.1.1.3  mrg % in, e.g., the LaTeX logo and acronyms.  If we are using bold fonts for
   2585  1.1.1.3  mrg % normal roman text, also use bold fonts for roman text in the smaller size.
   2586  1.1.1.3  mrg \def\switchtolllsize{%
   2587  1.1.1.3  mrg    \expandafter\assignfonts\expandafter{\lllsize}%
   2588  1.1.1.3  mrg    \ifrmisbold
   2589  1.1.1.3  mrg      \let\rmfont\bffont
   2590  1.1.1.3  mrg    \fi
   2591  1.1.1.3  mrg    \csname\curfontstyle\endcsname
   2592  1.1.1.3  mrg }%
   2593  1.1.1.3  mrg 
   2594  1.1.1.3  mrg \def\switchtolsize{%
   2595  1.1.1.3  mrg    \expandafter\assignfonts\expandafter{\lsize}%
   2596  1.1.1.3  mrg    \ifrmisbold
   2597  1.1.1.3  mrg      \let\rmfont\bffont
   2598  1.1.1.3  mrg    \fi
   2599  1.1.1.3  mrg    \csname\curfontstyle\endcsname
   2600  1.1.1.3  mrg }%
   2601  1.1.1.3  mrg 
   2602  1.1.1.3  mrg \def\definefontsetatsize#1#2#3#4#5{%
   2603  1.1.1.3  mrg \expandafter\def\csname #1fonts\endcsname{%
   2604  1.1.1.3  mrg   \def\curfontsize{#1}%
   2605  1.1.1.3  mrg   \def\lsize{#2}\def\lllsize{#3}%
   2606  1.1.1.3  mrg   \csname rmisbold#5\endcsname
   2607  1.1.1.3  mrg   \assignfonts{#1}%
   2608  1.1.1.3  mrg   \resetmathfonts
   2609  1.1.1.3  mrg   \setleading{#4}%
   2610  1.1.1.3  mrg }}
   2611  1.1.1.3  mrg 
   2612  1.1.1.3  mrg \definefontsetatsize{text}   {reduced}{smaller}{\textleading}{false}
   2613  1.1.1.3  mrg \definefontsetatsize{title}  {chap}   {subsec} {27pt}  {true}
   2614  1.1.1.3  mrg \definefontsetatsize{chap}   {sec}    {text}   {19pt}  {true}
   2615  1.1.1.3  mrg \definefontsetatsize{sec}    {subsec} {reduced}{17pt}  {true}
   2616  1.1.1.3  mrg \definefontsetatsize{ssec}   {text}   {small}  {15pt}  {true}
   2617  1.1.1.3  mrg \definefontsetatsize{reduced}{small}  {smaller}{10.5pt}{false}
   2618  1.1.1.3  mrg \definefontsetatsize{small}  {smaller}{smaller}{10.5pt}{false}
   2619  1.1.1.3  mrg \definefontsetatsize{smaller}{smaller}{smaller}{9.5pt} {false}
   2620  1.1.1.3  mrg 
   2621  1.1.1.3  mrg \def\titlefont#1{{\titlefonts\rm #1}}
   2622  1.1.1.3  mrg \let\subsecfonts = \ssecfonts
   2623      1.1  mrg \let\subsubsecfonts = \ssecfonts
   2624      1.1  mrg 
   2625      1.1  mrg % Define these just so they can be easily changed for other fonts.
   2626      1.1  mrg \def\angleleft{$\langle$}
   2627      1.1  mrg \def\angleright{$\rangle$}
   2628      1.1  mrg 
   2629      1.1  mrg % Set the fonts to use with the @small... environments.
   2630      1.1  mrg \let\smallexamplefonts = \smallfonts
   2631      1.1  mrg 
   2632      1.1  mrg % About \smallexamplefonts.  If we use \smallfonts (9pt), @smallexample
   2633      1.1  mrg % can fit this many characters:
   2634      1.1  mrg %   8.5x11=86   smallbook=72  a4=90  a5=69
   2635      1.1  mrg % If we use \scriptfonts (8pt), then we can fit this many characters:
   2636      1.1  mrg %   8.5x11=90+  smallbook=80  a4=90+  a5=77
   2637      1.1  mrg % For me, subjectively, the few extra characters that fit aren't worth
   2638      1.1  mrg % the additional smallness of 8pt.  So I'm making the default 9pt.
   2639      1.1  mrg %
   2640      1.1  mrg % By the way, for comparison, here's what fits with @example (10pt):
   2641      1.1  mrg %   8.5x11=71  smallbook=60  a4=75  a5=58
   2642      1.1  mrg % --karl, 24jan03.
   2643      1.1  mrg 
   2644      1.1  mrg % Set up the default fonts, so we can use them for creating boxes.
   2645      1.1  mrg %
   2646      1.1  mrg \definetextfontsizexi
   2647      1.1  mrg 
   2648      1.1  mrg 
   2649      1.1  mrg \message{markup,}
   2650      1.1  mrg 
   2651      1.1  mrg % Check if we are currently using a typewriter font.  Since all the
   2652      1.1  mrg % Computer Modern typewriter fonts have zero interword stretch (and
   2653      1.1  mrg % shrink), and it is reasonable to expect all typewriter fonts to have
   2654      1.1  mrg % this property, we can check that font parameter.
   2655      1.1  mrg %
   2656      1.1  mrg \def\ifmonospace{\ifdim\fontdimen3\font=0pt }
   2657      1.1  mrg 
   2658      1.1  mrg % Markup style infrastructure.  \defmarkupstylesetup\INITMACRO will
   2659      1.1  mrg % define and register \INITMACRO to be called on markup style changes.
   2660  1.1.1.3  mrg % \INITMACRO can check \currentmarkupstyle for the innermost
   2661      1.1  mrg % style.
   2662      1.1  mrg 
   2663      1.1  mrg \let\currentmarkupstyle\empty
   2664      1.1  mrg 
   2665      1.1  mrg \def\setupmarkupstyle#1{%
   2666      1.1  mrg   \def\currentmarkupstyle{#1}%
   2667      1.1  mrg   \markupstylesetup
   2668      1.1  mrg }
   2669      1.1  mrg 
   2670      1.1  mrg \let\markupstylesetup\empty
   2671      1.1  mrg 
   2672      1.1  mrg \def\defmarkupstylesetup#1{%
   2673      1.1  mrg   \expandafter\def\expandafter\markupstylesetup
   2674      1.1  mrg     \expandafter{\markupstylesetup #1}%
   2675      1.1  mrg   \def#1%
   2676      1.1  mrg }
   2677      1.1  mrg 
   2678      1.1  mrg % Markup style setup for left and right quotes.
   2679      1.1  mrg \defmarkupstylesetup\markupsetuplq{%
   2680      1.1  mrg   \expandafter\let\expandafter \temp
   2681      1.1  mrg     \csname markupsetuplq\currentmarkupstyle\endcsname
   2682      1.1  mrg   \ifx\temp\relax \markupsetuplqdefault \else \temp \fi
   2683      1.1  mrg }
   2684      1.1  mrg 
   2685      1.1  mrg \defmarkupstylesetup\markupsetuprq{%
   2686      1.1  mrg   \expandafter\let\expandafter \temp
   2687      1.1  mrg     \csname markupsetuprq\currentmarkupstyle\endcsname
   2688      1.1  mrg   \ifx\temp\relax \markupsetuprqdefault \else \temp \fi
   2689      1.1  mrg }
   2690      1.1  mrg 
   2691      1.1  mrg {
   2692      1.1  mrg \catcode`\'=\active
   2693      1.1  mrg \catcode`\`=\active
   2694      1.1  mrg 
   2695      1.1  mrg \gdef\markupsetuplqdefault{\let`\lq}
   2696      1.1  mrg \gdef\markupsetuprqdefault{\let'\rq}
   2697      1.1  mrg 
   2698      1.1  mrg \gdef\markupsetcodequoteleft{\let`\codequoteleft}
   2699      1.1  mrg \gdef\markupsetcodequoteright{\let'\codequoteright}
   2700      1.1  mrg }
   2701      1.1  mrg 
   2702      1.1  mrg \let\markupsetuplqcode \markupsetcodequoteleft
   2703      1.1  mrg \let\markupsetuprqcode \markupsetcodequoteright
   2704      1.1  mrg %
   2705      1.1  mrg \let\markupsetuplqexample \markupsetcodequoteleft
   2706      1.1  mrg \let\markupsetuprqexample \markupsetcodequoteright
   2707  1.1.1.2  mrg %
   2708  1.1.1.2  mrg \let\markupsetuplqkbd     \markupsetcodequoteleft
   2709  1.1.1.2  mrg \let\markupsetuprqkbd     \markupsetcodequoteright
   2710      1.1  mrg %
   2711      1.1  mrg \let\markupsetuplqsamp \markupsetcodequoteleft
   2712      1.1  mrg \let\markupsetuprqsamp \markupsetcodequoteright
   2713      1.1  mrg %
   2714      1.1  mrg \let\markupsetuplqverb \markupsetcodequoteleft
   2715      1.1  mrg \let\markupsetuprqverb \markupsetcodequoteright
   2716      1.1  mrg %
   2717      1.1  mrg \let\markupsetuplqverbatim \markupsetcodequoteleft
   2718      1.1  mrg \let\markupsetuprqverbatim \markupsetcodequoteright
   2719      1.1  mrg 
   2720      1.1  mrg % Allow an option to not use regular directed right quote/apostrophe
   2721      1.1  mrg % (char 0x27), but instead the undirected quote from cmtt (char 0x0d).
   2722      1.1  mrg % The undirected quote is ugly, so don't make it the default, but it
   2723      1.1  mrg % works for pasting with more pdf viewers (at least evince), the
   2724      1.1  mrg % lilypond developers report.  xpdf does work with the regular 0x27.
   2725      1.1  mrg %
   2726  1.1.1.3  mrg \def\codequoteright{%
   2727  1.1.1.3  mrg   \ifmonospace
   2728  1.1.1.3  mrg     \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax
   2729  1.1.1.3  mrg       \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax
   2730  1.1.1.3  mrg         '%
   2731      1.1  mrg       \else \char'15 \fi
   2732  1.1.1.3  mrg     \else \char'15 \fi
   2733  1.1.1.3  mrg    \else
   2734  1.1.1.3  mrg      '%
   2735      1.1  mrg    \fi
   2736      1.1  mrg }
   2737      1.1  mrg %
   2738      1.1  mrg % and a similar option for the left quote char vs. a grave accent.
   2739      1.1  mrg % Modern fonts display ASCII 0x60 as a grave accent, so some people like
   2740      1.1  mrg % the code environments to do likewise.
   2741      1.1  mrg %
   2742  1.1.1.3  mrg \def\codequoteleft{%
   2743  1.1.1.3  mrg   \ifmonospace
   2744  1.1.1.3  mrg     \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax
   2745  1.1.1.3  mrg       \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax
   2746  1.1.1.3  mrg         % [Knuth] pp. 380,381,391
   2747  1.1.1.3  mrg         % \relax disables Spanish ligatures ?` and !` of \tt font.
   2748  1.1.1.3  mrg         \relax`%
   2749      1.1  mrg       \else \char'22 \fi
   2750  1.1.1.3  mrg     \else \char'22 \fi
   2751  1.1.1.3  mrg    \else
   2752  1.1.1.3  mrg      \relax`%
   2753      1.1  mrg    \fi
   2754      1.1  mrg }
   2755      1.1  mrg 
   2756      1.1  mrg % Commands to set the quote options.
   2757      1.1  mrg % 
   2758      1.1  mrg \parseargdef\codequoteundirected{%
   2759      1.1  mrg   \def\temp{#1}%
   2760      1.1  mrg   \ifx\temp\onword
   2761      1.1  mrg     \expandafter\let\csname SETtxicodequoteundirected\endcsname
   2762      1.1  mrg       = t%
   2763      1.1  mrg   \else\ifx\temp\offword
   2764      1.1  mrg     \expandafter\let\csname SETtxicodequoteundirected\endcsname
   2765      1.1  mrg       = \relax
   2766      1.1  mrg   \else
   2767      1.1  mrg     \errhelp = \EMsimple
   2768      1.1  mrg     \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}%
   2769      1.1  mrg   \fi\fi
   2770      1.1  mrg }
   2771      1.1  mrg %
   2772      1.1  mrg \parseargdef\codequotebacktick{%
   2773      1.1  mrg   \def\temp{#1}%
   2774      1.1  mrg   \ifx\temp\onword
   2775      1.1  mrg     \expandafter\let\csname SETtxicodequotebacktick\endcsname
   2776      1.1  mrg       = t%
   2777      1.1  mrg   \else\ifx\temp\offword
   2778      1.1  mrg     \expandafter\let\csname SETtxicodequotebacktick\endcsname
   2779      1.1  mrg       = \relax
   2780      1.1  mrg   \else
   2781      1.1  mrg     \errhelp = \EMsimple
   2782      1.1  mrg     \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}%
   2783      1.1  mrg   \fi\fi
   2784      1.1  mrg }
   2785      1.1  mrg 
   2786      1.1  mrg % [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font.
   2787      1.1  mrg \def\noligaturesquoteleft{\relax\lq}
   2788      1.1  mrg 
   2789      1.1  mrg % Count depth in font-changes, for error checks
   2790      1.1  mrg \newcount\fontdepth \fontdepth=0
   2791      1.1  mrg 
   2792      1.1  mrg % Font commands.
   2793      1.1  mrg 
   2794      1.1  mrg % #1 is the font command (\sl or \it), #2 is the text to slant.
   2795      1.1  mrg % If we are in a monospaced environment, however, 1) always use \ttsl,
   2796      1.1  mrg % and 2) do not add an italic correction.
   2797      1.1  mrg \def\dosmartslant#1#2{%
   2798      1.1  mrg   \ifusingtt 
   2799      1.1  mrg     {{\ttsl #2}\let\next=\relax}%
   2800      1.1  mrg     {\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}%
   2801      1.1  mrg   \next
   2802      1.1  mrg }
   2803      1.1  mrg \def\smartslanted{\dosmartslant\sl}
   2804      1.1  mrg \def\smartitalic{\dosmartslant\it}
   2805      1.1  mrg 
   2806      1.1  mrg % Output an italic correction unless \next (presumed to be the following
   2807      1.1  mrg % character) is such as not to need one.
   2808      1.1  mrg \def\smartitaliccorrection{%
   2809      1.1  mrg   \ifx\next,%
   2810      1.1  mrg   \else\ifx\next-%
   2811  1.1.1.3  mrg   \else\ifx\next.%
   2812  1.1.1.3  mrg   \else\ifx\next\.%
   2813      1.1  mrg   \else\ifx\next\comma%
   2814  1.1.1.3  mrg   \else\ptexslash
   2815      1.1  mrg   \fi\fi\fi\fi\fi
   2816      1.1  mrg   \aftersmartic
   2817      1.1  mrg }
   2818  1.1.1.2  mrg 
   2819      1.1  mrg % Unconditional use \ttsl, and no ic.  @var is set to this for defuns.
   2820      1.1  mrg \def\ttslanted#1{{\ttsl #1}}
   2821      1.1  mrg 
   2822      1.1  mrg % @cite is like \smartslanted except unconditionally use \sl.  We never want
   2823      1.1  mrg % ttsl for book titles, do we?
   2824      1.1  mrg \def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection}
   2825      1.1  mrg 
   2826      1.1  mrg \def\aftersmartic{}
   2827      1.1  mrg \def\var#1{%
   2828      1.1  mrg   \let\saveaftersmartic = \aftersmartic
   2829      1.1  mrg   \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}%
   2830      1.1  mrg   \smartslanted{#1}%
   2831      1.1  mrg }
   2832      1.1  mrg 
   2833      1.1  mrg \let\i=\smartitalic
   2834      1.1  mrg \let\slanted=\smartslanted
   2835      1.1  mrg \let\dfn=\smartslanted
   2836      1.1  mrg \let\emph=\smartitalic
   2837      1.1  mrg 
   2838      1.1  mrg % Explicit font changes: @r, @sc, undocumented @ii.
   2839      1.1  mrg \def\r#1{{\rm #1}}              % roman font
   2840      1.1  mrg \def\sc#1{{\smallcaps#1}}       % smallcaps font
   2841      1.1  mrg \def\ii#1{{\it #1}}             % italic font
   2842      1.1  mrg 
   2843      1.1  mrg % @b, explicit bold.  Also @strong.
   2844      1.1  mrg \def\b#1{{\bf #1}}
   2845      1.1  mrg \let\strong=\b
   2846      1.1  mrg 
   2847      1.1  mrg % @sansserif, explicit sans.
   2848      1.1  mrg \def\sansserif#1{{\sf #1}}
   2849      1.1  mrg 
   2850      1.1  mrg % We can't just use \exhyphenpenalty, because that only has effect at
   2851      1.1  mrg % the end of a paragraph.  Restore normal hyphenation at the end of the
   2852      1.1  mrg % group within which \nohyphenation is presumably called.
   2853      1.1  mrg %
   2854      1.1  mrg \def\nohyphenation{\hyphenchar\font = -1  \aftergroup\restorehyphenation}
   2855      1.1  mrg \def\restorehyphenation{\hyphenchar\font = `- }
   2856      1.1  mrg 
   2857      1.1  mrg % Set sfcode to normal for the chars that usually have another value.
   2858      1.1  mrg % Can't use plain's \frenchspacing because it uses the `\x notation, and
   2859      1.1  mrg % sometimes \x has an active definition that messes things up.
   2860      1.1  mrg %
   2861      1.1  mrg \catcode`@=11
   2862  1.1.1.3  mrg   \def\plainfrenchspacing{%
   2863  1.1.1.3  mrg     \sfcode`\.=\@m \sfcode`\?=\@m \sfcode`\!=\@m
   2864      1.1  mrg     \sfcode`\:=\@m \sfcode`\;=\@m \sfcode`\,=\@m
   2865      1.1  mrg     \def\endofsentencespacefactor{1000}% for @. and friends
   2866      1.1  mrg   }
   2867      1.1  mrg   \def\plainnonfrenchspacing{%
   2868      1.1  mrg     \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000
   2869      1.1  mrg     \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250
   2870      1.1  mrg     \def\endofsentencespacefactor{3000}% for @. and friends
   2871      1.1  mrg   }
   2872      1.1  mrg \catcode`@=\other
   2873      1.1  mrg \def\endofsentencespacefactor{3000}% default
   2874      1.1  mrg 
   2875      1.1  mrg % @t, explicit typewriter.
   2876      1.1  mrg \def\t#1{%
   2877      1.1  mrg   {\tt \rawbackslash \plainfrenchspacing #1}%
   2878      1.1  mrg   \null
   2879      1.1  mrg }
   2880      1.1  mrg 
   2881      1.1  mrg % @samp.
   2882      1.1  mrg \def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}}
   2883  1.1.1.2  mrg 
   2884  1.1.1.2  mrg % @indicateurl is \samp, that is, with quotes.
   2885      1.1  mrg \let\indicateurl=\samp
   2886  1.1.1.2  mrg 
   2887  1.1.1.2  mrg % @code (and similar) prints in typewriter, but with spaces the same
   2888  1.1.1.2  mrg % size as normal in the surrounding text, without hyphenation, etc.
   2889      1.1  mrg % This is a subroutine for that.
   2890      1.1  mrg \def\tclose#1{%
   2891      1.1  mrg   {%
   2892      1.1  mrg     % Change normal interword space to be same as for the current font.
   2893      1.1  mrg     \spaceskip = \fontdimen2\font
   2894      1.1  mrg     %
   2895      1.1  mrg     % Switch to typewriter.
   2896      1.1  mrg     \tt
   2897      1.1  mrg     %
   2898      1.1  mrg     % But `\ ' produces the large typewriter interword space.
   2899      1.1  mrg     \def\ {{\spaceskip = 0pt{} }}%
   2900      1.1  mrg     %
   2901      1.1  mrg     % Turn off hyphenation.
   2902      1.1  mrg     \nohyphenation
   2903      1.1  mrg     %
   2904      1.1  mrg     \rawbackslash
   2905      1.1  mrg     \plainfrenchspacing
   2906      1.1  mrg     #1%
   2907      1.1  mrg   }%
   2908      1.1  mrg   \null % reset spacefactor to 1000
   2909      1.1  mrg }
   2910      1.1  mrg 
   2911  1.1.1.3  mrg % We *must* turn on hyphenation at `-' and `_' in @code.
   2912      1.1  mrg % (But see \codedashfinish below.)
   2913      1.1  mrg % Otherwise, it is too hard to avoid overfull hboxes
   2914  1.1.1.2  mrg % in the Emacs manual, the Library manual, etc.
   2915      1.1  mrg %
   2916      1.1  mrg % Unfortunately, TeX uses one parameter (\hyphenchar) to control
   2917      1.1  mrg % both hyphenation at - and hyphenation within words.
   2918  1.1.1.3  mrg % We must therefore turn them both off (\tclose does that)
   2919      1.1  mrg % and arrange explicitly to hyphenate at a dash. -- rms.
   2920      1.1  mrg {
   2921      1.1  mrg   \catcode`\-=\active \catcode`\_=\active
   2922      1.1  mrg   \catcode`\'=\active \catcode`\`=\active
   2923      1.1  mrg   \global\let'=\rq \global\let`=\lq  % default definitions
   2924      1.1  mrg   %
   2925      1.1  mrg   \global\def\code{\begingroup
   2926      1.1  mrg     \setupmarkupstyle{code}%
   2927      1.1  mrg     % The following should really be moved into \setupmarkupstyle handlers.
   2928      1.1  mrg     \catcode\dashChar=\active  \catcode\underChar=\active
   2929      1.1  mrg     \ifallowcodebreaks
   2930      1.1  mrg      \let-\codedash
   2931      1.1  mrg      \let_\codeunder
   2932  1.1.1.2  mrg     \else
   2933      1.1  mrg      \let-\normaldash
   2934      1.1  mrg      \let_\realunder
   2935  1.1.1.3  mrg     \fi
   2936  1.1.1.3  mrg     % Given -foo (with a single dash), we do not want to allow a break
   2937  1.1.1.3  mrg     % after the hyphen.
   2938  1.1.1.3  mrg     \global\let\codedashprev=\codedash
   2939      1.1  mrg     %
   2940      1.1  mrg     \codex
   2941  1.1.1.3  mrg   }
   2942  1.1.1.3  mrg   %
   2943  1.1.1.3  mrg   \gdef\codedash{\futurelet\next\codedashfinish}
   2944  1.1.1.3  mrg   \gdef\codedashfinish{%
   2945  1.1.1.3  mrg     \normaldash % always output the dash character itself.
   2946  1.1.1.3  mrg     % 
   2947  1.1.1.3  mrg     % Now, output a discretionary to allow a line break, unless
   2948  1.1.1.3  mrg     % (a) the next character is a -, or
   2949  1.1.1.3  mrg     % (b) the preceding character is a -.
   2950  1.1.1.3  mrg     % E.g., given --posix, we do not want to allow a break after either -.
   2951  1.1.1.3  mrg     % Given --foo-bar, we do want to allow a break between the - and the b.
   2952  1.1.1.3  mrg     \ifx\next\codedash \else
   2953  1.1.1.3  mrg       \ifx\codedashprev\codedash 
   2954  1.1.1.3  mrg       \else \discretionary{}{}{}\fi
   2955  1.1.1.3  mrg     \fi
   2956  1.1.1.3  mrg     % we need the space after the = for the case when \next itself is a
   2957  1.1.1.3  mrg     % space token; it would get swallowed otherwise.  As in @code{- a}.
   2958  1.1.1.3  mrg     \global\let\codedashprev= \next
   2959      1.1  mrg   }
   2960  1.1.1.3  mrg }
   2961  1.1.1.3  mrg \def\normaldash{-}
   2962      1.1  mrg %
   2963      1.1  mrg \def\codex #1{\tclose{#1}\endgroup}
   2964      1.1  mrg 
   2965      1.1  mrg \def\codeunder{%
   2966      1.1  mrg   % this is all so @math{@code{var_name}+1} can work.  In math mode, _
   2967      1.1  mrg   % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
   2968      1.1  mrg   % will therefore expand the active definition of _, which is us
   2969      1.1  mrg   % (inside @code that is), therefore an endless loop.
   2970      1.1  mrg   \ifusingtt{\ifmmode
   2971      1.1  mrg                \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_.
   2972      1.1  mrg              \else\normalunderscore \fi
   2973      1.1  mrg              \discretionary{}{}{}}%
   2974      1.1  mrg             {\_}%
   2975      1.1  mrg }
   2976      1.1  mrg 
   2977  1.1.1.2  mrg % An additional complication: the above will allow breaks after, e.g.,
   2978  1.1.1.2  mrg % each of the four underscores in __typeof__.  This is bad.
   2979  1.1.1.2  mrg % @allowcodebreaks provides a document-level way to turn breaking at -
   2980      1.1  mrg % and _ on and off.
   2981      1.1  mrg %
   2982      1.1  mrg \newif\ifallowcodebreaks  \allowcodebreakstrue
   2983      1.1  mrg 
   2984      1.1  mrg \def\keywordtrue{true}
   2985      1.1  mrg \def\keywordfalse{false}
   2986      1.1  mrg 
   2987      1.1  mrg \parseargdef\allowcodebreaks{%
   2988      1.1  mrg   \def\txiarg{#1}%
   2989      1.1  mrg   \ifx\txiarg\keywordtrue
   2990      1.1  mrg     \allowcodebreakstrue
   2991      1.1  mrg   \else\ifx\txiarg\keywordfalse
   2992      1.1  mrg     \allowcodebreaksfalse
   2993      1.1  mrg   \else
   2994      1.1  mrg     \errhelp = \EMsimple
   2995      1.1  mrg     \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}%
   2996      1.1  mrg   \fi\fi
   2997      1.1  mrg }
   2998  1.1.1.2  mrg 
   2999  1.1.1.2  mrg % For @command, @env, @file, @option quotes seem unnecessary,
   3000  1.1.1.2  mrg % so use \code rather than \samp.
   3001  1.1.1.2  mrg \let\command=\code
   3002  1.1.1.2  mrg \let\env=\code
   3003  1.1.1.2  mrg \let\file=\code
   3004  1.1.1.2  mrg \let\option=\code
   3005  1.1.1.3  mrg 
   3006  1.1.1.3  mrg % @uref (abbreviation for `urlref') aka @url takes an optional
   3007  1.1.1.3  mrg % (comma-separated) second argument specifying the text to display and
   3008  1.1.1.3  mrg % an optional third arg as text to display instead of (rather than in
   3009  1.1.1.3  mrg % addition to) the url itself.  First (mandatory) arg is the url.
   3010  1.1.1.3  mrg 
   3011  1.1.1.3  mrg % TeX-only option to allow changing PDF output to show only the second
   3012  1.1.1.3  mrg % arg (if given), and not the url (which is then just the link target).
   3013  1.1.1.3  mrg \newif\ifurefurlonlylink
   3014  1.1.1.3  mrg 
   3015  1.1.1.3  mrg % The main macro is \urefbreak, which allows breaking at expected
   3016  1.1.1.3  mrg % places within the url.  (There used to be another version, which
   3017      1.1  mrg % didn't support automatic breaking.)
   3018      1.1  mrg \def\urefbreak{\begingroup \urefcatcodes \dourefbreak}
   3019  1.1.1.3  mrg \let\uref=\urefbreak
   3020      1.1  mrg %
   3021      1.1  mrg \def\dourefbreak#1{\urefbreakfinish #1,,,\finish}
   3022      1.1  mrg \def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example
   3023      1.1  mrg   \unsepspaces
   3024      1.1  mrg   \pdfurl{#1}%
   3025      1.1  mrg   \setbox0 = \hbox{\ignorespaces #3}%
   3026      1.1  mrg   \ifdim\wd0 > 0pt
   3027      1.1  mrg     \unhbox0 % third arg given, show only that
   3028  1.1.1.3  mrg   \else
   3029      1.1  mrg     \setbox0 = \hbox{\ignorespaces #2}% look for second arg
   3030      1.1  mrg     \ifdim\wd0 > 0pt
   3031  1.1.1.3  mrg       \ifpdf
   3032  1.1.1.3  mrg         % For pdfTeX and LuaTeX
   3033  1.1.1.3  mrg         \ifurefurlonlylink
   3034  1.1.1.3  mrg           % PDF plus option to not display url, show just arg
   3035  1.1.1.3  mrg           \unhbox0             
   3036  1.1.1.3  mrg         \else
   3037  1.1.1.3  mrg           % PDF, normally display both arg and url for consistency,
   3038  1.1.1.3  mrg           % visibility, if the pdf is eventually used to print, etc.
   3039  1.1.1.3  mrg           \unhbox0\ (\urefcode{#1})%
   3040      1.1  mrg         \fi
   3041  1.1.1.3  mrg       \else
   3042  1.1.1.3  mrg         \ifx\XeTeXrevision\thisisundefined
   3043  1.1.1.3  mrg           \unhbox0\ (\urefcode{#1})% DVI, always show arg and url
   3044  1.1.1.3  mrg         \else
   3045  1.1.1.3  mrg           % For XeTeX
   3046  1.1.1.3  mrg           \ifurefurlonlylink
   3047  1.1.1.3  mrg             % PDF plus option to not display url, show just arg
   3048  1.1.1.3  mrg             \unhbox0             
   3049  1.1.1.3  mrg           \else
   3050  1.1.1.3  mrg             % PDF, normally display both arg and url for consistency,
   3051  1.1.1.3  mrg             % visibility, if the pdf is eventually used to print, etc.
   3052  1.1.1.3  mrg             \unhbox0\ (\urefcode{#1})%
   3053  1.1.1.3  mrg           \fi
   3054      1.1  mrg         \fi
   3055      1.1  mrg       \fi
   3056      1.1  mrg     \else
   3057      1.1  mrg       \urefcode{#1}% only url given, so show it
   3058      1.1  mrg     \fi
   3059      1.1  mrg   \fi
   3060      1.1  mrg   \endlink
   3061      1.1  mrg \endgroup}
   3062      1.1  mrg 
   3063      1.1  mrg % Allow line breaks around only a few characters (only).
   3064  1.1.1.3  mrg \def\urefcatcodes{%
   3065  1.1.1.3  mrg   \catcode`\&=\active \catcode`\.=\active
   3066  1.1.1.3  mrg   \catcode`\#=\active \catcode`\?=\active
   3067      1.1  mrg   \catcode`\/=\active
   3068      1.1  mrg }
   3069      1.1  mrg {
   3070      1.1  mrg   \urefcatcodes
   3071      1.1  mrg   %
   3072      1.1  mrg   \global\def\urefcode{\begingroup
   3073      1.1  mrg     \setupmarkupstyle{code}%
   3074      1.1  mrg     \urefcatcodes
   3075      1.1  mrg     \let&\urefcodeamp
   3076      1.1  mrg     \let.\urefcodedot
   3077      1.1  mrg     \let#\urefcodehash
   3078      1.1  mrg     \let?\urefcodequest
   3079      1.1  mrg     \let/\urefcodeslash
   3080      1.1  mrg     \codex
   3081      1.1  mrg   }
   3082      1.1  mrg   %
   3083      1.1  mrg   % By default, they are just regular characters.
   3084      1.1  mrg   \global\def&{\normalamp}
   3085      1.1  mrg   \global\def.{\normaldot}
   3086      1.1  mrg   \global\def#{\normalhash}
   3087      1.1  mrg   \global\def?{\normalquest}
   3088      1.1  mrg   \global\def/{\normalslash}
   3089      1.1  mrg }
   3090      1.1  mrg 
   3091      1.1  mrg % we put a little stretch before and after the breakable chars, to help
   3092      1.1  mrg % line breaking of long url's.  The unequal skips make look better in
   3093  1.1.1.3  mrg % cmtt at least, especially for dots.
   3094  1.1.1.3  mrg \def\urefprestretchamount{.13em}
   3095  1.1.1.3  mrg \def\urefpoststretchamount{.1em}
   3096  1.1.1.3  mrg \def\urefprestretch{\urefprebreak \hskip0pt plus\urefprestretchamount\relax}
   3097      1.1  mrg \def\urefpoststretch{\urefpostbreak \hskip0pt plus\urefprestretchamount\relax}
   3098      1.1  mrg %
   3099      1.1  mrg \def\urefcodeamp{\urefprestretch \&\urefpoststretch}
   3100      1.1  mrg \def\urefcodedot{\urefprestretch .\urefpoststretch}
   3101      1.1  mrg \def\urefcodehash{\urefprestretch \#\urefpoststretch}
   3102      1.1  mrg \def\urefcodequest{\urefprestretch ?\urefpoststretch}
   3103      1.1  mrg \def\urefcodeslash{\futurelet\next\urefcodeslashfinish}
   3104      1.1  mrg {
   3105      1.1  mrg   \catcode`\/=\active
   3106      1.1  mrg   \global\def\urefcodeslashfinish{%
   3107      1.1  mrg     \urefprestretch \slashChar
   3108      1.1  mrg     % Allow line break only after the final / in a sequence of
   3109      1.1  mrg     % slashes, to avoid line break between the slashes in http://.
   3110      1.1  mrg     \ifx\next/\else \urefpoststretch \fi
   3111      1.1  mrg   }
   3112      1.1  mrg }
   3113      1.1  mrg 
   3114      1.1  mrg % One more complication: by default we'll break after the special
   3115      1.1  mrg % characters, but some people like to break before the special chars, so
   3116      1.1  mrg % allow that.  Also allow no breaking at all, for manual control.
   3117      1.1  mrg % 
   3118      1.1  mrg \parseargdef\urefbreakstyle{%
   3119      1.1  mrg   \def\txiarg{#1}%
   3120      1.1  mrg   \ifx\txiarg\wordnone
   3121      1.1  mrg     \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak}
   3122      1.1  mrg   \else\ifx\txiarg\wordbefore
   3123      1.1  mrg     \def\urefprebreak{\allowbreak}\def\urefpostbreak{\nobreak}
   3124      1.1  mrg   \else\ifx\txiarg\wordafter
   3125      1.1  mrg     \def\urefprebreak{\nobreak}\def\urefpostbreak{\allowbreak}
   3126      1.1  mrg   \else
   3127      1.1  mrg     \errhelp = \EMsimple
   3128      1.1  mrg     \errmessage{Unknown @urefbreakstyle setting `\txiarg'}%
   3129      1.1  mrg   \fi\fi\fi
   3130      1.1  mrg }
   3131      1.1  mrg \def\wordafter{after}
   3132      1.1  mrg \def\wordbefore{before}
   3133      1.1  mrg \def\wordnone{none}
   3134      1.1  mrg 
   3135      1.1  mrg \urefbreakstyle after
   3136      1.1  mrg 
   3137      1.1  mrg % @url synonym for @uref, since that's how everyone uses it.
   3138      1.1  mrg %
   3139      1.1  mrg \let\url=\uref
   3140      1.1  mrg 
   3141      1.1  mrg % rms does not like angle brackets --karl, 17may97.
   3142      1.1  mrg % So now @email is just like @uref, unless we are pdf.
   3143      1.1  mrg %
   3144      1.1  mrg %\def\email#1{\angleleft{\tt #1}\angleright}
   3145      1.1  mrg \ifpdf
   3146      1.1  mrg   \def\email#1{\doemail#1,,\finish}
   3147      1.1  mrg   \def\doemail#1,#2,#3\finish{\begingroup
   3148      1.1  mrg     \unsepspaces
   3149      1.1  mrg     \pdfurl{mailto:#1}%
   3150      1.1  mrg     \setbox0 = \hbox{\ignorespaces #2}%
   3151      1.1  mrg     \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
   3152      1.1  mrg     \endlink
   3153      1.1  mrg   \endgroup}
   3154  1.1.1.3  mrg \else
   3155  1.1.1.3  mrg   \ifx\XeTeXrevision\thisisundefined
   3156  1.1.1.3  mrg     \let\email=\uref
   3157  1.1.1.3  mrg   \else
   3158  1.1.1.3  mrg     \def\email#1{\doemail#1,,\finish}
   3159  1.1.1.3  mrg     \def\doemail#1,#2,#3\finish{\begingroup
   3160  1.1.1.3  mrg       \unsepspaces
   3161  1.1.1.3  mrg       \pdfurl{mailto:#1}%
   3162  1.1.1.3  mrg       \setbox0 = \hbox{\ignorespaces #2}%
   3163  1.1.1.3  mrg       \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
   3164  1.1.1.3  mrg       \endlink
   3165  1.1.1.3  mrg     \endgroup}
   3166      1.1  mrg   \fi
   3167      1.1  mrg \fi
   3168      1.1  mrg 
   3169      1.1  mrg % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
   3170      1.1  mrg %   `example' (@kbd uses ttsl only inside of @example and friends),
   3171      1.1  mrg %   or `code' (@kbd uses normal tty font always).
   3172      1.1  mrg \parseargdef\kbdinputstyle{%
   3173      1.1  mrg   \def\txiarg{#1}%
   3174      1.1  mrg   \ifx\txiarg\worddistinct
   3175      1.1  mrg     \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
   3176      1.1  mrg   \else\ifx\txiarg\wordexample
   3177      1.1  mrg     \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
   3178      1.1  mrg   \else\ifx\txiarg\wordcode
   3179      1.1  mrg     \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
   3180      1.1  mrg   \else
   3181      1.1  mrg     \errhelp = \EMsimple
   3182      1.1  mrg     \errmessage{Unknown @kbdinputstyle setting `\txiarg'}%
   3183      1.1  mrg   \fi\fi\fi
   3184      1.1  mrg }
   3185      1.1  mrg \def\worddistinct{distinct}
   3186      1.1  mrg \def\wordexample{example}
   3187      1.1  mrg \def\wordcode{code}
   3188      1.1  mrg 
   3189      1.1  mrg % Default is `distinct'.
   3190      1.1  mrg \kbdinputstyle distinct
   3191  1.1.1.2  mrg 
   3192  1.1.1.2  mrg % @kbd is like @code, except that if the argument is just one @key command,
   3193  1.1.1.2  mrg % then @kbd has no effect.
   3194  1.1.1.2  mrg \def\kbd#1{{\def\look{#1}\expandafter\kbdsub\look??\par}}
   3195      1.1  mrg 
   3196  1.1.1.2  mrg \def\xkey{\key}
   3197  1.1.1.2  mrg \def\kbdsub#1#2#3\par{%
   3198  1.1.1.2  mrg   \def\one{#1}\def\three{#3}\def\threex{??}%
   3199  1.1.1.2  mrg   \ifx\one\xkey\ifx\threex\three \key{#2}%
   3200  1.1.1.2  mrg   \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
   3201  1.1.1.2  mrg   \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
   3202      1.1  mrg }
   3203  1.1.1.2  mrg 
   3204  1.1.1.2  mrg % definition of @key that produces a lozenge.  Doesn't adjust to text size.
   3205  1.1.1.2  mrg %\setfont\keyrm\rmshape{8}{1000}{OT1}
   3206  1.1.1.2  mrg %\font\keysy=cmsy9
   3207  1.1.1.2  mrg %\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
   3208  1.1.1.2  mrg %  \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
   3209  1.1.1.2  mrg %    \vbox{\hrule\kern-0.4pt
   3210  1.1.1.2  mrg %     \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
   3211  1.1.1.2  mrg %    \kern-0.4pt\hrule}%
   3212  1.1.1.2  mrg %  \kern-.06em\raise0.4pt\hbox{\angleright}}}}
   3213  1.1.1.2  mrg 
   3214  1.1.1.2  mrg % definition of @key with no lozenge.  If the current font is already
   3215  1.1.1.2  mrg % monospace, don't change it; that way, we respect @kbdinputstyle.  But
   3216  1.1.1.2  mrg % if it isn't monospace, then use \tt.
   3217  1.1.1.2  mrg %
   3218  1.1.1.2  mrg \def\key#1{{\setupmarkupstyle{key}%
   3219  1.1.1.2  mrg   \nohyphenation
   3220  1.1.1.2  mrg   \ifmonospace\else\tt\fi
   3221      1.1  mrg   #1}\null}
   3222      1.1  mrg 
   3223      1.1  mrg % @clicksequence{File @click{} Open ...}
   3224      1.1  mrg \def\clicksequence#1{\begingroup #1\endgroup}
   3225      1.1  mrg 
   3226      1.1  mrg % @clickstyle @arrow   (by default)
   3227      1.1  mrg \parseargdef\clickstyle{\def\click{#1}}
   3228      1.1  mrg \def\click{\arrow}
   3229      1.1  mrg 
   3230      1.1  mrg % Typeset a dimension, e.g., `in' or `pt'.  The only reason for the
   3231      1.1  mrg % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
   3232      1.1  mrg %
   3233      1.1  mrg \def\dmn#1{\thinspace #1}
   3234      1.1  mrg 
   3235      1.1  mrg % @acronym for "FBI", "NATO", and the like.
   3236      1.1  mrg % We print this one point size smaller, since it's intended for
   3237      1.1  mrg % all-uppercase.
   3238      1.1  mrg %
   3239      1.1  mrg \def\acronym#1{\doacronym #1,,\finish}
   3240  1.1.1.3  mrg \def\doacronym#1,#2,#3\finish{%
   3241      1.1  mrg   {\switchtolsize #1}%
   3242      1.1  mrg   \def\temp{#2}%
   3243      1.1  mrg   \ifx\temp\empty \else
   3244      1.1  mrg     \space ({\unsepspaces \ignorespaces \temp \unskip})%
   3245      1.1  mrg   \fi
   3246      1.1  mrg   \null % reset \spacefactor=1000
   3247      1.1  mrg }
   3248      1.1  mrg 
   3249      1.1  mrg % @abbr for "Comput. J." and the like.
   3250      1.1  mrg % No font change, but don't do end-of-sentence spacing.
   3251      1.1  mrg %
   3252      1.1  mrg \def\abbr#1{\doabbr #1,,\finish}
   3253      1.1  mrg \def\doabbr#1,#2,#3\finish{%
   3254      1.1  mrg   {\plainfrenchspacing #1}%
   3255      1.1  mrg   \def\temp{#2}%
   3256      1.1  mrg   \ifx\temp\empty \else
   3257      1.1  mrg     \space ({\unsepspaces \ignorespaces \temp \unskip})%
   3258      1.1  mrg   \fi
   3259      1.1  mrg   \null % reset \spacefactor=1000
   3260      1.1  mrg }
   3261      1.1  mrg 
   3262      1.1  mrg % @asis just yields its argument.  Used with @table, for example.
   3263      1.1  mrg %
   3264      1.1  mrg \def\asis#1{#1}
   3265      1.1  mrg 
   3266      1.1  mrg % @math outputs its argument in math mode.
   3267      1.1  mrg %
   3268      1.1  mrg % One complication: _ usually means subscripts, but it could also mean
   3269      1.1  mrg % an actual _ character, as in @math{@var{some_variable} + 1}.  So make
   3270      1.1  mrg % _ active, and distinguish by seeing if the current family is \slfam,
   3271      1.1  mrg % which is what @var uses.
   3272      1.1  mrg {
   3273      1.1  mrg   \catcode`\_ = \active
   3274      1.1  mrg   \gdef\mathunderscore{%
   3275      1.1  mrg     \catcode`\_=\active
   3276      1.1  mrg     \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
   3277      1.1  mrg   }
   3278      1.1  mrg }
   3279      1.1  mrg % Another complication: we want \\ (and @\) to output a math (or tt) \.
   3280      1.1  mrg % FYI, plain.tex uses \\ as a temporary control sequence (for no
   3281      1.1  mrg % particular reason), but this is not advertised and we don't care.
   3282      1.1  mrg %
   3283      1.1  mrg % The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
   3284      1.1  mrg \def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
   3285      1.1  mrg %
   3286  1.1.1.3  mrg \def\math{%
   3287  1.1.1.3  mrg   \ifmmode\else % only go into math if not in math mode already
   3288  1.1.1.3  mrg     \tex
   3289  1.1.1.3  mrg     \mathunderscore
   3290  1.1.1.3  mrg     \let\\ = \mathbackslash
   3291  1.1.1.3  mrg     \mathactive
   3292  1.1.1.3  mrg     % make the texinfo accent commands work in math mode
   3293  1.1.1.3  mrg     \let\"=\ddot
   3294  1.1.1.3  mrg     \let\'=\acute
   3295  1.1.1.3  mrg     \let\==\bar
   3296  1.1.1.3  mrg     \let\^=\hat
   3297  1.1.1.3  mrg     \let\`=\grave
   3298  1.1.1.3  mrg     \let\u=\breve
   3299  1.1.1.3  mrg     \let\v=\check
   3300  1.1.1.3  mrg     \let\~=\tilde
   3301  1.1.1.3  mrg     \let\dotaccent=\dot
   3302  1.1.1.3  mrg     % have to provide another name for sup operator
   3303  1.1.1.3  mrg     \let\mathopsup=\sup
   3304      1.1  mrg   $\expandafter\finishmath\fi
   3305      1.1  mrg }
   3306      1.1  mrg \def\finishmath#1{#1$\endgroup}  % Close the group opened by \tex.
   3307      1.1  mrg 
   3308      1.1  mrg % Some active characters (such as <) are spaced differently in math.
   3309      1.1  mrg % We have to reset their definitions in case the @math was an argument
   3310      1.1  mrg % to a command which sets the catcodes (such as @item or @section).
   3311      1.1  mrg %
   3312      1.1  mrg {
   3313      1.1  mrg   \catcode`^ = \active
   3314      1.1  mrg   \catcode`< = \active
   3315      1.1  mrg   \catcode`> = \active
   3316      1.1  mrg   \catcode`+ = \active
   3317      1.1  mrg   \catcode`' = \active
   3318      1.1  mrg   \gdef\mathactive{%
   3319      1.1  mrg     \let^ = \ptexhat
   3320      1.1  mrg     \let< = \ptexless
   3321      1.1  mrg     \let> = \ptexgtr
   3322      1.1  mrg     \let+ = \ptexplus
   3323      1.1  mrg     \let' = \ptexquoteright
   3324      1.1  mrg   }
   3325      1.1  mrg }
   3326  1.1.1.3  mrg 
   3327  1.1.1.3  mrg % for @sub and @sup, if in math mode, just do a normal sub/superscript.
   3328  1.1.1.3  mrg % If in text, use math to place as sub/superscript, but switch
   3329  1.1.1.3  mrg % into text mode, with smaller fonts.  This is a different font than the
   3330  1.1.1.3  mrg % one used for real math sub/superscripts (8pt vs. 7pt), but let's not
   3331  1.1.1.3  mrg % fix it (significant additions to font machinery) until someone notices.
   3332  1.1.1.3  mrg %
   3333  1.1.1.3  mrg \def\sub{\ifmmode \expandafter\sb \else \expandafter\finishsub\fi}
   3334  1.1.1.3  mrg \def\finishsub#1{$\sb{\hbox{\switchtolllsize #1}}$}%
   3335  1.1.1.3  mrg %
   3336  1.1.1.3  mrg \def\sup{\ifmmode \expandafter\ptexsp \else \expandafter\finishsup\fi}
   3337  1.1.1.2  mrg \def\finishsup#1{$\ptexsp{\hbox{\switchtolllsize #1}}$}%
   3338      1.1  mrg 
   3339      1.1  mrg % @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}.
   3340      1.1  mrg % Ignore unless FMTNAME == tex; then it is like @iftex and @tex,
   3341      1.1  mrg % except specified as a normal braced arg, so no newlines to worry about.
   3342      1.1  mrg % 
   3343      1.1  mrg \def\outfmtnametex{tex}
   3344      1.1  mrg %
   3345      1.1  mrg \long\def\inlinefmt#1{\doinlinefmt #1,\finish}
   3346      1.1  mrg \long\def\doinlinefmt#1,#2,\finish{%
   3347      1.1  mrg   \def\inlinefmtname{#1}%
   3348      1.1  mrg   \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi
   3349  1.1.1.3  mrg }
   3350  1.1.1.3  mrg % 
   3351  1.1.1.3  mrg % @inlinefmtifelse{FMTNAME,THEN-TEXT,ELSE-TEXT} expands THEN-TEXT if
   3352  1.1.1.3  mrg % FMTNAME is tex, else ELSE-TEXT.
   3353  1.1.1.3  mrg \long\def\inlinefmtifelse#1{\doinlinefmtifelse #1,,,\finish}
   3354  1.1.1.3  mrg \long\def\doinlinefmtifelse#1,#2,#3,#4,\finish{%
   3355  1.1.1.3  mrg   \def\inlinefmtname{#1}%
   3356  1.1.1.3  mrg   \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\else \ignorespaces #3\fi
   3357  1.1.1.3  mrg }
   3358      1.1  mrg %
   3359      1.1  mrg % For raw, must switch into @tex before parsing the argument, to avoid
   3360      1.1  mrg % setting catcodes prematurely.  Doing it this way means that, for
   3361      1.1  mrg % example, @inlineraw{html, foo{bar} gets a parse error instead of being
   3362      1.1  mrg % ignored.  But this isn't important because if people want a literal
   3363      1.1  mrg % *right* brace they would have to use a command anyway, so they may as
   3364      1.1  mrg % well use a command to get a left brace too.  We could re-use the
   3365      1.1  mrg % delimiter character idea from \verb, but it seems like overkill.
   3366      1.1  mrg % 
   3367      1.1  mrg \long\def\inlineraw{\tex \doinlineraw}
   3368      1.1  mrg \long\def\doinlineraw#1{\doinlinerawtwo #1,\finish}
   3369      1.1  mrg \def\doinlinerawtwo#1,#2,\finish{%
   3370      1.1  mrg   \def\inlinerawname{#1}%
   3371      1.1  mrg   \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi
   3372      1.1  mrg   \endgroup % close group opened by \tex.
   3373      1.1  mrg }
   3374  1.1.1.3  mrg 
   3375  1.1.1.3  mrg % @inlineifset{VAR, TEXT} expands TEXT if VAR is @set.
   3376  1.1.1.3  mrg %
   3377  1.1.1.3  mrg \long\def\inlineifset#1{\doinlineifset #1,\finish}
   3378  1.1.1.3  mrg \long\def\doinlineifset#1,#2,\finish{%
   3379  1.1.1.3  mrg   \def\inlinevarname{#1}%
   3380  1.1.1.3  mrg   \expandafter\ifx\csname SET\inlinevarname\endcsname\relax
   3381  1.1.1.3  mrg   \else\ignorespaces#2\fi
   3382  1.1.1.3  mrg }
   3383  1.1.1.3  mrg 
   3384  1.1.1.3  mrg % @inlineifclear{VAR, TEXT} expands TEXT if VAR is not @set.
   3385  1.1.1.3  mrg %
   3386  1.1.1.3  mrg \long\def\inlineifclear#1{\doinlineifclear #1,\finish}
   3387  1.1.1.3  mrg \long\def\doinlineifclear#1,#2,\finish{%
   3388  1.1.1.3  mrg   \def\inlinevarname{#1}%
   3389  1.1.1.3  mrg   \expandafter\ifx\csname SET\inlinevarname\endcsname\relax \ignorespaces#2\fi
   3390  1.1.1.3  mrg }
   3391      1.1  mrg 
   3392      1.1  mrg 
   3393      1.1  mrg \message{glyphs,}
   3394      1.1  mrg % and logos.
   3395      1.1  mrg 
   3396      1.1  mrg % @@ prints an @, as does @atchar{}.
   3397      1.1  mrg \def\@{\char64 }
   3398      1.1  mrg \let\atchar=\@
   3399      1.1  mrg 
   3400  1.1.1.3  mrg % @{ @} @lbracechar{} @rbracechar{} all generate brace characters.
   3401  1.1.1.3  mrg \def\lbracechar{{\ifmonospace\char123\else\ensuremath\lbrace\fi}}
   3402  1.1.1.3  mrg \def\rbracechar{{\ifmonospace\char125\else\ensuremath\rbrace\fi}}
   3403  1.1.1.3  mrg \let\{=\lbracechar
   3404      1.1  mrg \let\}=\rbracechar
   3405      1.1  mrg 
   3406      1.1  mrg % @comma{} to avoid , parsing problems.
   3407      1.1  mrg \let\comma = ,
   3408      1.1  mrg 
   3409      1.1  mrg % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
   3410      1.1  mrg % Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
   3411      1.1  mrg \let\, = \ptexc
   3412      1.1  mrg \let\dotaccent = \ptexdot
   3413      1.1  mrg \def\ringaccent#1{{\accent23 #1}}
   3414      1.1  mrg \let\tieaccent = \ptext
   3415      1.1  mrg \let\ubaraccent = \ptexb
   3416      1.1  mrg \let\udotaccent = \d
   3417      1.1  mrg 
   3418      1.1  mrg % Other special characters: @questiondown @exclamdown @ordf @ordm
   3419      1.1  mrg % Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
   3420      1.1  mrg \def\questiondown{?`}
   3421  1.1.1.3  mrg \def\exclamdown{!`}
   3422  1.1.1.3  mrg \def\ordf{\leavevmode\raise1ex\hbox{\switchtolllsize \underbar{a}}}
   3423      1.1  mrg \def\ordm{\leavevmode\raise1ex\hbox{\switchtolllsize \underbar{o}}}
   3424      1.1  mrg 
   3425      1.1  mrg % Dotless i and dotless j, used for accents.
   3426      1.1  mrg \def\imacro{i}
   3427      1.1  mrg \def\jmacro{j}
   3428      1.1  mrg \def\dotless#1{%
   3429      1.1  mrg   \def\temp{#1}%
   3430      1.1  mrg   \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi
   3431      1.1  mrg   \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi
   3432      1.1  mrg   \else \errmessage{@dotless can be used only with i or j}%
   3433      1.1  mrg   \fi\fi
   3434      1.1  mrg }
   3435      1.1  mrg 
   3436      1.1  mrg % The \TeX{} logo, as in plain, but resetting the spacing so that a
   3437      1.1  mrg % period following counts as ending a sentence.  (Idea found in latex.)
   3438      1.1  mrg %
   3439      1.1  mrg \edef\TeX{\TeX \spacefactor=1000 }
   3440      1.1  mrg 
   3441      1.1  mrg % @LaTeX{} logo.  Not quite the same results as the definition in
   3442      1.1  mrg % latex.ltx, since we use a different font for the raised A; it's most
   3443      1.1  mrg % convenient for us to use an explicitly smaller font, rather than using
   3444      1.1  mrg % the \scriptstyle font (since we don't reset \scriptstyle and
   3445      1.1  mrg % \scriptscriptstyle).
   3446      1.1  mrg %
   3447      1.1  mrg \def\LaTeX{%
   3448      1.1  mrg   L\kern-.36em
   3449      1.1  mrg   {\setbox0=\hbox{T}%
   3450      1.1  mrg    \vbox to \ht0{\hbox{%
   3451  1.1.1.3  mrg      \ifx\textnominalsize\xwordpt
   3452      1.1  mrg        % for 10pt running text, lllsize (8pt) is too small for the A in LaTeX.
   3453      1.1  mrg        % Revert to plain's \scriptsize, which is 7pt.
   3454      1.1  mrg        \count255=\the\fam $\fam\count255 \scriptstyle A$%
   3455      1.1  mrg      \else
   3456  1.1.1.3  mrg        % For 11pt, we can use our lllsize.
   3457      1.1  mrg        \switchtolllsize A%
   3458      1.1  mrg      \fi
   3459      1.1  mrg      }%
   3460      1.1  mrg      \vss
   3461      1.1  mrg   }}%
   3462      1.1  mrg   \kern-.15em
   3463      1.1  mrg   \TeX
   3464      1.1  mrg }
   3465  1.1.1.3  mrg 
   3466  1.1.1.3  mrg % Some math mode symbols.  Define \ensuremath to switch into math mode
   3467  1.1.1.3  mrg % unless we are already there.  Expansion tricks may not be needed here,
   3468  1.1.1.3  mrg % but safer, and can't hurt.
   3469  1.1.1.3  mrg \def\ensuremath{\ifmmode \expandafter\asis \else\expandafter\ensuredmath \fi}
   3470  1.1.1.3  mrg \def\ensuredmath#1{$\relax#1$}
   3471  1.1.1.3  mrg %
   3472  1.1.1.3  mrg \def\bullet{\ensuremath\ptexbullet}
   3473  1.1.1.3  mrg \def\geq{\ensuremath\ge}
   3474  1.1.1.3  mrg \def\leq{\ensuremath\le}
   3475      1.1  mrg \def\minus{\ensuremath-}
   3476      1.1  mrg 
   3477      1.1  mrg % @dots{} outputs an ellipsis using the current font.
   3478      1.1  mrg % We do .5em per period so that it has the same spacing in the cm
   3479      1.1  mrg % typewriter fonts as three actual period characters; on the other hand,
   3480      1.1  mrg % in other typewriter fonts three periods are wider than 1.5em.  So do
   3481      1.1  mrg % whichever is larger.
   3482      1.1  mrg %
   3483      1.1  mrg \def\dots{%
   3484      1.1  mrg   \leavevmode
   3485      1.1  mrg   \setbox0=\hbox{...}% get width of three periods
   3486      1.1  mrg   \ifdim\wd0 > 1.5em
   3487      1.1  mrg     \dimen0 = \wd0
   3488      1.1  mrg   \else
   3489      1.1  mrg     \dimen0 = 1.5em
   3490      1.1  mrg   \fi
   3491      1.1  mrg   \hbox to \dimen0{%
   3492      1.1  mrg     \hskip 0pt plus.25fil
   3493      1.1  mrg     .\hskip 0pt plus1fil
   3494      1.1  mrg     .\hskip 0pt plus1fil
   3495      1.1  mrg     .\hskip 0pt plus.5fil
   3496      1.1  mrg   }%
   3497      1.1  mrg }
   3498      1.1  mrg 
   3499      1.1  mrg % @enddots{} is an end-of-sentence ellipsis.
   3500      1.1  mrg %
   3501      1.1  mrg \def\enddots{%
   3502      1.1  mrg   \dots
   3503      1.1  mrg   \spacefactor=\endofsentencespacefactor
   3504      1.1  mrg }
   3505      1.1  mrg 
   3506      1.1  mrg % @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
   3507      1.1  mrg %
   3508      1.1  mrg % Since these characters are used in examples, they should be an even number of
   3509      1.1  mrg % \tt widths. Each \tt character is 1en, so two makes it 1em.
   3510      1.1  mrg %
   3511      1.1  mrg \def\point{$\star$}
   3512      1.1  mrg \def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}}
   3513      1.1  mrg \def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
   3514      1.1  mrg \def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}}
   3515      1.1  mrg \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
   3516      1.1  mrg \def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}}
   3517      1.1  mrg 
   3518      1.1  mrg % The @error{} command.
   3519      1.1  mrg % Adapted from the TeXbook's \boxit.
   3520      1.1  mrg %
   3521      1.1  mrg \newbox\errorbox
   3522  1.1.1.3  mrg %
   3523      1.1  mrg {\ttfont \global\dimen0 = 3em}% Width of the box.
   3524      1.1  mrg \dimen2 = .55pt % Thickness of rules
   3525      1.1  mrg % The text. (`r' is open on the right, `e' somewhat less so on the left.)
   3526      1.1  mrg \setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt}
   3527      1.1  mrg %
   3528      1.1  mrg \setbox\errorbox=\hbox to \dimen0{\hfil
   3529      1.1  mrg    \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
   3530      1.1  mrg    \advance\hsize by -2\dimen2 % Rules.
   3531      1.1  mrg    \vbox{%
   3532      1.1  mrg       \hrule height\dimen2
   3533      1.1  mrg       \hbox{\vrule width\dimen2 \kern3pt          % Space to left of text.
   3534      1.1  mrg          \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
   3535      1.1  mrg          \kern3pt\vrule width\dimen2}% Space to right.
   3536      1.1  mrg       \hrule height\dimen2}
   3537      1.1  mrg     \hfil}
   3538      1.1  mrg %
   3539      1.1  mrg \def\error{\leavevmode\lower.7ex\copy\errorbox}
   3540      1.1  mrg 
   3541      1.1  mrg % @pounds{} is a sterling sign, which Knuth put in the CM italic font.
   3542      1.1  mrg %
   3543      1.1  mrg \def\pounds{{\it\$}}
   3544      1.1  mrg 
   3545      1.1  mrg % @euro{} comes from a separate font, depending on the current style.
   3546      1.1  mrg % We use the free feym* fonts from the eurosym package by Henrik
   3547      1.1  mrg % Theiling, which support regular, slanted, bold and bold slanted (and
   3548      1.1  mrg % "outlined" (blackboard board, sort of) versions, which we don't need).
   3549      1.1  mrg % It is available from http://www.ctan.org/tex-archive/fonts/eurosym.
   3550      1.1  mrg %
   3551      1.1  mrg % Although only regular is the truly official Euro symbol, we ignore
   3552      1.1  mrg % that.  The Euro is designed to be slightly taller than the regular
   3553      1.1  mrg % font height.
   3554      1.1  mrg %
   3555      1.1  mrg % feymr - regular
   3556      1.1  mrg % feymo - slanted
   3557      1.1  mrg % feybr - bold
   3558      1.1  mrg % feybo - bold slanted
   3559      1.1  mrg %
   3560      1.1  mrg % There is no good (free) typewriter version, to my knowledge.
   3561      1.1  mrg % A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide.
   3562      1.1  mrg % Hmm.
   3563      1.1  mrg %
   3564      1.1  mrg % Also doesn't work in math.  Do we need to do math with euro symbols?
   3565      1.1  mrg % Hope not.
   3566      1.1  mrg %
   3567      1.1  mrg %
   3568      1.1  mrg \def\euro{{\eurofont e}}
   3569      1.1  mrg \def\eurofont{%
   3570      1.1  mrg   % We set the font at each command, rather than predefining it in
   3571      1.1  mrg   % \textfonts and the other font-switching commands, so that
   3572      1.1  mrg   % installations which never need the symbol don't have to have the
   3573      1.1  mrg   % font installed.
   3574      1.1  mrg   %
   3575      1.1  mrg   % There is only one designed size (nominal 10pt), so we always scale
   3576      1.1  mrg   % that to the current nominal size.
   3577      1.1  mrg   %
   3578      1.1  mrg   % By the way, simply using "at 1em" works for cmr10 and the like, but
   3579      1.1  mrg   % does not work for cmbx10 and other extended/shrunken fonts.
   3580      1.1  mrg   %
   3581      1.1  mrg   \def\eurosize{\csname\curfontsize nominalsize\endcsname}%
   3582      1.1  mrg   %
   3583      1.1  mrg   \ifx\curfontstyle\bfstylename
   3584      1.1  mrg     % bold:
   3585      1.1  mrg     \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize
   3586      1.1  mrg   \else
   3587      1.1  mrg     % regular:
   3588      1.1  mrg     \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize
   3589      1.1  mrg   \fi
   3590      1.1  mrg   \thiseurofont
   3591      1.1  mrg }
   3592      1.1  mrg 
   3593      1.1  mrg % Glyphs from the EC fonts.  We don't use \let for the aliases, because
   3594      1.1  mrg % sometimes we redefine the original macro, and the alias should reflect
   3595      1.1  mrg % the redefinition.
   3596      1.1  mrg %
   3597      1.1  mrg % Use LaTeX names for the Icelandic letters.
   3598      1.1  mrg \def\DH{{\ecfont \char"D0}} % Eth
   3599      1.1  mrg \def\dh{{\ecfont \char"F0}} % eth
   3600      1.1  mrg \def\TH{{\ecfont \char"DE}} % Thorn
   3601      1.1  mrg \def\th{{\ecfont \char"FE}} % thorn
   3602      1.1  mrg %
   3603      1.1  mrg \def\guillemetleft{{\ecfont \char"13}}
   3604      1.1  mrg \def\guillemotleft{\guillemetleft}
   3605      1.1  mrg \def\guillemetright{{\ecfont \char"14}}
   3606      1.1  mrg \def\guillemotright{\guillemetright}
   3607      1.1  mrg \def\guilsinglleft{{\ecfont \char"0E}}
   3608      1.1  mrg \def\guilsinglright{{\ecfont \char"0F}}
   3609      1.1  mrg \def\quotedblbase{{\ecfont \char"12}}
   3610      1.1  mrg \def\quotesinglbase{{\ecfont \char"0D}}
   3611      1.1  mrg %
   3612      1.1  mrg % This positioning is not perfect (see the ogonek LaTeX package), but
   3613      1.1  mrg % we have the precomposed glyphs for the most common cases.  We put the
   3614      1.1  mrg % tests to use those glyphs in the single \ogonek macro so we have fewer
   3615      1.1  mrg % dummy definitions to worry about for index entries, etc.
   3616      1.1  mrg %
   3617      1.1  mrg % ogonek is also used with other letters in Lithuanian (IOU), but using
   3618      1.1  mrg % the precomposed glyphs for those is not so easy since they aren't in
   3619      1.1  mrg % the same EC font.
   3620      1.1  mrg \def\ogonek#1{{%
   3621      1.1  mrg   \def\temp{#1}%
   3622      1.1  mrg   \ifx\temp\macrocharA\Aogonek
   3623      1.1  mrg   \else\ifx\temp\macrochara\aogonek
   3624      1.1  mrg   \else\ifx\temp\macrocharE\Eogonek
   3625      1.1  mrg   \else\ifx\temp\macrochare\eogonek
   3626      1.1  mrg   \else
   3627      1.1  mrg     \ecfont \setbox0=\hbox{#1}%
   3628      1.1  mrg     \ifdim\ht0=1ex\accent"0C #1%
   3629      1.1  mrg     \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}%
   3630      1.1  mrg     \fi
   3631      1.1  mrg   \fi\fi\fi\fi
   3632      1.1  mrg   }%
   3633      1.1  mrg }
   3634      1.1  mrg \def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A}
   3635      1.1  mrg \def\aogonek{{\ecfont \char"A1}}\def\macrochara{a}
   3636      1.1  mrg \def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E}
   3637      1.1  mrg \def\eogonek{{\ecfont \char"A6}}\def\macrochare{e}
   3638  1.1.1.3  mrg %
   3639  1.1.1.3  mrg % Use the European Computer Modern fonts (cm-super in outline format)
   3640  1.1.1.3  mrg % for non-CM glyphs.  That is ec* for regular text and tc* for the text
   3641  1.1.1.3  mrg % companion symbols (LaTeX TS1 encoding).  Both are part of the ec
   3642  1.1.1.3  mrg % package and follow the same conventions.
   3643  1.1.1.3  mrg % 
   3644  1.1.1.3  mrg \def\ecfont{\etcfont{e}}
   3645  1.1.1.3  mrg \def\tcfont{\etcfont{t}}
   3646  1.1.1.3  mrg %
   3647      1.1  mrg \def\etcfont#1{%
   3648      1.1  mrg   % We can't distinguish serif/sans and italic/slanted, but this
   3649      1.1  mrg   % is used for crude hacks anyway (like adding French and German
   3650      1.1  mrg   % quotes to documents typeset with CM, where we lose kerning), so
   3651      1.1  mrg   % hopefully nobody will notice/care.
   3652      1.1  mrg   \edef\ecsize{\csname\curfontsize ecsize\endcsname}%
   3653  1.1.1.2  mrg   \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}%
   3654  1.1.1.2  mrg   \ifmonospace
   3655  1.1.1.3  mrg     % typewriter:
   3656  1.1.1.2  mrg     \font\thisecfont = #1ctt\ecsize \space at \nominalsize
   3657  1.1.1.2  mrg   \else
   3658  1.1.1.2  mrg     \ifx\curfontstyle\bfstylename
   3659  1.1.1.3  mrg       % bold:
   3660  1.1.1.2  mrg       \font\thisecfont = #1cb\ifusingit{i}{x}\ecsize \space at \nominalsize
   3661  1.1.1.2  mrg     \else
   3662  1.1.1.3  mrg       % regular:
   3663  1.1.1.2  mrg       \font\thisecfont = #1c\ifusingit{ti}{rm}\ecsize \space at \nominalsize
   3664      1.1  mrg     \fi
   3665      1.1  mrg   \fi
   3666      1.1  mrg   \thisecfont
   3667      1.1  mrg }
   3668      1.1  mrg 
   3669      1.1  mrg % @registeredsymbol - R in a circle.  The font for the R should really
   3670      1.1  mrg % be smaller yet, but lllsize is the best we can do for now.
   3671      1.1  mrg % Adapted from the plain.tex definition of \copyright.
   3672      1.1  mrg %
   3673  1.1.1.3  mrg \def\registeredsymbol{%
   3674      1.1  mrg   $^{{\ooalign{\hfil\raise.07ex\hbox{\switchtolllsize R}%
   3675      1.1  mrg                \hfil\crcr\Orb}}%
   3676      1.1  mrg     }$%
   3677      1.1  mrg }
   3678      1.1  mrg 
   3679      1.1  mrg % @textdegree - the normal degrees sign.
   3680      1.1  mrg %
   3681      1.1  mrg \def\textdegree{$^\circ$}
   3682      1.1  mrg 
   3683      1.1  mrg % Laurent Siebenmann reports \Orb undefined with:
   3684      1.1  mrg %  Textures 1.7.7 (preloaded format=plain 93.10.14)  (68K)  16 APR 2004 02:38
   3685      1.1  mrg % so we'll define it if necessary.
   3686      1.1  mrg %
   3687      1.1  mrg \ifx\Orb\thisisundefined
   3688      1.1  mrg \def\Orb{\mathhexbox20D}
   3689      1.1  mrg \fi
   3690      1.1  mrg 
   3691      1.1  mrg % Quotes.
   3692      1.1  mrg \chardef\quotedblleft="5C
   3693      1.1  mrg \chardef\quotedblright=`\"
   3694      1.1  mrg \chardef\quoteleft=`\`
   3695      1.1  mrg \chardef\quoteright=`\'
   3696      1.1  mrg 
   3697      1.1  mrg 
   3698      1.1  mrg \message{page headings,}
   3699      1.1  mrg 
   3700      1.1  mrg \newskip\titlepagetopglue \titlepagetopglue = 1.5in
   3701      1.1  mrg \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
   3702      1.1  mrg 
   3703      1.1  mrg % First the title page.  Must do @settitle before @titlepage.
   3704      1.1  mrg \newif\ifseenauthor
   3705      1.1  mrg \newif\iffinishedtitlepage
   3706  1.1.1.3  mrg 
   3707  1.1.1.3  mrg % @setcontentsaftertitlepage used to do an implicit @contents or
   3708  1.1.1.3  mrg % @shortcontents after @end titlepage, but it is now obsolete.
   3709  1.1.1.3  mrg \def\setcontentsaftertitlepage{%
   3710  1.1.1.3  mrg   \errmessage{@setcontentsaftertitlepage has been removed as a Texinfo
   3711  1.1.1.3  mrg               command; move your @contents command if you want the contents
   3712  1.1.1.3  mrg               after the title page.}}%
   3713  1.1.1.3  mrg \def\setshortcontentsaftertitlepage{%
   3714  1.1.1.3  mrg   \errmessage{@setshortcontentsaftertitlepage has been removed as a Texinfo
   3715  1.1.1.3  mrg               command; move your @shortcontents and @contents commands if you 
   3716      1.1  mrg               want the contents after the title page.}}%
   3717      1.1  mrg 
   3718      1.1  mrg \parseargdef\shorttitlepage{%
   3719      1.1  mrg   \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}%
   3720      1.1  mrg   \endgroup\page\hbox{}\page}
   3721      1.1  mrg 
   3722      1.1  mrg \envdef\titlepage{%
   3723      1.1  mrg   % Open one extra group, as we want to close it in the middle of \Etitlepage.
   3724      1.1  mrg   \begingroup
   3725      1.1  mrg     \parindent=0pt \textfonts
   3726      1.1  mrg     % Leave some space at the very top of the page.
   3727      1.1  mrg     \vglue\titlepagetopglue
   3728      1.1  mrg     % No rule at page bottom unless we print one at the top with @title.
   3729      1.1  mrg     \finishedtitlepagetrue
   3730      1.1  mrg     %
   3731      1.1  mrg     % Most title ``pages'' are actually two pages long, with space
   3732      1.1  mrg     % at the top of the second.  We don't want the ragged left on the second.
   3733      1.1  mrg     \let\oldpage = \page
   3734      1.1  mrg     \def\page{%
   3735      1.1  mrg       \iffinishedtitlepage\else
   3736      1.1  mrg 	 \finishtitlepage
   3737      1.1  mrg       \fi
   3738      1.1  mrg       \let\page = \oldpage
   3739      1.1  mrg       \page
   3740      1.1  mrg       \null
   3741      1.1  mrg     }%
   3742      1.1  mrg }
   3743      1.1  mrg 
   3744      1.1  mrg \def\Etitlepage{%
   3745      1.1  mrg     \iffinishedtitlepage\else
   3746      1.1  mrg 	\finishtitlepage
   3747      1.1  mrg     \fi
   3748      1.1  mrg     % It is important to do the page break before ending the group,
   3749      1.1  mrg     % because the headline and footline are only empty inside the group.
   3750      1.1  mrg     % If we use the new definition of \page, we always get a blank page
   3751      1.1  mrg     % after the title page, which we certainly don't want.
   3752      1.1  mrg     \oldpage
   3753      1.1  mrg   \endgroup
   3754      1.1  mrg   %
   3755      1.1  mrg   % Need this before the \...aftertitlepage checks so that if they are
   3756      1.1  mrg   % in effect the toc pages will come out with page numbers.
   3757      1.1  mrg   \HEADINGSon
   3758      1.1  mrg }
   3759      1.1  mrg 
   3760      1.1  mrg \def\finishtitlepage{%
   3761      1.1  mrg   \vskip4pt \hrule height 2pt width \hsize
   3762      1.1  mrg   \vskip\titlepagebottomglue
   3763      1.1  mrg   \finishedtitlepagetrue
   3764      1.1  mrg }
   3765  1.1.1.2  mrg 
   3766  1.1.1.2  mrg % Settings used for typesetting titles: no hyphenation, no indentation,
   3767  1.1.1.3  mrg % don't worry much about spacing, ragged right.  This should be used
   3768  1.1.1.3  mrg % inside a \vbox, and fonts need to be set appropriately first. \par should
   3769  1.1.1.2  mrg % be specified before the end of the \vbox, since a vbox is a group.
   3770  1.1.1.2  mrg % 
   3771  1.1.1.3  mrg \def\raggedtitlesettings{%
   3772  1.1.1.2  mrg   \rm
   3773  1.1.1.2  mrg   \hyphenpenalty=10000
   3774  1.1.1.2  mrg   \parindent=0pt
   3775  1.1.1.2  mrg   \tolerance=5000
   3776  1.1.1.2  mrg   \ptexraggedright
   3777  1.1.1.2  mrg }
   3778      1.1  mrg 
   3779      1.1  mrg % Macros to be used within @titlepage:
   3780  1.1.1.3  mrg 
   3781      1.1  mrg \let\subtitlerm=\rmfont
   3782      1.1  mrg \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}
   3783      1.1  mrg 
   3784      1.1  mrg \parseargdef\title{%
   3785  1.1.1.2  mrg   \checkenv\titlepage
   3786      1.1  mrg   \vbox{\titlefonts \raggedtitlesettings #1\par}%
   3787      1.1  mrg   % print a rule at the page bottom also.
   3788      1.1  mrg   \finishedtitlepagefalse
   3789      1.1  mrg   \vskip4pt \hrule height 4pt width \hsize \vskip4pt
   3790      1.1  mrg }
   3791      1.1  mrg 
   3792      1.1  mrg \parseargdef\subtitle{%
   3793      1.1  mrg   \checkenv\titlepage
   3794      1.1  mrg   {\subtitlefont \rightline{#1}}%
   3795      1.1  mrg }
   3796      1.1  mrg 
   3797      1.1  mrg % @author should come last, but may come many times.
   3798      1.1  mrg % It can also be used inside @quotation.
   3799      1.1  mrg %
   3800      1.1  mrg \parseargdef\author{%
   3801      1.1  mrg   \def\temp{\quotation}%
   3802      1.1  mrg   \ifx\thisenv\temp
   3803      1.1  mrg     \def\quotationauthor{#1}% printed in \Equotation.
   3804      1.1  mrg   \else
   3805      1.1  mrg     \checkenv\titlepage
   3806  1.1.1.3  mrg     \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi
   3807      1.1  mrg     {\secfonts\rm \leftline{#1}}%
   3808      1.1  mrg   \fi
   3809      1.1  mrg }
   3810      1.1  mrg 
   3811      1.1  mrg 
   3812      1.1  mrg % Set up page headings and footings.
   3813      1.1  mrg 
   3814      1.1  mrg \let\thispage=\folio
   3815      1.1  mrg 
   3816      1.1  mrg \newtoks\evenheadline    % headline on even pages
   3817      1.1  mrg \newtoks\oddheadline     % headline on odd pages
   3818      1.1  mrg \newtoks\evenfootline    % footline on even pages
   3819      1.1  mrg \newtoks\oddfootline     % footline on odd pages
   3820  1.1.1.3  mrg 
   3821      1.1  mrg % Now make \makeheadline and \makefootline in Plain TeX use those variables
   3822      1.1  mrg \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
   3823      1.1  mrg                             \else \the\evenheadline \fi}}
   3824      1.1  mrg \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
   3825      1.1  mrg                             \else \the\evenfootline \fi}\HEADINGShook}
   3826      1.1  mrg \let\HEADINGShook=\relax
   3827      1.1  mrg 
   3828      1.1  mrg % Commands to set those variables.
   3829      1.1  mrg % For example, this is what  @headings on  does
   3830      1.1  mrg % @evenheading @thistitle|@thispage|@thischapter
   3831      1.1  mrg % @oddheading @thischapter|@thispage|@thistitle
   3832      1.1  mrg % @evenfooting @thisfile||
   3833      1.1  mrg % @oddfooting ||@thisfile
   3834      1.1  mrg 
   3835      1.1  mrg 
   3836      1.1  mrg \def\evenheading{\parsearg\evenheadingxxx}
   3837      1.1  mrg \def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish}
   3838      1.1  mrg \def\evenheadingyyy #1\|#2\|#3\|#4\finish{%
   3839      1.1  mrg \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
   3840      1.1  mrg 
   3841      1.1  mrg \def\oddheading{\parsearg\oddheadingxxx}
   3842      1.1  mrg \def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish}
   3843      1.1  mrg \def\oddheadingyyy #1\|#2\|#3\|#4\finish{%
   3844      1.1  mrg \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
   3845      1.1  mrg 
   3846      1.1  mrg \parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
   3847      1.1  mrg 
   3848      1.1  mrg \def\evenfooting{\parsearg\evenfootingxxx}
   3849      1.1  mrg \def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish}
   3850      1.1  mrg \def\evenfootingyyy #1\|#2\|#3\|#4\finish{%
   3851      1.1  mrg \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
   3852      1.1  mrg 
   3853      1.1  mrg \def\oddfooting{\parsearg\oddfootingxxx}
   3854      1.1  mrg \def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish}
   3855      1.1  mrg \def\oddfootingyyy #1\|#2\|#3\|#4\finish{%
   3856      1.1  mrg   \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
   3857      1.1  mrg   %
   3858      1.1  mrg   % Leave some space for the footline.  Hopefully ok to assume
   3859  1.1.1.3  mrg   % @evenfooting will not be used by itself.
   3860      1.1  mrg   \global\advance\txipageheight by -12pt
   3861      1.1  mrg   \global\advance\vsize by -12pt
   3862      1.1  mrg }
   3863      1.1  mrg 
   3864      1.1  mrg \parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}}
   3865      1.1  mrg 
   3866      1.1  mrg % @evenheadingmarks top     \thischapter <- chapter at the top of a page
   3867      1.1  mrg % @evenheadingmarks bottom  \thischapter <- chapter at the bottom of a page
   3868      1.1  mrg %
   3869      1.1  mrg % The same set of arguments for:
   3870      1.1  mrg %
   3871      1.1  mrg % @oddheadingmarks
   3872      1.1  mrg % @evenfootingmarks
   3873      1.1  mrg % @oddfootingmarks
   3874      1.1  mrg % @everyheadingmarks
   3875      1.1  mrg % @everyfootingmarks
   3876  1.1.1.3  mrg 
   3877  1.1.1.3  mrg % These define \getoddheadingmarks, \getevenheadingmarks,
   3878  1.1.1.3  mrg % \getoddfootingmarks, and \getevenfootingmarks, each to one of
   3879  1.1.1.3  mrg % \gettopheadingmarks, \getbottomheadingmarks.
   3880      1.1  mrg %
   3881      1.1  mrg \def\evenheadingmarks{\headingmarks{even}{heading}}
   3882      1.1  mrg \def\oddheadingmarks{\headingmarks{odd}{heading}}
   3883      1.1  mrg \def\evenfootingmarks{\headingmarks{even}{footing}}
   3884  1.1.1.3  mrg \def\oddfootingmarks{\headingmarks{odd}{footing}}
   3885      1.1  mrg \parseargdef\everyheadingmarks{\headingmarks{even}{heading}{#1}
   3886  1.1.1.3  mrg                           \headingmarks{odd}{heading}{#1} }
   3887      1.1  mrg \parseargdef\everyfootingmarks{\headingmarks{even}{footing}{#1}
   3888      1.1  mrg                           \headingmarks{odd}{footing}{#1} }
   3889      1.1  mrg % #1 = even/odd, #2 = heading/footing, #3 = top/bottom.
   3890      1.1  mrg \def\headingmarks#1#2#3 {%
   3891      1.1  mrg   \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname
   3892      1.1  mrg   \global\expandafter\let\csname get#1#2marks\endcsname \temp
   3893      1.1  mrg }
   3894      1.1  mrg 
   3895      1.1  mrg \everyheadingmarks bottom
   3896      1.1  mrg \everyfootingmarks bottom
   3897      1.1  mrg 
   3898      1.1  mrg % @headings double      turns headings on for double-sided printing.
   3899      1.1  mrg % @headings single      turns headings on for single-sided printing.
   3900      1.1  mrg % @headings off         turns them off.
   3901      1.1  mrg % @headings on          same as @headings double, retained for compatibility.
   3902      1.1  mrg % @headings after       turns on double-sided headings after this page.
   3903      1.1  mrg % @headings doubleafter turns on double-sided headings after this page.
   3904      1.1  mrg % @headings singleafter turns on single-sided headings after this page.
   3905      1.1  mrg % By default, they are off at the start of a document,
   3906      1.1  mrg % and turned `on' after @end titlepage.
   3907  1.1.1.3  mrg 
   3908      1.1  mrg \parseargdef\headings{\csname HEADINGS#1\endcsname}
   3909      1.1  mrg 
   3910      1.1  mrg \def\headingsoff{% non-global headings elimination
   3911      1.1  mrg   \evenheadline={\hfil}\evenfootline={\hfil}%
   3912      1.1  mrg    \oddheadline={\hfil}\oddfootline={\hfil}%
   3913      1.1  mrg }
   3914      1.1  mrg 
   3915      1.1  mrg \def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting
   3916      1.1  mrg \HEADINGSoff  % it's the default
   3917      1.1  mrg 
   3918      1.1  mrg % When we turn headings on, set the page number to 1.
   3919      1.1  mrg % For double-sided printing, put current file name in lower left corner,
   3920      1.1  mrg % chapter name on inside top of right hand pages, document
   3921      1.1  mrg % title on inside top of left hand pages, and page numbers on outside top
   3922      1.1  mrg % edge of all pages.
   3923      1.1  mrg \def\HEADINGSdouble{%
   3924      1.1  mrg \global\pageno=1
   3925      1.1  mrg \global\evenfootline={\hfil}
   3926      1.1  mrg \global\oddfootline={\hfil}
   3927  1.1.1.3  mrg \global\evenheadline={\line{\folio\hfil\thistitle}}
   3928      1.1  mrg \global\oddheadline={\line{\thischapterheading\hfil\folio}}
   3929      1.1  mrg \global\let\contentsalignmacro = \chapoddpage
   3930      1.1  mrg }
   3931      1.1  mrg \let\contentsalignmacro = \chappager
   3932      1.1  mrg 
   3933      1.1  mrg % For single-sided printing, chapter title goes across top left of page,
   3934      1.1  mrg % page number on top right.
   3935      1.1  mrg \def\HEADINGSsingle{%
   3936      1.1  mrg \global\pageno=1
   3937      1.1  mrg \global\evenfootline={\hfil}
   3938  1.1.1.3  mrg \global\oddfootline={\hfil}
   3939  1.1.1.3  mrg \global\evenheadline={\line{\thischapterheading\hfil\folio}}
   3940      1.1  mrg \global\oddheadline={\line{\thischapterheading\hfil\folio}}
   3941      1.1  mrg \global\let\contentsalignmacro = \chappager
   3942      1.1  mrg }
   3943      1.1  mrg \def\HEADINGSon{\HEADINGSdouble}
   3944      1.1  mrg 
   3945      1.1  mrg \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
   3946      1.1  mrg \let\HEADINGSdoubleafter=\HEADINGSafter
   3947      1.1  mrg \def\HEADINGSdoublex{%
   3948      1.1  mrg \global\evenfootline={\hfil}
   3949      1.1  mrg \global\oddfootline={\hfil}
   3950  1.1.1.3  mrg \global\evenheadline={\line{\folio\hfil\thistitle}}
   3951      1.1  mrg \global\oddheadline={\line{\thischapterheading\hfil\folio}}
   3952      1.1  mrg \global\let\contentsalignmacro = \chapoddpage
   3953      1.1  mrg }
   3954      1.1  mrg 
   3955      1.1  mrg \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
   3956      1.1  mrg \def\HEADINGSsinglex{%
   3957      1.1  mrg \global\evenfootline={\hfil}
   3958  1.1.1.3  mrg \global\oddfootline={\hfil}
   3959  1.1.1.3  mrg \global\evenheadline={\line{\thischapterheading\hfil\folio}}
   3960      1.1  mrg \global\oddheadline={\line{\thischapterheading\hfil\folio}}
   3961      1.1  mrg \global\let\contentsalignmacro = \chappager
   3962      1.1  mrg }
   3963      1.1  mrg 
   3964      1.1  mrg % Subroutines used in generating headings
   3965      1.1  mrg % This produces Day Month Year style of output.
   3966      1.1  mrg % Only define if not already defined, in case a txi-??.tex file has set
   3967      1.1  mrg % up a different format (e.g., txi-cs.tex does this).
   3968      1.1  mrg \ifx\today\thisisundefined
   3969      1.1  mrg \def\today{%
   3970      1.1  mrg   \number\day\space
   3971      1.1  mrg   \ifcase\month
   3972      1.1  mrg   \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
   3973      1.1  mrg   \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
   3974      1.1  mrg   \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
   3975      1.1  mrg   \fi
   3976      1.1  mrg   \space\number\year}
   3977      1.1  mrg \fi
   3978      1.1  mrg 
   3979      1.1  mrg % @settitle line...  specifies the title of the document, for headings.
   3980      1.1  mrg % It generates no output of its own.
   3981      1.1  mrg \def\thistitle{\putwordNoTitle}
   3982      1.1  mrg \def\settitle{\parsearg{\gdef\thistitle}}
   3983      1.1  mrg 
   3984      1.1  mrg 
   3985      1.1  mrg \message{tables,}
   3986      1.1  mrg % Tables -- @table, @ftable, @vtable, @item(x).
   3987      1.1  mrg 
   3988      1.1  mrg % default indentation of table text
   3989      1.1  mrg \newdimen\tableindent \tableindent=.8in
   3990      1.1  mrg % default indentation of @itemize and @enumerate text
   3991      1.1  mrg \newdimen\itemindent  \itemindent=.3in
   3992      1.1  mrg % margin between end of table item and start of table text.
   3993      1.1  mrg \newdimen\itemmargin  \itemmargin=.1in
   3994      1.1  mrg 
   3995      1.1  mrg % used internally for \itemindent minus \itemmargin
   3996      1.1  mrg \newdimen\itemmax
   3997      1.1  mrg 
   3998      1.1  mrg % Note @table, @ftable, and @vtable define @item, @itemx, etc., with
   3999      1.1  mrg % these defs.
   4000      1.1  mrg % They also define \itemindex
   4001      1.1  mrg % to index the item name in whatever manner is desired (perhaps none).
   4002      1.1  mrg 
   4003      1.1  mrg \newif\ifitemxneedsnegativevskip
   4004      1.1  mrg 
   4005      1.1  mrg \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
   4006      1.1  mrg 
   4007      1.1  mrg \def\internalBitem{\smallbreak \parsearg\itemzzz}
   4008      1.1  mrg \def\internalBitemx{\itemxpar \parsearg\itemzzz}
   4009      1.1  mrg 
   4010      1.1  mrg \def\itemzzz #1{\begingroup %
   4011      1.1  mrg   \advance\hsize by -\rightskip
   4012      1.1  mrg   \advance\hsize by -\tableindent
   4013      1.1  mrg   \setbox0=\hbox{\itemindicate{#1}}%
   4014      1.1  mrg   \itemindex{#1}%
   4015      1.1  mrg   \nobreak % This prevents a break before @itemx.
   4016      1.1  mrg   %
   4017      1.1  mrg   % If the item text does not fit in the space we have, put it on a line
   4018      1.1  mrg   % by itself, and do not allow a page break either before or after that
   4019      1.1  mrg   % line.  We do not start a paragraph here because then if the next
   4020      1.1  mrg   % command is, e.g., @kindex, the whatsit would get put into the
   4021      1.1  mrg   % horizontal list on a line by itself, resulting in extra blank space.
   4022      1.1  mrg   \ifdim \wd0>\itemmax
   4023      1.1  mrg     %
   4024      1.1  mrg     % Make this a paragraph so we get the \parskip glue and wrapping,
   4025      1.1  mrg     % but leave it ragged-right.
   4026      1.1  mrg     \begingroup
   4027      1.1  mrg       \advance\leftskip by-\tableindent
   4028      1.1  mrg       \advance\hsize by\tableindent
   4029      1.1  mrg       \advance\rightskip by0pt plus1fil\relax
   4030      1.1  mrg       \leavevmode\unhbox0\par
   4031      1.1  mrg     \endgroup
   4032      1.1  mrg     %
   4033      1.1  mrg     % We're going to be starting a paragraph, but we don't want the
   4034      1.1  mrg     % \parskip glue -- logically it's part of the @item we just started.
   4035      1.1  mrg     \nobreak \vskip-\parskip
   4036      1.1  mrg     %
   4037      1.1  mrg     % Stop a page break at the \parskip glue coming up.  However, if
   4038      1.1  mrg     % what follows is an environment such as @example, there will be no
   4039      1.1  mrg     % \parskip glue; then the negative vskip we just inserted would
   4040      1.1  mrg     % cause the example and the item to crash together.  So we use this
   4041      1.1  mrg     % bizarre value of 10001 as a signal to \aboveenvbreak to insert
   4042      1.1  mrg     % \parskip glue after all.  Section titles are handled this way also.
   4043      1.1  mrg     %
   4044      1.1  mrg     \penalty 10001
   4045      1.1  mrg     \endgroup
   4046      1.1  mrg     \itemxneedsnegativevskipfalse
   4047      1.1  mrg   \else
   4048      1.1  mrg     % The item text fits into the space.  Start a paragraph, so that the
   4049      1.1  mrg     % following text (if any) will end up on the same line.
   4050      1.1  mrg     \noindent
   4051      1.1  mrg     % Do this with kerns and \unhbox so that if there is a footnote in
   4052      1.1  mrg     % the item text, it can migrate to the main vertical list and
   4053      1.1  mrg     % eventually be printed.
   4054      1.1  mrg     \nobreak\kern-\tableindent
   4055      1.1  mrg     \dimen0 = \itemmax  \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
   4056      1.1  mrg     \unhbox0
   4057      1.1  mrg     \nobreak\kern\dimen0
   4058      1.1  mrg     \endgroup
   4059      1.1  mrg     \itemxneedsnegativevskiptrue
   4060      1.1  mrg   \fi
   4061      1.1  mrg }
   4062      1.1  mrg 
   4063      1.1  mrg \def\item{\errmessage{@item while not in a list environment}}
   4064      1.1  mrg \def\itemx{\errmessage{@itemx while not in a list environment}}
   4065      1.1  mrg 
   4066      1.1  mrg % @table, @ftable, @vtable.
   4067      1.1  mrg \envdef\table{%
   4068      1.1  mrg   \let\itemindex\gobble
   4069      1.1  mrg   \tablecheck{table}%
   4070      1.1  mrg }
   4071      1.1  mrg \envdef\ftable{%
   4072      1.1  mrg   \def\itemindex ##1{\doind {fn}{\code{##1}}}%
   4073      1.1  mrg   \tablecheck{ftable}%
   4074      1.1  mrg }
   4075      1.1  mrg \envdef\vtable{%
   4076      1.1  mrg   \def\itemindex ##1{\doind {vr}{\code{##1}}}%
   4077      1.1  mrg   \tablecheck{vtable}%
   4078      1.1  mrg }
   4079      1.1  mrg \def\tablecheck#1{%
   4080      1.1  mrg   \ifnum \the\catcode`\^^M=\active
   4081      1.1  mrg     \endgroup
   4082      1.1  mrg     \errmessage{This command won't work in this context; perhaps the problem is
   4083      1.1  mrg       that we are \inenvironment\thisenv}%
   4084      1.1  mrg     \def\next{\doignore{#1}}%
   4085      1.1  mrg   \else
   4086      1.1  mrg     \let\next\tablex
   4087      1.1  mrg   \fi
   4088      1.1  mrg   \next
   4089      1.1  mrg }
   4090      1.1  mrg \def\tablex#1{%
   4091      1.1  mrg   \def\itemindicate{#1}%
   4092      1.1  mrg   \parsearg\tabley
   4093      1.1  mrg }
   4094      1.1  mrg \def\tabley#1{%
   4095      1.1  mrg   {%
   4096      1.1  mrg     \makevalueexpandable
   4097      1.1  mrg     \edef\temp{\noexpand\tablez #1\space\space\space}%
   4098      1.1  mrg     \expandafter
   4099      1.1  mrg   }\temp \endtablez
   4100      1.1  mrg }
   4101      1.1  mrg \def\tablez #1 #2 #3 #4\endtablez{%
   4102      1.1  mrg   \aboveenvbreak
   4103      1.1  mrg   \ifnum 0#1>0 \advance \leftskip by #1\mil \fi
   4104      1.1  mrg   \ifnum 0#2>0 \tableindent=#2\mil \fi
   4105      1.1  mrg   \ifnum 0#3>0 \advance \rightskip by #3\mil \fi
   4106      1.1  mrg   \itemmax=\tableindent
   4107      1.1  mrg   \advance \itemmax by -\itemmargin
   4108      1.1  mrg   \advance \leftskip by \tableindent
   4109      1.1  mrg   \exdentamount=\tableindent
   4110      1.1  mrg   \parindent = 0pt
   4111      1.1  mrg   \parskip = \smallskipamount
   4112      1.1  mrg   \ifdim \parskip=0pt \parskip=2pt \fi
   4113      1.1  mrg   \let\item = \internalBitem
   4114      1.1  mrg   \let\itemx = \internalBitemx
   4115      1.1  mrg }
   4116      1.1  mrg \def\Etable{\endgraf\afterenvbreak}
   4117      1.1  mrg \let\Eftable\Etable
   4118      1.1  mrg \let\Evtable\Etable
   4119      1.1  mrg \let\Eitemize\Etable
   4120      1.1  mrg \let\Eenumerate\Etable
   4121      1.1  mrg 
   4122      1.1  mrg % This is the counter used by @enumerate, which is really @itemize
   4123      1.1  mrg 
   4124      1.1  mrg \newcount \itemno
   4125      1.1  mrg 
   4126      1.1  mrg \envdef\itemize{\parsearg\doitemize}
   4127      1.1  mrg 
   4128      1.1  mrg \def\doitemize#1{%
   4129      1.1  mrg   \aboveenvbreak
   4130      1.1  mrg   \itemmax=\itemindent
   4131      1.1  mrg   \advance\itemmax by -\itemmargin
   4132      1.1  mrg   \advance\leftskip by \itemindent
   4133      1.1  mrg   \exdentamount=\itemindent
   4134      1.1  mrg   \parindent=0pt
   4135      1.1  mrg   \parskip=\smallskipamount
   4136      1.1  mrg   \ifdim\parskip=0pt \parskip=2pt \fi
   4137  1.1.1.3  mrg   %
   4138      1.1  mrg   % Try typesetting the item mark so that if the document erroneously says
   4139      1.1  mrg   % something like @itemize @samp (intending @table), there's an error
   4140      1.1  mrg   % right away at the @itemize.  It's not the best error message in the
   4141      1.1  mrg   % world, but it's better than leaving it to the @item.  This means if
   4142      1.1  mrg   % the user wants an empty mark, they have to say @w{} not just @w.
   4143      1.1  mrg   \def\itemcontents{#1}%
   4144      1.1  mrg   \setbox0 = \hbox{\itemcontents}%
   4145      1.1  mrg   %
   4146      1.1  mrg   % @itemize with no arg is equivalent to @itemize @bullet.
   4147      1.1  mrg   \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
   4148      1.1  mrg   %
   4149      1.1  mrg   \let\item=\itemizeitem
   4150      1.1  mrg }
   4151      1.1  mrg 
   4152      1.1  mrg % Definition of @item while inside @itemize and @enumerate.
   4153      1.1  mrg %
   4154      1.1  mrg \def\itemizeitem{%
   4155      1.1  mrg   \advance\itemno by 1  % for enumerations
   4156      1.1  mrg   {\let\par=\endgraf \smallbreak}% reasonable place to break
   4157      1.1  mrg   {%
   4158      1.1  mrg    % If the document has an @itemize directly after a section title, a
   4159      1.1  mrg    % \nobreak will be last on the list, and \sectionheading will have
   4160      1.1  mrg    % done a \vskip-\parskip.  In that case, we don't want to zero
   4161      1.1  mrg    % parskip, or the item text will crash with the heading.  On the
   4162      1.1  mrg    % other hand, when there is normal text preceding the item (as there
   4163      1.1  mrg    % usually is), we do want to zero parskip, or there would be too much
   4164      1.1  mrg    % space.  In that case, we won't have a \nobreak before.  At least
   4165      1.1  mrg    % that's the theory.
   4166      1.1  mrg    \ifnum\lastpenalty<10000 \parskip=0in \fi
   4167      1.1  mrg    \noindent
   4168      1.1  mrg    \hbox to 0pt{\hss \itemcontents \kern\itemmargin}%
   4169  1.1.1.3  mrg    %
   4170  1.1.1.3  mrg    \ifinner\else
   4171  1.1.1.3  mrg      \vadjust{\penalty 1200}% not good to break after first line of item.
   4172  1.1.1.3  mrg    \fi
   4173  1.1.1.3  mrg    % We can be in inner vertical mode in a footnote, although an
   4174  1.1.1.3  mrg    % @itemize looks awful there.
   4175      1.1  mrg   }%
   4176      1.1  mrg   \flushcr
   4177      1.1  mrg }
   4178      1.1  mrg 
   4179      1.1  mrg % \splitoff TOKENS\endmark defines \first to be the first token in
   4180      1.1  mrg % TOKENS, and \rest to be the remainder.
   4181      1.1  mrg %
   4182      1.1  mrg \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
   4183      1.1  mrg 
   4184      1.1  mrg % Allow an optional argument of an uppercase letter, lowercase letter,
   4185      1.1  mrg % or number, to specify the first label in the enumerated list.  No
   4186      1.1  mrg % argument is the same as `1'.
   4187      1.1  mrg %
   4188      1.1  mrg \envparseargdef\enumerate{\enumeratey #1  \endenumeratey}
   4189      1.1  mrg \def\enumeratey #1 #2\endenumeratey{%
   4190      1.1  mrg   % If we were given no argument, pretend we were given `1'.
   4191      1.1  mrg   \def\thearg{#1}%
   4192      1.1  mrg   \ifx\thearg\empty \def\thearg{1}\fi
   4193      1.1  mrg   %
   4194      1.1  mrg   % Detect if the argument is a single token.  If so, it might be a
   4195      1.1  mrg   % letter.  Otherwise, the only valid thing it can be is a number.
   4196      1.1  mrg   % (We will always have one token, because of the test we just made.
   4197      1.1  mrg   % This is a good thing, since \splitoff doesn't work given nothing at
   4198      1.1  mrg   % all -- the first parameter is undelimited.)
   4199      1.1  mrg   \expandafter\splitoff\thearg\endmark
   4200      1.1  mrg   \ifx\rest\empty
   4201      1.1  mrg     % Only one token in the argument.  It could still be anything.
   4202      1.1  mrg     % A ``lowercase letter'' is one whose \lccode is nonzero.
   4203      1.1  mrg     % An ``uppercase letter'' is one whose \lccode is both nonzero, and
   4204      1.1  mrg     %   not equal to itself.
   4205      1.1  mrg     % Otherwise, we assume it's a number.
   4206      1.1  mrg     %
   4207      1.1  mrg     % We need the \relax at the end of the \ifnum lines to stop TeX from
   4208      1.1  mrg     % continuing to look for a <number>.
   4209      1.1  mrg     %
   4210      1.1  mrg     \ifnum\lccode\expandafter`\thearg=0\relax
   4211      1.1  mrg       \numericenumerate % a number (we hope)
   4212      1.1  mrg     \else
   4213      1.1  mrg       % It's a letter.
   4214      1.1  mrg       \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
   4215      1.1  mrg         \lowercaseenumerate % lowercase letter
   4216      1.1  mrg       \else
   4217      1.1  mrg         \uppercaseenumerate % uppercase letter
   4218      1.1  mrg       \fi
   4219      1.1  mrg     \fi
   4220      1.1  mrg   \else
   4221      1.1  mrg     % Multiple tokens in the argument.  We hope it's a number.
   4222      1.1  mrg     \numericenumerate
   4223      1.1  mrg   \fi
   4224      1.1  mrg }
   4225      1.1  mrg 
   4226      1.1  mrg % An @enumerate whose labels are integers.  The starting integer is
   4227      1.1  mrg % given in \thearg.
   4228      1.1  mrg %
   4229      1.1  mrg \def\numericenumerate{%
   4230      1.1  mrg   \itemno = \thearg
   4231      1.1  mrg   \startenumeration{\the\itemno}%
   4232      1.1  mrg }
   4233      1.1  mrg 
   4234      1.1  mrg % The starting (lowercase) letter is in \thearg.
   4235      1.1  mrg \def\lowercaseenumerate{%
   4236      1.1  mrg   \itemno = \expandafter`\thearg
   4237      1.1  mrg   \startenumeration{%
   4238      1.1  mrg     % Be sure we're not beyond the end of the alphabet.
   4239      1.1  mrg     \ifnum\itemno=0
   4240      1.1  mrg       \errmessage{No more lowercase letters in @enumerate; get a bigger
   4241      1.1  mrg                   alphabet}%
   4242      1.1  mrg     \fi
   4243      1.1  mrg     \char\lccode\itemno
   4244      1.1  mrg   }%
   4245      1.1  mrg }
   4246      1.1  mrg 
   4247      1.1  mrg % The starting (uppercase) letter is in \thearg.
   4248      1.1  mrg \def\uppercaseenumerate{%
   4249      1.1  mrg   \itemno = \expandafter`\thearg
   4250      1.1  mrg   \startenumeration{%
   4251      1.1  mrg     % Be sure we're not beyond the end of the alphabet.
   4252      1.1  mrg     \ifnum\itemno=0
   4253      1.1  mrg       \errmessage{No more uppercase letters in @enumerate; get a bigger
   4254      1.1  mrg                   alphabet}
   4255      1.1  mrg     \fi
   4256      1.1  mrg     \char\uccode\itemno
   4257      1.1  mrg   }%
   4258      1.1  mrg }
   4259      1.1  mrg 
   4260      1.1  mrg % Call \doitemize, adding a period to the first argument and supplying the
   4261      1.1  mrg % common last two arguments.  Also subtract one from the initial value in
   4262      1.1  mrg % \itemno, since @item increments \itemno.
   4263      1.1  mrg %
   4264      1.1  mrg \def\startenumeration#1{%
   4265      1.1  mrg   \advance\itemno by -1
   4266      1.1  mrg   \doitemize{#1.}\flushcr
   4267      1.1  mrg }
   4268      1.1  mrg 
   4269      1.1  mrg % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
   4270      1.1  mrg % to @enumerate.
   4271      1.1  mrg %
   4272      1.1  mrg \def\alphaenumerate{\enumerate{a}}
   4273      1.1  mrg \def\capsenumerate{\enumerate{A}}
   4274      1.1  mrg \def\Ealphaenumerate{\Eenumerate}
   4275      1.1  mrg \def\Ecapsenumerate{\Eenumerate}
   4276      1.1  mrg 
   4277      1.1  mrg 
   4278      1.1  mrg % @multitable macros
   4279      1.1  mrg % Amy Hendrickson, 8/18/94, 3/6/96
   4280      1.1  mrg %
   4281      1.1  mrg % @multitable ... @end multitable will make as many columns as desired.
   4282      1.1  mrg % Contents of each column will wrap at width given in preamble.  Width
   4283      1.1  mrg % can be specified either with sample text given in a template line,
   4284      1.1  mrg % or in percent of \hsize, the current width of text on page.
   4285      1.1  mrg 
   4286      1.1  mrg % Table can continue over pages but will only break between lines.
   4287      1.1  mrg 
   4288      1.1  mrg % To make preamble:
   4289      1.1  mrg %
   4290      1.1  mrg % Either define widths of columns in terms of percent of \hsize:
   4291      1.1  mrg %   @multitable @columnfractions .25 .3 .45
   4292      1.1  mrg %   @item ...
   4293      1.1  mrg %
   4294      1.1  mrg %   Numbers following @columnfractions are the percent of the total
   4295      1.1  mrg %   current hsize to be used for each column. You may use as many
   4296      1.1  mrg %   columns as desired.
   4297      1.1  mrg 
   4298      1.1  mrg 
   4299      1.1  mrg % Or use a template:
   4300      1.1  mrg %   @multitable {Column 1 template} {Column 2 template} {Column 3 template}
   4301      1.1  mrg %   @item ...
   4302      1.1  mrg %   using the widest term desired in each column.
   4303      1.1  mrg 
   4304      1.1  mrg % Each new table line starts with @item, each subsequent new column
   4305      1.1  mrg % starts with @tab. Empty columns may be produced by supplying @tab's
   4306      1.1  mrg % with nothing between them for as many times as empty columns are needed,
   4307      1.1  mrg % ie, @tab@tab@tab will produce two empty columns.
   4308      1.1  mrg 
   4309      1.1  mrg % @item, @tab do not need to be on their own lines, but it will not hurt
   4310      1.1  mrg % if they are.
   4311      1.1  mrg 
   4312      1.1  mrg % Sample multitable:
   4313      1.1  mrg 
   4314      1.1  mrg %   @multitable {Column 1 template} {Column 2 template} {Column 3 template}
   4315      1.1  mrg %   @item first col stuff @tab second col stuff @tab third col
   4316      1.1  mrg %   @item
   4317      1.1  mrg %   first col stuff
   4318      1.1  mrg %   @tab
   4319      1.1  mrg %   second col stuff
   4320      1.1  mrg %   @tab
   4321      1.1  mrg %   third col
   4322      1.1  mrg %   @item first col stuff @tab second col stuff
   4323      1.1  mrg %   @tab Many paragraphs of text may be used in any column.
   4324      1.1  mrg %
   4325      1.1  mrg %         They will wrap at the width determined by the template.
   4326      1.1  mrg %   @item@tab@tab This will be in third column.
   4327      1.1  mrg %   @end multitable
   4328      1.1  mrg 
   4329      1.1  mrg % Default dimensions may be reset by user.
   4330      1.1  mrg % @multitableparskip is vertical space between paragraphs in table.
   4331      1.1  mrg % @multitableparindent is paragraph indent in table.
   4332      1.1  mrg % @multitablecolmargin is horizontal space to be left between columns.
   4333      1.1  mrg % @multitablelinespace is space to leave between table items, baseline
   4334      1.1  mrg %                                                            to baseline.
   4335      1.1  mrg %   0pt means it depends on current normal line spacing.
   4336      1.1  mrg %
   4337      1.1  mrg \newskip\multitableparskip
   4338      1.1  mrg \newskip\multitableparindent
   4339      1.1  mrg \newdimen\multitablecolspace
   4340      1.1  mrg \newskip\multitablelinespace
   4341      1.1  mrg \multitableparskip=0pt
   4342      1.1  mrg \multitableparindent=6pt
   4343      1.1  mrg \multitablecolspace=12pt
   4344      1.1  mrg \multitablelinespace=0pt
   4345      1.1  mrg 
   4346      1.1  mrg % Macros used to set up halign preamble:
   4347      1.1  mrg %
   4348      1.1  mrg \let\endsetuptable\relax
   4349      1.1  mrg \def\xendsetuptable{\endsetuptable}
   4350      1.1  mrg \let\columnfractions\relax
   4351      1.1  mrg \def\xcolumnfractions{\columnfractions}
   4352      1.1  mrg \newif\ifsetpercent
   4353      1.1  mrg 
   4354      1.1  mrg % #1 is the @columnfraction, usually a decimal number like .5, but might
   4355      1.1  mrg % be just 1.  We just use it, whatever it is.
   4356      1.1  mrg %
   4357      1.1  mrg \def\pickupwholefraction#1 {%
   4358      1.1  mrg   \global\advance\colcount by 1
   4359      1.1  mrg   \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}%
   4360      1.1  mrg   \setuptable
   4361      1.1  mrg }
   4362      1.1  mrg 
   4363      1.1  mrg \newcount\colcount
   4364      1.1  mrg \def\setuptable#1{%
   4365      1.1  mrg   \def\firstarg{#1}%
   4366      1.1  mrg   \ifx\firstarg\xendsetuptable
   4367      1.1  mrg     \let\go = \relax
   4368      1.1  mrg   \else
   4369      1.1  mrg     \ifx\firstarg\xcolumnfractions
   4370      1.1  mrg       \global\setpercenttrue
   4371      1.1  mrg     \else
   4372      1.1  mrg       \ifsetpercent
   4373      1.1  mrg          \let\go\pickupwholefraction
   4374      1.1  mrg       \else
   4375      1.1  mrg          \global\advance\colcount by 1
   4376      1.1  mrg          \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a
   4377      1.1  mrg                    % separator; typically that is always in the input, anyway.
   4378      1.1  mrg          \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
   4379      1.1  mrg       \fi
   4380      1.1  mrg     \fi
   4381      1.1  mrg     \ifx\go\pickupwholefraction
   4382      1.1  mrg       % Put the argument back for the \pickupwholefraction call, so
   4383      1.1  mrg       % we'll always have a period there to be parsed.
   4384      1.1  mrg       \def\go{\pickupwholefraction#1}%
   4385      1.1  mrg     \else
   4386      1.1  mrg       \let\go = \setuptable
   4387      1.1  mrg     \fi%
   4388      1.1  mrg   \fi
   4389      1.1  mrg   \go
   4390      1.1  mrg }
   4391      1.1  mrg 
   4392  1.1.1.3  mrg % multitable-only commands.
   4393  1.1.1.3  mrg % 
   4394  1.1.1.3  mrg % @headitem starts a heading row, which we typeset in bold.  Assignments
   4395  1.1.1.3  mrg % have to be global since we are inside the implicit group of an
   4396      1.1  mrg % alignment entry.  \everycr below resets \everytab so we don't have to
   4397      1.1  mrg % undo it ourselves.
   4398      1.1  mrg \def\headitemfont{\b}% for people to use in the template row; not changeable
   4399      1.1  mrg \def\headitem{%
   4400      1.1  mrg   \checkenv\multitable
   4401  1.1.1.3  mrg   \crcr
   4402      1.1  mrg   \gdef\headitemcrhook{\nobreak}% attempt to avoid page break after headings
   4403      1.1  mrg   \global\everytab={\bf}% can't use \headitemfont since the parsing differs
   4404      1.1  mrg   \the\everytab % for the first item
   4405      1.1  mrg }%
   4406  1.1.1.3  mrg %
   4407  1.1.1.3  mrg % default for tables with no headings.
   4408  1.1.1.3  mrg \let\headitemcrhook=\relax
   4409      1.1  mrg %
   4410      1.1  mrg % A \tab used to include \hskip1sp.  But then the space in a template
   4411      1.1  mrg % line is not enough.  That is bad.  So let's go back to just `&' until
   4412      1.1  mrg % we again encounter the problem the 1sp was intended to solve.
   4413      1.1  mrg %					--karl, nathan (a] acm.org, 20apr99.
   4414      1.1  mrg \def\tab{\checkenv\multitable &\the\everytab}%
   4415      1.1  mrg 
   4416      1.1  mrg % @multitable ... @end multitable definitions:
   4417      1.1  mrg %
   4418      1.1  mrg \newtoks\everytab  % insert after every tab.
   4419      1.1  mrg %
   4420      1.1  mrg \envdef\multitable{%
   4421      1.1  mrg   \vskip\parskip
   4422      1.1  mrg   \startsavinginserts
   4423      1.1  mrg   %
   4424      1.1  mrg   % @item within a multitable starts a normal row.
   4425      1.1  mrg   % We use \def instead of \let so that if one of the multitable entries
   4426      1.1  mrg   % contains an @itemize, we don't choke on the \item (seen as \crcr aka
   4427      1.1  mrg   % \endtemplate) expanding \doitemize.
   4428      1.1  mrg   \def\item{\crcr}%
   4429      1.1  mrg   %
   4430      1.1  mrg   \tolerance=9500
   4431      1.1  mrg   \hbadness=9500
   4432      1.1  mrg   \setmultitablespacing
   4433      1.1  mrg   \parskip=\multitableparskip
   4434      1.1  mrg   \parindent=\multitableparindent
   4435      1.1  mrg   \overfullrule=0pt
   4436      1.1  mrg   \global\colcount=0
   4437      1.1  mrg   %
   4438      1.1  mrg   \everycr = {%
   4439  1.1.1.3  mrg     \noalign{%
   4440      1.1  mrg       \global\everytab={}% Reset from possible headitem.
   4441  1.1.1.3  mrg       \global\colcount=0 % Reset the column counter.
   4442  1.1.1.3  mrg       %
   4443      1.1  mrg       % Check for saved footnotes, etc.:
   4444  1.1.1.3  mrg       \checkinserts
   4445  1.1.1.3  mrg       %
   4446  1.1.1.3  mrg       % Perhaps a \nobreak, then reset:
   4447  1.1.1.3  mrg       \headitemcrhook
   4448      1.1  mrg       \global\let\headitemcrhook=\relax
   4449      1.1  mrg     }%
   4450      1.1  mrg   }%
   4451      1.1  mrg   %
   4452      1.1  mrg   \parsearg\domultitable
   4453      1.1  mrg }
   4454      1.1  mrg \def\domultitable#1{%
   4455      1.1  mrg   % To parse everything between @multitable and @item:
   4456      1.1  mrg   \setuptable#1 \endsetuptable
   4457      1.1  mrg   %
   4458      1.1  mrg   % This preamble sets up a generic column definition, which will
   4459      1.1  mrg   % be used as many times as user calls for columns.
   4460      1.1  mrg   % \vtop will set a single line and will also let text wrap and
   4461      1.1  mrg   % continue for many paragraphs if desired.
   4462      1.1  mrg   \halign\bgroup &%
   4463      1.1  mrg     \global\advance\colcount by 1
   4464      1.1  mrg     \multistrut
   4465      1.1  mrg     \vtop{%
   4466      1.1  mrg       % Use the current \colcount to find the correct column width:
   4467      1.1  mrg       \hsize=\expandafter\csname col\the\colcount\endcsname
   4468      1.1  mrg       %
   4469      1.1  mrg       % In order to keep entries from bumping into each other
   4470      1.1  mrg       % we will add a \leftskip of \multitablecolspace to all columns after
   4471      1.1  mrg       % the first one.
   4472      1.1  mrg       %
   4473      1.1  mrg       % If a template has been used, we will add \multitablecolspace
   4474      1.1  mrg       % to the width of each template entry.
   4475      1.1  mrg       %
   4476      1.1  mrg       % If the user has set preamble in terms of percent of \hsize we will
   4477      1.1  mrg       % use that dimension as the width of the column, and the \leftskip
   4478      1.1  mrg       % will keep entries from bumping into each other.  Table will start at
   4479      1.1  mrg       % left margin and final column will justify at right margin.
   4480      1.1  mrg       %
   4481      1.1  mrg       % Make sure we don't inherit \rightskip from the outer environment.
   4482      1.1  mrg       \rightskip=0pt
   4483      1.1  mrg       \ifnum\colcount=1
   4484      1.1  mrg 	% The first column will be indented with the surrounding text.
   4485      1.1  mrg 	\advance\hsize by\leftskip
   4486      1.1  mrg       \else
   4487      1.1  mrg 	\ifsetpercent \else
   4488      1.1  mrg 	  % If user has not set preamble in terms of percent of \hsize
   4489      1.1  mrg 	  % we will advance \hsize by \multitablecolspace.
   4490      1.1  mrg 	  \advance\hsize by \multitablecolspace
   4491      1.1  mrg 	\fi
   4492      1.1  mrg        % In either case we will make \leftskip=\multitablecolspace:
   4493      1.1  mrg       \leftskip=\multitablecolspace
   4494      1.1  mrg       \fi
   4495      1.1  mrg       % Ignoring space at the beginning and end avoids an occasional spurious
   4496      1.1  mrg       % blank line, when TeX decides to break the line at the space before the
   4497      1.1  mrg       % box from the multistrut, so the strut ends up on a line by itself.
   4498      1.1  mrg       % For example:
   4499      1.1  mrg       % @multitable @columnfractions .11 .89
   4500      1.1  mrg       % @item @code{#}
   4501      1.1  mrg       % @tab Legal holiday which is valid in major parts of the whole country.
   4502      1.1  mrg       % Is automatically provided with highlighting sequences respectively
   4503      1.1  mrg       % marking characters.
   4504      1.1  mrg       \noindent\ignorespaces##\unskip\multistrut
   4505      1.1  mrg     }\cr
   4506      1.1  mrg }
   4507      1.1  mrg \def\Emultitable{%
   4508      1.1  mrg   \crcr
   4509      1.1  mrg   \egroup % end the \halign
   4510      1.1  mrg   \global\setpercentfalse
   4511      1.1  mrg }
   4512      1.1  mrg 
   4513      1.1  mrg \def\setmultitablespacing{%
   4514      1.1  mrg   \def\multistrut{\strut}% just use the standard line spacing
   4515      1.1  mrg   %
   4516      1.1  mrg   % Compute \multitablelinespace (if not defined by user) for use in
   4517      1.1  mrg   % \multitableparskip calculation.  We used define \multistrut based on
   4518      1.1  mrg   % this, but (ironically) that caused the spacing to be off.
   4519      1.1  mrg   % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100.
   4520      1.1  mrg \ifdim\multitablelinespace=0pt
   4521      1.1  mrg \setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
   4522      1.1  mrg \global\advance\multitablelinespace by-\ht0
   4523      1.1  mrg \fi
   4524      1.1  mrg % Test to see if parskip is larger than space between lines of
   4525      1.1  mrg % table. If not, do nothing.
   4526      1.1  mrg %        If so, set to same dimension as multitablelinespace.
   4527      1.1  mrg \ifdim\multitableparskip>\multitablelinespace
   4528      1.1  mrg \global\multitableparskip=\multitablelinespace
   4529      1.1  mrg \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
   4530      1.1  mrg                                       % than skip between lines in the table.
   4531      1.1  mrg \fi%
   4532      1.1  mrg \ifdim\multitableparskip=0pt
   4533      1.1  mrg \global\multitableparskip=\multitablelinespace
   4534      1.1  mrg \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
   4535      1.1  mrg                                       % than skip between lines in the table.
   4536      1.1  mrg \fi}
   4537      1.1  mrg 
   4538      1.1  mrg 
   4539      1.1  mrg \message{conditionals,}
   4540      1.1  mrg 
   4541      1.1  mrg % @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext,
   4542      1.1  mrg % @ifnotxml always succeed.  They currently do nothing; we don't
   4543      1.1  mrg % attempt to check whether the conditionals are properly nested.  But we
   4544      1.1  mrg % have to remember that they are conditionals, so that @end doesn't
   4545      1.1  mrg % attempt to close an environment group.
   4546      1.1  mrg %
   4547      1.1  mrg \def\makecond#1{%
   4548      1.1  mrg   \expandafter\let\csname #1\endcsname = \relax
   4549      1.1  mrg   \expandafter\let\csname iscond.#1\endcsname = 1
   4550      1.1  mrg }
   4551      1.1  mrg \makecond{iftex}
   4552      1.1  mrg \makecond{ifnotdocbook}
   4553      1.1  mrg \makecond{ifnothtml}
   4554      1.1  mrg \makecond{ifnotinfo}
   4555      1.1  mrg \makecond{ifnotplaintext}
   4556      1.1  mrg \makecond{ifnotxml}
   4557      1.1  mrg 
   4558      1.1  mrg % Ignore @ignore, @ifhtml, @ifinfo, and the like.
   4559      1.1  mrg %
   4560      1.1  mrg \def\direntry{\doignore{direntry}}
   4561      1.1  mrg \def\documentdescription{\doignore{documentdescription}}
   4562      1.1  mrg \def\docbook{\doignore{docbook}}
   4563      1.1  mrg \def\html{\doignore{html}}
   4564      1.1  mrg \def\ifdocbook{\doignore{ifdocbook}}
   4565      1.1  mrg \def\ifhtml{\doignore{ifhtml}}
   4566      1.1  mrg \def\ifinfo{\doignore{ifinfo}}
   4567      1.1  mrg \def\ifnottex{\doignore{ifnottex}}
   4568      1.1  mrg \def\ifplaintext{\doignore{ifplaintext}}
   4569      1.1  mrg \def\ifxml{\doignore{ifxml}}
   4570      1.1  mrg \def\ignore{\doignore{ignore}}
   4571      1.1  mrg \def\menu{\doignore{menu}}
   4572      1.1  mrg \def\xml{\doignore{xml}}
   4573      1.1  mrg 
   4574      1.1  mrg % Ignore text until a line `@end #1', keeping track of nested conditionals.
   4575      1.1  mrg %
   4576      1.1  mrg % A count to remember the depth of nesting.
   4577      1.1  mrg \newcount\doignorecount
   4578      1.1  mrg 
   4579      1.1  mrg \def\doignore#1{\begingroup
   4580      1.1  mrg   % Scan in ``verbatim'' mode:
   4581      1.1  mrg   \obeylines
   4582      1.1  mrg   \catcode`\@ = \other
   4583      1.1  mrg   \catcode`\{ = \other
   4584      1.1  mrg   \catcode`\} = \other
   4585      1.1  mrg   %
   4586      1.1  mrg   % Make sure that spaces turn into tokens that match what \doignoretext wants.
   4587      1.1  mrg   \spaceisspace
   4588      1.1  mrg   %
   4589      1.1  mrg   % Count number of #1's that we've seen.
   4590      1.1  mrg   \doignorecount = 0
   4591      1.1  mrg   %
   4592      1.1  mrg   % Swallow text until we reach the matching `@end #1'.
   4593      1.1  mrg   \dodoignore{#1}%
   4594      1.1  mrg }
   4595      1.1  mrg 
   4596      1.1  mrg { \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source.
   4597      1.1  mrg   \obeylines %
   4598      1.1  mrg   %
   4599      1.1  mrg   \gdef\dodoignore#1{%
   4600      1.1  mrg     % #1 contains the command name as a string, e.g., `ifinfo'.
   4601      1.1  mrg     %
   4602      1.1  mrg     % Define a command to find the next `@end #1'.
   4603      1.1  mrg     \long\def\doignoretext##1^^M@end #1{%
   4604      1.1  mrg       \doignoretextyyy##1^^M@#1\_STOP_}%
   4605      1.1  mrg     %
   4606      1.1  mrg     % And this command to find another #1 command, at the beginning of a
   4607      1.1  mrg     % line.  (Otherwise, we would consider a line `@c @ifset', for
   4608      1.1  mrg     % example, to count as an @ifset for nesting.)
   4609      1.1  mrg     \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}%
   4610      1.1  mrg     %
   4611      1.1  mrg     % And now expand that command.
   4612      1.1  mrg     \doignoretext ^^M%
   4613      1.1  mrg   }%
   4614      1.1  mrg }
   4615      1.1  mrg 
   4616      1.1  mrg \def\doignoreyyy#1{%
   4617      1.1  mrg   \def\temp{#1}%
   4618      1.1  mrg   \ifx\temp\empty			% Nothing found.
   4619      1.1  mrg     \let\next\doignoretextzzz
   4620      1.1  mrg   \else					% Found a nested condition, ...
   4621      1.1  mrg     \advance\doignorecount by 1
   4622      1.1  mrg     \let\next\doignoretextyyy		% ..., look for another.
   4623      1.1  mrg     % If we're here, #1 ends with ^^M\ifinfo (for example).
   4624      1.1  mrg   \fi
   4625      1.1  mrg   \next #1% the token \_STOP_ is present just after this macro.
   4626      1.1  mrg }
   4627      1.1  mrg 
   4628      1.1  mrg % We have to swallow the remaining "\_STOP_".
   4629      1.1  mrg %
   4630      1.1  mrg \def\doignoretextzzz#1{%
   4631      1.1  mrg   \ifnum\doignorecount = 0	% We have just found the outermost @end.
   4632      1.1  mrg     \let\next\enddoignore
   4633      1.1  mrg   \else				% Still inside a nested condition.
   4634      1.1  mrg     \advance\doignorecount by -1
   4635      1.1  mrg     \let\next\doignoretext      % Look for the next @end.
   4636      1.1  mrg   \fi
   4637      1.1  mrg   \next
   4638      1.1  mrg }
   4639      1.1  mrg 
   4640      1.1  mrg % Finish off ignored text.
   4641      1.1  mrg { \obeylines%
   4642      1.1  mrg   % Ignore anything after the last `@end #1'; this matters in verbatim
   4643      1.1  mrg   % environments, where otherwise the newline after an ignored conditional
   4644      1.1  mrg   % would result in a blank line in the output.
   4645      1.1  mrg   \gdef\enddoignore#1^^M{\endgroup\ignorespaces}%
   4646      1.1  mrg }
   4647      1.1  mrg 
   4648      1.1  mrg 
   4649      1.1  mrg % @set VAR sets the variable VAR to an empty value.
   4650      1.1  mrg % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
   4651      1.1  mrg %
   4652      1.1  mrg % Since we want to separate VAR from REST-OF-LINE (which might be
   4653      1.1  mrg % empty), we can't just use \parsearg; we have to insert a space of our
   4654      1.1  mrg % own to delimit the rest of the line, and then take it out again if we
   4655      1.1  mrg % didn't need it.
   4656      1.1  mrg % We rely on the fact that \parsearg sets \catcode`\ =10.
   4657      1.1  mrg %
   4658      1.1  mrg \parseargdef\set{\setyyy#1 \endsetyyy}
   4659      1.1  mrg \def\setyyy#1 #2\endsetyyy{%
   4660      1.1  mrg   {%
   4661      1.1  mrg     \makevalueexpandable
   4662      1.1  mrg     \def\temp{#2}%
   4663      1.1  mrg     \edef\next{\gdef\makecsname{SET#1}}%
   4664      1.1  mrg     \ifx\temp\empty
   4665      1.1  mrg       \next{}%
   4666      1.1  mrg     \else
   4667      1.1  mrg       \setzzz#2\endsetzzz
   4668      1.1  mrg     \fi
   4669      1.1  mrg   }%
   4670      1.1  mrg }
   4671      1.1  mrg % Remove the trailing space \setxxx inserted.
   4672      1.1  mrg \def\setzzz#1 \endsetzzz{\next{#1}}
   4673      1.1  mrg 
   4674      1.1  mrg % @clear VAR clears (i.e., unsets) the variable VAR.
   4675      1.1  mrg %
   4676      1.1  mrg \parseargdef\clear{%
   4677      1.1  mrg   {%
   4678      1.1  mrg     \makevalueexpandable
   4679      1.1  mrg     \global\expandafter\let\csname SET#1\endcsname=\relax
   4680      1.1  mrg   }%
   4681      1.1  mrg }
   4682      1.1  mrg 
   4683      1.1  mrg % @value{foo} gets the text saved in variable foo.
   4684      1.1  mrg \def\value{\begingroup\makevalueexpandable\valuexxx}
   4685      1.1  mrg \def\valuexxx#1{\expandablevalue{#1}\endgroup}
   4686  1.1.1.3  mrg {
   4687      1.1  mrg   \catcode`\-=\active \catcode`\_=\active
   4688      1.1  mrg   %
   4689      1.1  mrg   \gdef\makevalueexpandable{%
   4690      1.1  mrg     \let\value = \expandablevalue
   4691      1.1  mrg     % We don't want these characters active, ...
   4692      1.1  mrg     \catcode`\-=\other \catcode`\_=\other
   4693      1.1  mrg     % ..., but we might end up with active ones in the argument if
   4694      1.1  mrg     % we're called from @code, as @code{@value{foo-bar_}}, though.
   4695  1.1.1.2  mrg     % So \let them to their normal equivalents.
   4696      1.1  mrg     \let-\normaldash \let_\normalunderscore
   4697      1.1  mrg   }
   4698      1.1  mrg }
   4699      1.1  mrg 
   4700      1.1  mrg % We have this subroutine so that we can handle at least some @value's
   4701      1.1  mrg % properly in indexes (we call \makevalueexpandable in \indexdummies).
   4702      1.1  mrg % The command has to be fully expandable (if the variable is set), since
   4703      1.1  mrg % the result winds up in the index file.  This means that if the
   4704      1.1  mrg % variable's value contains other Texinfo commands, it's almost certain
   4705      1.1  mrg % it will fail (although perhaps we could fix that with sufficient work
   4706  1.1.1.3  mrg % to do a one-level expansion on the result, instead of complete).
   4707  1.1.1.3  mrg % 
   4708  1.1.1.3  mrg % Unfortunately, this has the consequence that when _ is in the *value*
   4709  1.1.1.3  mrg % of an @set, it does not print properly in the roman fonts (get the cmr
   4710  1.1.1.3  mrg % dot accent at position 126 instead).  No fix comes to mind, and it's
   4711  1.1.1.3  mrg % been this way since 2003 or earlier, so just ignore it.
   4712      1.1  mrg % 
   4713      1.1  mrg \def\expandablevalue#1{%
   4714      1.1  mrg   \expandafter\ifx\csname SET#1\endcsname\relax
   4715      1.1  mrg     {[No value for ``#1'']}%
   4716      1.1  mrg     \message{Variable `#1', used in @value, is not set.}%
   4717      1.1  mrg   \else
   4718      1.1  mrg     \csname SET#1\endcsname
   4719      1.1  mrg   \fi
   4720      1.1  mrg }
   4721  1.1.1.3  mrg 
   4722  1.1.1.3  mrg % Like \expandablevalue, but completely expandable (the \message in the
   4723  1.1.1.3  mrg % definition above operates at the execution level of TeX).  Used when
   4724  1.1.1.3  mrg % writing to auxiliary files, due to the expansion that \write does.
   4725  1.1.1.3  mrg % If flag is undefined, pass through an unexpanded @value command: maybe it 
   4726  1.1.1.3  mrg % will be set by the time it is read back in.
   4727  1.1.1.3  mrg %
   4728  1.1.1.3  mrg % NB flag names containing - or _ may not work here.
   4729  1.1.1.3  mrg \def\dummyvalue#1{%
   4730  1.1.1.3  mrg   \expandafter\ifx\csname SET#1\endcsname\relax
   4731  1.1.1.3  mrg     \noexpand\value{#1}%
   4732  1.1.1.3  mrg   \else
   4733  1.1.1.3  mrg     \csname SET#1\endcsname
   4734  1.1.1.3  mrg   \fi
   4735  1.1.1.3  mrg }
   4736  1.1.1.3  mrg 
   4737  1.1.1.3  mrg % Used for @value's in index entries to form the sort key: expand the @value
   4738  1.1.1.3  mrg % if possible, otherwise sort late.
   4739  1.1.1.3  mrg \def\indexnofontsvalue#1{%
   4740  1.1.1.3  mrg   \expandafter\ifx\csname SET#1\endcsname\relax
   4741  1.1.1.3  mrg     ZZZZZZZ
   4742  1.1.1.3  mrg   \else
   4743  1.1.1.3  mrg     \csname SET#1\endcsname
   4744  1.1.1.3  mrg   \fi
   4745  1.1.1.3  mrg }
   4746      1.1  mrg 
   4747      1.1  mrg % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
   4748  1.1.1.3  mrg % with @set.
   4749  1.1.1.3  mrg % 
   4750  1.1.1.3  mrg % To get the special treatment we need for `@end ifset,' we call
   4751      1.1  mrg % \makecond and then redefine.
   4752      1.1  mrg %
   4753      1.1  mrg \makecond{ifset}
   4754      1.1  mrg \def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}}
   4755      1.1  mrg \def\doifset#1#2{%
   4756      1.1  mrg   {%
   4757      1.1  mrg     \makevalueexpandable
   4758      1.1  mrg     \let\next=\empty
   4759      1.1  mrg     \expandafter\ifx\csname SET#2\endcsname\relax
   4760      1.1  mrg       #1% If not set, redefine \next.
   4761      1.1  mrg     \fi
   4762      1.1  mrg     \expandafter
   4763      1.1  mrg   }\next
   4764      1.1  mrg }
   4765      1.1  mrg \def\ifsetfail{\doignore{ifset}}
   4766  1.1.1.2  mrg 
   4767      1.1  mrg % @ifclear VAR ... @end executes the `...' iff VAR has never been
   4768      1.1  mrg % defined with @set, or has been undefined with @clear.
   4769      1.1  mrg %
   4770      1.1  mrg % The `\else' inside the `\doifset' parameter is a trick to reuse the
   4771      1.1  mrg % above code: if the variable is not set, do nothing, if it is set,
   4772      1.1  mrg % then redefine \next to \ifclearfail.
   4773      1.1  mrg %
   4774      1.1  mrg \makecond{ifclear}
   4775      1.1  mrg \def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}}
   4776      1.1  mrg \def\ifclearfail{\doignore{ifclear}}
   4777  1.1.1.2  mrg 
   4778  1.1.1.2  mrg % @ifcommandisdefined CMD ... @end executes the `...' if CMD (written
   4779  1.1.1.2  mrg % without the @) is in fact defined.  We can only feasibly check at the
   4780  1.1.1.2  mrg % TeX level, so something like `mathcode' is going to considered
   4781  1.1.1.2  mrg % defined even though it is not a Texinfo command.
   4782  1.1.1.2  mrg % 
   4783  1.1.1.2  mrg \makecond{ifcommanddefined}
   4784  1.1.1.2  mrg \def\ifcommanddefined{\parsearg{\doifcmddefined{\let\next=\ifcmddefinedfail}}}
   4785  1.1.1.2  mrg %
   4786  1.1.1.2  mrg \def\doifcmddefined#1#2{{%
   4787  1.1.1.2  mrg     \makevalueexpandable
   4788  1.1.1.2  mrg     \let\next=\empty
   4789  1.1.1.2  mrg     \expandafter\ifx\csname #2\endcsname\relax
   4790  1.1.1.2  mrg       #1% If not defined, \let\next as above.
   4791  1.1.1.2  mrg     \fi
   4792  1.1.1.2  mrg     \expandafter
   4793  1.1.1.2  mrg   }\next
   4794  1.1.1.2  mrg }
   4795  1.1.1.2  mrg \def\ifcmddefinedfail{\doignore{ifcommanddefined}}
   4796  1.1.1.2  mrg 
   4797  1.1.1.2  mrg % @ifcommandnotdefined CMD ... handled similar to @ifclear above.
   4798  1.1.1.2  mrg \makecond{ifcommandnotdefined}
   4799  1.1.1.2  mrg \def\ifcommandnotdefined{%
   4800  1.1.1.2  mrg   \parsearg{\doifcmddefined{\else \let\next=\ifcmdnotdefinedfail}}}
   4801  1.1.1.2  mrg \def\ifcmdnotdefinedfail{\doignore{ifcommandnotdefined}}
   4802  1.1.1.2  mrg 
   4803  1.1.1.2  mrg % Set the `txicommandconditionals' variable, so documents have a way to
   4804  1.1.1.2  mrg % test if the @ifcommand...defined conditionals are available.
   4805  1.1.1.2  mrg \set txicommandconditionals
   4806      1.1  mrg 
   4807      1.1  mrg % @dircategory CATEGORY  -- specify a category of the dir file
   4808      1.1  mrg % which this file should belong to.  Ignore this in TeX.
   4809      1.1  mrg \let\dircategory=\comment
   4810      1.1  mrg 
   4811      1.1  mrg % @defininfoenclose.
   4812      1.1  mrg \let\definfoenclose=\comment
   4813      1.1  mrg 
   4814      1.1  mrg 
   4815      1.1  mrg \message{indexing,}
   4816      1.1  mrg % Index generation facilities
   4817      1.1  mrg 
   4818      1.1  mrg % Define \newwrite to be identical to plain tex's \newwrite
   4819      1.1  mrg % except not \outer, so it can be used within macros and \if's.
   4820      1.1  mrg \edef\newwrite{\makecsname{ptexnewwrite}}
   4821  1.1.1.3  mrg 
   4822  1.1.1.3  mrg % \newindex {foo} defines an index named IX.
   4823  1.1.1.3  mrg % It automatically defines \IXindex such that
   4824  1.1.1.3  mrg % \IXindex ...rest of line... puts an entry in the index IX.
   4825  1.1.1.3  mrg % It also defines \IXindfile to be the number of the output channel for
   4826      1.1  mrg % the file that accumulates this index.  The file's extension is IX.
   4827      1.1  mrg % The name of an index should be no more than 2 characters long
   4828      1.1  mrg % for the sake of vms.
   4829      1.1  mrg %
   4830  1.1.1.3  mrg \def\newindex#1{%
   4831      1.1  mrg   \expandafter\chardef\csname#1indfile\endcsname=0
   4832      1.1  mrg   \expandafter\xdef\csname#1index\endcsname{%     % Define @#1index
   4833      1.1  mrg     \noexpand\doindex{#1}}
   4834      1.1  mrg }
   4835      1.1  mrg 
   4836      1.1  mrg % @defindex foo  ==  \newindex{foo}
   4837      1.1  mrg %
   4838      1.1  mrg \def\defindex{\parsearg\newindex}
   4839      1.1  mrg 
   4840      1.1  mrg % Define @defcodeindex, like @defindex except put all entries in @code.
   4841      1.1  mrg %
   4842      1.1  mrg \def\defcodeindex{\parsearg\newcodeindex}
   4843      1.1  mrg %
   4844  1.1.1.3  mrg \def\newcodeindex#1{%
   4845      1.1  mrg   \expandafter\chardef\csname#1indfile\endcsname=0
   4846      1.1  mrg   \expandafter\xdef\csname#1index\endcsname{%
   4847      1.1  mrg     \noexpand\docodeindex{#1}}%
   4848      1.1  mrg }
   4849  1.1.1.3  mrg 
   4850  1.1.1.3  mrg % The default indices:
   4851  1.1.1.3  mrg \newindex{cp}%      concepts,
   4852  1.1.1.3  mrg \newcodeindex{fn}%  functions,
   4853  1.1.1.3  mrg \newcodeindex{vr}%  variables,
   4854  1.1.1.3  mrg \newcodeindex{tp}%  types,
   4855  1.1.1.3  mrg \newcodeindex{ky}%  keys
   4856  1.1.1.3  mrg \newcodeindex{pg}%  and programs.
   4857      1.1  mrg 
   4858      1.1  mrg 
   4859      1.1  mrg % @synindex foo bar    makes index foo feed into index bar.
   4860      1.1  mrg % Do this instead of @defindex foo if you don't want it as a separate index.
   4861      1.1  mrg %
   4862      1.1  mrg % @syncodeindex foo bar   similar, but put all entries made for index foo
   4863      1.1  mrg % inside @code.
   4864      1.1  mrg %
   4865      1.1  mrg \def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
   4866      1.1  mrg \def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}
   4867      1.1  mrg 
   4868      1.1  mrg % #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
   4869      1.1  mrg % #3 the target index (bar).
   4870  1.1.1.3  mrg \def\dosynindex#1#2#3{%
   4871      1.1  mrg   \requireopenindexfile{#3}%
   4872      1.1  mrg   % redefine \fooindfile:
   4873      1.1  mrg   \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
   4874      1.1  mrg   \expandafter\let\csname#2indfile\endcsname=\temp
   4875      1.1  mrg   % redefine \fooindex:
   4876      1.1  mrg   \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
   4877      1.1  mrg }
   4878  1.1.1.3  mrg 
   4879      1.1  mrg % Define \doindex, the driver for all index macros.
   4880  1.1.1.3  mrg % Argument #1 is generated by the calling \fooindex macro,
   4881      1.1  mrg % and it is the two-letter name of the index.
   4882  1.1.1.3  mrg 
   4883  1.1.1.3  mrg \def\doindex#1{\edef\indexname{#1}\parsearg\doindexxxx}
   4884      1.1  mrg \def\doindexxxx #1{\doind{\indexname}{#1}}
   4885      1.1  mrg 
   4886  1.1.1.3  mrg % like the previous two, but they put @code around the argument.
   4887  1.1.1.3  mrg \def\docodeindex#1{\edef\indexname{#1}\parsearg\docodeindexxxx}
   4888      1.1  mrg \def\docodeindexxxx #1{\doind{\indexname}{\code{#1}}}
   4889  1.1.1.3  mrg 
   4890  1.1.1.3  mrg 
   4892      1.1  mrg % Used when writing an index entry out to an index file to prevent
   4893      1.1  mrg % expansion of Texinfo commands that can appear in an index entry.
   4894      1.1  mrg %
   4895  1.1.1.3  mrg \def\indexdummies{%
   4896  1.1.1.3  mrg   \escapechar = `\\     % use backslash in output files.
   4897      1.1  mrg   \definedummyletter\@%
   4898  1.1.1.3  mrg   \definedummyletter\ %
   4899  1.1.1.3  mrg   %
   4900  1.1.1.3  mrg   % For texindex which always views { and } as separators.
   4901      1.1  mrg   \def\{{\lbracechar{}}%
   4902      1.1  mrg   \def\}{\rbracechar{}}%
   4903  1.1.1.3  mrg   %
   4904      1.1  mrg   % Do the redefinitions.
   4905      1.1  mrg   \definedummies
   4906  1.1.1.3  mrg }
   4907      1.1  mrg 
   4908      1.1  mrg % Used for the aux and toc files, where @ is the escape character.
   4909  1.1.1.3  mrg %
   4910  1.1.1.3  mrg \def\atdummies{%
   4911  1.1.1.3  mrg   \definedummyletter\@%
   4912  1.1.1.3  mrg   \definedummyletter\ %
   4913      1.1  mrg   \definedummyletter\{%
   4914      1.1  mrg   \definedummyletter\}%
   4915  1.1.1.3  mrg   %
   4916      1.1  mrg   % Do the redefinitions.
   4917      1.1  mrg   \definedummies
   4918      1.1  mrg   \otherbackslash
   4919  1.1.1.3  mrg }
   4920  1.1.1.3  mrg 
   4921  1.1.1.3  mrg % \definedummyword defines \#1 as \string\#1\space, thus effectively
   4922  1.1.1.3  mrg % preventing its expansion.  This is used only for control words,
   4923  1.1.1.3  mrg % not control letters, because the \space would be incorrect for
   4924  1.1.1.3  mrg % control characters, but is needed to separate the control word
   4925  1.1.1.3  mrg % from whatever follows.
   4926  1.1.1.3  mrg %
   4927  1.1.1.3  mrg % These can be used both for control words that take an argument and
   4928  1.1.1.3  mrg % those that do not.  If it is followed by {arg} in the input, then
   4929  1.1.1.3  mrg % that will dutifully get written to the index (or wherever).
   4930  1.1.1.3  mrg %
   4931  1.1.1.3  mrg % For control letters, we have \definedummyletter, which omits the
   4932  1.1.1.3  mrg % space.
   4933  1.1.1.3  mrg %
   4934  1.1.1.3  mrg \def\definedummyword  #1{\def#1{\string#1\space}}%
   4935  1.1.1.3  mrg \def\definedummyletter#1{\def#1{\string#1}}%
   4936  1.1.1.3  mrg \let\definedummyaccent\definedummyletter
   4937  1.1.1.3  mrg 
   4938  1.1.1.3  mrg % Called from \indexdummies and \atdummies, to effectively prevent
   4939  1.1.1.3  mrg % the expansion of commands.
   4940  1.1.1.3  mrg %
   4941  1.1.1.3  mrg \def\definedummies{%
   4942  1.1.1.3  mrg   %
   4943  1.1.1.3  mrg   \let\commondummyword\definedummyword
   4944      1.1  mrg   \let\commondummyletter\definedummyletter
   4945      1.1  mrg   \let\commondummyaccent\definedummyaccent
   4946      1.1  mrg   \commondummiesnofonts
   4947      1.1  mrg   %
   4948      1.1  mrg   \definedummyletter\_%
   4949      1.1  mrg   \definedummyletter\-%
   4950      1.1  mrg   %
   4951      1.1  mrg   % Non-English letters.
   4952      1.1  mrg   \definedummyword\AA
   4953      1.1  mrg   \definedummyword\AE
   4954      1.1  mrg   \definedummyword\DH
   4955      1.1  mrg   \definedummyword\L
   4956      1.1  mrg   \definedummyword\O
   4957      1.1  mrg   \definedummyword\OE
   4958      1.1  mrg   \definedummyword\TH
   4959      1.1  mrg   \definedummyword\aa
   4960      1.1  mrg   \definedummyword\ae
   4961      1.1  mrg   \definedummyword\dh
   4962      1.1  mrg   \definedummyword\exclamdown
   4963      1.1  mrg   \definedummyword\l
   4964      1.1  mrg   \definedummyword\o
   4965      1.1  mrg   \definedummyword\oe
   4966      1.1  mrg   \definedummyword\ordf
   4967      1.1  mrg   \definedummyword\ordm
   4968      1.1  mrg   \definedummyword\questiondown
   4969      1.1  mrg   \definedummyword\ss
   4970      1.1  mrg   \definedummyword\th
   4971      1.1  mrg   %
   4972      1.1  mrg   % Although these internal commands shouldn't show up, sometimes they do.
   4973      1.1  mrg   \definedummyword\bf
   4974      1.1  mrg   \definedummyword\gtr
   4975      1.1  mrg   \definedummyword\hat
   4976      1.1  mrg   \definedummyword\less
   4977      1.1  mrg   \definedummyword\sf
   4978      1.1  mrg   \definedummyword\sl
   4979      1.1  mrg   \definedummyword\tclose
   4980      1.1  mrg   \definedummyword\tt
   4981      1.1  mrg   %
   4982      1.1  mrg   \definedummyword\LaTeX
   4983      1.1  mrg   \definedummyword\TeX
   4984  1.1.1.3  mrg   %
   4985      1.1  mrg   % Assorted special characters.
   4986      1.1  mrg   \definedummyword\atchar
   4987      1.1  mrg   \definedummyword\arrow
   4988      1.1  mrg   \definedummyword\bullet
   4989      1.1  mrg   \definedummyword\comma
   4990      1.1  mrg   \definedummyword\copyright
   4991      1.1  mrg   \definedummyword\registeredsymbol
   4992      1.1  mrg   \definedummyword\dots
   4993      1.1  mrg   \definedummyword\enddots
   4994      1.1  mrg   \definedummyword\entrybreak
   4995      1.1  mrg   \definedummyword\equiv
   4996      1.1  mrg   \definedummyword\error
   4997      1.1  mrg   \definedummyword\euro
   4998      1.1  mrg   \definedummyword\expansion
   4999      1.1  mrg   \definedummyword\geq
   5000      1.1  mrg   \definedummyword\guillemetleft
   5001      1.1  mrg   \definedummyword\guillemetright
   5002  1.1.1.2  mrg   \definedummyword\guilsinglleft
   5003      1.1  mrg   \definedummyword\guilsinglright
   5004  1.1.1.3  mrg   \definedummyword\lbracechar
   5005      1.1  mrg   \definedummyword\leq
   5006      1.1  mrg   \definedummyword\mathopsup
   5007      1.1  mrg   \definedummyword\minus
   5008      1.1  mrg   \definedummyword\ogonek
   5009      1.1  mrg   \definedummyword\pounds
   5010      1.1  mrg   \definedummyword\point
   5011      1.1  mrg   \definedummyword\print
   5012      1.1  mrg   \definedummyword\quotedblbase
   5013      1.1  mrg   \definedummyword\quotedblleft
   5014      1.1  mrg   \definedummyword\quotedblright
   5015      1.1  mrg   \definedummyword\quoteleft
   5016  1.1.1.2  mrg   \definedummyword\quoteright
   5017      1.1  mrg   \definedummyword\quotesinglbase
   5018  1.1.1.3  mrg   \definedummyword\rbracechar
   5019  1.1.1.3  mrg   \definedummyword\result
   5020      1.1  mrg   \definedummyword\sub
   5021      1.1  mrg   \definedummyword\sup
   5022      1.1  mrg   \definedummyword\textdegree
   5023      1.1  mrg   %
   5024  1.1.1.3  mrg   % We want to disable all macros so that they are not expanded by \write.
   5025      1.1  mrg   \macrolist
   5026      1.1  mrg   \let\value\dummyvalue
   5027      1.1  mrg   %
   5028      1.1  mrg   \normalturnoffactive
   5029  1.1.1.3  mrg }
   5030  1.1.1.3  mrg 
   5031  1.1.1.3  mrg % \commondummiesnofonts: common to \definedummies and \indexnofonts.
   5032      1.1  mrg % Define \commondummyletter, \commondummyaccent and \commondummyword before
   5033      1.1  mrg % using.  Used for accents, font commands, and various control letters.
   5034      1.1  mrg %
   5035  1.1.1.3  mrg \def\commondummiesnofonts{%
   5036  1.1.1.3  mrg   % Control letters and accents.
   5037  1.1.1.3  mrg   \commondummyletter\!%
   5038  1.1.1.3  mrg   \commondummyaccent\"%
   5039  1.1.1.3  mrg   \commondummyaccent\'%
   5040  1.1.1.3  mrg   \commondummyletter\*%
   5041  1.1.1.3  mrg   \commondummyaccent\,%
   5042  1.1.1.3  mrg   \commondummyletter\.%
   5043  1.1.1.3  mrg   \commondummyletter\/%
   5044  1.1.1.3  mrg   \commondummyletter\:%
   5045  1.1.1.3  mrg   \commondummyaccent\=%
   5046  1.1.1.3  mrg   \commondummyletter\?%
   5047  1.1.1.3  mrg   \commondummyaccent\^%
   5048  1.1.1.3  mrg   \commondummyaccent\`%
   5049  1.1.1.3  mrg   \commondummyaccent\~%
   5050  1.1.1.3  mrg   \commondummyword\u
   5051  1.1.1.3  mrg   \commondummyword\v
   5052  1.1.1.3  mrg   \commondummyword\H
   5053  1.1.1.3  mrg   \commondummyword\dotaccent
   5054  1.1.1.3  mrg   \commondummyword\ogonek
   5055  1.1.1.3  mrg   \commondummyword\ringaccent
   5056  1.1.1.3  mrg   \commondummyword\tieaccent
   5057  1.1.1.3  mrg   \commondummyword\ubaraccent
   5058      1.1  mrg   \commondummyword\udotaccent
   5059      1.1  mrg   \commondummyword\dotless
   5060  1.1.1.3  mrg   %
   5061  1.1.1.3  mrg   % Texinfo font commands.
   5062  1.1.1.3  mrg   \commondummyword\b
   5063  1.1.1.3  mrg   \commondummyword\i
   5064  1.1.1.3  mrg   \commondummyword\r
   5065  1.1.1.3  mrg   \commondummyword\sansserif
   5066  1.1.1.3  mrg   \commondummyword\sc
   5067      1.1  mrg   \commondummyword\slanted
   5068      1.1  mrg   \commondummyword\t
   5069  1.1.1.3  mrg   %
   5070  1.1.1.3  mrg   % Commands that take arguments.
   5071  1.1.1.3  mrg   \commondummyword\abbr
   5072  1.1.1.3  mrg   \commondummyword\acronym
   5073  1.1.1.3  mrg   \commondummyword\anchor
   5074  1.1.1.3  mrg   \commondummyword\cite
   5075  1.1.1.3  mrg   \commondummyword\code
   5076  1.1.1.3  mrg   \commondummyword\command
   5077  1.1.1.3  mrg   \commondummyword\dfn
   5078  1.1.1.3  mrg   \commondummyword\dmn
   5079  1.1.1.3  mrg   \commondummyword\email
   5080  1.1.1.3  mrg   \commondummyword\emph
   5081  1.1.1.3  mrg   \commondummyword\env
   5082  1.1.1.3  mrg   \commondummyword\file
   5083  1.1.1.3  mrg   \commondummyword\image
   5084  1.1.1.3  mrg   \commondummyword\indicateurl
   5085  1.1.1.3  mrg   \commondummyword\inforef
   5086  1.1.1.3  mrg   \commondummyword\kbd
   5087  1.1.1.3  mrg   \commondummyword\key
   5088  1.1.1.3  mrg   \commondummyword\math
   5089  1.1.1.3  mrg   \commondummyword\option
   5090  1.1.1.3  mrg   \commondummyword\pxref
   5091  1.1.1.3  mrg   \commondummyword\ref
   5092  1.1.1.3  mrg   \commondummyword\samp
   5093  1.1.1.3  mrg   \commondummyword\strong
   5094  1.1.1.3  mrg   \commondummyword\tie
   5095  1.1.1.3  mrg   \commondummyword\U
   5096  1.1.1.3  mrg   \commondummyword\uref
   5097  1.1.1.3  mrg   \commondummyword\url
   5098  1.1.1.3  mrg   \commondummyword\var
   5099  1.1.1.3  mrg   \commondummyword\verb
   5100  1.1.1.3  mrg   \commondummyword\w
   5101  1.1.1.3  mrg   \commondummyword\xref
   5102  1.1.1.3  mrg }
   5103  1.1.1.3  mrg 
   5104  1.1.1.3  mrg % For testing: output @{ and @} in index sort strings as \{ and \}.
   5105  1.1.1.3  mrg \newif\ifusebracesinindexes
   5106  1.1.1.3  mrg 
   5107  1.1.1.3  mrg \let\indexlbrace\relax
   5108  1.1.1.3  mrg \let\indexrbrace\relax
   5109  1.1.1.3  mrg 
   5110  1.1.1.3  mrg {\catcode`\@=0
   5111  1.1.1.3  mrg \catcode`\\=13
   5112  1.1.1.3  mrg   @gdef@backslashdisappear{@def\{}}
   5113  1.1.1.3  mrg }
   5114  1.1.1.3  mrg 
   5115  1.1.1.3  mrg {
   5116  1.1.1.3  mrg \catcode`\<=13
   5117  1.1.1.3  mrg \catcode`\-=13
   5118  1.1.1.3  mrg \catcode`\`=13
   5119  1.1.1.3  mrg   \gdef\indexnonalnumdisappear{%
   5120  1.1.1.3  mrg     \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax\else
   5121  1.1.1.3  mrg       % @set txiindexlquoteignore makes us ignore left quotes in the sort term.
   5122  1.1.1.3  mrg       % (Introduced for FSFS 2nd ed.)
   5123  1.1.1.3  mrg       \let`=\empty
   5124  1.1.1.3  mrg     \fi
   5125  1.1.1.3  mrg     %
   5126  1.1.1.3  mrg     \expandafter\ifx\csname SETtxiindexbackslashignore\endcsname\relax\else
   5127  1.1.1.3  mrg       \backslashdisappear
   5128  1.1.1.3  mrg     \fi
   5129  1.1.1.3  mrg     %
   5130  1.1.1.3  mrg     \expandafter\ifx\csname SETtxiindexhyphenignore\endcsname\relax\else
   5131  1.1.1.3  mrg       \def-{}%
   5132  1.1.1.3  mrg     \fi
   5133  1.1.1.3  mrg     \expandafter\ifx\csname SETtxiindexlessthanignore\endcsname\relax\else
   5134  1.1.1.3  mrg       \def<{}%
   5135  1.1.1.3  mrg     \fi
   5136  1.1.1.3  mrg     \expandafter\ifx\csname SETtxiindexatsignignore\endcsname\relax\else
   5137  1.1.1.3  mrg       \def\@{}%
   5138  1.1.1.3  mrg     \fi
   5139  1.1.1.3  mrg   }
   5140  1.1.1.3  mrg 
   5141  1.1.1.3  mrg   \gdef\indexnonalnumreappear{%
   5142  1.1.1.3  mrg     \useindexbackslash
   5143  1.1.1.3  mrg     \let-\normaldash
   5144  1.1.1.3  mrg     \let<\normalless
   5145      1.1  mrg     \def\@{@}%
   5146      1.1  mrg   }
   5147  1.1.1.3  mrg }
   5148      1.1  mrg 
   5149      1.1  mrg 
   5150      1.1  mrg % \indexnofonts is used when outputting the strings to sort the index
   5151      1.1  mrg % by, and when constructing control sequence names.  It eliminates all
   5152      1.1  mrg % control sequences and just writes whatever the best ASCII sort string
   5153      1.1  mrg % would be for a given command (usually its argument).
   5154      1.1  mrg %
   5155  1.1.1.3  mrg \def\indexnofonts{%
   5156      1.1  mrg   % Accent commands should become @asis.
   5157  1.1.1.3  mrg   \def\commondummyaccent##1{\let##1\asis}%
   5158      1.1  mrg   % We can just ignore other control letters.
   5159  1.1.1.3  mrg   \def\commondummyletter##1{\let##1\empty}%
   5160      1.1  mrg   % All control words become @asis by default; overrides below.
   5161      1.1  mrg   \let\commondummyword\commondummyaccent
   5162      1.1  mrg   \commondummiesnofonts
   5163      1.1  mrg   %
   5164      1.1  mrg   % Don't no-op \tt, since it isn't a user-level command
   5165      1.1  mrg   % and is used in the definitions of the active chars like <, >, |, etc.
   5166      1.1  mrg   % Likewise with the other plain tex font commands.
   5167      1.1  mrg   %\let\tt=\asis
   5168      1.1  mrg   %
   5169      1.1  mrg   \def\ { }%
   5170      1.1  mrg   \def\@{@}%
   5171      1.1  mrg   \def\_{\normalunderscore}%
   5172  1.1.1.3  mrg   \def\-{}% @- shouldn't affect sorting
   5173  1.1.1.3  mrg   %
   5174  1.1.1.3  mrg   \uccode`\1=`\{ \uppercase{\def\{{1}}%
   5175  1.1.1.3  mrg   \uccode`\1=`\} \uppercase{\def\}{1}}%
   5176      1.1  mrg   \let\lbracechar\{%
   5177      1.1  mrg   \let\rbracechar\}%
   5178      1.1  mrg   %
   5179      1.1  mrg   % Non-English letters.
   5180      1.1  mrg   \def\AA{AA}%
   5181      1.1  mrg   \def\AE{AE}%
   5182      1.1  mrg   \def\DH{DZZ}%
   5183      1.1  mrg   \def\L{L}%
   5184  1.1.1.3  mrg   \def\OE{OE}%
   5185      1.1  mrg   \def\O{O}%
   5186      1.1  mrg   \def\TH{TH}%
   5187      1.1  mrg   \def\aa{aa}%
   5188      1.1  mrg   \def\ae{ae}%
   5189      1.1  mrg   \def\dh{dzz}%
   5190      1.1  mrg   \def\exclamdown{!}%
   5191      1.1  mrg   \def\l{l}%
   5192      1.1  mrg   \def\oe{oe}%
   5193      1.1  mrg   \def\ordf{a}%
   5194      1.1  mrg   \def\ordm{o}%
   5195      1.1  mrg   \def\o{o}%
   5196  1.1.1.3  mrg   \def\questiondown{?}%
   5197      1.1  mrg   \def\ss{ss}%
   5198      1.1  mrg   \def\th{th}%
   5199      1.1  mrg   %
   5200      1.1  mrg   \def\LaTeX{LaTeX}%
   5201  1.1.1.3  mrg   \def\TeX{TeX}%
   5202  1.1.1.3  mrg   %
   5203  1.1.1.3  mrg   % Assorted special characters.  \defglyph gives the control sequence a
   5204  1.1.1.3  mrg   % definition that removes the {} that follows its use.
   5205  1.1.1.3  mrg   \defglyph\atchar{@}%
   5206  1.1.1.3  mrg   \defglyph\arrow{->}%
   5207  1.1.1.3  mrg   \defglyph\bullet{bullet}%
   5208  1.1.1.3  mrg   \defglyph\comma{,}%
   5209  1.1.1.3  mrg   \defglyph\copyright{copyright}%
   5210  1.1.1.3  mrg   \defglyph\dots{...}%
   5211  1.1.1.3  mrg   \defglyph\enddots{...}%
   5212  1.1.1.3  mrg   \defglyph\equiv{==}%
   5213  1.1.1.3  mrg   \defglyph\error{error}%
   5214  1.1.1.3  mrg   \defglyph\euro{euro}%
   5215  1.1.1.3  mrg   \defglyph\expansion{==>}%
   5216  1.1.1.3  mrg   \defglyph\geq{>=}%
   5217  1.1.1.3  mrg   \defglyph\guillemetleft{<<}%
   5218  1.1.1.3  mrg   \defglyph\guillemetright{>>}%
   5219  1.1.1.3  mrg   \defglyph\guilsinglleft{<}%
   5220  1.1.1.3  mrg   \defglyph\guilsinglright{>}%
   5221  1.1.1.3  mrg   \defglyph\leq{<=}%
   5222  1.1.1.3  mrg   \defglyph\lbracechar{\{}%
   5223  1.1.1.3  mrg   \defglyph\minus{-}%
   5224  1.1.1.3  mrg   \defglyph\point{.}%
   5225  1.1.1.3  mrg   \defglyph\pounds{pounds}%
   5226  1.1.1.3  mrg   \defglyph\print{-|}%
   5227  1.1.1.3  mrg   \defglyph\quotedblbase{"}%
   5228  1.1.1.3  mrg   \defglyph\quotedblleft{"}%
   5229  1.1.1.3  mrg   \defglyph\quotedblright{"}%
   5230  1.1.1.3  mrg   \defglyph\quoteleft{`}%
   5231  1.1.1.3  mrg   \defglyph\quoteright{'}%
   5232  1.1.1.3  mrg   \defglyph\quotesinglbase{,}%
   5233  1.1.1.3  mrg   \defglyph\rbracechar{\}}%
   5234  1.1.1.3  mrg   \defglyph\registeredsymbol{R}%
   5235      1.1  mrg   \defglyph\result{=>}%
   5236      1.1  mrg   \defglyph\textdegree{o}%
   5237      1.1  mrg   %
   5238      1.1  mrg   % We need to get rid of all macros, leaving only the arguments (if present).
   5239      1.1  mrg   % Of course this is not nearly correct, but it is the best we can do for now.
   5240      1.1  mrg   % makeinfo does not expand macros in the argument to @deffn, which ends up
   5241      1.1  mrg   % writing an index entry, and texindex isn't prepared for an index sort entry
   5242      1.1  mrg   % that starts with \.
   5243      1.1  mrg   %
   5244      1.1  mrg   % Since macro invocations are followed by braces, we can just redefine them
   5245      1.1  mrg   % to take a single TeX argument.  The case of a macro invocation that
   5246      1.1  mrg   % goes to end-of-line is not handled.
   5247  1.1.1.3  mrg   %
   5248      1.1  mrg   \macrolist
   5249  1.1.1.3  mrg   \let\value\indexnofontsvalue
   5250  1.1.1.3  mrg }
   5251  1.1.1.3  mrg \def\defglyph#1#2{\def#1##1{#2}} % see above
   5252      1.1  mrg 
   5253      1.1  mrg 
   5255      1.1  mrg 
   5256      1.1  mrg 
   5257      1.1  mrg \let\SETmarginindex=\relax % put index entries in margin (undocumented)?
   5258      1.1  mrg 
   5259      1.1  mrg % Most index entries go through here, but \dosubind is the general case.
   5260  1.1.1.3  mrg % #1 is the index name, #2 is the entry text.
   5261  1.1.1.3  mrg \def\doind#1#2{\dosubind{#1}{#2}{}}
   5262  1.1.1.3  mrg 
   5263  1.1.1.3  mrg % There is also \dosubind {index}{topic}{subtopic}
   5264  1.1.1.3  mrg % which makes an entry in a two-level index such as the operation index.
   5265      1.1  mrg % TODO: Two-level index?  Operation index?
   5266      1.1  mrg 
   5267      1.1  mrg % Workhorse for all indexes.
   5268      1.1  mrg % #1 is name of index, #2 is stuff to put there, #3 is subentry --
   5269      1.1  mrg % empty if called from \doind, as we usually are (the main exception
   5270      1.1  mrg % is with most defuns, which call us directly).
   5271      1.1  mrg %
   5272  1.1.1.3  mrg \def\dosubind#1#2#3{%
   5273      1.1  mrg   \iflinks
   5274      1.1  mrg   {%
   5275      1.1  mrg     \requireopenindexfile{#1}%
   5276      1.1  mrg     % Store the main index entry text (including the third arg).
   5277      1.1  mrg     \toks0 = {#2}%
   5278      1.1  mrg     % If third arg is present, precede it with a space.
   5279      1.1  mrg     \def\thirdarg{#3}%
   5280      1.1  mrg     \ifx\thirdarg\empty \else
   5281      1.1  mrg       \toks0 = \expandafter{\the\toks0 \space #3}%
   5282      1.1  mrg     \fi
   5283      1.1  mrg     %
   5284      1.1  mrg     \edef\writeto{\csname#1indfile\endcsname}%
   5285      1.1  mrg     %
   5286      1.1  mrg     \safewhatsit\dosubindwrite
   5287      1.1  mrg   }%
   5288  1.1.1.3  mrg   \fi
   5289  1.1.1.3  mrg }
   5290  1.1.1.3  mrg 
   5291  1.1.1.3  mrg % Check if an index file has been opened, and if not, open it.
   5292  1.1.1.3  mrg \def\requireopenindexfile#1{%
   5293  1.1.1.3  mrg \ifnum\csname #1indfile\endcsname=0
   5294  1.1.1.3  mrg   \expandafter\newwrite \csname#1indfile\endcsname
   5295  1.1.1.3  mrg   \edef\suffix{#1}%
   5296  1.1.1.3  mrg   % A .fls suffix would conflict with the file extension for the output
   5297  1.1.1.3  mrg   % of -recorder, so use .f1s instead.
   5298  1.1.1.3  mrg   \ifx\suffix\indexisfl\def\suffix{f1}\fi
   5299  1.1.1.3  mrg   % Open the file
   5300  1.1.1.3  mrg   \immediate\openout\csname#1indfile\endcsname \jobname.\suffix
   5301  1.1.1.3  mrg   % Using \immediate above here prevents an object entering into the current 
   5302  1.1.1.3  mrg   % box, which could confound checks such as those in \safewhatsit for
   5303  1.1.1.3  mrg   % preceding skips.
   5304  1.1.1.3  mrg   \typeout{Writing index file \jobname.\suffix}%
   5305  1.1.1.3  mrg \fi}
   5306  1.1.1.3  mrg \def\indexisfl{fl}
   5307  1.1.1.3  mrg 
   5308  1.1.1.3  mrg % Output \ as {\indexbackslash}, because \ is an escape character in
   5309  1.1.1.3  mrg % the index files.
   5310  1.1.1.3  mrg \let\indexbackslash=\relax
   5311  1.1.1.3  mrg {\catcode`\@=0 \catcode`\\=\active
   5312  1.1.1.3  mrg   @gdef@useindexbackslash{@def\{{@indexbackslash}}}
   5313  1.1.1.3  mrg }
   5314  1.1.1.3  mrg 
   5315  1.1.1.3  mrg % Definition for writing index entry text.
   5316  1.1.1.3  mrg \def\sortas#1{\ignorespaces}%
   5317  1.1.1.3  mrg 
   5318  1.1.1.3  mrg % Definition for writing index entry sort key.  Should occur at the at
   5319  1.1.1.3  mrg % the beginning of the index entry, like
   5320  1.1.1.3  mrg %     @cindex @sortas{september} \september
   5321  1.1.1.3  mrg % The \ignorespaces takes care of following space, but there's no way
   5322  1.1.1.3  mrg % to remove space before it.
   5323  1.1.1.3  mrg {
   5324  1.1.1.3  mrg \catcode`\-=13
   5325  1.1.1.3  mrg \gdef\indexwritesortas{%
   5326  1.1.1.3  mrg   \begingroup
   5327  1.1.1.3  mrg   \indexnonalnumreappear
   5328  1.1.1.3  mrg   \indexwritesortasxxx}
   5329  1.1.1.3  mrg \gdef\indexwritesortasxxx#1{%
   5330  1.1.1.3  mrg   \xdef\indexsortkey{#1}\endgroup}
   5331  1.1.1.3  mrg }
   5332      1.1  mrg 
   5333      1.1  mrg 
   5334      1.1  mrg % Write the entry in \toks0 to the index file.
   5335      1.1  mrg %
   5336      1.1  mrg \def\dosubindwrite{%
   5337      1.1  mrg   % Put the index entry in the margin if desired.
   5338      1.1  mrg   \ifx\SETmarginindex\relax\else
   5339      1.1  mrg     \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}%
   5340      1.1  mrg   \fi
   5341  1.1.1.3  mrg   %
   5342  1.1.1.3  mrg   % Remember, we are within a group.
   5343  1.1.1.3  mrg   \indexdummies % Must do this here, since \bf, etc expand at this stage
   5344      1.1  mrg   \useindexbackslash % \indexbackslash isn't defined now so it will be output 
   5345  1.1.1.3  mrg                      % as is; and it will print as backslash.
   5346  1.1.1.3  mrg   % The braces around \indexbrace are recognized by texindex.
   5347      1.1  mrg   %
   5348  1.1.1.3  mrg   % Get the string to sort by, by processing the index entry with all
   5349  1.1.1.3  mrg   % font commands turned off.
   5350  1.1.1.3  mrg   {\indexnofonts
   5351  1.1.1.3  mrg    \def\lbracechar{{\indexlbrace}}%
   5352  1.1.1.3  mrg    \def\rbracechar{{\indexrbrace}}%
   5353  1.1.1.3  mrg    \let\{=\lbracechar
   5354  1.1.1.3  mrg    \let\}=\rbracechar
   5355  1.1.1.3  mrg    \indexnonalnumdisappear
   5356  1.1.1.3  mrg    \xdef\indexsortkey{}%
   5357  1.1.1.3  mrg    \let\sortas=\indexwritesortas
   5358  1.1.1.3  mrg    \edef\temp{\the\toks0}%
   5359  1.1.1.3  mrg    \setbox\dummybox = \hbox{\temp}% Make sure to execute any \sortas
   5360  1.1.1.3  mrg    \ifx\indexsortkey\empty
   5361      1.1  mrg      \xdef\indexsortkey{\temp}%
   5362      1.1  mrg      \ifx\indexsortkey\empty\xdef\indexsortkey{ }\fi
   5363      1.1  mrg    \fi
   5364      1.1  mrg   }%
   5365      1.1  mrg   %
   5366      1.1  mrg   % Set up the complete index entry, with both the sort key and
   5367      1.1  mrg   % the original text, including any font commands.  We write
   5368      1.1  mrg   % three arguments to \entry to the .?? file (four in the
   5369      1.1  mrg   % subentry case), texindex reduces to two when writing the .??s
   5370  1.1.1.3  mrg   % sorted result.
   5371      1.1  mrg   \edef\temp{%
   5372      1.1  mrg     \write\writeto{%
   5373      1.1  mrg       \string\entry{\indexsortkey}{\noexpand\folio}{\the\toks0}}%
   5374  1.1.1.3  mrg   }%
   5375      1.1  mrg   \temp
   5376      1.1  mrg }
   5377      1.1  mrg \newbox\dummybox % used above
   5378      1.1  mrg 
   5379      1.1  mrg % Take care of unwanted page breaks/skips around a whatsit:
   5380      1.1  mrg %
   5381      1.1  mrg % If a skip is the last thing on the list now, preserve it
   5382      1.1  mrg % by backing up by \lastskip, doing the \write, then inserting
   5383      1.1  mrg % the skip again.  Otherwise, the whatsit generated by the
   5384      1.1  mrg % \write or \pdfdest will make \lastskip zero.  The result is that
   5385      1.1  mrg % sequences like this:
   5386      1.1  mrg % @end defun
   5387      1.1  mrg % @tindex whatever
   5388      1.1  mrg % @defun ...
   5389      1.1  mrg % will have extra space inserted, because the \medbreak in the
   5390      1.1  mrg % start of the @defun won't see the skip inserted by the @end of
   5391      1.1  mrg % the previous defun.
   5392      1.1  mrg %
   5393      1.1  mrg % But don't do any of this if we're not in vertical mode.  We
   5394      1.1  mrg % don't want to do a \vskip and prematurely end a paragraph.
   5395      1.1  mrg %
   5396      1.1  mrg % Avoid page breaks due to these extra skips, too.
   5397      1.1  mrg %
   5398      1.1  mrg % But wait, there is a catch there:
   5399      1.1  mrg % We'll have to check whether \lastskip is zero skip.  \ifdim is not
   5400      1.1  mrg % sufficient for this purpose, as it ignores stretch and shrink parts
   5401      1.1  mrg % of the skip.  The only way seems to be to check the textual
   5402      1.1  mrg % representation of the skip.
   5403      1.1  mrg %
   5404      1.1  mrg % The following is almost like \def\zeroskipmacro{0.0pt} except that
   5405      1.1  mrg % the ``p'' and ``t'' characters have catcode \other, not 11 (letter).
   5406      1.1  mrg %
   5407      1.1  mrg \edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname}
   5408      1.1  mrg %
   5409      1.1  mrg \newskip\whatsitskip
   5410      1.1  mrg \newcount\whatsitpenalty
   5411      1.1  mrg %
   5412      1.1  mrg % ..., ready, GO:
   5413      1.1  mrg %
   5414      1.1  mrg \def\safewhatsit#1{\ifhmode
   5415      1.1  mrg   #1%
   5416      1.1  mrg  \else
   5417      1.1  mrg   % \lastskip and \lastpenalty cannot both be nonzero simultaneously.
   5418      1.1  mrg   \whatsitskip = \lastskip
   5419      1.1  mrg   \edef\lastskipmacro{\the\lastskip}%
   5420      1.1  mrg   \whatsitpenalty = \lastpenalty
   5421      1.1  mrg   %
   5422      1.1  mrg   % If \lastskip is nonzero, that means the last item was a
   5423      1.1  mrg   % skip.  And since a skip is discardable, that means this
   5424      1.1  mrg   % -\whatsitskip glue we're inserting is preceded by a
   5425      1.1  mrg   % non-discardable item, therefore it is not a potential
   5426      1.1  mrg   % breakpoint, therefore no \nobreak needed.
   5427      1.1  mrg   \ifx\lastskipmacro\zeroskipmacro
   5428      1.1  mrg   \else
   5429      1.1  mrg     \vskip-\whatsitskip
   5430      1.1  mrg   \fi
   5431      1.1  mrg   %
   5432      1.1  mrg   #1%
   5433      1.1  mrg   %
   5434      1.1  mrg   \ifx\lastskipmacro\zeroskipmacro
   5435      1.1  mrg     % If \lastskip was zero, perhaps the last item was a penalty, and
   5436      1.1  mrg     % perhaps it was >=10000, e.g., a \nobreak.  In that case, we want
   5437      1.1  mrg     % to re-insert the same penalty (values >10000 are used for various
   5438      1.1  mrg     % signals); since we just inserted a non-discardable item, any
   5439      1.1  mrg     % following glue (such as a \parskip) would be a breakpoint.  For example:
   5440      1.1  mrg     %   @deffn deffn-whatever
   5441      1.1  mrg     %   @vindex index-whatever
   5442      1.1  mrg     %   Description.
   5443      1.1  mrg     % would allow a break between the index-whatever whatsit
   5444      1.1  mrg     % and the "Description." paragraph.
   5445      1.1  mrg     \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi
   5446      1.1  mrg   \else
   5447      1.1  mrg     % On the other hand, if we had a nonzero \lastskip,
   5448      1.1  mrg     % this make-up glue would be preceded by a non-discardable item
   5449      1.1  mrg     % (the whatsit from the \write), so we must insert a \nobreak.
   5450      1.1  mrg     \nobreak\vskip\whatsitskip
   5451      1.1  mrg   \fi
   5452      1.1  mrg \fi}
   5453      1.1  mrg 
   5454      1.1  mrg % The index entry written in the file actually looks like
   5455      1.1  mrg %  \entry {sortstring}{page}{topic}
   5456      1.1  mrg % or
   5457      1.1  mrg %  \entry {sortstring}{page}{topic}{subtopic}
   5458      1.1  mrg % The texindex program reads in these files and writes files
   5459      1.1  mrg % containing these kinds of lines:
   5460      1.1  mrg %  \initial {c}
   5461      1.1  mrg %     before the first topic whose initial is c
   5462      1.1  mrg %  \entry {topic}{pagelist}
   5463      1.1  mrg %     for a topic that is used without subtopics
   5464      1.1  mrg %  \primary {topic}
   5465      1.1  mrg %     for the beginning of a topic that is used with subtopics
   5466      1.1  mrg %  \secondary {subtopic}{pagelist}
   5467      1.1  mrg %     for each subtopic.
   5468      1.1  mrg 
   5469      1.1  mrg % Define the user-accessible indexing commands
   5470      1.1  mrg % @findex, @vindex, @kindex, @cindex.
   5471      1.1  mrg 
   5472      1.1  mrg \def\findex {\fnindex}
   5473      1.1  mrg \def\kindex {\kyindex}
   5474      1.1  mrg \def\cindex {\cpindex}
   5475      1.1  mrg \def\vindex {\vrindex}
   5476      1.1  mrg \def\tindex {\tpindex}
   5477      1.1  mrg \def\pindex {\pgindex}
   5478      1.1  mrg 
   5479      1.1  mrg \def\cindexsub {\begingroup\obeylines\cindexsub}
   5480      1.1  mrg {\obeylines %
   5481      1.1  mrg \gdef\cindexsub "#1" #2^^M{\endgroup %
   5482      1.1  mrg \dosubind{cp}{#2}{#1}}}
   5483      1.1  mrg 
   5484      1.1  mrg % Define the macros used in formatting output of the sorted index material.
   5485      1.1  mrg 
   5486      1.1  mrg % @printindex causes a particular index (the ??s file) to get printed.
   5487      1.1  mrg % It does not print any chapter heading (usually an @unnumbered).
   5488      1.1  mrg %
   5489      1.1  mrg \parseargdef\printindex{\begingroup
   5490      1.1  mrg   \dobreak \chapheadingskip{10000}%
   5491      1.1  mrg   %
   5492      1.1  mrg   \smallfonts \rm
   5493      1.1  mrg   \tolerance = 9500
   5494      1.1  mrg   \plainfrenchspacing
   5495      1.1  mrg   \everypar = {}% don't want the \kern\-parindent from indentation suppression.
   5496      1.1  mrg   %
   5497      1.1  mrg   % See if the index file exists and is nonempty.
   5498      1.1  mrg   % Change catcode of @ here so that if the index file contains
   5499  1.1.1.3  mrg   % \initial {@}
   5500  1.1.1.3  mrg   % as its first line, TeX doesn't complain about mismatched braces
   5501  1.1.1.3  mrg   % (because it thinks @} is a control sequence).
   5502  1.1.1.3  mrg   \catcode`\@ = 12
   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   \openin 1 \jobname.\indexname s
   5506      1.1  mrg   \ifeof 1
   5507      1.1  mrg     % \enddoublecolumns gets confused if there is no text in the index,
   5508      1.1  mrg     % and it loses the chapter title and the aux file entries for the
   5509  1.1.1.3  mrg     % index.  The easiest way to prevent this problem is to make sure
   5510      1.1  mrg     % there is some text.
   5511  1.1.1.3  mrg     \putwordIndexNonexistent
   5512      1.1  mrg     \typeout{No file \jobname.\indexname s.}%
   5513      1.1  mrg   \else
   5514      1.1  mrg     \catcode`\\ = 0
   5515      1.1  mrg     %
   5516  1.1.1.3  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.1.3  mrg       % Index files are almost Texinfo source, but we use \ as the escape
   5524  1.1.1.3  mrg       % character.  It would be better to use @, but that's too big a change
   5525  1.1.1.3  mrg       % to make right now.
   5526      1.1  mrg       \def\indexbackslash{\ttbackslash}%
   5527  1.1.1.3  mrg       \let\indexlbrace\{   % Likewise, set these sequences for braces
   5528  1.1.1.3  mrg       \let\indexrbrace\}   % used in the sort key.
   5529  1.1.1.3  mrg       \begindoublecolumns
   5530  1.1.1.3  mrg       \let\dotheinsertentrybox\dotheinsertentryboxwithpenalty
   5531  1.1.1.3  mrg       %
   5532  1.1.1.3  mrg       % Read input from the index file line by line.
   5533  1.1.1.3  mrg       \loopdo
   5534  1.1.1.3  mrg         \ifeof1 \else
   5535  1.1.1.3  mrg           \read 1 to \nextline
   5536  1.1.1.3  mrg         \fi
   5537  1.1.1.3  mrg         %
   5538  1.1.1.3  mrg         \indexinputprocessing
   5539  1.1.1.3  mrg         \thisline
   5540  1.1.1.3  mrg         %
   5541  1.1.1.3  mrg         \ifeof1\else
   5542      1.1  mrg         \let\thisline\nextline
   5543      1.1  mrg       \repeat
   5544      1.1  mrg       %%
   5545      1.1  mrg       \enddoublecolumns
   5546      1.1  mrg     \fi
   5547  1.1.1.3  mrg   \fi
   5548  1.1.1.3  mrg   \closein 1
   5549  1.1.1.3  mrg \endgroup}
   5550  1.1.1.3  mrg \def\loopdo#1\repeat{\def\body{#1}\loopdoxxx}
   5551  1.1.1.3  mrg \def\loopdoxxx{\let\next=\relax\body\let\next=\loopdoxxx\fi\next}
   5552  1.1.1.3  mrg 
   5553  1.1.1.3  mrg \def\indexinputprocessing{%
   5554  1.1.1.3  mrg   \ifeof1
   5555  1.1.1.3  mrg     \let\firsttoken\relax
   5556  1.1.1.3  mrg   \else
   5557  1.1.1.3  mrg     \edef\act{\gdef\noexpand\firsttoken{\getfirsttoken\nextline}}%
   5558  1.1.1.3  mrg     \act
   5559  1.1.1.3  mrg   \fi
   5560  1.1.1.3  mrg }
   5561      1.1  mrg \def\getfirsttoken#1{\expandafter\getfirsttokenx#1\endfirsttoken}
   5562      1.1  mrg \long\def\getfirsttokenx#1#2\endfirsttoken{\noexpand#1}
   5563      1.1  mrg 
   5564      1.1  mrg 
   5565  1.1.1.3  mrg % These macros are used by the sorted index file itself.
   5566  1.1.1.3  mrg % Change them to control the appearance of the index.
   5567  1.1.1.3  mrg 
   5568  1.1.1.3  mrg {\catcode`\/=13 \catcode`\-=13 \catcode`\^=13 \catcode`\~=13 \catcode`\_=13
   5569  1.1.1.3  mrg \catcode`\|=13 \catcode`\<=13 \catcode`\>=13 \catcode`\+=13 \catcode`\"=13
   5570  1.1.1.3  mrg \catcode`\$=3
   5571  1.1.1.3  mrg \gdef\initialglyphs{%
   5572  1.1.1.3  mrg   % Some changes for non-alphabetic characters.  Using the glyphs from the
   5573  1.1.1.3  mrg   % math fonts looks more consistent than the typewriter font used elsewhere
   5574  1.1.1.3  mrg   % for these characters.
   5575  1.1.1.3  mrg   \def\indexbackslash{\math{\backslash}}%
   5576  1.1.1.3  mrg   \let\\=\indexbackslash
   5577  1.1.1.3  mrg   %
   5578  1.1.1.3  mrg   % Can't get bold backslash so don't use bold forward slash
   5579  1.1.1.3  mrg   \catcode`\/=13
   5580  1.1.1.3  mrg   \def/{{\secrmnotbold \normalslash}}%
   5581  1.1.1.3  mrg   \def-{{\normaldash\normaldash}}% en dash `--'
   5582  1.1.1.3  mrg   \def^{{\chapbf \normalcaret}}%
   5583  1.1.1.3  mrg   \def~{{\chapbf \normaltilde}}%
   5584  1.1.1.3  mrg   \def\_{%
   5585  1.1.1.3  mrg      \leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }%
   5586  1.1.1.3  mrg   \def|{$\vert$}%
   5587  1.1.1.3  mrg   \def<{$\less$}%
   5588  1.1.1.3  mrg   \def>{$\gtr$}%
   5589  1.1.1.3  mrg   \def+{$\normalplus$}%
   5590  1.1.1.3  mrg }}
   5591  1.1.1.3  mrg 
   5592  1.1.1.3  mrg \def\initial{%
   5593  1.1.1.3  mrg   \bgroup
   5594  1.1.1.3  mrg   \initialglyphs
   5595  1.1.1.3  mrg   \initialx
   5596      1.1  mrg }
   5597      1.1  mrg 
   5598      1.1  mrg \def\initialx#1{%
   5599      1.1  mrg   % Remove any glue we may have, we'll be inserting our own.
   5600  1.1.1.3  mrg   \removelastskip
   5601  1.1.1.3  mrg   %
   5602      1.1  mrg   % We like breaks before the index initials, so insert a bonus.
   5603  1.1.1.3  mrg   % The glue before the bonus allows a little bit of space at the
   5604  1.1.1.3  mrg   % bottom of a column to reduce an increase in inter-line spacing.
   5605  1.1.1.3  mrg   \nobreak
   5606      1.1  mrg   \vskip 0pt plus 5\baselineskip
   5607      1.1  mrg   \penalty -300 
   5608      1.1  mrg   \vskip 0pt plus -5\baselineskip
   5609      1.1  mrg   %
   5610      1.1  mrg   % Typeset the initial.  Making this add up to a whole number of
   5611      1.1  mrg   % baselineskips increases the chance of the dots lining up from column
   5612      1.1  mrg   % to column.  It still won't often be perfect, because of the stretch
   5613  1.1.1.3  mrg   % we need before each entry, but it's better.
   5614  1.1.1.3  mrg   %
   5615  1.1.1.3  mrg   % No shrink because it confuses \balancecolumns.
   5616  1.1.1.3  mrg   \vskip 1.67\baselineskip plus 1\baselineskip
   5617  1.1.1.3  mrg   \leftline{\secfonts \kern-0.05em \secbf #1}%
   5618      1.1  mrg   % \secfonts is inside the argument of \leftline so that the change of
   5619      1.1  mrg   % \baselineskip will not affect any glue inserted before the vbox that
   5620      1.1  mrg   % \leftline creates.
   5621  1.1.1.3  mrg   % Do our best not to break after the initial.
   5622  1.1.1.3  mrg   \nobreak
   5623  1.1.1.3  mrg   \vskip .33\baselineskip plus .1\baselineskip
   5624  1.1.1.3  mrg   \egroup % \initialglyphs
   5625  1.1.1.3  mrg }
   5626      1.1  mrg 
   5627      1.1  mrg \newdimen\entryrightmargin
   5628      1.1  mrg \entryrightmargin=0pt
   5629      1.1  mrg 
   5630      1.1  mrg % \entry typesets a paragraph consisting of the text (#1), dot leaders, and
   5631      1.1  mrg % then page number (#2) flushed to the right margin.  It is used for index
   5632      1.1  mrg % and table of contents entries.  The paragraph is indented by \leftskip.
   5633      1.1  mrg %
   5634  1.1.1.3  mrg \def\entry{%
   5635  1.1.1.3  mrg   \begingroup
   5636  1.1.1.3  mrg     %
   5637  1.1.1.3  mrg     % For pdfTeX and XeTeX.
   5638  1.1.1.3  mrg     % The redefinition of \domark stops marks being added in \pdflink to 
   5639  1.1.1.3  mrg     % preserve coloured links across page boundaries.  Otherwise the marks
   5640      1.1  mrg     % would get in the way of \lastbox in \insertentrybox.
   5641      1.1  mrg     \let\domark\relax
   5642      1.1  mrg     %
   5643      1.1  mrg     % Start a new paragraph if necessary, so our assignments below can't
   5644      1.1  mrg     % affect previous text.
   5645      1.1  mrg     \par
   5646      1.1  mrg     %
   5647      1.1  mrg     % No extra space above this paragraph.
   5648      1.1  mrg     \parskip = 0in
   5649      1.1  mrg     %
   5650      1.1  mrg     % When reading the text of entry, convert explicit line breaks
   5651  1.1.1.3  mrg     % from @* into spaces.  The user might give these in long section
   5652      1.1  mrg     % titles, for instance.
   5653      1.1  mrg     \def\*{\unskip\space\ignorespaces}%
   5654      1.1  mrg     \def\entrybreak{\hfil\break}% An undocumented command
   5655      1.1  mrg     %
   5656      1.1  mrg     % Swallow the left brace of the text (first parameter):
   5657      1.1  mrg     \afterassignment\doentry
   5658      1.1  mrg     \let\temp =
   5659  1.1.1.3  mrg }
   5660  1.1.1.3  mrg \def\entrybreak{\unskip\space\ignorespaces}%
   5661      1.1  mrg \def\doentry{%
   5662      1.1  mrg     % Save the text of the entry
   5663      1.1  mrg     \global\setbox\boxA=\hbox\bgroup
   5664      1.1  mrg     \bgroup % Instead of the swallowed brace.
   5665  1.1.1.3  mrg       \noindent
   5666  1.1.1.3  mrg       \aftergroup\finishentry
   5667      1.1  mrg       % And now comes the text of the entry.
   5668  1.1.1.3  mrg       % Not absorbing as a macro argument reduces the chance of problems
   5669  1.1.1.3  mrg       % with catcodes occurring.
   5670  1.1.1.3  mrg }
   5671  1.1.1.3  mrg {\catcode`\@=11
   5672  1.1.1.3  mrg \gdef\finishentry#1{%
   5673      1.1  mrg     \egroup % end box A
   5674      1.1  mrg     \dimen@ = \wd\boxA % Length of text of entry
   5675  1.1.1.3  mrg     \global\setbox\boxA=\hbox\bgroup\unhbox\boxA
   5676  1.1.1.3  mrg     % #1 is the page number.
   5677  1.1.1.3  mrg     %
   5678  1.1.1.3  mrg     % Get the width of the page numbers, and only use
   5679  1.1.1.3  mrg     % leaders if they are present.
   5680      1.1  mrg     \global\setbox\boxB = \hbox{#1}%
   5681      1.1  mrg     \ifdim\wd\boxB = 0pt
   5682      1.1  mrg       \null\nobreak\hfill\ %
   5683      1.1  mrg     \else
   5684      1.1  mrg       %
   5685  1.1.1.3  mrg       \null\nobreak\indexdotfill % Have leaders before the page number.
   5686  1.1.1.3  mrg       %
   5687      1.1  mrg       \ifpdf
   5688  1.1.1.3  mrg         \pdfgettoks#1.%
   5689  1.1.1.3  mrg         \hskip\skip\thinshrinkable\the\toksA
   5690  1.1.1.3  mrg       \else
   5691  1.1.1.3  mrg         \ifx\XeTeXrevision\thisisundefined
   5692  1.1.1.3  mrg           \hskip\skip\thinshrinkable #1%
   5693  1.1.1.3  mrg         \else
   5694      1.1  mrg           \pdfgettoks#1.%
   5695      1.1  mrg           \hskip\skip\thinshrinkable\the\toksA
   5696  1.1.1.3  mrg         \fi
   5697  1.1.1.3  mrg       \fi
   5698  1.1.1.3  mrg     \fi
   5699  1.1.1.3  mrg     \egroup % end \boxA
   5700  1.1.1.3  mrg     \ifdim\wd\boxB = 0pt
   5701  1.1.1.3  mrg       \global\setbox\entrybox=\vbox{\unhbox\boxA}%
   5702  1.1.1.3  mrg     \else
   5703  1.1.1.3  mrg     \global\setbox\entrybox=\vbox\bgroup
   5704  1.1.1.3  mrg       % We want the text of the entries to be aligned to the left, and the
   5705  1.1.1.3  mrg       % page numbers to be aligned to the right.
   5706  1.1.1.3  mrg       %
   5707  1.1.1.3  mrg       \parindent = 0pt
   5708  1.1.1.3  mrg       \advance\leftskip by 0pt plus 1fil
   5709  1.1.1.3  mrg       \advance\leftskip by 0pt plus -1fill
   5710  1.1.1.3  mrg       \rightskip = 0pt plus -1fil
   5711  1.1.1.3  mrg       \advance\rightskip by 0pt plus 1fill
   5712  1.1.1.3  mrg       % Cause last line, which could consist of page numbers on their own
   5713  1.1.1.3  mrg       % if the list of page numbers is long, to be aligned to the right.
   5714  1.1.1.3  mrg       \parfillskip=0pt plus -1fill
   5715  1.1.1.3  mrg       %
   5716  1.1.1.3  mrg       \advance\rightskip by \entryrightmargin
   5717  1.1.1.3  mrg       % Determine how far we can stretch into the margin.
   5718  1.1.1.3  mrg       % This allows, e.g., "Appendix H  GNU Free Documentation License" to
   5719  1.1.1.3  mrg       % fit on one line in @letterpaper format.
   5720  1.1.1.3  mrg       \ifdim\entryrightmargin>2.1em
   5721  1.1.1.3  mrg         \dimen@i=2.1em
   5722  1.1.1.3  mrg       \else
   5723  1.1.1.3  mrg         \dimen@i=0em
   5724  1.1.1.3  mrg       \fi
   5725  1.1.1.3  mrg       \advance \parfillskip by 0pt minus 1\dimen@i
   5726  1.1.1.3  mrg       %
   5727  1.1.1.3  mrg       \dimen@ii = \hsize
   5728  1.1.1.3  mrg       \advance\dimen@ii by -1\leftskip
   5729  1.1.1.3  mrg       \advance\dimen@ii by -1\entryrightmargin
   5730  1.1.1.3  mrg       \advance\dimen@ii by 1\dimen@i
   5731  1.1.1.3  mrg       \ifdim\wd\boxA > \dimen@ii % If the entry doesn't fit in one line
   5732  1.1.1.3  mrg       \ifdim\dimen@ > 0.8\dimen@ii   % due to long index text
   5733  1.1.1.3  mrg         % Try to split the text roughly evenly.  \dimen@ will be the length of 
   5734  1.1.1.3  mrg         % the first line.
   5735  1.1.1.3  mrg         \dimen@ = 0.7\dimen@
   5736  1.1.1.3  mrg         \dimen@ii = \hsize
   5737  1.1.1.3  mrg         \ifnum\dimen@>\dimen@ii
   5738  1.1.1.3  mrg           % If the entry is too long (for example, if it needs more than
   5739  1.1.1.3  mrg           % two lines), use all the space in the first line.
   5740  1.1.1.3  mrg           \dimen@ = \dimen@ii
   5741  1.1.1.3  mrg         \fi
   5742  1.1.1.3  mrg         \advance\leftskip by 0pt plus 1fill % ragged right
   5743  1.1.1.3  mrg         \advance \dimen@ by 1\rightskip
   5744  1.1.1.3  mrg         \parshape = 2 0pt \dimen@ 0em \dimen@ii
   5745  1.1.1.3  mrg         % Ideally we'd add a finite glue at the end of the first line only,
   5746  1.1.1.3  mrg         % instead of using \parshape with explicit line lengths, but TeX
   5747  1.1.1.3  mrg         % doesn't seem to provide a way to do such a thing.
   5748  1.1.1.3  mrg         %
   5749  1.1.1.3  mrg         % Indent all lines but the first one.
   5750  1.1.1.3  mrg         \advance\leftskip by 1em
   5751  1.1.1.3  mrg         \advance\parindent by -1em
   5752  1.1.1.3  mrg       \fi\fi
   5753  1.1.1.3  mrg       \indent % start paragraph
   5754  1.1.1.3  mrg       \unhbox\boxA
   5755  1.1.1.3  mrg       %
   5756  1.1.1.3  mrg       % Do not prefer a separate line ending with a hyphen to fewer lines.
   5757  1.1.1.3  mrg       \finalhyphendemerits = 0
   5758  1.1.1.3  mrg       %
   5759  1.1.1.3  mrg       % Word spacing - no stretch
   5760  1.1.1.3  mrg       \spaceskip=\fontdimen2\font minus \fontdimen4\font
   5761  1.1.1.3  mrg       %
   5762  1.1.1.3  mrg       \linepenalty=1000  % Discourage line breaks.
   5763  1.1.1.3  mrg       \hyphenpenalty=5000  % Discourage hyphenation.
   5764  1.1.1.3  mrg       %
   5765      1.1  mrg       \par % format the paragraph
   5766  1.1.1.3  mrg     \egroup % The \vbox
   5767  1.1.1.3  mrg     \fi
   5768  1.1.1.3  mrg   \endgroup
   5769  1.1.1.3  mrg   \dotheinsertentrybox
   5770  1.1.1.3  mrg }}
   5771  1.1.1.3  mrg 
   5772  1.1.1.3  mrg \newskip\thinshrinkable
   5773  1.1.1.3  mrg \skip\thinshrinkable=.15em minus .15em
   5774  1.1.1.3  mrg 
   5775  1.1.1.3  mrg \newbox\entrybox
   5776  1.1.1.3  mrg \def\insertentrybox{%
   5777  1.1.1.3  mrg   \ourunvbox\entrybox
   5778  1.1.1.3  mrg }
   5779  1.1.1.3  mrg 
   5780  1.1.1.3  mrg % default definition
   5781  1.1.1.3  mrg \let\dotheinsertentrybox\insertentrybox
   5782  1.1.1.3  mrg 
   5783  1.1.1.3  mrg % Use \lastbox to take apart vbox box by box, and add each sub-box
   5784  1.1.1.3  mrg % to the current vertical list.
   5785  1.1.1.3  mrg \def\ourunvbox#1{%
   5786  1.1.1.3  mrg \bgroup % for local binding of \delayedbox
   5787  1.1.1.3  mrg   % Remove the last box from box #1
   5788  1.1.1.3  mrg   \global\setbox#1=\vbox{%
   5789  1.1.1.3  mrg     \unvbox#1%
   5790  1.1.1.3  mrg     \unskip % remove any glue
   5791  1.1.1.3  mrg     \unpenalty
   5792  1.1.1.3  mrg     \global\setbox\interbox=\lastbox
   5793  1.1.1.3  mrg   }%
   5794  1.1.1.3  mrg   \setbox\delayedbox=\box\interbox
   5795  1.1.1.3  mrg   \ifdim\ht#1=0pt\else
   5796  1.1.1.3  mrg     \ourunvbox#1 % Repeat on what's left of the box
   5797  1.1.1.3  mrg     \nobreak
   5798      1.1  mrg   \fi
   5799  1.1.1.3  mrg   \box\delayedbox
   5800  1.1.1.3  mrg \egroup
   5801  1.1.1.3  mrg }
   5802  1.1.1.3  mrg \newbox\delayedbox
   5803  1.1.1.3  mrg \newbox\interbox
   5804  1.1.1.3  mrg 
   5805  1.1.1.3  mrg % Used from \printindex.  \firsttoken should be the first token
   5806  1.1.1.3  mrg % after the \entry.  If it's not another \entry, we are at the last
   5807  1.1.1.3  mrg % line of a group of index entries, so insert a penalty to discourage
   5808  1.1.1.3  mrg % widowed index entries.
   5809  1.1.1.3  mrg \def\dotheinsertentryboxwithpenalty{%
   5810  1.1.1.3  mrg   \ifx\firsttoken\isentry
   5811  1.1.1.3  mrg   \else
   5812  1.1.1.3  mrg     \penalty 9000
   5813  1.1.1.3  mrg   \fi
   5814      1.1  mrg   \insertentrybox
   5815      1.1  mrg }
   5816  1.1.1.3  mrg \def\isentry{\entry}%
   5817  1.1.1.3  mrg 
   5818      1.1  mrg % Like plain.tex's \dotfill, except uses up at least 1 em.
   5819  1.1.1.3  mrg % The filll stretch here overpowers both the fil and fill stretch to push
   5820  1.1.1.3  mrg % the page number to the right.
   5821      1.1  mrg \def\indexdotfill{\cleaders
   5822      1.1  mrg   \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1filll}
   5823      1.1  mrg 
   5824      1.1  mrg 
   5825      1.1  mrg \def\primary #1{\line{#1\hfil}}
   5826      1.1  mrg 
   5827      1.1  mrg \newskip\secondaryindent \secondaryindent=0.5cm
   5828      1.1  mrg \def\secondary#1#2{{%
   5829      1.1  mrg   \parfillskip=0in
   5830      1.1  mrg   \parskip=0in
   5831      1.1  mrg   \hangindent=1in
   5832      1.1  mrg   \hangafter=1
   5833      1.1  mrg   \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill
   5834  1.1.1.3  mrg   \ifpdf
   5835  1.1.1.3  mrg     \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
   5836  1.1.1.3  mrg   \else
   5837  1.1.1.3  mrg     \ifx\XeTeXrevision\thisisundefined
   5838  1.1.1.3  mrg       #2
   5839      1.1  mrg     \else
   5840      1.1  mrg       \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
   5841      1.1  mrg     \fi
   5842      1.1  mrg   \fi
   5843      1.1  mrg   \par
   5844      1.1  mrg }}
   5845      1.1  mrg 
   5846  1.1.1.3  mrg % Define two-column mode, which we use to typeset indexes.
   5847      1.1  mrg % Adapted from the TeXbook, page 416, which is to say,
   5848      1.1  mrg % the manmac.tex format used to print the TeXbook itself.
   5849      1.1  mrg \catcode`\@=11  % private names
   5850      1.1  mrg 
   5851  1.1.1.3  mrg \newbox\partialpage
   5852  1.1.1.3  mrg \newdimen\doublecolumnhsize
   5853  1.1.1.3  mrg 
   5854  1.1.1.3  mrg % Use inside an output routine to save \topmark and \firstmark
   5855  1.1.1.3  mrg \def\savemarks{%
   5856  1.1.1.3  mrg   \global\savedtopmark=\expandafter{\topmark }%
   5857  1.1.1.3  mrg   \global\savedfirstmark=\expandafter{\firstmark }%
   5858  1.1.1.3  mrg }
   5859  1.1.1.3  mrg \newtoks\savedtopmark
   5860  1.1.1.3  mrg \newtoks\savedfirstmark
   5861  1.1.1.3  mrg 
   5862  1.1.1.3  mrg % Set \topmark and \firstmark for next time \output runs.
   5863  1.1.1.3  mrg % Can't be run from withinside \output (because any material
   5864  1.1.1.3  mrg % added while an output routine is active, including 
   5865  1.1.1.3  mrg % penalties, is saved for after it finishes).  The page so far
   5866  1.1.1.3  mrg % should be empty, otherwise what's on it will be thrown away.
   5867  1.1.1.3  mrg \def\restoremarks{%
   5868  1.1.1.3  mrg   \mark{\the\savedtopmark}%
   5869  1.1.1.3  mrg   \bgroup\output = {%
   5870  1.1.1.3  mrg     \setbox\dummybox=\box\PAGE
   5871  1.1.1.3  mrg   }abc\eject\egroup
   5872  1.1.1.3  mrg   % "abc" because output routine doesn't fire for a completely empty page.
   5873      1.1  mrg   \mark{\the\savedfirstmark}%
   5874  1.1.1.3  mrg }
   5875  1.1.1.3  mrg 
   5876  1.1.1.3  mrg \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
   5877      1.1  mrg   % If not much space left on page, start a new page.
   5878      1.1  mrg   \ifdim\pagetotal>0.8\vsize\vfill\eject\fi
   5879      1.1  mrg   %
   5880      1.1  mrg   % Grab any single-column material above us.
   5881      1.1  mrg   \output = {%
   5882      1.1  mrg     %
   5883      1.1  mrg     % Here is a possibility not foreseen in manmac: if we accumulate a
   5884      1.1  mrg     % whole lot of material, we might end up calling this \output
   5885      1.1  mrg     % routine twice in a row (see the doublecol-lose test, which is
   5886      1.1  mrg     % essentially a couple of indexes with @setchapternewpage off).  In
   5887      1.1  mrg     % that case we just ship out what is in \partialpage with the normal
   5888      1.1  mrg     % output routine.  Generally, \partialpage will be empty when this
   5889      1.1  mrg     % runs and this will be a no-op.  See the indexspread.tex test case.
   5890      1.1  mrg     \ifvoid\partialpage \else
   5891      1.1  mrg       \onepageout{\pagecontents\partialpage}%
   5892      1.1  mrg     \fi
   5893      1.1  mrg     %
   5894      1.1  mrg     \global\setbox\partialpage = \vbox{%
   5895      1.1  mrg       % Unvbox the main output page.
   5896  1.1.1.3  mrg       \unvbox\PAGE
   5897      1.1  mrg       \kern-\topskip \kern\baselineskip
   5898      1.1  mrg     }%
   5899  1.1.1.3  mrg     \savemarks
   5900  1.1.1.3  mrg   }%
   5901  1.1.1.3  mrg   \eject % run that output routine to set \partialpage
   5902  1.1.1.3  mrg   \restoremarks
   5903  1.1.1.3  mrg   %
   5904  1.1.1.3  mrg   % We recover the two marks that the last output routine saved in order
   5905      1.1  mrg   % to propagate the information in marks added around a chapter heading,
   5906      1.1  mrg   % which could be otherwise be lost by the time the final page is output.
   5907      1.1  mrg   %
   5908      1.1  mrg   %
   5909      1.1  mrg   % Use the double-column output routine for subsequent pages.
   5910      1.1  mrg   \output = {\doublecolumnout}%
   5911      1.1  mrg   %
   5912      1.1  mrg   % Change the page size parameters.  We could do this once outside this
   5913      1.1  mrg   % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
   5914      1.1  mrg   % format, but then we repeat the same computation.  Repeating a couple
   5915      1.1  mrg   % of assignments once per index is clearly meaningless for the
   5916      1.1  mrg   % execution time, so we may as well do it in one place.
   5917      1.1  mrg   %
   5918      1.1  mrg   % First we halve the line length, less a little for the gutter between
   5919      1.1  mrg   % the columns.  We compute the gutter based on the line length, so it
   5920      1.1  mrg   % changes automatically with the paper format.  The magic constant
   5921      1.1  mrg   % below is chosen so that the gutter has the same value (well, +-<1pt)
   5922      1.1  mrg   % as it did when we hard-coded it.
   5923      1.1  mrg   %
   5924      1.1  mrg   % We put the result in a separate register, \doublecolumhsize, so we
   5925      1.1  mrg   % can restore it in \pagesofar, after \hsize itself has (potentially)
   5926      1.1  mrg   % been clobbered.
   5927      1.1  mrg   %
   5928      1.1  mrg   \doublecolumnhsize = \hsize
   5929      1.1  mrg     \advance\doublecolumnhsize by -.04154\hsize
   5930  1.1.1.3  mrg     \divide\doublecolumnhsize by 2
   5931  1.1.1.3  mrg   \hsize = \doublecolumnhsize
   5932      1.1  mrg   %
   5933  1.1.1.3  mrg   % Double the \vsize as well.
   5934  1.1.1.3  mrg   \advance\vsize by -\ht\partialpage
   5935  1.1.1.3  mrg   \vsize = 2\vsize
   5936      1.1  mrg   %
   5937      1.1  mrg   % For the benefit of balancing columns
   5938      1.1  mrg   \advance\baselineskip by 0pt plus 0.5pt
   5939  1.1.1.3  mrg }
   5940      1.1  mrg 
   5941      1.1  mrg % The double-column output routine for all double-column pages except
   5942  1.1.1.3  mrg % the last, which is done by \balancecolumns.
   5943      1.1  mrg %
   5944      1.1  mrg \def\doublecolumnout{%
   5945      1.1  mrg   %
   5946      1.1  mrg   \splittopskip=\topskip \splitmaxdepth=\maxdepth
   5947      1.1  mrg   % Get the available space for the double columns -- the normal
   5948      1.1  mrg   % (undoubled) page height minus any material left over from the
   5949      1.1  mrg   % previous page.
   5950      1.1  mrg   \dimen@ = \vsize
   5951  1.1.1.3  mrg   \divide\dimen@ by 2
   5952  1.1.1.3  mrg   %
   5953      1.1  mrg   % box0 will be the left-hand column, box2 the right.
   5954  1.1.1.3  mrg   \setbox0=\vsplit\PAGE to\dimen@ \setbox2=\vsplit\PAGE to\dimen@
   5955      1.1  mrg   \global\advance\vsize by 2\ht\partialpage
   5956      1.1  mrg   \onepageout\pagesofar
   5957      1.1  mrg   \unvbox\PAGE
   5958      1.1  mrg   \penalty\outputpenalty
   5959      1.1  mrg }
   5960      1.1  mrg %
   5961      1.1  mrg % Re-output the contents of the output page -- any previous material,
   5962      1.1  mrg % followed by the two boxes we just split, in box0 and box2.
   5963      1.1  mrg \def\pagesofar{%
   5964      1.1  mrg   \unvbox\partialpage
   5965  1.1.1.3  mrg   %
   5966      1.1  mrg   \hsize = \doublecolumnhsize
   5967  1.1.1.3  mrg   \wd0=\hsize \wd2=\hsize
   5968  1.1.1.3  mrg   \hbox to\txipagewidth{\box0\hfil\box2}%
   5969  1.1.1.3  mrg }
   5970      1.1  mrg 
   5971      1.1  mrg 
   5972      1.1  mrg % Finished with with double columns.
   5973      1.1  mrg \def\enddoublecolumns{%
   5974      1.1  mrg   % The following penalty ensures that the page builder is exercised
   5975      1.1  mrg   % _before_ we change the output routine.  This is necessary in the
   5976      1.1  mrg   % following situation:
   5977      1.1  mrg   %
   5978      1.1  mrg   % The last section of the index consists only of a single entry.
   5979      1.1  mrg   % Before this section, \pagetotal is less than \pagegoal, so no
   5980      1.1  mrg   % break occurs before the last section starts.  However, the last
   5981      1.1  mrg   % section, consisting of \initial and the single \entry, does not
   5982      1.1  mrg   % fit on the page and has to be broken off.  Without the following
   5983      1.1  mrg   % penalty the page builder will not be exercised until \eject
   5984      1.1  mrg   % below, and by that time we'll already have changed the output
   5985      1.1  mrg   % routine to the \balancecolumns version, so the next-to-last
   5986      1.1  mrg   % double-column page will be processed with \balancecolumns, which
   5987      1.1  mrg   % is wrong:  The two columns will go to the main vertical list, with
   5988      1.1  mrg   % the broken-off section in the recent contributions.  As soon as
   5989      1.1  mrg   % the output routine finishes, TeX starts reconsidering the page
   5990      1.1  mrg   % break.  The two columns and the broken-off section both fit on the
   5991      1.1  mrg   % page, because the two columns now take up only half of the page
   5992  1.1.1.3  mrg   % goal.  When TeX sees \eject from below which follows the final
   5993      1.1  mrg   % section, it invokes the new output routine that we've set after
   5994      1.1  mrg   % \balancecolumns below; \onepageout will try to fit the two columns
   5995      1.1  mrg   % and the final section into the vbox of \txipageheight (see
   5996      1.1  mrg   % \pagebody), causing an overfull box.
   5997      1.1  mrg   %
   5998      1.1  mrg   % Note that glue won't work here, because glue does not exercise the
   5999      1.1  mrg   % page builder, unlike penalties (see The TeXbook, pp. 280-281).
   6000  1.1.1.3  mrg   \penalty0
   6001  1.1.1.3  mrg   %
   6002      1.1  mrg   \output = {%
   6003  1.1.1.3  mrg     % Split the last of the double-column material.
   6004  1.1.1.3  mrg     \savemarks
   6005  1.1.1.3  mrg     \balancecolumns
   6006  1.1.1.3  mrg   }%
   6007      1.1  mrg   \eject % call the \output just set
   6008  1.1.1.3  mrg   \ifdim\pagetotal=0pt
   6009      1.1  mrg     % Having called \balancecolumns once, we do not
   6010  1.1.1.3  mrg     % want to call it again.  Therefore, reset \output to its normal
   6011  1.1.1.3  mrg     % definition right away.
   6012  1.1.1.3  mrg     \global\output = {\onepageout{\pagecontents\PAGE}}%
   6013  1.1.1.3  mrg     %
   6014  1.1.1.3  mrg     \endgroup % started in \begindoublecolumns
   6015  1.1.1.3  mrg     \restoremarks
   6016  1.1.1.3  mrg     % Leave the double-column material on the current page, no automatic
   6017  1.1.1.3  mrg     % page break.
   6018  1.1.1.3  mrg     \box\balancedcolumns
   6019  1.1.1.3  mrg     %
   6020  1.1.1.3  mrg     % \pagegoal was set to the doubled \vsize above, since we restarted
   6021  1.1.1.3  mrg     % the current page.  We're now back to normal single-column
   6022  1.1.1.3  mrg     % typesetting, so reset \pagegoal to the normal \vsize.
   6023  1.1.1.3  mrg     \global\vsize = \txipageheight %
   6024  1.1.1.3  mrg     \pagegoal = \txipageheight %
   6025  1.1.1.3  mrg   \else
   6026  1.1.1.3  mrg     % We had some left-over material.  This might happen when \doublecolumnout
   6027      1.1  mrg     % is called in \balancecolumns.  Try again.
   6028  1.1.1.3  mrg     \expandafter\enddoublecolumns
   6029  1.1.1.3  mrg   \fi
   6030      1.1  mrg }
   6031  1.1.1.3  mrg \newbox\balancedcolumns
   6032  1.1.1.3  mrg \setbox\balancedcolumns=\vbox{shouldnt see this}%
   6033      1.1  mrg %
   6034  1.1.1.3  mrg % Only called for the last of the double column material.  \doublecolumnout 
   6035      1.1  mrg % does the others.
   6036      1.1  mrg \def\balancecolumns{%
   6037      1.1  mrg   \setbox0 = \vbox{\unvbox\PAGE}% like \box255 but more efficient, see p.120.
   6038  1.1.1.3  mrg   \dimen@ = \ht0
   6039  1.1.1.3  mrg   \advance\dimen@ by \topskip
   6040  1.1.1.3  mrg   \advance\dimen@ by-\baselineskip
   6041  1.1.1.3  mrg   \ifdim\dimen@<5\baselineskip
   6042  1.1.1.3  mrg     % Don't split a short final column in two.
   6043  1.1.1.3  mrg     \setbox2=\vbox{}%
   6044  1.1.1.3  mrg     \global\setbox\balancedcolumns=\vbox{\pagesofar}%
   6045  1.1.1.3  mrg   \else
   6046  1.1.1.3  mrg     \divide\dimen@ by 2 % target to split to
   6047  1.1.1.3  mrg     \dimen@ii = \dimen@
   6048  1.1.1.3  mrg     \splittopskip = \topskip
   6049  1.1.1.3  mrg     % Loop until left column is at least as high as the right column.
   6050  1.1.1.3  mrg     {%
   6051  1.1.1.3  mrg       \vbadness = 10000
   6052  1.1.1.3  mrg       \loop
   6053  1.1.1.3  mrg         \global\setbox3 = \copy0
   6054  1.1.1.3  mrg         \global\setbox1 = \vsplit3 to \dimen@
   6055  1.1.1.3  mrg       \ifdim\ht1<\ht3
   6056  1.1.1.3  mrg         \global\advance\dimen@ by 1pt
   6057  1.1.1.3  mrg       \repeat
   6058  1.1.1.3  mrg     }%
   6059  1.1.1.3  mrg     % Now the left column is in box 1, and the right column in box 3.
   6060  1.1.1.3  mrg     %
   6061  1.1.1.3  mrg     % Check whether the left column has come out higher than the page itself.  
   6062  1.1.1.3  mrg     % (Note that we have doubled \vsize for the double columns, so
   6063  1.1.1.3  mrg     % the actual height of the page is 0.5\vsize).
   6064  1.1.1.3  mrg     \ifdim2\ht1>\vsize
   6065  1.1.1.3  mrg       % It appears that we have been called upon to balance too much material.
   6066  1.1.1.3  mrg       % Output some of it with \doublecolumnout, leaving the rest on the page.
   6067  1.1.1.3  mrg       \setbox\PAGE=\box0
   6068  1.1.1.3  mrg       \doublecolumnout
   6069  1.1.1.3  mrg     \else
   6070  1.1.1.3  mrg       % Compare the heights of the two columns.
   6071  1.1.1.3  mrg       \ifdim4\ht1>5\ht3
   6072  1.1.1.3  mrg         % Column heights are too different, so don't make their bottoms
   6073  1.1.1.3  mrg         % flush with each other.
   6074  1.1.1.3  mrg         \setbox2=\vbox to \ht1 {\unvbox3\vfill}%
   6075  1.1.1.3  mrg         \setbox0=\vbox to \ht1 {\unvbox1\vfill}%
   6076  1.1.1.3  mrg       \else
   6077  1.1.1.3  mrg         % Make column bottoms flush with each other.
   6078  1.1.1.3  mrg         \setbox2=\vbox to\ht1{\unvbox3\unskip}%
   6079  1.1.1.3  mrg         \setbox0=\vbox to\ht1{\unvbox1\unskip}%
   6080  1.1.1.3  mrg       \fi
   6081      1.1  mrg       \global\setbox\balancedcolumns=\vbox{\pagesofar}%
   6082      1.1  mrg     \fi
   6083      1.1  mrg   \fi
   6084      1.1  mrg   %
   6085      1.1  mrg }
   6086      1.1  mrg \catcode`\@ = \other
   6087      1.1  mrg 
   6088      1.1  mrg 
   6089      1.1  mrg \message{sectioning,}
   6090      1.1  mrg % Chapters, sections, etc.
   6091      1.1  mrg 
   6092      1.1  mrg % Let's start with @part.
   6093      1.1  mrg \outer\parseargdef\part{\partzzz{#1}}
   6094      1.1  mrg \def\partzzz#1{%
   6095      1.1  mrg   \chapoddpage
   6096  1.1.1.3  mrg   \null
   6097      1.1  mrg   \vskip.3\vsize  % move it down on the page a bit
   6098      1.1  mrg   \begingroup
   6099      1.1  mrg     \noindent \titlefonts\rm #1\par % the text
   6100  1.1.1.3  mrg     \let\lastnode=\empty      % no node to associate with
   6101  1.1.1.3  mrg     \writetocentry{part}{#1}{}% but put it in the toc
   6102  1.1.1.3  mrg     \headingsoff              % no headline or footline on the part page
   6103  1.1.1.3  mrg     % This outputs a mark at the end of the page that clears \thischapter
   6104      1.1  mrg     % and \thissection, as is done in \startcontents.
   6105      1.1  mrg     \let\pchapsepmacro\relax
   6106      1.1  mrg     \chapmacro{}{Yomitfromtoc}{}%
   6107      1.1  mrg     \chapoddpage
   6108      1.1  mrg   \endgroup
   6109      1.1  mrg }
   6110      1.1  mrg 
   6111      1.1  mrg % \unnumberedno is an oxymoron.  But we count the unnumbered
   6112      1.1  mrg % sections so that we can refer to them unambiguously in the pdf
   6113      1.1  mrg % outlines by their "section number".  We avoid collisions with chapter
   6114      1.1  mrg % numbers by starting them at 10000.  (If a document ever has 10000
   6115      1.1  mrg % chapters, we're in trouble anyway, I'm sure.)
   6116      1.1  mrg \newcount\unnumberedno \unnumberedno = 10000
   6117      1.1  mrg \newcount\chapno
   6118      1.1  mrg \newcount\secno        \secno=0
   6119      1.1  mrg \newcount\subsecno     \subsecno=0
   6120      1.1  mrg \newcount\subsubsecno  \subsubsecno=0
   6121      1.1  mrg 
   6122      1.1  mrg % This counter is funny since it counts through charcodes of letters A, B, ...
   6123      1.1  mrg \newcount\appendixno  \appendixno = `\@
   6124      1.1  mrg %
   6125      1.1  mrg % \def\appendixletter{\char\the\appendixno}
   6126      1.1  mrg % We do the following ugly conditional instead of the above simple
   6127      1.1  mrg % construct for the sake of pdftex, which needs the actual
   6128      1.1  mrg % letter in the expansion, not just typeset.
   6129      1.1  mrg %
   6130      1.1  mrg \def\appendixletter{%
   6131      1.1  mrg   \ifnum\appendixno=`A A%
   6132      1.1  mrg   \else\ifnum\appendixno=`B B%
   6133      1.1  mrg   \else\ifnum\appendixno=`C C%
   6134      1.1  mrg   \else\ifnum\appendixno=`D D%
   6135      1.1  mrg   \else\ifnum\appendixno=`E E%
   6136      1.1  mrg   \else\ifnum\appendixno=`F F%
   6137      1.1  mrg   \else\ifnum\appendixno=`G G%
   6138      1.1  mrg   \else\ifnum\appendixno=`H H%
   6139      1.1  mrg   \else\ifnum\appendixno=`I I%
   6140      1.1  mrg   \else\ifnum\appendixno=`J J%
   6141      1.1  mrg   \else\ifnum\appendixno=`K K%
   6142      1.1  mrg   \else\ifnum\appendixno=`L L%
   6143      1.1  mrg   \else\ifnum\appendixno=`M M%
   6144      1.1  mrg   \else\ifnum\appendixno=`N N%
   6145      1.1  mrg   \else\ifnum\appendixno=`O O%
   6146      1.1  mrg   \else\ifnum\appendixno=`P P%
   6147      1.1  mrg   \else\ifnum\appendixno=`Q Q%
   6148      1.1  mrg   \else\ifnum\appendixno=`R R%
   6149      1.1  mrg   \else\ifnum\appendixno=`S S%
   6150      1.1  mrg   \else\ifnum\appendixno=`T T%
   6151      1.1  mrg   \else\ifnum\appendixno=`U U%
   6152      1.1  mrg   \else\ifnum\appendixno=`V V%
   6153      1.1  mrg   \else\ifnum\appendixno=`W W%
   6154      1.1  mrg   \else\ifnum\appendixno=`X X%
   6155      1.1  mrg   \else\ifnum\appendixno=`Y Y%
   6156      1.1  mrg   \else\ifnum\appendixno=`Z Z%
   6157      1.1  mrg   % The \the is necessary, despite appearances, because \appendixletter is
   6158      1.1  mrg   % expanded while writing the .toc file.  \char\appendixno is not
   6159      1.1  mrg   % expandable, thus it is written literally, thus all appendixes come out
   6160      1.1  mrg   % with the same letter (or @) in the toc without it.
   6161      1.1  mrg   \else\char\the\appendixno
   6162      1.1  mrg   \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
   6163      1.1  mrg   \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
   6164      1.1  mrg 
   6165      1.1  mrg % Each @chapter defines these (using marks) as the number+name, number
   6166      1.1  mrg % and name of the chapter.  Page headings and footings can use
   6167      1.1  mrg % these.  @section does likewise.
   6168      1.1  mrg \def\thischapter{}
   6169      1.1  mrg \def\thischapternum{}
   6170      1.1  mrg \def\thischaptername{}
   6171      1.1  mrg \def\thissection{}
   6172      1.1  mrg \def\thissectionnum{}
   6173      1.1  mrg \def\thissectionname{}
   6174      1.1  mrg 
   6175      1.1  mrg \newcount\absseclevel % used to calculate proper heading level
   6176      1.1  mrg \newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count
   6177      1.1  mrg 
   6178      1.1  mrg % @raisesections: treat @section as chapter, @subsection as section, etc.
   6179      1.1  mrg \def\raisesections{\global\advance\secbase by -1}
   6180      1.1  mrg \let\up=\raisesections % original BFox name
   6181      1.1  mrg 
   6182      1.1  mrg % @lowersections: treat @chapter as section, @section as subsection, etc.
   6183      1.1  mrg \def\lowersections{\global\advance\secbase by 1}
   6184      1.1  mrg \let\down=\lowersections % original BFox name
   6185      1.1  mrg 
   6186      1.1  mrg % we only have subsub.
   6187      1.1  mrg \chardef\maxseclevel = 3
   6188      1.1  mrg %
   6189      1.1  mrg % A numbered section within an unnumbered changes to unnumbered too.
   6190      1.1  mrg % To achieve this, remember the "biggest" unnum. sec. we are currently in:
   6191      1.1  mrg \chardef\unnlevel = \maxseclevel
   6192      1.1  mrg %
   6193      1.1  mrg % Trace whether the current chapter is an appendix or not:
   6194      1.1  mrg % \chapheadtype is "N" or "A", unnumbered chapters are ignored.
   6195      1.1  mrg \def\chapheadtype{N}
   6196      1.1  mrg 
   6197      1.1  mrg % Choose a heading macro
   6198      1.1  mrg % #1 is heading type
   6199      1.1  mrg % #2 is heading level
   6200      1.1  mrg % #3 is text for heading
   6201      1.1  mrg \def\genhead#1#2#3{%
   6202      1.1  mrg   % Compute the abs. sec. level:
   6203      1.1  mrg   \absseclevel=#2
   6204      1.1  mrg   \advance\absseclevel by \secbase
   6205      1.1  mrg   % Make sure \absseclevel doesn't fall outside the range:
   6206      1.1  mrg   \ifnum \absseclevel < 0
   6207      1.1  mrg     \absseclevel = 0
   6208      1.1  mrg   \else
   6209      1.1  mrg     \ifnum \absseclevel > 3
   6210      1.1  mrg       \absseclevel = 3
   6211      1.1  mrg     \fi
   6212      1.1  mrg   \fi
   6213      1.1  mrg   % The heading type:
   6214      1.1  mrg   \def\headtype{#1}%
   6215      1.1  mrg   \if \headtype U%
   6216      1.1  mrg     \ifnum \absseclevel < \unnlevel
   6217      1.1  mrg       \chardef\unnlevel = \absseclevel
   6218      1.1  mrg     \fi
   6219      1.1  mrg   \else
   6220      1.1  mrg     % Check for appendix sections:
   6221      1.1  mrg     \ifnum \absseclevel = 0
   6222      1.1  mrg       \edef\chapheadtype{\headtype}%
   6223      1.1  mrg     \else
   6224      1.1  mrg       \if \headtype A\if \chapheadtype N%
   6225      1.1  mrg 	\errmessage{@appendix... within a non-appendix chapter}%
   6226      1.1  mrg       \fi\fi
   6227      1.1  mrg     \fi
   6228      1.1  mrg     % Check for numbered within unnumbered:
   6229      1.1  mrg     \ifnum \absseclevel > \unnlevel
   6230      1.1  mrg       \def\headtype{U}%
   6231      1.1  mrg     \else
   6232      1.1  mrg       \chardef\unnlevel = 3
   6233      1.1  mrg     \fi
   6234      1.1  mrg   \fi
   6235      1.1  mrg   % Now print the heading:
   6236      1.1  mrg   \if \headtype U%
   6237      1.1  mrg     \ifcase\absseclevel
   6238      1.1  mrg 	\unnumberedzzz{#3}%
   6239      1.1  mrg     \or \unnumberedseczzz{#3}%
   6240      1.1  mrg     \or \unnumberedsubseczzz{#3}%
   6241      1.1  mrg     \or \unnumberedsubsubseczzz{#3}%
   6242      1.1  mrg     \fi
   6243      1.1  mrg   \else
   6244      1.1  mrg     \if \headtype A%
   6245      1.1  mrg       \ifcase\absseclevel
   6246      1.1  mrg 	  \appendixzzz{#3}%
   6247      1.1  mrg       \or \appendixsectionzzz{#3}%
   6248      1.1  mrg       \or \appendixsubseczzz{#3}%
   6249      1.1  mrg       \or \appendixsubsubseczzz{#3}%
   6250      1.1  mrg       \fi
   6251      1.1  mrg     \else
   6252      1.1  mrg       \ifcase\absseclevel
   6253      1.1  mrg 	  \chapterzzz{#3}%
   6254      1.1  mrg       \or \seczzz{#3}%
   6255      1.1  mrg       \or \numberedsubseczzz{#3}%
   6256      1.1  mrg       \or \numberedsubsubseczzz{#3}%
   6257      1.1  mrg       \fi
   6258      1.1  mrg     \fi
   6259      1.1  mrg   \fi
   6260      1.1  mrg   \suppressfirstparagraphindent
   6261      1.1  mrg }
   6262      1.1  mrg 
   6263      1.1  mrg % an interface:
   6264      1.1  mrg \def\numhead{\genhead N}
   6265      1.1  mrg \def\apphead{\genhead A}
   6266      1.1  mrg \def\unnmhead{\genhead U}
   6267      1.1  mrg 
   6268      1.1  mrg % @chapter, @appendix, @unnumbered.  Increment top-level counter, reset
   6269      1.1  mrg % all lower-level sectioning counters to zero.
   6270      1.1  mrg %
   6271      1.1  mrg % Also set \chaplevelprefix, which we prepend to @float sequence numbers
   6272      1.1  mrg % (e.g., figures), q.v.  By default (before any chapter), that is empty.
   6273      1.1  mrg \let\chaplevelprefix = \empty
   6274      1.1  mrg %
   6275      1.1  mrg \outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz
   6276      1.1  mrg \def\chapterzzz#1{%
   6277      1.1  mrg   % section resetting is \global in case the chapter is in a group, such
   6278      1.1  mrg   % as an @include file.
   6279      1.1  mrg   \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
   6280      1.1  mrg     \global\advance\chapno by 1
   6281      1.1  mrg   %
   6282      1.1  mrg   % Used for \float.
   6283      1.1  mrg   \gdef\chaplevelprefix{\the\chapno.}%
   6284      1.1  mrg   \resetallfloatnos
   6285      1.1  mrg   %
   6286      1.1  mrg   % \putwordChapter can contain complex things in translations.
   6287      1.1  mrg   \toks0=\expandafter{\putwordChapter}%
   6288      1.1  mrg   \message{\the\toks0 \space \the\chapno}%
   6289      1.1  mrg   %
   6290      1.1  mrg   % Write the actual heading.
   6291      1.1  mrg   \chapmacro{#1}{Ynumbered}{\the\chapno}%
   6292      1.1  mrg   %
   6293      1.1  mrg   % So @section and the like are numbered underneath this chapter.
   6294      1.1  mrg   \global\let\section = \numberedsec
   6295      1.1  mrg   \global\let\subsection = \numberedsubsec
   6296      1.1  mrg   \global\let\subsubsection = \numberedsubsubsec
   6297      1.1  mrg }
   6298      1.1  mrg 
   6299      1.1  mrg \outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz
   6300      1.1  mrg %
   6301      1.1  mrg \def\appendixzzz#1{%
   6302      1.1  mrg   \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
   6303      1.1  mrg     \global\advance\appendixno by 1
   6304      1.1  mrg   \gdef\chaplevelprefix{\appendixletter.}%
   6305      1.1  mrg   \resetallfloatnos
   6306      1.1  mrg   %
   6307      1.1  mrg   % \putwordAppendix can contain complex things in translations.
   6308      1.1  mrg   \toks0=\expandafter{\putwordAppendix}%
   6309      1.1  mrg   \message{\the\toks0 \space \appendixletter}%
   6310      1.1  mrg   %
   6311      1.1  mrg   \chapmacro{#1}{Yappendix}{\appendixletter}%
   6312      1.1  mrg   %
   6313      1.1  mrg   \global\let\section = \appendixsec
   6314      1.1  mrg   \global\let\subsection = \appendixsubsec
   6315      1.1  mrg   \global\let\subsubsection = \appendixsubsubsec
   6316      1.1  mrg }
   6317      1.1  mrg 
   6318      1.1  mrg % normally unnmhead0 calls unnumberedzzz:
   6319      1.1  mrg \outer\parseargdef\unnumbered{\unnmhead0{#1}}
   6320      1.1  mrg \def\unnumberedzzz#1{%
   6321      1.1  mrg   \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
   6322      1.1  mrg     \global\advance\unnumberedno by 1
   6323      1.1  mrg   %
   6324      1.1  mrg   % Since an unnumbered has no number, no prefix for figures.
   6325      1.1  mrg   \global\let\chaplevelprefix = \empty
   6326      1.1  mrg   \resetallfloatnos
   6327      1.1  mrg   %
   6328      1.1  mrg   % This used to be simply \message{#1}, but TeX fully expands the
   6329      1.1  mrg   % argument to \message.  Therefore, if #1 contained @-commands, TeX
   6330      1.1  mrg   % expanded them.  For example, in `@unnumbered The @cite{Book}', TeX
   6331      1.1  mrg   % expanded @cite (which turns out to cause errors because \cite is meant
   6332      1.1  mrg   % to be executed, not expanded).
   6333      1.1  mrg   %
   6334      1.1  mrg   % Anyway, we don't want the fully-expanded definition of @cite to appear
   6335      1.1  mrg   % as a result of the \message, we just want `@cite' itself.  We use
   6336      1.1  mrg   % \the<toks register> to achieve this: TeX expands \the<toks> only once,
   6337      1.1  mrg   % simply yielding the contents of <toks register>.  (We also do this for
   6338      1.1  mrg   % the toc entries.)
   6339      1.1  mrg   \toks0 = {#1}%
   6340      1.1  mrg   \message{(\the\toks0)}%
   6341      1.1  mrg   %
   6342      1.1  mrg   \chapmacro{#1}{Ynothing}{\the\unnumberedno}%
   6343      1.1  mrg   %
   6344      1.1  mrg   \global\let\section = \unnumberedsec
   6345      1.1  mrg   \global\let\subsection = \unnumberedsubsec
   6346      1.1  mrg   \global\let\subsubsection = \unnumberedsubsubsec
   6347      1.1  mrg }
   6348      1.1  mrg 
   6349      1.1  mrg % @centerchap is like @unnumbered, but the heading is centered.
   6350      1.1  mrg \outer\parseargdef\centerchap{%
   6351      1.1  mrg   \let\centerparametersmaybe = \centerparameters
   6352      1.1  mrg   \unnmhead0{#1}%
   6353      1.1  mrg   \let\centerparametersmaybe = \relax
   6354      1.1  mrg }
   6355      1.1  mrg 
   6356      1.1  mrg % @top is like @unnumbered.
   6357      1.1  mrg \let\top\unnumbered
   6358      1.1  mrg 
   6359      1.1  mrg % Sections.
   6360      1.1  mrg % 
   6361      1.1  mrg \outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz
   6362      1.1  mrg \def\seczzz#1{%
   6363      1.1  mrg   \global\subsecno=0 \global\subsubsecno=0  \global\advance\secno by 1
   6364      1.1  mrg   \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}%
   6365      1.1  mrg }
   6366      1.1  mrg 
   6367      1.1  mrg % normally calls appendixsectionzzz:
   6368      1.1  mrg \outer\parseargdef\appendixsection{\apphead1{#1}}
   6369      1.1  mrg \def\appendixsectionzzz#1{%
   6370      1.1  mrg   \global\subsecno=0 \global\subsubsecno=0  \global\advance\secno by 1
   6371      1.1  mrg   \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}%
   6372      1.1  mrg }
   6373      1.1  mrg \let\appendixsec\appendixsection
   6374      1.1  mrg 
   6375      1.1  mrg % normally calls unnumberedseczzz:
   6376      1.1  mrg \outer\parseargdef\unnumberedsec{\unnmhead1{#1}}
   6377      1.1  mrg \def\unnumberedseczzz#1{%
   6378      1.1  mrg   \global\subsecno=0 \global\subsubsecno=0  \global\advance\secno by 1
   6379      1.1  mrg   \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}%
   6380      1.1  mrg }
   6381      1.1  mrg 
   6382      1.1  mrg % Subsections.
   6383      1.1  mrg % 
   6384      1.1  mrg % normally calls numberedsubseczzz:
   6385      1.1  mrg \outer\parseargdef\numberedsubsec{\numhead2{#1}}
   6386      1.1  mrg \def\numberedsubseczzz#1{%
   6387      1.1  mrg   \global\subsubsecno=0  \global\advance\subsecno by 1
   6388      1.1  mrg   \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}%
   6389      1.1  mrg }
   6390      1.1  mrg 
   6391      1.1  mrg % normally calls appendixsubseczzz:
   6392      1.1  mrg \outer\parseargdef\appendixsubsec{\apphead2{#1}}
   6393      1.1  mrg \def\appendixsubseczzz#1{%
   6394      1.1  mrg   \global\subsubsecno=0  \global\advance\subsecno by 1
   6395      1.1  mrg   \sectionheading{#1}{subsec}{Yappendix}%
   6396      1.1  mrg                  {\appendixletter.\the\secno.\the\subsecno}%
   6397      1.1  mrg }
   6398      1.1  mrg 
   6399      1.1  mrg % normally calls unnumberedsubseczzz:
   6400      1.1  mrg \outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}}
   6401      1.1  mrg \def\unnumberedsubseczzz#1{%
   6402      1.1  mrg   \global\subsubsecno=0  \global\advance\subsecno by 1
   6403      1.1  mrg   \sectionheading{#1}{subsec}{Ynothing}%
   6404      1.1  mrg                  {\the\unnumberedno.\the\secno.\the\subsecno}%
   6405      1.1  mrg }
   6406      1.1  mrg 
   6407      1.1  mrg % Subsubsections.
   6408      1.1  mrg % 
   6409      1.1  mrg % normally numberedsubsubseczzz:
   6410      1.1  mrg \outer\parseargdef\numberedsubsubsec{\numhead3{#1}}
   6411      1.1  mrg \def\numberedsubsubseczzz#1{%
   6412      1.1  mrg   \global\advance\subsubsecno by 1
   6413      1.1  mrg   \sectionheading{#1}{subsubsec}{Ynumbered}%
   6414      1.1  mrg                  {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}%
   6415      1.1  mrg }
   6416      1.1  mrg 
   6417      1.1  mrg % normally appendixsubsubseczzz:
   6418      1.1  mrg \outer\parseargdef\appendixsubsubsec{\apphead3{#1}}
   6419      1.1  mrg \def\appendixsubsubseczzz#1{%
   6420      1.1  mrg   \global\advance\subsubsecno by 1
   6421      1.1  mrg   \sectionheading{#1}{subsubsec}{Yappendix}%
   6422      1.1  mrg                  {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}%
   6423      1.1  mrg }
   6424      1.1  mrg 
   6425      1.1  mrg % normally unnumberedsubsubseczzz:
   6426      1.1  mrg \outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}}
   6427      1.1  mrg \def\unnumberedsubsubseczzz#1{%
   6428      1.1  mrg   \global\advance\subsubsecno by 1
   6429      1.1  mrg   \sectionheading{#1}{subsubsec}{Ynothing}%
   6430      1.1  mrg                  {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}%
   6431      1.1  mrg }
   6432      1.1  mrg 
   6433      1.1  mrg % These macros control what the section commands do, according
   6434      1.1  mrg % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
   6435      1.1  mrg % Define them by default for a numbered chapter.
   6436      1.1  mrg \let\section = \numberedsec
   6437      1.1  mrg \let\subsection = \numberedsubsec
   6438      1.1  mrg \let\subsubsection = \numberedsubsubsec
   6439      1.1  mrg 
   6440      1.1  mrg % Define @majorheading, @heading and @subheading
   6441      1.1  mrg 
   6442      1.1  mrg \def\majorheading{%
   6443      1.1  mrg   {\advance\chapheadingskip by 10pt \chapbreak }%
   6444      1.1  mrg   \parsearg\chapheadingzzz
   6445      1.1  mrg }
   6446  1.1.1.2  mrg 
   6447  1.1.1.2  mrg \def\chapheading{\chapbreak \parsearg\chapheadingzzz}
   6448      1.1  mrg \def\chapheadingzzz#1{%
   6449      1.1  mrg   \vbox{\chapfonts \raggedtitlesettings #1\par}%
   6450      1.1  mrg   \nobreak\bigskip \nobreak
   6451      1.1  mrg   \suppressfirstparagraphindent
   6452      1.1  mrg }
   6453      1.1  mrg 
   6454      1.1  mrg % @heading, @subheading, @subsubheading.
   6455      1.1  mrg \parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{}
   6456      1.1  mrg   \suppressfirstparagraphindent}
   6457      1.1  mrg \parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{}
   6458      1.1  mrg   \suppressfirstparagraphindent}
   6459      1.1  mrg \parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{}
   6460      1.1  mrg   \suppressfirstparagraphindent}
   6461      1.1  mrg 
   6462      1.1  mrg % These macros generate a chapter, section, etc. heading only
   6463      1.1  mrg % (including whitespace, linebreaking, etc. around it),
   6464      1.1  mrg % given all the information in convenient, parsed form.
   6465      1.1  mrg 
   6466      1.1  mrg % Args are the skip and penalty (usually negative)
   6467      1.1  mrg \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
   6468      1.1  mrg 
   6469      1.1  mrg % Parameter controlling skip before chapter headings (if needed)
   6470      1.1  mrg \newskip\chapheadingskip
   6471  1.1.1.3  mrg 
   6472  1.1.1.3  mrg % Define plain chapter starts, and page on/off switching for it.
   6473      1.1  mrg \def\chapbreak{\dobreak \chapheadingskip {-4000}}
   6474  1.1.1.3  mrg 
   6475  1.1.1.3  mrg % Start a new page
   6476      1.1  mrg \def\chappager{\par\vfill\supereject}
   6477      1.1  mrg 
   6478      1.1  mrg % \chapoddpage - start on an odd page for a new chapter
   6479      1.1  mrg % Because \domark is called before \chapoddpage, the filler page will
   6480      1.1  mrg % get the headings for the next chapter, which is wrong.  But we don't
   6481      1.1  mrg % care -- we just disable all headings on the filler page.
   6482      1.1  mrg \def\chapoddpage{%
   6483      1.1  mrg   \chappager
   6484      1.1  mrg   \ifodd\pageno \else
   6485      1.1  mrg     \begingroup
   6486      1.1  mrg       \headingsoff
   6487      1.1  mrg       \null
   6488      1.1  mrg       \chappager
   6489      1.1  mrg     \endgroup
   6490  1.1.1.3  mrg   \fi
   6491      1.1  mrg }
   6492      1.1  mrg 
   6493      1.1  mrg \parseargdef\setchapternewpage{\csname CHAPPAG#1\endcsname}
   6494      1.1  mrg 
   6495      1.1  mrg \def\CHAPPAGoff{%
   6496      1.1  mrg \global\let\contentsalignmacro = \chappager
   6497      1.1  mrg \global\let\pchapsepmacro=\chapbreak
   6498      1.1  mrg \global\let\pagealignmacro=\chappager}
   6499      1.1  mrg 
   6500      1.1  mrg \def\CHAPPAGon{%
   6501      1.1  mrg \global\let\contentsalignmacro = \chappager
   6502      1.1  mrg \global\let\pchapsepmacro=\chappager
   6503      1.1  mrg \global\let\pagealignmacro=\chappager
   6504      1.1  mrg \global\def\HEADINGSon{\HEADINGSsingle}}
   6505      1.1  mrg 
   6506      1.1  mrg \def\CHAPPAGodd{%
   6507      1.1  mrg \global\let\contentsalignmacro = \chapoddpage
   6508      1.1  mrg \global\let\pchapsepmacro=\chapoddpage
   6509      1.1  mrg \global\let\pagealignmacro=\chapoddpage
   6510      1.1  mrg \global\def\HEADINGSon{\HEADINGSdouble}}
   6511  1.1.1.3  mrg 
   6512      1.1  mrg \CHAPPAGon
   6513      1.1  mrg 
   6514      1.1  mrg % \chapmacro - Chapter opening.
   6515  1.1.1.3  mrg %
   6516      1.1  mrg % #1 is the text, #2 is the section type (Ynumbered, Ynothing,
   6517      1.1  mrg % Yappendix, Yomitfromtoc), #3 the chapter number.
   6518      1.1  mrg % Not used for @heading series.
   6519      1.1  mrg %
   6520  1.1.1.3  mrg % To test against our argument.
   6521      1.1  mrg \def\Ynothingkeyword{Ynothing}
   6522      1.1  mrg \def\Yappendixkeyword{Yappendix}
   6523  1.1.1.3  mrg \def\Yomitfromtockeyword{Yomitfromtoc}
   6524  1.1.1.3  mrg %
   6525  1.1.1.3  mrg \def\chapmacro#1#2#3{%
   6526  1.1.1.3  mrg   \expandafter\ifx\thisenv\titlepage\else
   6527  1.1.1.3  mrg     \checkenv{}% chapters, etc., should not start inside an environment.
   6528  1.1.1.3  mrg   \fi
   6529  1.1.1.3  mrg   % FIXME: \chapmacro is currently called from inside \titlepage when
   6530  1.1.1.3  mrg   % \setcontentsaftertitlepage to print the "Table of Contents" heading, but
   6531      1.1  mrg   % this should probably be done by \sectionheading with an option to print
   6532      1.1  mrg   % in chapter size.
   6533      1.1  mrg   %
   6534      1.1  mrg   % Insert the first mark before the heading break (see notes for \domark).
   6535      1.1  mrg   \let\prevchapterdefs=\lastchapterdefs
   6536      1.1  mrg   \let\prevsectiondefs=\lastsectiondefs
   6537      1.1  mrg   \gdef\lastsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}%
   6538      1.1  mrg                         \gdef\thissection{}}%
   6539      1.1  mrg   %
   6540      1.1  mrg   \def\temptype{#2}%
   6541      1.1  mrg   \ifx\temptype\Ynothingkeyword
   6542      1.1  mrg     \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
   6543      1.1  mrg                           \gdef\thischapter{\thischaptername}}%
   6544      1.1  mrg   \else\ifx\temptype\Yomitfromtockeyword
   6545      1.1  mrg     \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
   6546      1.1  mrg                           \gdef\thischapter{}}%
   6547      1.1  mrg   \else\ifx\temptype\Yappendixkeyword
   6548      1.1  mrg     \toks0={#1}%
   6549      1.1  mrg     \xdef\lastchapterdefs{%
   6550      1.1  mrg       \gdef\noexpand\thischaptername{\the\toks0}%
   6551      1.1  mrg       \gdef\noexpand\thischapternum{\appendixletter}%
   6552      1.1  mrg       % \noexpand\putwordAppendix avoids expanding indigestible
   6553      1.1  mrg       % commands in some of the translations.
   6554      1.1  mrg       \gdef\noexpand\thischapter{\noexpand\putwordAppendix{}
   6555      1.1  mrg                                  \noexpand\thischapternum:
   6556      1.1  mrg                                  \noexpand\thischaptername}%
   6557      1.1  mrg     }%
   6558      1.1  mrg   \else
   6559      1.1  mrg     \toks0={#1}%
   6560      1.1  mrg     \xdef\lastchapterdefs{%
   6561      1.1  mrg       \gdef\noexpand\thischaptername{\the\toks0}%
   6562      1.1  mrg       \gdef\noexpand\thischapternum{\the\chapno}%
   6563      1.1  mrg       % \noexpand\putwordChapter avoids expanding indigestible
   6564      1.1  mrg       % commands in some of the translations.
   6565      1.1  mrg       \gdef\noexpand\thischapter{\noexpand\putwordChapter{}
   6566      1.1  mrg                                  \noexpand\thischapternum:
   6567      1.1  mrg                                  \noexpand\thischaptername}%
   6568      1.1  mrg     }%
   6569      1.1  mrg   \fi\fi\fi
   6570      1.1  mrg   %
   6571      1.1  mrg   % Output the mark.  Pass it through \safewhatsit, to take care of
   6572      1.1  mrg   % the preceding space.
   6573      1.1  mrg   \safewhatsit\domark
   6574      1.1  mrg   %
   6575      1.1  mrg   % Insert the chapter heading break.
   6576      1.1  mrg   \pchapsepmacro
   6577      1.1  mrg   %
   6578      1.1  mrg   % Now the second mark, after the heading break.  No break points
   6579      1.1  mrg   % between here and the heading.
   6580      1.1  mrg   \let\prevchapterdefs=\lastchapterdefs
   6581      1.1  mrg   \let\prevsectiondefs=\lastsectiondefs
   6582  1.1.1.3  mrg   \domark
   6583  1.1.1.3  mrg   %
   6584      1.1  mrg   {%
   6585      1.1  mrg     \chapfonts \rm
   6586      1.1  mrg     \let\footnote=\errfootnoteheading % give better error message
   6587      1.1  mrg     %
   6588      1.1  mrg     % Have to define \lastsection before calling \donoderef, because the
   6589      1.1  mrg     % xref code eventually uses it.  On the other hand, it has to be called
   6590      1.1  mrg     % after \pchapsepmacro, or the headline will change too soon.
   6591      1.1  mrg     \gdef\lastsection{#1}%
   6592      1.1  mrg     %
   6593      1.1  mrg     % Only insert the separating space if we have a chapter/appendix
   6594      1.1  mrg     % number, and don't print the unnumbered ``number''.
   6595      1.1  mrg     \ifx\temptype\Ynothingkeyword
   6596      1.1  mrg       \setbox0 = \hbox{}%
   6597      1.1  mrg       \def\toctype{unnchap}%
   6598      1.1  mrg     \else\ifx\temptype\Yomitfromtockeyword
   6599      1.1  mrg       \setbox0 = \hbox{}% contents like unnumbered, but no toc entry
   6600      1.1  mrg       \def\toctype{omit}%
   6601      1.1  mrg     \else\ifx\temptype\Yappendixkeyword
   6602      1.1  mrg       \setbox0 = \hbox{\putwordAppendix{} #3\enspace}%
   6603      1.1  mrg       \def\toctype{app}%
   6604      1.1  mrg     \else
   6605      1.1  mrg       \setbox0 = \hbox{#3\enspace}%
   6606      1.1  mrg       \def\toctype{numchap}%
   6607      1.1  mrg     \fi\fi\fi
   6608      1.1  mrg     %
   6609      1.1  mrg     % Write the toc entry for this chapter.  Must come before the
   6610      1.1  mrg     % \donoderef, because we include the current node name in the toc
   6611      1.1  mrg     % entry, and \donoderef resets it to empty.
   6612      1.1  mrg     \writetocentry{\toctype}{#1}{#3}%
   6613      1.1  mrg     %
   6614      1.1  mrg     % For pdftex, we have to write out the node definition (aka, make
   6615      1.1  mrg     % the pdfdest) after any page break, but before the actual text has
   6616      1.1  mrg     % been typeset.  If the destination for the pdf outline is after the
   6617      1.1  mrg     % text, then jumping from the outline may wind up with the text not
   6618      1.1  mrg     % being visible, for instance under high magnification.
   6619      1.1  mrg     \donoderef{#2}%
   6620  1.1.1.2  mrg     %
   6621      1.1  mrg     % Typeset the actual heading.
   6622      1.1  mrg     \nobreak % Avoid page breaks at the interline glue.
   6623      1.1  mrg     \vbox{\raggedtitlesettings \hangindent=\wd0 \centerparametersmaybe
   6624      1.1  mrg           \unhbox0 #1\par}%
   6625      1.1  mrg   }%
   6626      1.1  mrg   \nobreak\bigskip % no page break after a chapter title
   6627      1.1  mrg   \nobreak
   6628      1.1  mrg }
   6629      1.1  mrg 
   6630      1.1  mrg % @centerchap -- centered and unnumbered.
   6631      1.1  mrg \let\centerparametersmaybe = \relax
   6632      1.1  mrg \def\centerparameters{%
   6633      1.1  mrg   \advance\rightskip by 3\rightskip
   6634      1.1  mrg   \leftskip = \rightskip
   6635      1.1  mrg   \parfillskip = 0pt
   6636      1.1  mrg }
   6637      1.1  mrg 
   6638      1.1  mrg 
   6639      1.1  mrg % Section titles.  These macros combine the section number parts and
   6640      1.1  mrg % call the generic \sectionheading to do the printing.
   6641      1.1  mrg %
   6642      1.1  mrg \newskip\secheadingskip
   6643      1.1  mrg \def\secheadingbreak{\dobreak \secheadingskip{-1000}}
   6644      1.1  mrg 
   6645      1.1  mrg % Subsection titles.
   6646      1.1  mrg \newskip\subsecheadingskip
   6647      1.1  mrg \def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}}
   6648      1.1  mrg 
   6649      1.1  mrg % Subsubsection titles.
   6650      1.1  mrg \def\subsubsecheadingskip{\subsecheadingskip}
   6651      1.1  mrg \def\subsubsecheadingbreak{\subsecheadingbreak}
   6652      1.1  mrg 
   6653  1.1.1.3  mrg 
   6654  1.1.1.3  mrg % Print any size, any type, section title.
   6655  1.1.1.3  mrg %
   6656  1.1.1.3  mrg % #1 is the text of the title,
   6657      1.1  mrg % #2 is the section level (sec/subsec/subsubsec),
   6658      1.1  mrg % #3 is the section type (Ynumbered, Ynothing, Yappendix, Yomitfromtoc),
   6659      1.1  mrg % #4 is the section number.
   6660      1.1  mrg %
   6661      1.1  mrg \def\seckeyword{sec}
   6662      1.1  mrg %
   6663      1.1  mrg \def\sectionheading#1#2#3#4{%
   6664      1.1  mrg   {%
   6665  1.1.1.3  mrg     \def\sectionlevel{#2}%
   6666  1.1.1.3  mrg     \def\temptype{#3}%
   6667  1.1.1.3  mrg     %
   6668  1.1.1.3  mrg     % It is ok for the @heading series commands to appear inside an
   6669  1.1.1.3  mrg     % environment (it's been historically allowed, though the logic is
   6670  1.1.1.3  mrg     % dubious), but not the others.
   6671  1.1.1.3  mrg     \ifx\temptype\Yomitfromtockeyword\else
   6672  1.1.1.3  mrg       \checkenv{}% non-@*heading should not be in an environment.
   6673  1.1.1.3  mrg     \fi
   6674  1.1.1.3  mrg     \let\footnote=\errfootnoteheading
   6675  1.1.1.3  mrg     %
   6676      1.1  mrg     % Switch to the right set of fonts.
   6677      1.1  mrg     \csname #2fonts\endcsname \rm
   6678      1.1  mrg     %
   6679      1.1  mrg     % Insert first mark before the heading break (see notes for \domark).
   6680      1.1  mrg     \let\prevsectiondefs=\lastsectiondefs
   6681      1.1  mrg     \ifx\temptype\Ynothingkeyword
   6682      1.1  mrg       \ifx\sectionlevel\seckeyword
   6683      1.1  mrg         \gdef\lastsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}%
   6684      1.1  mrg                               \gdef\thissection{\thissectionname}}%
   6685      1.1  mrg       \fi
   6686      1.1  mrg     \else\ifx\temptype\Yomitfromtockeyword
   6687      1.1  mrg       % Don't redefine \thissection.
   6688      1.1  mrg     \else\ifx\temptype\Yappendixkeyword
   6689      1.1  mrg       \ifx\sectionlevel\seckeyword
   6690      1.1  mrg         \toks0={#1}%
   6691      1.1  mrg         \xdef\lastsectiondefs{%
   6692      1.1  mrg           \gdef\noexpand\thissectionname{\the\toks0}%
   6693      1.1  mrg           \gdef\noexpand\thissectionnum{#4}%
   6694      1.1  mrg           % \noexpand\putwordSection avoids expanding indigestible
   6695      1.1  mrg           % commands in some of the translations.
   6696      1.1  mrg           \gdef\noexpand\thissection{\noexpand\putwordSection{}
   6697      1.1  mrg                                      \noexpand\thissectionnum:
   6698      1.1  mrg                                      \noexpand\thissectionname}%
   6699      1.1  mrg         }%
   6700      1.1  mrg       \fi
   6701      1.1  mrg     \else
   6702      1.1  mrg       \ifx\sectionlevel\seckeyword
   6703      1.1  mrg         \toks0={#1}%
   6704      1.1  mrg         \xdef\lastsectiondefs{%
   6705      1.1  mrg           \gdef\noexpand\thissectionname{\the\toks0}%
   6706      1.1  mrg           \gdef\noexpand\thissectionnum{#4}%
   6707      1.1  mrg           % \noexpand\putwordSection avoids expanding indigestible
   6708      1.1  mrg           % commands in some of the translations.
   6709      1.1  mrg           \gdef\noexpand\thissection{\noexpand\putwordSection{}
   6710      1.1  mrg                                      \noexpand\thissectionnum:
   6711      1.1  mrg                                      \noexpand\thissectionname}%
   6712      1.1  mrg         }%
   6713      1.1  mrg       \fi
   6714      1.1  mrg     \fi\fi\fi
   6715      1.1  mrg     %
   6716      1.1  mrg     % Go into vertical mode.  Usually we'll already be there, but we
   6717      1.1  mrg     % don't want the following whatsit to end up in a preceding paragraph
   6718      1.1  mrg     % if the document didn't happen to have a blank line.
   6719      1.1  mrg     \par
   6720      1.1  mrg     %
   6721      1.1  mrg     % Output the mark.  Pass it through \safewhatsit, to take care of
   6722      1.1  mrg     % the preceding space.
   6723      1.1  mrg     \safewhatsit\domark
   6724      1.1  mrg     %
   6725      1.1  mrg     % Insert space above the heading.
   6726      1.1  mrg     \csname #2headingbreak\endcsname
   6727  1.1.1.3  mrg     %
   6728      1.1  mrg     % Now the second mark, after the heading break.  No break points
   6729      1.1  mrg     % between here and the heading.
   6730      1.1  mrg     \global\let\prevsectiondefs=\lastsectiondefs
   6731      1.1  mrg     \domark
   6732      1.1  mrg     %
   6733      1.1  mrg     % Only insert the space after the number if we have a section number.
   6734      1.1  mrg     \ifx\temptype\Ynothingkeyword
   6735      1.1  mrg       \setbox0 = \hbox{}%
   6736      1.1  mrg       \def\toctype{unn}%
   6737      1.1  mrg       \gdef\lastsection{#1}%
   6738      1.1  mrg     \else\ifx\temptype\Yomitfromtockeyword
   6739      1.1  mrg       % for @headings -- no section number, don't include in toc,
   6740      1.1  mrg       % and don't redefine \lastsection.
   6741      1.1  mrg       \setbox0 = \hbox{}%
   6742      1.1  mrg       \def\toctype{omit}%
   6743      1.1  mrg       \let\sectionlevel=\empty
   6744      1.1  mrg     \else\ifx\temptype\Yappendixkeyword
   6745      1.1  mrg       \setbox0 = \hbox{#4\enspace}%
   6746      1.1  mrg       \def\toctype{app}%
   6747      1.1  mrg       \gdef\lastsection{#1}%
   6748      1.1  mrg     \else
   6749      1.1  mrg       \setbox0 = \hbox{#4\enspace}%
   6750      1.1  mrg       \def\toctype{num}%
   6751      1.1  mrg       \gdef\lastsection{#1}%
   6752      1.1  mrg     \fi\fi\fi
   6753      1.1  mrg     %
   6754      1.1  mrg     % Write the toc entry (before \donoderef).  See comments in \chapmacro.
   6755      1.1  mrg     \writetocentry{\toctype\sectionlevel}{#1}{#4}%
   6756      1.1  mrg     %
   6757      1.1  mrg     % Write the node reference (= pdf destination for pdftex).
   6758      1.1  mrg     % Again, see comments in \chapmacro.
   6759      1.1  mrg     \donoderef{#3}%
   6760      1.1  mrg     %
   6761      1.1  mrg     % Interline glue will be inserted when the vbox is completed.
   6762      1.1  mrg     % That glue will be a valid breakpoint for the page, since it'll be
   6763      1.1  mrg     % preceded by a whatsit (usually from the \donoderef, or from the
   6764      1.1  mrg     % \writetocentry if there was no node).  We don't want to allow that
   6765      1.1  mrg     % break, since then the whatsits could end up on page n while the
   6766      1.1  mrg     % section is on page n+1, thus toc/etc. are wrong.  Debian bug 276000.
   6767      1.1  mrg     \nobreak
   6768      1.1  mrg     %
   6769      1.1  mrg     % Output the actual section heading.
   6770      1.1  mrg     \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright
   6771      1.1  mrg           \hangindent=\wd0  % zero if no section number
   6772      1.1  mrg           \unhbox0 #1}%
   6773      1.1  mrg   }%
   6774      1.1  mrg   % Add extra space after the heading -- half of whatever came above it.
   6775      1.1  mrg   % Don't allow stretch, though.
   6776      1.1  mrg   \kern .5 \csname #2headingskip\endcsname
   6777      1.1  mrg   %
   6778      1.1  mrg   % Do not let the kern be a potential breakpoint, as it would be if it
   6779      1.1  mrg   % was followed by glue.
   6780      1.1  mrg   \nobreak
   6781      1.1  mrg   %
   6782      1.1  mrg   % We'll almost certainly start a paragraph next, so don't let that
   6783      1.1  mrg   % glue accumulate.  (Not a breakpoint because it's preceded by a
   6784      1.1  mrg   % discardable item.)  However, when a paragraph is not started next
   6785      1.1  mrg   % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out
   6786      1.1  mrg   % or the negative glue will cause weirdly wrong output, typically
   6787      1.1  mrg   % obscuring the section heading with something else.
   6788      1.1  mrg   \vskip-\parskip
   6789      1.1  mrg   %
   6790      1.1  mrg   % This is so the last item on the main vertical list is a known
   6791      1.1  mrg   % \penalty > 10000, so \startdefun, etc., can recognize the situation
   6792      1.1  mrg   % and do the needful.
   6793      1.1  mrg   \penalty 10001
   6794      1.1  mrg }
   6795      1.1  mrg 
   6796      1.1  mrg 
   6797      1.1  mrg \message{toc,}
   6798      1.1  mrg % Table of contents.
   6799      1.1  mrg \newwrite\tocfile
   6800      1.1  mrg 
   6801      1.1  mrg % Write an entry to the toc file, opening it if necessary.
   6802      1.1  mrg % Called from @chapter, etc.
   6803      1.1  mrg %
   6804      1.1  mrg % Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno}
   6805      1.1  mrg % We append the current node name (if any) and page number as additional
   6806      1.1  mrg % arguments for the \{chap,sec,...}entry macros which will eventually
   6807      1.1  mrg % read this.  The node name is used in the pdf outlines as the
   6808      1.1  mrg % destination to jump to.
   6809      1.1  mrg %
   6810      1.1  mrg % We open the .toc file for writing here instead of at @setfilename (or
   6811      1.1  mrg % any other fixed time) so that @contents can be anywhere in the document.
   6812      1.1  mrg % But if #1 is `omit', then we don't do anything.  This is used for the
   6813      1.1  mrg % table of contents chapter openings themselves.
   6814      1.1  mrg %
   6815      1.1  mrg \newif\iftocfileopened
   6816      1.1  mrg \def\omitkeyword{omit}%
   6817      1.1  mrg %
   6818      1.1  mrg \def\writetocentry#1#2#3{%
   6819      1.1  mrg   \edef\writetoctype{#1}%
   6820      1.1  mrg   \ifx\writetoctype\omitkeyword \else
   6821      1.1  mrg     \iftocfileopened\else
   6822      1.1  mrg       \immediate\openout\tocfile = \jobname.toc
   6823      1.1  mrg       \global\tocfileopenedtrue
   6824      1.1  mrg     \fi
   6825      1.1  mrg     %
   6826      1.1  mrg     \iflinks
   6827      1.1  mrg       {\atdummies
   6828      1.1  mrg        \edef\temp{%
   6829      1.1  mrg          \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}%
   6830      1.1  mrg        \temp
   6831      1.1  mrg       }%
   6832      1.1  mrg     \fi
   6833      1.1  mrg   \fi
   6834      1.1  mrg   %
   6835      1.1  mrg   % Tell \shipout to create a pdf destination on each page, if we're
   6836      1.1  mrg   % writing pdf.  These are used in the table of contents.  We can't
   6837      1.1  mrg   % just write one on every page because the title pages are numbered
   6838  1.1.1.3  mrg   % 1 and 2 (the page numbers aren't printed), and so are the first
   6839  1.1.1.3  mrg   % two pages of the document.  Thus, we'd have two destinations named
   6840  1.1.1.3  mrg   % `1', and two named `2'.
   6841  1.1.1.3  mrg   \ifpdf
   6842  1.1.1.3  mrg     \global\pdfmakepagedesttrue
   6843  1.1.1.3  mrg   \else
   6844  1.1.1.3  mrg     \ifx\XeTeXrevision\thisisundefined
   6845  1.1.1.3  mrg     \else
   6846      1.1  mrg       \global\pdfmakepagedesttrue
   6847      1.1  mrg     \fi
   6848      1.1  mrg   \fi
   6849      1.1  mrg }
   6850      1.1  mrg 
   6851      1.1  mrg 
   6852      1.1  mrg % These characters do not print properly in the Computer Modern roman
   6853      1.1  mrg % fonts, so we must take special care.  This is more or less redundant
   6854      1.1  mrg % with the Texinfo input format setup at the end of this file.
   6855      1.1  mrg %
   6856      1.1  mrg \def\activecatcodes{%
   6857      1.1  mrg   \catcode`\"=\active
   6858      1.1  mrg   \catcode`\$=\active
   6859      1.1  mrg   \catcode`\<=\active
   6860      1.1  mrg   \catcode`\>=\active
   6861      1.1  mrg   \catcode`\\=\active
   6862      1.1  mrg   \catcode`\^=\active
   6863      1.1  mrg   \catcode`\_=\active
   6864      1.1  mrg   \catcode`\|=\active
   6865      1.1  mrg   \catcode`\~=\active
   6866      1.1  mrg }
   6867      1.1  mrg 
   6868      1.1  mrg 
   6869      1.1  mrg % Read the toc file, which is essentially Texinfo input.
   6870      1.1  mrg \def\readtocfile{%
   6871      1.1  mrg   \setupdatafile
   6872      1.1  mrg   \activecatcodes
   6873      1.1  mrg   \input \tocreadfilename
   6874      1.1  mrg }
   6875      1.1  mrg 
   6876      1.1  mrg \newskip\contentsrightmargin \contentsrightmargin=1in
   6877      1.1  mrg \newcount\savepageno
   6878      1.1  mrg \newcount\lastnegativepageno \lastnegativepageno = -1
   6879      1.1  mrg 
   6880      1.1  mrg % Prepare to read what we've written to \tocfile.
   6881      1.1  mrg %
   6882      1.1  mrg \def\startcontents#1{%
   6883      1.1  mrg   % If @setchapternewpage on, and @headings double, the contents should
   6884      1.1  mrg   % start on an odd page, unlike chapters.  Thus, we maintain
   6885      1.1  mrg   % \contentsalignmacro in parallel with \pagealignmacro.
   6886      1.1  mrg   % From: Torbjorn Granlund <tege (a] matematik.su.se>
   6887      1.1  mrg   \contentsalignmacro
   6888      1.1  mrg   \immediate\closeout\tocfile
   6889      1.1  mrg   %
   6890      1.1  mrg   % Don't need to put `Contents' or `Short Contents' in the headline.
   6891      1.1  mrg   % It is abundantly clear what they are.
   6892      1.1  mrg   \chapmacro{#1}{Yomitfromtoc}{}%
   6893      1.1  mrg   %
   6894  1.1.1.3  mrg   \savepageno = \pageno
   6895      1.1  mrg   \begingroup                  % Set up to handle contents files properly.
   6896      1.1  mrg     \raggedbottom              % Worry more about breakpoints than the bottom.
   6897      1.1  mrg     \entryrightmargin=\contentsrightmargin % Don't use the full line length.
   6898      1.1  mrg     %
   6899      1.1  mrg     % Roman numerals for page numbers.
   6900      1.1  mrg     \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
   6901      1.1  mrg }
   6902      1.1  mrg 
   6903      1.1  mrg % redefined for the two-volume lispref.  We always output on
   6904      1.1  mrg % \jobname.toc even if this is redefined.
   6905      1.1  mrg %
   6906      1.1  mrg \def\tocreadfilename{\jobname.toc}
   6907      1.1  mrg 
   6908      1.1  mrg % Normal (long) toc.
   6909      1.1  mrg %
   6910      1.1  mrg \def\contents{%
   6911      1.1  mrg   \startcontents{\putwordTOC}%
   6912      1.1  mrg     \openin 1 \tocreadfilename\space
   6913      1.1  mrg     \ifeof 1 \else
   6914      1.1  mrg       \readtocfile
   6915      1.1  mrg     \fi
   6916      1.1  mrg     \vfill \eject
   6917      1.1  mrg     \contentsalignmacro % in case @setchapternewpage odd is in effect
   6918      1.1  mrg     \ifeof 1 \else
   6919      1.1  mrg       \pdfmakeoutlines
   6920      1.1  mrg     \fi
   6921      1.1  mrg     \closein 1
   6922      1.1  mrg   \endgroup
   6923      1.1  mrg   \lastnegativepageno = \pageno
   6924      1.1  mrg   \global\pageno = \savepageno
   6925      1.1  mrg }
   6926      1.1  mrg 
   6927      1.1  mrg % And just the chapters.
   6928      1.1  mrg \def\summarycontents{%
   6929      1.1  mrg   \startcontents{\putwordShortTOC}%
   6930      1.1  mrg     %
   6931      1.1  mrg     \let\partentry = \shortpartentry
   6932      1.1  mrg     \let\numchapentry = \shortchapentry
   6933      1.1  mrg     \let\appentry = \shortchapentry
   6934      1.1  mrg     \let\unnchapentry = \shortunnchapentry
   6935      1.1  mrg     % We want a true roman here for the page numbers.
   6936      1.1  mrg     \secfonts
   6937      1.1  mrg     \let\rm=\shortcontrm \let\bf=\shortcontbf
   6938      1.1  mrg     \let\sl=\shortcontsl \let\tt=\shortconttt
   6939      1.1  mrg     \rm
   6940      1.1  mrg     \hyphenpenalty = 10000
   6941      1.1  mrg     \advance\baselineskip by 1pt % Open it up a little.
   6942      1.1  mrg     \def\numsecentry##1##2##3##4{}
   6943      1.1  mrg     \let\appsecentry = \numsecentry
   6944      1.1  mrg     \let\unnsecentry = \numsecentry
   6945      1.1  mrg     \let\numsubsecentry = \numsecentry
   6946      1.1  mrg     \let\appsubsecentry = \numsecentry
   6947      1.1  mrg     \let\unnsubsecentry = \numsecentry
   6948      1.1  mrg     \let\numsubsubsecentry = \numsecentry
   6949      1.1  mrg     \let\appsubsubsecentry = \numsecentry
   6950      1.1  mrg     \let\unnsubsubsecentry = \numsecentry
   6951      1.1  mrg     \openin 1 \tocreadfilename\space
   6952      1.1  mrg     \ifeof 1 \else
   6953      1.1  mrg       \readtocfile
   6954      1.1  mrg     \fi
   6955      1.1  mrg     \closein 1
   6956      1.1  mrg     \vfill \eject
   6957      1.1  mrg     \contentsalignmacro % in case @setchapternewpage odd is in effect
   6958      1.1  mrg   \endgroup
   6959      1.1  mrg   \lastnegativepageno = \pageno
   6960      1.1  mrg   \global\pageno = \savepageno
   6961      1.1  mrg }
   6962      1.1  mrg \let\shortcontents = \summarycontents
   6963      1.1  mrg 
   6964      1.1  mrg % Typeset the label for a chapter or appendix for the short contents.
   6965      1.1  mrg % The arg is, e.g., `A' for an appendix, or `3' for a chapter.
   6966      1.1  mrg %
   6967      1.1  mrg \def\shortchaplabel#1{%
   6968      1.1  mrg   % This space should be enough, since a single number is .5em, and the
   6969      1.1  mrg   % widest letter (M) is 1em, at least in the Computer Modern fonts.
   6970      1.1  mrg   % But use \hss just in case.
   6971      1.1  mrg   % (This space doesn't include the extra space that gets added after
   6972      1.1  mrg   % the label; that gets put in by \shortchapentry above.)
   6973      1.1  mrg   %
   6974      1.1  mrg   % We'd like to right-justify chapter numbers, but that looks strange
   6975      1.1  mrg   % with appendix letters.  And right-justifying numbers and
   6976      1.1  mrg   % left-justifying letters looks strange when there is less than 10
   6977      1.1  mrg   % chapters.  Have to read the whole toc once to know how many chapters
   6978      1.1  mrg   % there are before deciding ...
   6979      1.1  mrg   \hbox to 1em{#1\hss}%
   6980      1.1  mrg }
   6981      1.1  mrg 
   6982      1.1  mrg % These macros generate individual entries in the table of contents.
   6983      1.1  mrg % The first argument is the chapter or section name.
   6984      1.1  mrg % The last argument is the page number.
   6985      1.1  mrg % The arguments in between are the chapter number, section number, ...
   6986      1.1  mrg 
   6987      1.1  mrg % Parts, in the main contents.  Replace the part number, which doesn't
   6988  1.1.1.3  mrg % exist, with an empty box.  Let's hope all the numbers have the same width.
   6989  1.1.1.3  mrg % Also ignore the page number, which is conventionally not printed.
   6990  1.1.1.3  mrg \def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}}
   6991  1.1.1.3  mrg \def\partentry#1#2#3#4{%
   6992  1.1.1.3  mrg   % Add stretch and a bonus for breaking the page before the part heading.
   6993  1.1.1.3  mrg   % This reduces the chance of the page being broken immediately after the
   6994  1.1.1.3  mrg   % part heading, before a following chapter heading.
   6995  1.1.1.3  mrg   \vskip 0pt plus 5\baselineskip
   6996  1.1.1.3  mrg   \penalty-300
   6997      1.1  mrg   \vskip 0pt plus -5\baselineskip
   6998      1.1  mrg   \dochapentry{\numeralbox\labelspace#1}{}%
   6999      1.1  mrg }
   7000      1.1  mrg %
   7001      1.1  mrg % Parts, in the short toc.
   7002      1.1  mrg \def\shortpartentry#1#2#3#4{%
   7003      1.1  mrg   \penalty-300
   7004      1.1  mrg   \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip
   7005      1.1  mrg   \shortchapentry{{\bf #1}}{\numeralbox}{}{}%
   7006      1.1  mrg }
   7007  1.1.1.3  mrg 
   7008      1.1  mrg % Chapters, in the main contents.
   7009      1.1  mrg \def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}}
   7010      1.1  mrg 
   7011      1.1  mrg % Chapters, in the short toc.
   7012      1.1  mrg % See comments in \dochapentry re vbox and related settings.
   7013      1.1  mrg \def\shortchapentry#1#2#3#4{%
   7014      1.1  mrg   \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}%
   7015      1.1  mrg }
   7016      1.1  mrg 
   7017      1.1  mrg % Appendices, in the main contents.
   7018      1.1  mrg % Need the word Appendix, and a fixed-size box.
   7019      1.1  mrg %
   7020      1.1  mrg \def\appendixbox#1{%
   7021      1.1  mrg   % We use M since it's probably the widest letter.
   7022  1.1.1.3  mrg   \setbox0 = \hbox{\putwordAppendix{} M}%
   7023      1.1  mrg   \hbox to \wd0{\putwordAppendix{} #1\hss}}
   7024      1.1  mrg %
   7025      1.1  mrg \def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\hskip.7em#1}{#4}}
   7026      1.1  mrg 
   7027      1.1  mrg % Unnumbered chapters.
   7028      1.1  mrg \def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}}
   7029      1.1  mrg \def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}}
   7030      1.1  mrg 
   7031      1.1  mrg % Sections.
   7032      1.1  mrg \def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}}
   7033      1.1  mrg \let\appsecentry=\numsecentry
   7034      1.1  mrg \def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}}
   7035      1.1  mrg 
   7036      1.1  mrg % Subsections.
   7037      1.1  mrg \def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}}
   7038      1.1  mrg \let\appsubsecentry=\numsubsecentry
   7039      1.1  mrg \def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}}
   7040      1.1  mrg 
   7041      1.1  mrg % And subsubsections.
   7042      1.1  mrg \def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}}
   7043      1.1  mrg \let\appsubsubsecentry=\numsubsubsecentry
   7044      1.1  mrg \def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}}
   7045      1.1  mrg 
   7046      1.1  mrg % This parameter controls the indentation of the various levels.
   7047      1.1  mrg % Same as \defaultparindent.
   7048      1.1  mrg \newdimen\tocindent \tocindent = 15pt
   7049      1.1  mrg 
   7050      1.1  mrg % Now for the actual typesetting. In all these, #1 is the text and #2 is the
   7051      1.1  mrg % page number.
   7052      1.1  mrg %
   7053      1.1  mrg % If the toc has to be broken over pages, we want it to be at chapters
   7054      1.1  mrg % if at all possible; hence the \penalty.
   7055  1.1.1.3  mrg \def\dochapentry#1#2{%
   7056  1.1.1.3  mrg    \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
   7057      1.1  mrg    \begingroup
   7058      1.1  mrg      % Move the page numbers slightly to the right
   7059      1.1  mrg      \advance\entryrightmargin by -0.05em
   7060      1.1  mrg      \chapentryfonts
   7061      1.1  mrg      \tocentry{#1}{\dopageno\bgroup#2\egroup}%
   7062      1.1  mrg    \endgroup
   7063      1.1  mrg    \nobreak\vskip .25\baselineskip plus.1\baselineskip
   7064      1.1  mrg }
   7065      1.1  mrg 
   7066      1.1  mrg \def\dosecentry#1#2{\begingroup
   7067      1.1  mrg   \secentryfonts \leftskip=\tocindent
   7068      1.1  mrg   \tocentry{#1}{\dopageno\bgroup#2\egroup}%
   7069      1.1  mrg \endgroup}
   7070      1.1  mrg 
   7071      1.1  mrg \def\dosubsecentry#1#2{\begingroup
   7072      1.1  mrg   \subsecentryfonts \leftskip=2\tocindent
   7073      1.1  mrg   \tocentry{#1}{\dopageno\bgroup#2\egroup}%
   7074      1.1  mrg \endgroup}
   7075      1.1  mrg 
   7076      1.1  mrg \def\dosubsubsecentry#1#2{\begingroup
   7077      1.1  mrg   \subsubsecentryfonts \leftskip=3\tocindent
   7078      1.1  mrg   \tocentry{#1}{\dopageno\bgroup#2\egroup}%
   7079      1.1  mrg \endgroup}
   7080      1.1  mrg 
   7081      1.1  mrg % We use the same \entry macro as for the index entries.
   7082      1.1  mrg \let\tocentry = \entry
   7083      1.1  mrg 
   7084      1.1  mrg % Space between chapter (or whatever) number and the title.
   7085      1.1  mrg \def\labelspace{\hskip1em \relax}
   7086      1.1  mrg 
   7087      1.1  mrg \def\dopageno#1{{\rm #1}}
   7088      1.1  mrg \def\doshortpageno#1{{\rm #1}}
   7089      1.1  mrg 
   7090      1.1  mrg \def\chapentryfonts{\secfonts \rm}
   7091      1.1  mrg \def\secentryfonts{\textfonts}
   7092      1.1  mrg \def\subsecentryfonts{\textfonts}
   7093      1.1  mrg \def\subsubsecentryfonts{\textfonts}
   7094      1.1  mrg 
   7095      1.1  mrg 
   7096      1.1  mrg \message{environments,}
   7097      1.1  mrg % @foo ... @end foo.
   7098      1.1  mrg 
   7099      1.1  mrg % @tex ... @end tex    escapes into raw TeX temporarily.
   7100      1.1  mrg % One exception: @ is still an escape character, so that @end tex works.
   7101      1.1  mrg % But \@ or @@ will get a plain @ character.
   7102      1.1  mrg 
   7103      1.1  mrg \envdef\tex{%
   7104      1.1  mrg   \setupmarkupstyle{tex}%
   7105      1.1  mrg   \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
   7106      1.1  mrg   \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
   7107      1.1  mrg   \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
   7108      1.1  mrg   \catcode `\%=14
   7109      1.1  mrg   \catcode `\+=\other
   7110      1.1  mrg   \catcode `\"=\other
   7111  1.1.1.3  mrg   \catcode `\|=\other
   7112  1.1.1.3  mrg   \catcode `\<=\other
   7113      1.1  mrg   \catcode `\>=\other
   7114      1.1  mrg   \catcode `\`=\other
   7115      1.1  mrg   \catcode `\'=\other
   7116      1.1  mrg   %
   7117      1.1  mrg   % ' is active in math mode (mathcode"8000).  So reset it, and all our
   7118  1.1.1.3  mrg   % other math active characters (just in case), to plain's definitions.
   7119      1.1  mrg   \mathactive
   7120      1.1  mrg   %
   7121      1.1  mrg   % Inverse of the list at the beginning of the file.
   7122      1.1  mrg   \let\b=\ptexb
   7123      1.1  mrg   \let\bullet=\ptexbullet
   7124      1.1  mrg   \let\c=\ptexc
   7125      1.1  mrg   \let\,=\ptexcomma
   7126      1.1  mrg   \let\.=\ptexdot
   7127      1.1  mrg   \let\dots=\ptexdots
   7128      1.1  mrg   \let\equiv=\ptexequiv
   7129      1.1  mrg   \let\!=\ptexexclam
   7130      1.1  mrg   \let\i=\ptexi
   7131      1.1  mrg   \let\indent=\ptexindent
   7132      1.1  mrg   \let\noindent=\ptexnoindent
   7133      1.1  mrg   \let\{=\ptexlbrace
   7134  1.1.1.3  mrg   \let\+=\tabalign
   7135      1.1  mrg   \let\}=\ptexrbrace
   7136  1.1.1.3  mrg   \let\/=\ptexslash
   7137      1.1  mrg   \let\sp=\ptexsp
   7138  1.1.1.3  mrg   \let\*=\ptexstar
   7139      1.1  mrg   %\let\sup=\ptexsup % do not redefine, we want @sup to work in math mode
   7140      1.1  mrg   \let\t=\ptext
   7141      1.1  mrg   \expandafter \let\csname top\endcsname=\ptextop  % we've made it outer
   7142      1.1  mrg   \let\frenchspacing=\plainfrenchspacing
   7143      1.1  mrg   %
   7144      1.1  mrg   \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
   7145      1.1  mrg   \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
   7146      1.1  mrg   \def\@{@}%
   7147      1.1  mrg }
   7148      1.1  mrg % There is no need to define \Etex.
   7149      1.1  mrg 
   7150      1.1  mrg % Define @lisp ... @end lisp.
   7151      1.1  mrg % @lisp environment forms a group so it can rebind things,
   7152      1.1  mrg % including the definition of @end lisp (which normally is erroneous).
   7153      1.1  mrg 
   7154      1.1  mrg % Amount to narrow the margins by for @lisp.
   7155      1.1  mrg \newskip\lispnarrowing \lispnarrowing=0.4in
   7156      1.1  mrg 
   7157      1.1  mrg % This is the definition that ^^M gets inside @lisp, @example, and other
   7158      1.1  mrg % such environments.  \null is better than a space, since it doesn't
   7159      1.1  mrg % have any width.
   7160      1.1  mrg \def\lisppar{\null\endgraf}
   7161      1.1  mrg 
   7162      1.1  mrg % This space is always present above and below environments.
   7163      1.1  mrg \newskip\envskipamount \envskipamount = 0pt
   7164      1.1  mrg 
   7165      1.1  mrg % Make spacing and below environment symmetrical.  We use \parskip here
   7166      1.1  mrg % to help in doing that, since in @example-like environments \parskip
   7167      1.1  mrg % is reset to zero; thus the \afterenvbreak inserts no space -- but the
   7168      1.1  mrg % start of the next paragraph will insert \parskip.
   7169      1.1  mrg %
   7170      1.1  mrg \def\aboveenvbreak{{%
   7171      1.1  mrg   % =10000 instead of <10000 because of a special case in \itemzzz and
   7172      1.1  mrg   % \sectionheading, q.v.
   7173      1.1  mrg   \ifnum \lastpenalty=10000 \else
   7174      1.1  mrg     \advance\envskipamount by \parskip
   7175  1.1.1.3  mrg     \endgraf
   7176  1.1.1.3  mrg     \ifdim\lastskip<\envskipamount
   7177  1.1.1.3  mrg       \removelastskip
   7178  1.1.1.3  mrg       \ifnum\lastpenalty<10000
   7179  1.1.1.3  mrg         % Penalize breaking before the environment, because preceding text
   7180  1.1.1.3  mrg         % often leads into it.
   7181  1.1.1.3  mrg         \penalty100
   7182  1.1.1.3  mrg       \fi
   7183  1.1.1.3  mrg       \vskip\envskipamount
   7184  1.1.1.3  mrg     \fi
   7185  1.1.1.3  mrg   \fi
   7186  1.1.1.3  mrg }}
   7187  1.1.1.3  mrg 
   7188  1.1.1.3  mrg \def\afterenvbreak{{%
   7189  1.1.1.3  mrg   % =10000 instead of <10000 because of a special case in \itemzzz and
   7190  1.1.1.3  mrg   % \sectionheading, q.v.
   7191  1.1.1.3  mrg   \ifnum \lastpenalty=10000 \else
   7192  1.1.1.3  mrg     \advance\envskipamount by \parskip
   7193      1.1  mrg     \endgraf
   7194      1.1  mrg     \ifdim\lastskip<\envskipamount
   7195      1.1  mrg       \removelastskip
   7196      1.1  mrg       % it's not a good place to break if the last penalty was \nobreak
   7197      1.1  mrg       % or better ...
   7198      1.1  mrg       \ifnum\lastpenalty<10000 \penalty-50 \fi
   7199      1.1  mrg       \vskip\envskipamount
   7200      1.1  mrg     \fi
   7201      1.1  mrg   \fi
   7202      1.1  mrg }}
   7203      1.1  mrg 
   7204      1.1  mrg % \nonarrowing is a flag.  If "set", @lisp etc don't narrow margins; it will
   7205      1.1  mrg % also clear it, so that its embedded environments do the narrowing again.
   7206      1.1  mrg \let\nonarrowing=\relax
   7207      1.1  mrg 
   7208      1.1  mrg % @cartouche ... @end cartouche: draw rectangle w/rounded corners around
   7209      1.1  mrg % environment contents.
   7210      1.1  mrg \font\circle=lcircle10
   7211      1.1  mrg \newdimen\circthick
   7212      1.1  mrg \newdimen\cartouter\newdimen\cartinner
   7213      1.1  mrg \newskip\normbskip\newskip\normpskip\newskip\normlskip
   7214      1.1  mrg \circthick=\fontdimen8\circle
   7215      1.1  mrg %
   7216      1.1  mrg \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
   7217      1.1  mrg \def\ctr{{\hskip 6pt\circle\char'010}}
   7218      1.1  mrg \def\cbl{{\circle\char'012\hskip -6pt}}
   7219      1.1  mrg \def\cbr{{\hskip 6pt\circle\char'011}}
   7220      1.1  mrg \def\carttop{\hbox to \cartouter{\hskip\lskip
   7221      1.1  mrg         \ctl\leaders\hrule height\circthick\hfil\ctr
   7222      1.1  mrg         \hskip\rskip}}
   7223      1.1  mrg \def\cartbot{\hbox to \cartouter{\hskip\lskip
   7224      1.1  mrg         \cbl\leaders\hrule height\circthick\hfil\cbr
   7225      1.1  mrg         \hskip\rskip}}
   7226      1.1  mrg %
   7227      1.1  mrg \newskip\lskip\newskip\rskip
   7228      1.1  mrg 
   7229      1.1  mrg \envdef\cartouche{%
   7230      1.1  mrg   \ifhmode\par\fi  % can't be in the midst of a paragraph.
   7231      1.1  mrg   \startsavinginserts
   7232      1.1  mrg   \lskip=\leftskip \rskip=\rightskip
   7233      1.1  mrg   \leftskip=0pt\rightskip=0pt % we want these *outside*.
   7234      1.1  mrg   \cartinner=\hsize \advance\cartinner by-\lskip
   7235      1.1  mrg   \advance\cartinner by-\rskip
   7236      1.1  mrg   \cartouter=\hsize
   7237      1.1  mrg   \advance\cartouter by 18.4pt	% allow for 3pt kerns on either
   7238      1.1  mrg 				% side, and for 6pt waste from
   7239      1.1  mrg 				% each corner char, and rule thickness
   7240      1.1  mrg   \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
   7241      1.1  mrg   %
   7242      1.1  mrg   % If this cartouche directly follows a sectioning command, we need the
   7243      1.1  mrg   % \parskip glue (backspaced over by default) or the cartouche can
   7244  1.1.1.3  mrg   % collide with the section heading.
   7245      1.1  mrg   \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi
   7246      1.1  mrg   %
   7247      1.1  mrg   \setbox\groupbox=\vbox\bgroup
   7248      1.1  mrg       \baselineskip=0pt\parskip=0pt\lineskip=0pt
   7249      1.1  mrg       \carttop
   7250      1.1  mrg       \hbox\bgroup
   7251      1.1  mrg 	  \hskip\lskip
   7252      1.1  mrg 	  \vrule\kern3pt
   7253      1.1  mrg 	  \vbox\bgroup
   7254      1.1  mrg 	      \kern3pt
   7255      1.1  mrg 	      \hsize=\cartinner
   7256      1.1  mrg 	      \baselineskip=\normbskip
   7257      1.1  mrg 	      \lineskip=\normlskip
   7258      1.1  mrg 	      \parskip=\normpskip
   7259      1.1  mrg 	      \vskip -\parskip
   7260      1.1  mrg 	      \comment % For explanation, see the end of def\group.
   7261      1.1  mrg }
   7262      1.1  mrg \def\Ecartouche{%
   7263      1.1  mrg               \ifhmode\par\fi
   7264      1.1  mrg 	      \kern3pt
   7265      1.1  mrg 	  \egroup
   7266      1.1  mrg 	  \kern3pt\vrule
   7267      1.1  mrg 	  \hskip\rskip
   7268  1.1.1.3  mrg       \egroup
   7269      1.1  mrg       \cartbot
   7270      1.1  mrg   \egroup
   7271      1.1  mrg   \addgroupbox
   7272      1.1  mrg   \checkinserts
   7273      1.1  mrg }
   7274      1.1  mrg 
   7275      1.1  mrg 
   7276      1.1  mrg % This macro is called at the beginning of all the @example variants,
   7277      1.1  mrg % inside a group.
   7278  1.1.1.3  mrg \newdimen\nonfillparindent
   7279      1.1  mrg \def\nonfillstart{%
   7280      1.1  mrg   \aboveenvbreak
   7281      1.1  mrg   \ifdim\hfuzz < 12pt \hfuzz = 12pt \fi % Don't be fussy
   7282      1.1  mrg   \sepspaces % Make spaces be word-separators rather than space tokens.
   7283      1.1  mrg   \let\par = \lisppar % don't ignore blank lines
   7284      1.1  mrg   \obeylines % each line of input is a line of output
   7285      1.1  mrg   \parskip = 0pt
   7286      1.1  mrg   % Turn off paragraph indentation but redefine \indent to emulate
   7287      1.1  mrg   % the normal \indent.
   7288      1.1  mrg   \nonfillparindent=\parindent
   7289      1.1  mrg   \parindent = 0pt
   7290      1.1  mrg   \let\indent\nonfillindent
   7291      1.1  mrg   %
   7292      1.1  mrg   \emergencystretch = 0pt % don't try to avoid overfull boxes
   7293      1.1  mrg   \ifx\nonarrowing\relax
   7294      1.1  mrg     \advance \leftskip by \lispnarrowing
   7295      1.1  mrg     \exdentamount=\lispnarrowing
   7296      1.1  mrg   \else
   7297      1.1  mrg     \let\nonarrowing = \relax
   7298      1.1  mrg   \fi
   7299      1.1  mrg   \let\exdent=\nofillexdent
   7300      1.1  mrg }
   7301      1.1  mrg 
   7302      1.1  mrg \begingroup
   7303      1.1  mrg \obeyspaces
   7304      1.1  mrg % We want to swallow spaces (but not other tokens) after the fake
   7305      1.1  mrg % @indent in our nonfill-environments, where spaces are normally
   7306      1.1  mrg % active and set to @tie, resulting in them not being ignored after
   7307      1.1  mrg % @indent.
   7308      1.1  mrg \gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}%
   7309      1.1  mrg \gdef\nonfillindentcheck{%
   7310      1.1  mrg \ifx\temp %
   7311      1.1  mrg \expandafter\nonfillindentgobble%
   7312      1.1  mrg \else%
   7313      1.1  mrg \leavevmode\nonfillindentbox%
   7314      1.1  mrg \fi%
   7315      1.1  mrg }%
   7316      1.1  mrg \endgroup
   7317      1.1  mrg \def\nonfillindentgobble#1{\nonfillindent}
   7318      1.1  mrg \def\nonfillindentbox{\hbox to \nonfillparindent{\hss}}
   7319      1.1  mrg 
   7320      1.1  mrg % If you want all examples etc. small: @set dispenvsize small.
   7321      1.1  mrg % If you want even small examples the full size: @set dispenvsize nosmall.
   7322      1.1  mrg % This affects the following displayed environments:
   7323      1.1  mrg %    @example, @display, @format, @lisp
   7324      1.1  mrg %
   7325      1.1  mrg \def\smallword{small}
   7326      1.1  mrg \def\nosmallword{nosmall}
   7327      1.1  mrg \let\SETdispenvsize\relax
   7328      1.1  mrg \def\setnormaldispenv{%
   7329      1.1  mrg   \ifx\SETdispenvsize\smallword
   7330      1.1  mrg     % end paragraph for sake of leading, in case document has no blank
   7331      1.1  mrg     % line.  This is redundant with what happens in \aboveenvbreak, but
   7332      1.1  mrg     % we need to do it before changing the fonts, and it's inconvenient
   7333      1.1  mrg     % to change the fonts afterward.
   7334      1.1  mrg     \ifnum \lastpenalty=10000 \else \endgraf \fi
   7335      1.1  mrg     \smallexamplefonts \rm
   7336      1.1  mrg   \fi
   7337      1.1  mrg }
   7338      1.1  mrg \def\setsmalldispenv{%
   7339      1.1  mrg   \ifx\SETdispenvsize\nosmallword
   7340      1.1  mrg   \else
   7341      1.1  mrg     \ifnum \lastpenalty=10000 \else \endgraf \fi
   7342      1.1  mrg     \smallexamplefonts \rm
   7343      1.1  mrg   \fi
   7344      1.1  mrg }
   7345      1.1  mrg 
   7346      1.1  mrg % We often define two environments, @foo and @smallfoo.
   7347      1.1  mrg % Let's do it in one command.  #1 is the env name, #2 the definition.
   7348      1.1  mrg \def\makedispenvdef#1#2{%
   7349      1.1  mrg   \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}%
   7350      1.1  mrg   \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}%
   7351      1.1  mrg   \expandafter\let\csname E#1\endcsname \afterenvbreak
   7352      1.1  mrg   \expandafter\let\csname Esmall#1\endcsname \afterenvbreak
   7353      1.1  mrg }
   7354      1.1  mrg 
   7355      1.1  mrg % Define two environment synonyms (#1 and #2) for an environment.
   7356      1.1  mrg \def\maketwodispenvdef#1#2#3{%
   7357      1.1  mrg   \makedispenvdef{#1}{#3}%
   7358      1.1  mrg   \makedispenvdef{#2}{#3}%
   7359      1.1  mrg }
   7360      1.1  mrg %
   7361      1.1  mrg % @lisp: indented, narrowed, typewriter font;
   7362      1.1  mrg % @example: same as @lisp.
   7363      1.1  mrg %
   7364      1.1  mrg % @smallexample and @smalllisp: use smaller fonts.
   7365      1.1  mrg % Originally contributed by Pavel@xerox.
   7366      1.1  mrg %
   7367      1.1  mrg \maketwodispenvdef{lisp}{example}{%
   7368      1.1  mrg   \nonfillstart
   7369      1.1  mrg   \tt\setupmarkupstyle{example}%
   7370      1.1  mrg   \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
   7371      1.1  mrg   \gobble % eat return
   7372      1.1  mrg }
   7373      1.1  mrg % @display/@smalldisplay: same as @lisp except keep current font.
   7374      1.1  mrg %
   7375      1.1  mrg \makedispenvdef{display}{%
   7376      1.1  mrg   \nonfillstart
   7377      1.1  mrg   \gobble
   7378      1.1  mrg }
   7379      1.1  mrg 
   7380      1.1  mrg % @format/@smallformat: same as @display except don't narrow margins.
   7381      1.1  mrg %
   7382      1.1  mrg \makedispenvdef{format}{%
   7383      1.1  mrg   \let\nonarrowing = t%
   7384      1.1  mrg   \nonfillstart
   7385      1.1  mrg   \gobble
   7386      1.1  mrg }
   7387      1.1  mrg 
   7388      1.1  mrg % @flushleft: same as @format, but doesn't obey \SETdispenvsize.
   7389      1.1  mrg \envdef\flushleft{%
   7390      1.1  mrg   \let\nonarrowing = t%
   7391      1.1  mrg   \nonfillstart
   7392      1.1  mrg   \gobble
   7393      1.1  mrg }
   7394      1.1  mrg \let\Eflushleft = \afterenvbreak
   7395      1.1  mrg 
   7396      1.1  mrg % @flushright.
   7397      1.1  mrg %
   7398      1.1  mrg \envdef\flushright{%
   7399      1.1  mrg   \let\nonarrowing = t%
   7400      1.1  mrg   \nonfillstart
   7401      1.1  mrg   \advance\leftskip by 0pt plus 1fill\relax
   7402      1.1  mrg   \gobble
   7403      1.1  mrg }
   7404      1.1  mrg \let\Eflushright = \afterenvbreak
   7405  1.1.1.3  mrg 
   7406  1.1.1.3  mrg 
   7407  1.1.1.3  mrg % @raggedright does more-or-less normal line breaking but no right
   7408      1.1  mrg % justification.  From plain.tex.  Don't stretch around special
   7409  1.1.1.3  mrg % characters in urls in this environment, since the stretch at the right
   7410  1.1.1.3  mrg % should be enough.
   7411  1.1.1.3  mrg \envdef\raggedright{%
   7412      1.1  mrg   \rightskip0pt plus2.4em \spaceskip.3333em \xspaceskip.5em\relax
   7413      1.1  mrg   \def\urefprestretchamount{0pt}%
   7414      1.1  mrg   \def\urefpoststretchamount{0pt}%
   7415      1.1  mrg }
   7416      1.1  mrg \let\Eraggedright\par
   7417      1.1  mrg 
   7418      1.1  mrg \envdef\raggedleft{%
   7419      1.1  mrg   \parindent=0pt \leftskip0pt plus2em
   7420      1.1  mrg   \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
   7421      1.1  mrg   \hbadness=10000 % Last line will usually be underfull, so turn off
   7422      1.1  mrg                   % badness reporting.
   7423      1.1  mrg }
   7424      1.1  mrg \let\Eraggedleft\par
   7425      1.1  mrg 
   7426      1.1  mrg \envdef\raggedcenter{%
   7427      1.1  mrg   \parindent=0pt \rightskip0pt plus1em \leftskip0pt plus1em
   7428      1.1  mrg   \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
   7429      1.1  mrg   \hbadness=10000 % Last line will usually be underfull, so turn off
   7430      1.1  mrg                   % badness reporting.
   7431      1.1  mrg }
   7432      1.1  mrg \let\Eraggedcenter\par
   7433      1.1  mrg 
   7434      1.1  mrg 
   7435      1.1  mrg % @quotation does normal linebreaking (hence we can't use \nonfillstart)
   7436      1.1  mrg % and narrows the margins.  We keep \parskip nonzero in general, since
   7437      1.1  mrg % we're doing normal filling.  So, when using \aboveenvbreak and
   7438      1.1  mrg % \afterenvbreak, temporarily make \parskip 0.
   7439      1.1  mrg %
   7440  1.1.1.2  mrg \makedispenvdef{quotation}{\quotationstart}
   7441      1.1  mrg %
   7442      1.1  mrg \def\quotationstart{%
   7443      1.1  mrg   \indentedblockstart % same as \indentedblock, but increase right margin too.
   7444      1.1  mrg   \ifx\nonarrowing\relax
   7445      1.1  mrg     \advance\rightskip by \lispnarrowing
   7446      1.1  mrg   \fi
   7447      1.1  mrg   \parsearg\quotationlabel
   7448      1.1  mrg }
   7449      1.1  mrg 
   7450      1.1  mrg % We have retained a nonzero parskip for the environment, since we're
   7451      1.1  mrg % doing normal filling.
   7452      1.1  mrg %
   7453      1.1  mrg \def\Equotation{%
   7454      1.1  mrg   \par
   7455      1.1  mrg   \ifx\quotationauthor\thisisundefined\else
   7456      1.1  mrg     % indent a bit.
   7457      1.1  mrg     \leftline{\kern 2\leftskip \sl ---\quotationauthor}%
   7458      1.1  mrg   \fi
   7459      1.1  mrg   {\parskip=0pt \afterenvbreak}%
   7460      1.1  mrg }
   7461      1.1  mrg \def\Esmallquotation{\Equotation}
   7462      1.1  mrg 
   7463      1.1  mrg % If we're given an argument, typeset it in bold with a colon after.
   7464      1.1  mrg \def\quotationlabel#1{%
   7465      1.1  mrg   \def\temp{#1}%
   7466      1.1  mrg   \ifx\temp\empty \else
   7467      1.1  mrg     {\bf #1: }%
   7468  1.1.1.2  mrg   \fi
   7469  1.1.1.2  mrg }
   7470  1.1.1.2  mrg 
   7471  1.1.1.2  mrg % @indentedblock is like @quotation, but indents only on the left and
   7472  1.1.1.2  mrg % has no optional argument.
   7473  1.1.1.2  mrg % 
   7474  1.1.1.2  mrg \makedispenvdef{indentedblock}{\indentedblockstart}
   7475  1.1.1.2  mrg %
   7476  1.1.1.2  mrg \def\indentedblockstart{%
   7477  1.1.1.2  mrg   {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
   7478  1.1.1.2  mrg   \parindent=0pt
   7479  1.1.1.2  mrg   %
   7480  1.1.1.2  mrg   % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
   7481  1.1.1.2  mrg   \ifx\nonarrowing\relax
   7482  1.1.1.2  mrg     \advance\leftskip by \lispnarrowing
   7483  1.1.1.2  mrg     \exdentamount = \lispnarrowing
   7484  1.1.1.2  mrg   \else
   7485  1.1.1.2  mrg     \let\nonarrowing = \relax
   7486  1.1.1.2  mrg   \fi
   7487  1.1.1.2  mrg }
   7488  1.1.1.2  mrg 
   7489  1.1.1.2  mrg % Keep a nonzero parskip for the environment, since we're doing normal filling.
   7490  1.1.1.2  mrg %
   7491  1.1.1.2  mrg \def\Eindentedblock{%
   7492  1.1.1.2  mrg   \par
   7493  1.1.1.2  mrg   {\parskip=0pt \afterenvbreak}%
   7494      1.1  mrg }
   7495      1.1  mrg \def\Esmallindentedblock{\Eindentedblock}
   7496      1.1  mrg 
   7497      1.1  mrg 
   7498      1.1  mrg % LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
   7499      1.1  mrg % If we want to allow any <char> as delimiter,
   7500      1.1  mrg % we need the curly braces so that makeinfo sees the @verb command, eg:
   7501      1.1  mrg % `@verbx...x' would look like the '@verbx' command.  --janneke (a] gnu.org
   7502      1.1  mrg %
   7503      1.1  mrg % [Knuth]: Donald Ervin Knuth, 1996.  The TeXbook.
   7504      1.1  mrg %
   7505      1.1  mrg % [Knuth] p.344; only we need to do the other characters Texinfo sets
   7506      1.1  mrg % active too.  Otherwise, they get lost as the first character on a
   7507      1.1  mrg % verbatim line.
   7508      1.1  mrg \def\dospecials{%
   7509      1.1  mrg   \do\ \do\\\do\{\do\}\do\$\do\&%
   7510      1.1  mrg   \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~%
   7511      1.1  mrg   \do\<\do\>\do\|\do\@\do+\do\"%
   7512      1.1  mrg   % Don't do the quotes -- if we do, @set txicodequoteundirected and
   7513      1.1  mrg   % @set txicodequotebacktick will not have effect on @verb and
   7514      1.1  mrg   % @verbatim, and ?` and !` ligatures won't get disabled.
   7515      1.1  mrg   %\do\`\do\'%
   7516      1.1  mrg }
   7517      1.1  mrg %
   7518      1.1  mrg % [Knuth] p. 380
   7519      1.1  mrg \def\uncatcodespecials{%
   7520      1.1  mrg   \def\do##1{\catcode`##1=\other}\dospecials}
   7521      1.1  mrg %
   7522      1.1  mrg % Setup for the @verb command.
   7523      1.1  mrg %
   7524      1.1  mrg % Eight spaces for a tab
   7525      1.1  mrg \begingroup
   7526      1.1  mrg   \catcode`\^^I=\active
   7527      1.1  mrg   \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
   7528      1.1  mrg \endgroup
   7529      1.1  mrg %
   7530      1.1  mrg \def\setupverb{%
   7531      1.1  mrg   \tt  % easiest (and conventionally used) font for verbatim
   7532      1.1  mrg   \def\par{\leavevmode\endgraf}%
   7533      1.1  mrg   \setupmarkupstyle{verb}%
   7534      1.1  mrg   \tabeightspaces
   7535      1.1  mrg   % Respect line breaks,
   7536      1.1  mrg   % print special symbols as themselves, and
   7537      1.1  mrg   % make each space count
   7538      1.1  mrg   % must do in this order:
   7539      1.1  mrg   \obeylines \uncatcodespecials \sepspaces
   7540      1.1  mrg }
   7541      1.1  mrg 
   7542      1.1  mrg % Setup for the @verbatim environment
   7543      1.1  mrg %
   7544      1.1  mrg % Real tab expansion.
   7545      1.1  mrg \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
   7546      1.1  mrg %
   7547      1.1  mrg % We typeset each line of the verbatim in an \hbox, so we can handle
   7548      1.1  mrg % tabs.  The \global is in case the verbatim line starts with an accent,
   7549      1.1  mrg % or some other command that starts with a begin-group.  Otherwise, the
   7550      1.1  mrg % entire \verbbox would disappear at the corresponding end-group, before
   7551      1.1  mrg % it is typeset.  Meanwhile, we can't have nested verbatim commands
   7552      1.1  mrg % (can we?), so the \global won't be overwriting itself.
   7553      1.1  mrg \newbox\verbbox
   7554      1.1  mrg \def\starttabbox{\global\setbox\verbbox=\hbox\bgroup}
   7555      1.1  mrg %
   7556      1.1  mrg \begingroup
   7557      1.1  mrg   \catcode`\^^I=\active
   7558      1.1  mrg   \gdef\tabexpand{%
   7559      1.1  mrg     \catcode`\^^I=\active
   7560      1.1  mrg     \def^^I{\leavevmode\egroup
   7561      1.1  mrg       \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab
   7562      1.1  mrg       \divide\dimen\verbbox by\tabw
   7563      1.1  mrg       \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw
   7564      1.1  mrg       \advance\dimen\verbbox by\tabw  % advance to next multiple of \tabw
   7565      1.1  mrg       \wd\verbbox=\dimen\verbbox \box\verbbox \starttabbox
   7566      1.1  mrg     }%
   7567      1.1  mrg   }
   7568      1.1  mrg \endgroup
   7569      1.1  mrg 
   7570      1.1  mrg % start the verbatim environment.
   7571      1.1  mrg \def\setupverbatim{%
   7572      1.1  mrg   \let\nonarrowing = t%
   7573      1.1  mrg   \nonfillstart
   7574      1.1  mrg   \tt % easiest (and conventionally used) font for verbatim
   7575      1.1  mrg   % The \leavevmode here is for blank lines.  Otherwise, we would
   7576      1.1  mrg   % never \starttabox and the \egroup would end verbatim mode.
   7577      1.1  mrg   \def\par{\leavevmode\egroup\box\verbbox\endgraf}%
   7578      1.1  mrg   \tabexpand
   7579      1.1  mrg   \setupmarkupstyle{verbatim}%
   7580      1.1  mrg   % Respect line breaks,
   7581      1.1  mrg   % print special symbols as themselves, and
   7582      1.1  mrg   % make each space count.
   7583      1.1  mrg   % Must do in this order:
   7584      1.1  mrg   \obeylines \uncatcodespecials \sepspaces
   7585      1.1  mrg   \everypar{\starttabbox}%
   7586      1.1  mrg }
   7587      1.1  mrg 
   7588      1.1  mrg % Do the @verb magic: verbatim text is quoted by unique
   7589      1.1  mrg % delimiter characters.  Before first delimiter expect a
   7590      1.1  mrg % right brace, after last delimiter expect closing brace:
   7591      1.1  mrg %
   7592      1.1  mrg %    \def\doverb'{'<char>#1<char>'}'{#1}
   7593      1.1  mrg %
   7594      1.1  mrg % [Knuth] p. 382; only eat outer {}
   7595      1.1  mrg \begingroup
   7596      1.1  mrg   \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other
   7597      1.1  mrg   \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
   7598      1.1  mrg \endgroup
   7599      1.1  mrg %
   7600      1.1  mrg \def\verb{\begingroup\setupverb\doverb}
   7601      1.1  mrg %
   7602      1.1  mrg %
   7603      1.1  mrg % Do the @verbatim magic: define the macro \doverbatim so that
   7604      1.1  mrg % the (first) argument ends when '@end verbatim' is reached, ie:
   7605      1.1  mrg %
   7606      1.1  mrg %     \def\doverbatim#1@end verbatim{#1}
   7607      1.1  mrg %
   7608      1.1  mrg % For Texinfo it's a lot easier than for LaTeX,
   7609      1.1  mrg % because texinfo's \verbatim doesn't stop at '\end{verbatim}':
   7610      1.1  mrg % we need not redefine '\', '{' and '}'.
   7611      1.1  mrg %
   7612      1.1  mrg % Inspired by LaTeX's verbatim command set [latex.ltx]
   7613      1.1  mrg %
   7614      1.1  mrg \begingroup
   7615      1.1  mrg   \catcode`\ =\active
   7616      1.1  mrg   \obeylines %
   7617      1.1  mrg   % ignore everything up to the first ^^M, that's the newline at the end
   7618      1.1  mrg   % of the @verbatim input line itself.  Otherwise we get an extra blank
   7619      1.1  mrg   % line in the output.
   7620      1.1  mrg   \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}%
   7621      1.1  mrg   % We really want {...\end verbatim} in the body of the macro, but
   7622      1.1  mrg   % without the active space; thus we have to use \xdef and \gobble.
   7623      1.1  mrg \endgroup
   7624      1.1  mrg %
   7625      1.1  mrg \envdef\verbatim{%
   7626      1.1  mrg     \setupverbatim\doverbatim
   7627      1.1  mrg }
   7628      1.1  mrg \let\Everbatim = \afterenvbreak
   7629      1.1  mrg 
   7630      1.1  mrg 
   7631      1.1  mrg % @verbatiminclude FILE - insert text of file in verbatim environment.
   7632      1.1  mrg %
   7633      1.1  mrg \def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude}
   7634      1.1  mrg %
   7635      1.1  mrg \def\doverbatiminclude#1{%
   7636      1.1  mrg   {%
   7637      1.1  mrg     \makevalueexpandable
   7638      1.1  mrg     \setupverbatim
   7639      1.1  mrg     \indexnofonts       % Allow `@@' and other weird things in file names.
   7640      1.1  mrg     \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}%
   7641      1.1  mrg     \input #1
   7642      1.1  mrg     \afterenvbreak
   7643      1.1  mrg   }%
   7644      1.1  mrg }
   7645      1.1  mrg 
   7646      1.1  mrg % @copying ... @end copying.
   7647      1.1  mrg % Save the text away for @insertcopying later.
   7648      1.1  mrg %
   7649      1.1  mrg % We save the uninterpreted tokens, rather than creating a box.
   7650      1.1  mrg % Saving the text in a box would be much easier, but then all the
   7651  1.1.1.3  mrg % typesetting commands (@smallbook, font changes, etc.) have to be done
   7652      1.1  mrg % beforehand -- and a) we want @copying to be done first in the source
   7653      1.1  mrg % file; b) letting users define the frontmatter in as flexible order as
   7654      1.1  mrg % possible is desirable.
   7655      1.1  mrg %
   7656      1.1  mrg \def\copying{\checkenv{}\begingroup\scanargctxt\docopying}
   7657      1.1  mrg \def\docopying#1@end copying{\endgroup\def\copyingtext{#1}}
   7658      1.1  mrg %
   7659      1.1  mrg \def\insertcopying{%
   7660      1.1  mrg   \begingroup
   7661      1.1  mrg     \parindent = 0pt  % paragraph indentation looks wrong on title page
   7662      1.1  mrg     \scanexp\copyingtext
   7663      1.1  mrg   \endgroup
   7664      1.1  mrg }
   7665      1.1  mrg 
   7666      1.1  mrg 
   7667      1.1  mrg \message{defuns,}
   7668      1.1  mrg % @defun etc.
   7669      1.1  mrg 
   7670      1.1  mrg \newskip\defbodyindent \defbodyindent=.4in
   7671      1.1  mrg \newskip\defargsindent \defargsindent=50pt
   7672      1.1  mrg \newskip\deflastargmargin \deflastargmargin=18pt
   7673      1.1  mrg \newcount\defunpenalty
   7674      1.1  mrg 
   7675      1.1  mrg % Start the processing of @deffn:
   7676      1.1  mrg \def\startdefun{%
   7677      1.1  mrg   \ifnum\lastpenalty<10000
   7678      1.1  mrg     \medbreak
   7679      1.1  mrg     \defunpenalty=10003 % Will keep this @deffn together with the
   7680      1.1  mrg                         % following @def command, see below.
   7681      1.1  mrg   \else
   7682      1.1  mrg     % If there are two @def commands in a row, we'll have a \nobreak,
   7683      1.1  mrg     % which is there to keep the function description together with its
   7684      1.1  mrg     % header.  But if there's nothing but headers, we need to allow a
   7685      1.1  mrg     % break somewhere.  Check specifically for penalty 10002, inserted
   7686      1.1  mrg     % by \printdefunline, instead of 10000, since the sectioning
   7687      1.1  mrg     % commands also insert a nobreak penalty, and we don't want to allow
   7688      1.1  mrg     % a break between a section heading and a defun.
   7689      1.1  mrg     %
   7690      1.1  mrg     % As a further refinement, we avoid "club" headers by signalling
   7691      1.1  mrg     % with penalty of 10003 after the very first @deffn in the
   7692      1.1  mrg     % sequence (see above), and penalty of 10002 after any following
   7693      1.1  mrg     % @def command.
   7694      1.1  mrg     \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi
   7695      1.1  mrg     %
   7696      1.1  mrg     % Similarly, after a section heading, do not allow a break.
   7697      1.1  mrg     % But do insert the glue.
   7698      1.1  mrg     \medskip  % preceded by discardable penalty, so not a breakpoint
   7699      1.1  mrg   \fi
   7700      1.1  mrg   %
   7701      1.1  mrg   \parindent=0in
   7702      1.1  mrg   \advance\leftskip by \defbodyindent
   7703      1.1  mrg   \exdentamount=\defbodyindent
   7704      1.1  mrg }
   7705      1.1  mrg 
   7706      1.1  mrg \def\dodefunx#1{%
   7707      1.1  mrg   % First, check whether we are in the right environment:
   7708      1.1  mrg   \checkenv#1%
   7709      1.1  mrg   %
   7710      1.1  mrg   % As above, allow line break if we have multiple x headers in a row.
   7711      1.1  mrg   % It's not a great place, though.
   7712      1.1  mrg   \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi
   7713      1.1  mrg   %
   7714      1.1  mrg   % And now, it's time to reuse the body of the original defun:
   7715      1.1  mrg   \expandafter\gobbledefun#1%
   7716      1.1  mrg }
   7717      1.1  mrg \def\gobbledefun#1\startdefun{}
   7718      1.1  mrg 
   7719      1.1  mrg % \printdefunline \deffnheader{text}
   7720      1.1  mrg %
   7721      1.1  mrg \def\printdefunline#1#2{%
   7722      1.1  mrg   \begingroup
   7723      1.1  mrg     % call \deffnheader:
   7724      1.1  mrg     #1#2 \endheader
   7725      1.1  mrg     % common ending:
   7726      1.1  mrg     \interlinepenalty = 10000
   7727      1.1  mrg     \advance\rightskip by 0pt plus 1fil\relax
   7728      1.1  mrg     \endgraf
   7729      1.1  mrg     \nobreak\vskip -\parskip
   7730      1.1  mrg     \penalty\defunpenalty  % signal to \startdefun and \dodefunx
   7731      1.1  mrg     % Some of the @defun-type tags do not enable magic parentheses,
   7732      1.1  mrg     % rendering the following check redundant.  But we don't optimize.
   7733      1.1  mrg     \checkparencounts
   7734      1.1  mrg   \endgroup
   7735      1.1  mrg }
   7736      1.1  mrg 
   7737      1.1  mrg \def\Edefun{\endgraf\medbreak}
   7738      1.1  mrg 
   7739      1.1  mrg % \makedefun{deffn} creates \deffn, \deffnx and \Edeffn;
   7740      1.1  mrg % the only thing remaining is to define \deffnheader.
   7741      1.1  mrg %
   7742      1.1  mrg \def\makedefun#1{%
   7743      1.1  mrg   \expandafter\let\csname E#1\endcsname = \Edefun
   7744      1.1  mrg   \edef\temp{\noexpand\domakedefun
   7745      1.1  mrg     \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}%
   7746  1.1.1.3  mrg   \temp
   7747      1.1  mrg }
   7748      1.1  mrg 
   7749      1.1  mrg % \domakedefun \deffn \deffnx \deffnheader { (defn. of \deffnheader) }
   7750      1.1  mrg %
   7751      1.1  mrg % Define \deffn and \deffnx, without parameters.
   7752      1.1  mrg % \deffnheader has to be defined explicitly.
   7753      1.1  mrg %
   7754      1.1  mrg \def\domakedefun#1#2#3{%
   7755      1.1  mrg   \envdef#1{%
   7756      1.1  mrg     \startdefun
   7757      1.1  mrg     \doingtypefnfalse    % distinguish typed functions from all else
   7758      1.1  mrg     \parseargusing\activeparens{\printdefunline#3}%
   7759      1.1  mrg   }%
   7760      1.1  mrg   \def#2{\dodefunx#1}%
   7761      1.1  mrg   \def#3%
   7762      1.1  mrg }
   7763      1.1  mrg 
   7764      1.1  mrg \newif\ifdoingtypefn       % doing typed function?
   7765      1.1  mrg \newif\ifrettypeownline    % typeset return type on its own line?
   7766      1.1  mrg 
   7767      1.1  mrg % @deftypefnnewline on|off says whether the return type of typed functions
   7768      1.1  mrg % are printed on their own line.  This affects @deftypefn, @deftypefun,
   7769      1.1  mrg % @deftypeop, and @deftypemethod.
   7770      1.1  mrg % 
   7771      1.1  mrg \parseargdef\deftypefnnewline{%
   7772      1.1  mrg   \def\temp{#1}%
   7773      1.1  mrg   \ifx\temp\onword
   7774      1.1  mrg     \expandafter\let\csname SETtxideftypefnnl\endcsname
   7775      1.1  mrg       = \empty
   7776      1.1  mrg   \else\ifx\temp\offword
   7777      1.1  mrg     \expandafter\let\csname SETtxideftypefnnl\endcsname
   7778      1.1  mrg       = \relax
   7779      1.1  mrg   \else
   7780      1.1  mrg     \errhelp = \EMsimple
   7781      1.1  mrg     \errmessage{Unknown @txideftypefnnl value `\temp',
   7782      1.1  mrg                 must be on|off}%
   7783      1.1  mrg   \fi\fi
   7784      1.1  mrg }
   7785      1.1  mrg 
   7786      1.1  mrg % Untyped functions:
   7787      1.1  mrg 
   7788      1.1  mrg % @deffn category name args
   7789      1.1  mrg \makedefun{deffn}{\deffngeneral{}}
   7790      1.1  mrg 
   7791      1.1  mrg % @deffn category class name args
   7792      1.1  mrg \makedefun{defop}#1 {\defopon{#1\ \putwordon}}
   7793      1.1  mrg 
   7794      1.1  mrg % \defopon {category on}class name args
   7795      1.1  mrg \def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
   7796      1.1  mrg 
   7797      1.1  mrg % \deffngeneral {subind}category name args
   7798      1.1  mrg %
   7799      1.1  mrg \def\deffngeneral#1#2 #3 #4\endheader{%
   7800      1.1  mrg   % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}.
   7801      1.1  mrg   \dosubind{fn}{\code{#3}}{#1}%
   7802      1.1  mrg   \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}%
   7803      1.1  mrg }
   7804      1.1  mrg 
   7805      1.1  mrg % Typed functions:
   7806      1.1  mrg 
   7807      1.1  mrg % @deftypefn category type name args
   7808      1.1  mrg \makedefun{deftypefn}{\deftypefngeneral{}}
   7809      1.1  mrg 
   7810      1.1  mrg % @deftypeop category class type name args
   7811      1.1  mrg \makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}}
   7812      1.1  mrg 
   7813      1.1  mrg % \deftypeopon {category on}class type name args
   7814      1.1  mrg \def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
   7815      1.1  mrg 
   7816      1.1  mrg % \deftypefngeneral {subind}category type name args
   7817      1.1  mrg %
   7818      1.1  mrg \def\deftypefngeneral#1#2 #3 #4 #5\endheader{%
   7819      1.1  mrg   \dosubind{fn}{\code{#4}}{#1}%
   7820      1.1  mrg   \doingtypefntrue
   7821      1.1  mrg   \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
   7822      1.1  mrg }
   7823      1.1  mrg 
   7824      1.1  mrg % Typed variables:
   7825      1.1  mrg 
   7826      1.1  mrg % @deftypevr category type var args
   7827      1.1  mrg \makedefun{deftypevr}{\deftypecvgeneral{}}
   7828      1.1  mrg 
   7829      1.1  mrg % @deftypecv category class type var args
   7830      1.1  mrg \makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}}
   7831      1.1  mrg 
   7832      1.1  mrg % \deftypecvof {category of}class type var args
   7833      1.1  mrg \def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} }
   7834      1.1  mrg 
   7835      1.1  mrg % \deftypecvgeneral {subind}category type var args
   7836      1.1  mrg %
   7837      1.1  mrg \def\deftypecvgeneral#1#2 #3 #4 #5\endheader{%
   7838      1.1  mrg   \dosubind{vr}{\code{#4}}{#1}%
   7839      1.1  mrg   \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
   7840      1.1  mrg }
   7841      1.1  mrg 
   7842      1.1  mrg % Untyped variables:
   7843      1.1  mrg 
   7844      1.1  mrg % @defvr category var args
   7845      1.1  mrg \makedefun{defvr}#1 {\deftypevrheader{#1} {} }
   7846      1.1  mrg 
   7847      1.1  mrg % @defcv category class var args
   7848      1.1  mrg \makedefun{defcv}#1 {\defcvof{#1\ \putwordof}}
   7849      1.1  mrg 
   7850      1.1  mrg % \defcvof {category of}class var args
   7851      1.1  mrg \def\defcvof#1#2 {\deftypecvof{#1}#2 {} }
   7852      1.1  mrg 
   7853      1.1  mrg % Types:
   7854      1.1  mrg 
   7855      1.1  mrg % @deftp category name args
   7856      1.1  mrg \makedefun{deftp}#1 #2 #3\endheader{%
   7857      1.1  mrg   \doind{tp}{\code{#2}}%
   7858      1.1  mrg   \defname{#1}{}{#2}\defunargs{#3\unskip}%
   7859      1.1  mrg }
   7860      1.1  mrg 
   7861      1.1  mrg % Remaining @defun-like shortcuts:
   7862      1.1  mrg \makedefun{defun}{\deffnheader{\putwordDeffunc} }
   7863      1.1  mrg \makedefun{defmac}{\deffnheader{\putwordDefmac} }
   7864      1.1  mrg \makedefun{defspec}{\deffnheader{\putwordDefspec} }
   7865      1.1  mrg \makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} }
   7866      1.1  mrg \makedefun{defvar}{\defvrheader{\putwordDefvar} }
   7867      1.1  mrg \makedefun{defopt}{\defvrheader{\putwordDefopt} }
   7868      1.1  mrg \makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} }
   7869      1.1  mrg \makedefun{defmethod}{\defopon\putwordMethodon}
   7870      1.1  mrg \makedefun{deftypemethod}{\deftypeopon\putwordMethodon}
   7871      1.1  mrg \makedefun{defivar}{\defcvof\putwordInstanceVariableof}
   7872      1.1  mrg \makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof}
   7873      1.1  mrg 
   7874      1.1  mrg % \defname, which formats the name of the @def (not the args).
   7875      1.1  mrg % #1 is the category, such as "Function".
   7876      1.1  mrg % #2 is the return type, if any.
   7877      1.1  mrg % #3 is the function name.
   7878      1.1  mrg %
   7879      1.1  mrg % We are followed by (but not passed) the arguments, if any.
   7880      1.1  mrg %
   7881      1.1  mrg \def\defname#1#2#3{%
   7882      1.1  mrg   \par
   7883      1.1  mrg   % Get the values of \leftskip and \rightskip as they were outside the @def...
   7884      1.1  mrg   \advance\leftskip by -\defbodyindent
   7885      1.1  mrg   %
   7886      1.1  mrg   % Determine if we are typesetting the return type of a typed function
   7887      1.1  mrg   % on a line by itself.
   7888      1.1  mrg   \rettypeownlinefalse
   7889      1.1  mrg   \ifdoingtypefn  % doing a typed function specifically?
   7890      1.1  mrg     % then check user option for putting return type on its own line:
   7891      1.1  mrg     \expandafter\ifx\csname SETtxideftypefnnl\endcsname\relax \else
   7892      1.1  mrg       \rettypeownlinetrue
   7893      1.1  mrg     \fi
   7894      1.1  mrg   \fi
   7895      1.1  mrg   %
   7896      1.1  mrg   % How we'll format the category name.  Putting it in brackets helps
   7897      1.1  mrg   % distinguish it from the body text that may end up on the next line
   7898      1.1  mrg   % just below it.
   7899      1.1  mrg   \def\temp{#1}%
   7900      1.1  mrg   \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi}
   7901      1.1  mrg   %
   7902      1.1  mrg   % Figure out line sizes for the paragraph shape.  We'll always have at
   7903      1.1  mrg   % least two.
   7904      1.1  mrg   \tempnum = 2
   7905      1.1  mrg   %
   7906      1.1  mrg   % The first line needs space for \box0; but if \rightskip is nonzero,
   7907      1.1  mrg   % we need only space for the part of \box0 which exceeds it:
   7908      1.1  mrg   \dimen0=\hsize  \advance\dimen0 by -\wd0  \advance\dimen0 by \rightskip
   7909      1.1  mrg   %
   7910      1.1  mrg   % If doing a return type on its own line, we'll have another line.
   7911      1.1  mrg   \ifrettypeownline
   7912      1.1  mrg     \advance\tempnum by 1
   7913      1.1  mrg     \def\maybeshapeline{0in \hsize}%
   7914      1.1  mrg   \else
   7915      1.1  mrg     \def\maybeshapeline{}%
   7916      1.1  mrg   \fi
   7917      1.1  mrg   %
   7918      1.1  mrg   % The continuations:
   7919      1.1  mrg   \dimen2=\hsize  \advance\dimen2 by -\defargsindent
   7920      1.1  mrg   %
   7921      1.1  mrg   % The final paragraph shape:
   7922      1.1  mrg   \parshape \tempnum  0in \dimen0  \maybeshapeline  \defargsindent \dimen2
   7923      1.1  mrg   %
   7924      1.1  mrg   % Put the category name at the right margin.
   7925      1.1  mrg   \noindent
   7926      1.1  mrg   \hbox to 0pt{%
   7927      1.1  mrg     \hfil\box0 \kern-\hsize
   7928      1.1  mrg     % \hsize has to be shortened this way:
   7929      1.1  mrg     \kern\leftskip
   7930      1.1  mrg     % Intentionally do not respect \rightskip, since we need the space.
   7931      1.1  mrg   }%
   7932      1.1  mrg   %
   7933      1.1  mrg   % Allow all lines to be underfull without complaint:
   7934      1.1  mrg   \tolerance=10000 \hbadness=10000
   7935      1.1  mrg   \exdentamount=\defbodyindent
   7936      1.1  mrg   {%
   7937      1.1  mrg     % defun fonts. We use typewriter by default (used to be bold) because:
   7938      1.1  mrg     % . we're printing identifiers, they should be in tt in principle.
   7939      1.1  mrg     % . in languages with many accents, such as Czech or French, it's
   7940      1.1  mrg     %   common to leave accents off identifiers.  The result looks ok in
   7941      1.1  mrg     %   tt, but exceedingly strange in rm.
   7942      1.1  mrg     % . we don't want -- and --- to be treated as ligatures.
   7943      1.1  mrg     % . this still does not fix the ?` and !` ligatures, but so far no
   7944      1.1  mrg     %   one has made identifiers using them :).
   7945      1.1  mrg     \df \tt
   7946      1.1  mrg     \def\temp{#2}% text of the return type
   7947      1.1  mrg     \ifx\temp\empty\else
   7948      1.1  mrg       \tclose{\temp}% typeset the return type
   7949      1.1  mrg       \ifrettypeownline
   7950      1.1  mrg         % put return type on its own line; prohibit line break following:
   7951      1.1  mrg         \hfil\vadjust{\nobreak}\break  
   7952      1.1  mrg       \else
   7953      1.1  mrg         \space  % type on same line, so just followed by a space
   7954      1.1  mrg       \fi
   7955  1.1.1.3  mrg     \fi           % no return type
   7956      1.1  mrg     #3% output function name
   7957      1.1  mrg   }%
   7958      1.1  mrg   {\rm\enskip}% hskip 0.5 em of \rmfont
   7959      1.1  mrg   %
   7960      1.1  mrg   \boldbrax
   7961      1.1  mrg   % arguments will be output next, if any.
   7962      1.1  mrg }
   7963      1.1  mrg 
   7964      1.1  mrg % Print arguments in slanted roman (not ttsl), inconsistently with using
   7965      1.1  mrg % tt for the name.  This is because literal text is sometimes needed in
   7966      1.1  mrg % the argument list (groff manual), and ttsl and tt are not very
   7967      1.1  mrg % distinguishable.  Prevent hyphenation at `-' chars.
   7968      1.1  mrg %
   7969      1.1  mrg \def\defunargs#1{%
   7970      1.1  mrg   % use sl by default (not ttsl),
   7971      1.1  mrg   % tt for the names.
   7972  1.1.1.2  mrg   \df \sl \hyphenchar\font=0
   7973  1.1.1.2  mrg   %
   7974  1.1.1.2  mrg   % On the other hand, if an argument has two dashes (for instance), we
   7975  1.1.1.2  mrg   % want a way to get ttsl.  We used to recommend @var for that, so
   7976      1.1  mrg   % leave the code in, but it's strange for @var to lead to typewriter.
   7977      1.1  mrg   % Nowadays we recommend @code, since the difference between a ttsl hyphen
   7978      1.1  mrg   % and a tt hyphen is pretty tiny.  @code also disables ?` !`.
   7979      1.1  mrg   \def\var##1{{\setupmarkupstyle{var}\ttslanted{##1}}}%
   7980      1.1  mrg   #1%
   7981      1.1  mrg   \sl\hyphenchar\font=45
   7982      1.1  mrg }
   7983      1.1  mrg 
   7984      1.1  mrg % We want ()&[] to print specially on the defun line.
   7985      1.1  mrg %
   7986      1.1  mrg \def\activeparens{%
   7987      1.1  mrg   \catcode`\(=\active \catcode`\)=\active
   7988      1.1  mrg   \catcode`\[=\active \catcode`\]=\active
   7989      1.1  mrg   \catcode`\&=\active
   7990      1.1  mrg }
   7991      1.1  mrg 
   7992      1.1  mrg % Make control sequences which act like normal parenthesis chars.
   7993      1.1  mrg \let\lparen = ( \let\rparen = )
   7994      1.1  mrg 
   7995      1.1  mrg % Be sure that we always have a definition for `(', etc.  For example,
   7996      1.1  mrg % if the fn name has parens in it, \boldbrax will not be in effect yet,
   7997      1.1  mrg % so TeX would otherwise complain about undefined control sequence.
   7998      1.1  mrg {
   7999      1.1  mrg   \activeparens
   8000      1.1  mrg   \global\let(=\lparen \global\let)=\rparen
   8001      1.1  mrg   \global\let[=\lbrack \global\let]=\rbrack
   8002      1.1  mrg   \global\let& = \&
   8003      1.1  mrg 
   8004      1.1  mrg   \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
   8005      1.1  mrg   \gdef\magicamp{\let&=\amprm}
   8006      1.1  mrg }
   8007      1.1  mrg 
   8008      1.1  mrg \newcount\parencount
   8009      1.1  mrg 
   8010      1.1  mrg % If we encounter &foo, then turn on ()-hacking afterwards
   8011      1.1  mrg \newif\ifampseen
   8012      1.1  mrg \def\amprm#1 {\ampseentrue{\bf\&#1 }}
   8013      1.1  mrg 
   8014      1.1  mrg \def\parenfont{%
   8015      1.1  mrg   \ifampseen
   8016      1.1  mrg     % At the first level, print parens in roman,
   8017      1.1  mrg     % otherwise use the default font.
   8018      1.1  mrg     \ifnum \parencount=1 \rm \fi
   8019      1.1  mrg   \else
   8020      1.1  mrg     % The \sf parens (in \boldbrax) actually are a little bolder than
   8021      1.1  mrg     % the contained text.  This is especially needed for [ and ] .
   8022      1.1  mrg     \sf
   8023      1.1  mrg   \fi
   8024      1.1  mrg }
   8025      1.1  mrg \def\infirstlevel#1{%
   8026      1.1  mrg   \ifampseen
   8027      1.1  mrg     \ifnum\parencount=1
   8028      1.1  mrg       #1%
   8029      1.1  mrg     \fi
   8030      1.1  mrg   \fi
   8031      1.1  mrg }
   8032      1.1  mrg \def\bfafterword#1 {#1 \bf}
   8033      1.1  mrg 
   8034      1.1  mrg \def\opnr{%
   8035      1.1  mrg   \global\advance\parencount by 1
   8036      1.1  mrg   {\parenfont(}%
   8037      1.1  mrg   \infirstlevel \bfafterword
   8038      1.1  mrg }
   8039      1.1  mrg \def\clnr{%
   8040      1.1  mrg   {\parenfont)}%
   8041      1.1  mrg   \infirstlevel \sl
   8042      1.1  mrg   \global\advance\parencount by -1
   8043      1.1  mrg }
   8044      1.1  mrg 
   8045      1.1  mrg \newcount\brackcount
   8046      1.1  mrg \def\lbrb{%
   8047      1.1  mrg   \global\advance\brackcount by 1
   8048      1.1  mrg   {\bf[}%
   8049      1.1  mrg }
   8050      1.1  mrg \def\rbrb{%
   8051      1.1  mrg   {\bf]}%
   8052      1.1  mrg   \global\advance\brackcount by -1
   8053      1.1  mrg }
   8054      1.1  mrg 
   8055      1.1  mrg \def\checkparencounts{%
   8056      1.1  mrg   \ifnum\parencount=0 \else \badparencount \fi
   8057      1.1  mrg   \ifnum\brackcount=0 \else \badbrackcount \fi
   8058      1.1  mrg }
   8059      1.1  mrg % these should not use \errmessage; the glibc manual, at least, actually
   8060      1.1  mrg % has such constructs (when documenting function pointers).
   8061      1.1  mrg \def\badparencount{%
   8062      1.1  mrg   \message{Warning: unbalanced parentheses in @def...}%
   8063      1.1  mrg   \global\parencount=0
   8064      1.1  mrg }
   8065      1.1  mrg \def\badbrackcount{%
   8066      1.1  mrg   \message{Warning: unbalanced square brackets in @def...}%
   8067      1.1  mrg   \global\brackcount=0
   8068      1.1  mrg }
   8069      1.1  mrg 
   8070      1.1  mrg 
   8071      1.1  mrg \message{macros,}
   8072      1.1  mrg % @macro.
   8073      1.1  mrg 
   8074      1.1  mrg % To do this right we need a feature of e-TeX, \scantokens,
   8075      1.1  mrg % which we arrange to emulate with a temporary file in ordinary TeX.
   8076      1.1  mrg \ifx\eTeXversion\thisisundefined
   8077      1.1  mrg   \newwrite\macscribble
   8078      1.1  mrg   \def\scantokens#1{%
   8079      1.1  mrg     \toks0={#1}%
   8080      1.1  mrg     \immediate\openout\macscribble=\jobname.tmp
   8081      1.1  mrg     \immediate\write\macscribble{\the\toks0}%
   8082      1.1  mrg     \immediate\closeout\macscribble
   8083      1.1  mrg     \input \jobname.tmp
   8084  1.1.1.3  mrg   }
   8085  1.1.1.3  mrg \fi
   8086  1.1.1.3  mrg 
   8087  1.1.1.3  mrg % alias because \c means cedilla in @tex or @math
   8088  1.1.1.3  mrg \let\texinfoc=\c
   8089  1.1.1.3  mrg 
   8090  1.1.1.3  mrg \newcount\savedcatcodeone
   8091  1.1.1.3  mrg \newcount\savedcatcodetwo
   8092  1.1.1.3  mrg 
   8093      1.1  mrg % Used at the time of macro expansion.
   8094  1.1.1.3  mrg % Argument is macro body with arguments substituted
   8095  1.1.1.3  mrg \def\scanmacro#1{%
   8096  1.1.1.3  mrg   \newlinechar`\^^M
   8097  1.1.1.3  mrg   \def\xeatspaces{\eatspaces}%
   8098  1.1.1.3  mrg   %
   8099  1.1.1.3  mrg   % Temporarily undo catcode changes of \printindex.  Set catcode of @ to
   8100  1.1.1.3  mrg   % 0 so that @-commands in macro expansions aren't printed literally when 
   8101  1.1.1.3  mrg   % formatting an index file, where \ is used as the escape character.
   8102  1.1.1.3  mrg   \savedcatcodeone=\catcode`\@
   8103      1.1  mrg   \savedcatcodetwo=\catcode`\\
   8104  1.1.1.3  mrg   \catcode`\@=0
   8105  1.1.1.3  mrg   \catcode`\\=\active
   8106      1.1  mrg   %
   8107  1.1.1.3  mrg   % Process the macro body under the current catcode regime.
   8108  1.1.1.3  mrg   \scantokens{#1@texinfoc}%
   8109      1.1  mrg   %
   8110  1.1.1.3  mrg   \catcode`\@=\savedcatcodeone
   8111  1.1.1.3  mrg   \catcode`\\=\savedcatcodetwo
   8112  1.1.1.3  mrg   %
   8113  1.1.1.3  mrg   % The \texinfoc is to remove the \newlinechar added by \scantokens, and
   8114  1.1.1.3  mrg   % can be noticed by \parsearg.
   8115      1.1  mrg   %   We avoid surrounding the call to \scantokens with \bgroup and \egroup
   8116  1.1.1.3  mrg   % to allow macros to open or close groups themselves.
   8117      1.1  mrg }
   8118  1.1.1.3  mrg 
   8119      1.1  mrg % Used for copying and captions
   8120      1.1  mrg \def\scanexp#1{%
   8121      1.1  mrg   \expandafter\scanmacro\expandafter{#1}%
   8122      1.1  mrg }
   8123      1.1  mrg 
   8124      1.1  mrg \newcount\paramno   % Count of parameters
   8125      1.1  mrg \newtoks\macname    % Macro name
   8126  1.1.1.3  mrg \newif\ifrecursive  % Is it recursive?
   8127      1.1  mrg 
   8128      1.1  mrg % List of all defined macros in the form
   8129      1.1  mrg %    \commondummyword\macro1\commondummyword\macro2...
   8130      1.1  mrg % Currently is also contains all @aliases; the list can be split
   8131      1.1  mrg % if there is a need.
   8132      1.1  mrg \def\macrolist{}
   8133      1.1  mrg 
   8134  1.1.1.3  mrg % Add the macro to \macrolist
   8135      1.1  mrg \def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname}
   8136      1.1  mrg \def\addtomacrolistxxx#1{%
   8137      1.1  mrg      \toks0 = \expandafter{\macrolist\commondummyword#1}%
   8138      1.1  mrg      \xdef\macrolist{\the\toks0}%
   8139      1.1  mrg }
   8140      1.1  mrg 
   8141      1.1  mrg % Utility routines.
   8142      1.1  mrg % This does \let #1 = #2, with \csnames; that is,
   8143      1.1  mrg %   \let \csname#1\endcsname = \csname#2\endcsname
   8144      1.1  mrg % (except of course we have to play expansion games).
   8145      1.1  mrg %
   8146      1.1  mrg \def\cslet#1#2{%
   8147      1.1  mrg   \expandafter\let
   8148      1.1  mrg   \csname#1\expandafter\endcsname
   8149      1.1  mrg   \csname#2\endcsname
   8150      1.1  mrg }
   8151      1.1  mrg 
   8152      1.1  mrg % Trim leading and trailing spaces off a string.
   8153      1.1  mrg % Concepts from aro-bend problem 15 (see CTAN).
   8154      1.1  mrg {\catcode`\@=11
   8155      1.1  mrg \gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
   8156      1.1  mrg \gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
   8157      1.1  mrg \gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
   8158      1.1  mrg \def\unbrace#1{#1}
   8159      1.1  mrg \unbrace{\gdef\trim@@@ #1 } #2@{#1}
   8160      1.1  mrg }
   8161      1.1  mrg 
   8162      1.1  mrg % Trim a single trailing ^^M off a string.
   8163      1.1  mrg {\catcode`\^^M=\other \catcode`\Q=3%
   8164      1.1  mrg \gdef\eatcr #1{\eatcra #1Q^^MQ}%
   8165      1.1  mrg \gdef\eatcra#1^^MQ{\eatcrb#1Q}%
   8166      1.1  mrg \gdef\eatcrb#1Q#2Q{#1}%
   8167      1.1  mrg }
   8168      1.1  mrg 
   8169      1.1  mrg % Macro bodies are absorbed as an argument in a context where
   8170      1.1  mrg % all characters are catcode 10, 11 or 12, except \ which is active
   8171      1.1  mrg % (as in normal texinfo). It is necessary to change the definition of \
   8172      1.1  mrg % to recognize macro arguments; this is the job of \mbodybackslash.
   8173      1.1  mrg %
   8174      1.1  mrg % Non-ASCII encodings make 8-bit characters active, so un-activate
   8175      1.1  mrg % them to avoid their expansion.  Must do this non-globally, to
   8176      1.1  mrg % confine the change to the current group.
   8177      1.1  mrg %
   8178      1.1  mrg % It's necessary to have hard CRs when the macro is executed. This is
   8179      1.1  mrg % done by making ^^M (\endlinechar) catcode 12 when reading the macro
   8180      1.1  mrg % body, and then making it the \newlinechar in \scanmacro.
   8181      1.1  mrg %
   8182      1.1  mrg \def\scanctxt{% used as subroutine
   8183      1.1  mrg   \catcode`\"=\other
   8184      1.1  mrg   \catcode`\+=\other
   8185      1.1  mrg   \catcode`\<=\other
   8186      1.1  mrg   \catcode`\>=\other
   8187      1.1  mrg   \catcode`\^=\other
   8188  1.1.1.3  mrg   \catcode`\_=\other
   8189      1.1  mrg   \catcode`\|=\other
   8190      1.1  mrg   \catcode`\~=\other
   8191      1.1  mrg   \passthroughcharstrue
   8192      1.1  mrg }
   8193  1.1.1.3  mrg 
   8194      1.1  mrg \def\scanargctxt{% used for copying and captions, not macros.
   8195      1.1  mrg   \scanctxt
   8196      1.1  mrg   \catcode`\@=\other
   8197      1.1  mrg   \catcode`\\=\other
   8198      1.1  mrg   \catcode`\^^M=\other
   8199      1.1  mrg }
   8200  1.1.1.3  mrg 
   8201  1.1.1.3  mrg \def\macrobodyctxt{% used for @macro definitions
   8202      1.1  mrg   \scanctxt
   8203      1.1  mrg   \catcode`\ =\other
   8204      1.1  mrg   \catcode`\@=\other
   8205      1.1  mrg   \catcode`\{=\other
   8206      1.1  mrg   \catcode`\}=\other
   8207      1.1  mrg   \catcode`\^^M=\other
   8208  1.1.1.3  mrg   \usembodybackslash
   8209  1.1.1.3  mrg }
   8210  1.1.1.3  mrg 
   8211  1.1.1.3  mrg % Used when scanning braced macro arguments.  Note, however, that catcode
   8212      1.1  mrg % changes here are ineffectual if the macro invocation was nested inside
   8213  1.1.1.3  mrg % an argument to another Texinfo command.
   8214  1.1.1.3  mrg \def\macroargctxt{%
   8215  1.1.1.3  mrg   \scanctxt
   8216      1.1  mrg   \catcode`\ =\active
   8217      1.1  mrg   \catcode`\^^M=\other
   8218  1.1.1.3  mrg   \catcode`\\=\active
   8219  1.1.1.3  mrg }
   8220  1.1.1.3  mrg 
   8221  1.1.1.3  mrg \def\macrolineargctxt{% used for whole-line arguments without braces
   8222  1.1.1.3  mrg   \scanctxt
   8223      1.1  mrg   \catcode`\{=\other
   8224      1.1  mrg   \catcode`\}=\other
   8225      1.1  mrg }
   8226      1.1  mrg 
   8227      1.1  mrg % \mbodybackslash is the definition of \ in @macro bodies.
   8228      1.1  mrg % It maps \foo\ => \csname macarg.foo\endcsname => #N
   8229      1.1  mrg % where N is the macro parameter number.
   8230      1.1  mrg % We define \csname macarg.\endcsname to be \realbackslash, so
   8231      1.1  mrg % \\ in macro replacement text gets you a backslash.
   8232      1.1  mrg %
   8233      1.1  mrg {\catcode`@=0 @catcode`@\=@active
   8234      1.1  mrg  @gdef@usembodybackslash{@let\=@mbodybackslash}
   8235      1.1  mrg  @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
   8236      1.1  mrg }
   8237      1.1  mrg \expandafter\def\csname macarg.\endcsname{\realbackslash}
   8238      1.1  mrg 
   8239      1.1  mrg \def\margbackslash#1{\char`\#1 }
   8240      1.1  mrg 
   8241      1.1  mrg \def\macro{\recursivefalse\parsearg\macroxxx}
   8242      1.1  mrg \def\rmacro{\recursivetrue\parsearg\macroxxx}
   8243      1.1  mrg 
   8244      1.1  mrg \def\macroxxx#1{%
   8245      1.1  mrg   \getargs{#1}% now \macname is the macname and \argl the arglist
   8246      1.1  mrg   \ifx\argl\empty       % no arguments
   8247      1.1  mrg      \paramno=0\relax
   8248      1.1  mrg   \else
   8249      1.1  mrg      \expandafter\parsemargdef \argl;%
   8250      1.1  mrg      \if\paramno>256\relax
   8251      1.1  mrg        \ifx\eTeXversion\thisisundefined
   8252      1.1  mrg          \errhelp = \EMsimple
   8253      1.1  mrg          \errmessage{You need eTeX to compile a file with macros with more than 256 arguments}
   8254      1.1  mrg        \fi
   8255      1.1  mrg      \fi
   8256      1.1  mrg   \fi
   8257      1.1  mrg   \if1\csname ismacro.\the\macname\endcsname
   8258      1.1  mrg      \message{Warning: redefining \the\macname}%
   8259      1.1  mrg   \else
   8260      1.1  mrg      \expandafter\ifx\csname \the\macname\endcsname \relax
   8261      1.1  mrg      \else \errmessage{Macro name \the\macname\space already defined}\fi
   8262      1.1  mrg      \global\cslet{macsave.\the\macname}{\the\macname}%
   8263      1.1  mrg      \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
   8264      1.1  mrg      \addtomacrolist{\the\macname}%
   8265      1.1  mrg   \fi
   8266      1.1  mrg   \begingroup \macrobodyctxt
   8267      1.1  mrg   \ifrecursive \expandafter\parsermacbody
   8268      1.1  mrg   \else \expandafter\parsemacbody
   8269      1.1  mrg   \fi}
   8270      1.1  mrg 
   8271      1.1  mrg \parseargdef\unmacro{%
   8272      1.1  mrg   \if1\csname ismacro.#1\endcsname
   8273      1.1  mrg     \global\cslet{#1}{macsave.#1}%
   8274      1.1  mrg     \global\expandafter\let \csname ismacro.#1\endcsname=0%
   8275  1.1.1.3  mrg     % Remove the macro name from \macrolist:
   8276      1.1  mrg     \begingroup
   8277      1.1  mrg       \expandafter\let\csname#1\endcsname \relax
   8278      1.1  mrg       \let\commondummyword\unmacrodo
   8279      1.1  mrg       \xdef\macrolist{\macrolist}%
   8280      1.1  mrg     \endgroup
   8281      1.1  mrg   \else
   8282      1.1  mrg     \errmessage{Macro #1 not defined}%
   8283      1.1  mrg   \fi
   8284      1.1  mrg }
   8285      1.1  mrg 
   8286      1.1  mrg % Called by \do from \dounmacro on each macro.  The idea is to omit any
   8287      1.1  mrg % macro definitions that have been changed to \relax.
   8288      1.1  mrg %
   8289      1.1  mrg \def\unmacrodo#1{%
   8290  1.1.1.3  mrg   \ifx #1\relax
   8291      1.1  mrg     % remove this
   8292      1.1  mrg   \else
   8293      1.1  mrg     \noexpand\commondummyword \noexpand#1%
   8294  1.1.1.3  mrg   \fi
   8295  1.1.1.3  mrg }
   8296      1.1  mrg 
   8297      1.1  mrg % \getargs -- Parse the arguments to a @macro line.  Set \macname to
   8298      1.1  mrg % the name of the macro, and \argl to the braced argument list.
   8299      1.1  mrg \def\getargs#1{\getargsxxx#1{}}
   8300  1.1.1.3  mrg \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
   8301  1.1.1.3  mrg \def\getmacname#1 #2\relax{\macname={#1}}
   8302  1.1.1.3  mrg \def\getmacargs#1{\def\argl{#1}}
   8303      1.1  mrg % This made use of the feature that if the last token of a
   8304  1.1.1.3  mrg % <parameter list> is #, then the preceding argument is delimited by
   8305  1.1.1.3  mrg % an opening brace, and that opening brace is not consumed.
   8306  1.1.1.3  mrg 
   8307  1.1.1.3  mrg % Parse the optional {params} list to @macro or @rmacro.
   8308  1.1.1.3  mrg % Set \paramno to the number of arguments,
   8309  1.1.1.3  mrg % and \paramlist to a parameter text for the macro (e.g. #1,#2,#3 for a
   8310      1.1  mrg % three-param macro.)  Define \macarg.BLAH for each BLAH in the params
   8311      1.1  mrg % list to some hook where the argument is to be expanded.  If there are
   8312      1.1  mrg % less than 10 arguments that hook is to be replaced by ##N where N
   8313      1.1  mrg % is the position in that list, that is to say the macro arguments are to be
   8314      1.1  mrg % defined `a la TeX in the macro body.  
   8315  1.1.1.3  mrg %
   8316  1.1.1.3  mrg % That gets used by \mbodybackslash (above).
   8317      1.1  mrg %
   8318      1.1  mrg % If there are 10 or more arguments, a different technique is used: see
   8319      1.1  mrg % \parsemmanyargdef.
   8320      1.1  mrg %
   8321  1.1.1.3  mrg \def\parsemargdef#1;{%
   8322      1.1  mrg   \paramno=0\def\paramlist{}%
   8323      1.1  mrg   \let\hash\relax
   8324      1.1  mrg   % \hash is redefined to `#' later to get it into definitions
   8325      1.1  mrg   \let\xeatspaces\relax
   8326      1.1  mrg   \parsemargdefxxx#1,;,%
   8327      1.1  mrg   \ifnum\paramno<10\relax\else
   8328      1.1  mrg     \paramno0\relax
   8329      1.1  mrg     \parsemmanyargdef@@#1,;,% 10 or more arguments
   8330      1.1  mrg   \fi
   8331      1.1  mrg }
   8332      1.1  mrg \def\parsemargdefxxx#1,{%
   8333      1.1  mrg   \if#1;\let\next=\relax
   8334      1.1  mrg   \else \let\next=\parsemargdefxxx
   8335      1.1  mrg     \advance\paramno by 1
   8336      1.1  mrg     \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
   8337      1.1  mrg         {\xeatspaces{\hash\the\paramno}}%
   8338  1.1.1.3  mrg     \edef\paramlist{\paramlist\hash\the\paramno,}%
   8339  1.1.1.3  mrg   \fi\next}
   8340  1.1.1.3  mrg 
   8341  1.1.1.3  mrg % \parsemacbody, \parsermacbody
   8342  1.1.1.3  mrg %
   8343  1.1.1.3  mrg % Read recursive and nonrecursive macro bodies. (They're different since
   8344  1.1.1.3  mrg % rec and nonrec macros end differently.)
   8345  1.1.1.3  mrg % 
   8346  1.1.1.3  mrg % We are in \macrobodyctxt, and the \xdef causes backslashshes in the macro 
   8347  1.1.1.3  mrg % body to be transformed.
   8348  1.1.1.3  mrg % Set \macrobody to the body of the macro, and call \defmacro.
   8349  1.1.1.3  mrg %
   8350  1.1.1.3  mrg {\catcode`\ =\other\long\gdef\parsemacbody#1@end macro{%
   8351  1.1.1.3  mrg \xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}%
   8352  1.1.1.3  mrg {\catcode`\ =\other\long\gdef\parsermacbody#1@end rmacro{%
   8353  1.1.1.3  mrg \xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}%
   8354  1.1.1.3  mrg 
   8355  1.1.1.3  mrg % Make @ a letter, so that we can make private-to-Texinfo macro names.
   8356  1.1.1.3  mrg \edef\texiatcatcode{\the\catcode`\@}
   8357  1.1.1.3  mrg \catcode `@=11\relax
   8358  1.1.1.3  mrg 
   8359  1.1.1.3  mrg %%%%%%%%%%%%%% Code for > 10 arguments only   %%%%%%%%%%%%%%%%%%
   8360  1.1.1.3  mrg 
   8361  1.1.1.3  mrg % If there are 10 or more arguments, a different technique is used, where the
   8362  1.1.1.3  mrg % hook remains in the body, and when macro is to be expanded the body is
   8363  1.1.1.3  mrg % processed again to replace the arguments.
   8364  1.1.1.3  mrg %
   8365  1.1.1.3  mrg % In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the
   8366  1.1.1.3  mrg % argument N value and then \edef the body (nothing else will expand because of
   8367  1.1.1.3  mrg % the catcode regime under which the body was input).
   8368  1.1.1.3  mrg %
   8369  1.1.1.3  mrg % If you compile with TeX (not eTeX), and you have macros with 10 or more
   8370  1.1.1.3  mrg % arguments, no macro can have more than 256 arguments (else error).
   8371  1.1.1.3  mrg %
   8372  1.1.1.3  mrg % In case that there are 10 or more arguments we parse again the arguments
   8373  1.1.1.3  mrg % list to set new definitions for the \macarg.BLAH macros corresponding to
   8374  1.1.1.3  mrg % each BLAH argument. It was anyhow needed to parse already once this list
   8375      1.1  mrg % in order to count the arguments, and as macros with at most 9 arguments
   8376      1.1  mrg % are by far more frequent than macro with 10 or more arguments, defining
   8377      1.1  mrg % twice the \macarg.BLAH macros does not cost too much processing power.
   8378      1.1  mrg \def\parsemmanyargdef@@#1,{%
   8379      1.1  mrg   \if#1;\let\next=\relax
   8380      1.1  mrg   \else 
   8381      1.1  mrg     \let\next=\parsemmanyargdef@@
   8382      1.1  mrg     \edef\tempb{\eatspaces{#1}}%
   8383      1.1  mrg     \expandafter\def\expandafter\tempa
   8384      1.1  mrg        \expandafter{\csname macarg.\tempb\endcsname}%
   8385      1.1  mrg     % Note that we need some extra \noexpand\noexpand, this is because we
   8386      1.1  mrg     % don't want \the  to be expanded in the \parsermacbody  as it uses an
   8387      1.1  mrg     % \xdef .
   8388      1.1  mrg     \expandafter\edef\tempa
   8389      1.1  mrg       {\noexpand\noexpand\noexpand\the\toks\the\paramno}%
   8390      1.1  mrg     \advance\paramno by 1\relax
   8391      1.1  mrg   \fi\next}
   8392      1.1  mrg 
   8393      1.1  mrg 
   8394      1.1  mrg \let\endargs@\relax
   8395      1.1  mrg \let\nil@\relax
   8396      1.1  mrg \def\nilm@{\nil@}%
   8397  1.1.1.3  mrg \long\def\nillm@{\nil@}%
   8398      1.1  mrg 
   8399      1.1  mrg % This macro is expanded during the Texinfo macro expansion, not during its
   8400      1.1  mrg % definition.  It gets all the arguments' values and assigns them to macros
   8401      1.1  mrg % macarg.ARGNAME
   8402      1.1  mrg %
   8403      1.1  mrg % #1 is the macro name
   8404      1.1  mrg % #2 is the list of argument names
   8405      1.1  mrg % #3 is the list of argument values
   8406      1.1  mrg \def\getargvals@#1#2#3{%
   8407      1.1  mrg   \def\macargdeflist@{}%
   8408      1.1  mrg   \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion.
   8409      1.1  mrg   \def\paramlist{#2,\nil@}%
   8410      1.1  mrg   \def\macroname{#1}%
   8411      1.1  mrg   \begingroup
   8412      1.1  mrg   \macroargctxt
   8413      1.1  mrg   \def\argvaluelist{#3,\nil@}%
   8414      1.1  mrg   \def\@tempa{#3}%
   8415      1.1  mrg   \ifx\@tempa\empty
   8416      1.1  mrg     \setemptyargvalues@
   8417      1.1  mrg   \else
   8418      1.1  mrg     \getargvals@@
   8419      1.1  mrg   \fi
   8420      1.1  mrg }
   8421      1.1  mrg \def\getargvals@@{%
   8422      1.1  mrg   \ifx\paramlist\nilm@
   8423      1.1  mrg       % Some sanity check needed here that \argvaluelist is also empty.
   8424      1.1  mrg       \ifx\argvaluelist\nillm@
   8425      1.1  mrg       \else
   8426      1.1  mrg         \errhelp = \EMsimple
   8427      1.1  mrg         \errmessage{Too many arguments in macro `\macroname'!}%
   8428      1.1  mrg       \fi
   8429      1.1  mrg       \let\next\macargexpandinbody@
   8430      1.1  mrg   \else
   8431      1.1  mrg     \ifx\argvaluelist\nillm@
   8432      1.1  mrg        % No more arguments values passed to macro.  Set remaining named-arg
   8433      1.1  mrg        % macros to empty.
   8434      1.1  mrg        \let\next\setemptyargvalues@
   8435      1.1  mrg     \else
   8436      1.1  mrg       % pop current arg name into \@tempb
   8437      1.1  mrg       \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}%
   8438      1.1  mrg       \expandafter\@tempa\expandafter{\paramlist}%
   8439      1.1  mrg        % pop current argument value into \@tempc
   8440      1.1  mrg       \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}%
   8441      1.1  mrg       \expandafter\@tempa\expandafter{\argvaluelist}%
   8442      1.1  mrg        % Here \@tempb is the current arg name and \@tempc is the current arg value.
   8443      1.1  mrg        % First place the new argument macro definition into \@tempd
   8444      1.1  mrg        \expandafter\macname\expandafter{\@tempc}%
   8445      1.1  mrg        \expandafter\let\csname macarg.\@tempb\endcsname\relax
   8446      1.1  mrg        \expandafter\def\expandafter\@tempe\expandafter{%
   8447      1.1  mrg          \csname macarg.\@tempb\endcsname}%
   8448      1.1  mrg        \edef\@tempd{\long\def\@tempe{\the\macname}}%
   8449      1.1  mrg        \push@\@tempd\macargdeflist@
   8450      1.1  mrg        \let\next\getargvals@@
   8451      1.1  mrg     \fi
   8452      1.1  mrg   \fi
   8453      1.1  mrg   \next
   8454      1.1  mrg }
   8455      1.1  mrg 
   8456      1.1  mrg \def\push@#1#2{%
   8457      1.1  mrg   \expandafter\expandafter\expandafter\def
   8458      1.1  mrg   \expandafter\expandafter\expandafter#2%
   8459      1.1  mrg   \expandafter\expandafter\expandafter{%
   8460      1.1  mrg   \expandafter#1#2}%
   8461  1.1.1.3  mrg }
   8462  1.1.1.3  mrg 
   8463      1.1  mrg % Replace arguments by their values in the macro body, and place the result
   8464      1.1  mrg % in macro \@tempa.
   8465      1.1  mrg % 
   8466      1.1  mrg \def\macvalstoargs@{%
   8467      1.1  mrg   %  To do this we use the property that token registers that are \the'ed
   8468      1.1  mrg   % within an \edef  expand only once. So we are going to place all argument
   8469      1.1  mrg   % values into respective token registers.
   8470      1.1  mrg   %
   8471      1.1  mrg   % First we save the token context, and initialize argument numbering.
   8472      1.1  mrg   \begingroup
   8473      1.1  mrg     \paramno0\relax
   8474      1.1  mrg     % Then, for each argument number #N, we place the corresponding argument
   8475      1.1  mrg     % value into a new token list register \toks#N
   8476      1.1  mrg     \expandafter\putargsintokens@\saveparamlist@,;,%
   8477      1.1  mrg     % Then, we expand the body so that argument are replaced by their
   8478      1.1  mrg     % values. The trick for values not to be expanded themselves is that they
   8479      1.1  mrg     % are within tokens and that tokens expand only once in an \edef .
   8480      1.1  mrg     \edef\@tempc{\csname mac.\macroname .body\endcsname}%
   8481      1.1  mrg     % Now we restore the token stack pointer to free the token list registers
   8482      1.1  mrg     % which we have used, but we make sure that expanded body is saved after
   8483      1.1  mrg     % group.
   8484      1.1  mrg     \expandafter
   8485      1.1  mrg   \endgroup
   8486  1.1.1.3  mrg   \expandafter\def\expandafter\@tempa\expandafter{\@tempc}%
   8487  1.1.1.3  mrg   }
   8488      1.1  mrg 
   8489      1.1  mrg % Define the named-macro outside of this group and then close this group. 
   8490      1.1  mrg % 
   8491      1.1  mrg \def\macargexpandinbody@{% 
   8492      1.1  mrg   \expandafter
   8493      1.1  mrg   \endgroup
   8494      1.1  mrg   \macargdeflist@
   8495      1.1  mrg   % First the replace in body the macro arguments by their values, the result
   8496      1.1  mrg   % is in \@tempa .
   8497      1.1  mrg   \macvalstoargs@
   8498      1.1  mrg   % Then we point at the \norecurse or \gobble (for recursive) macro value
   8499      1.1  mrg   % with \@tempb .
   8500      1.1  mrg   \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname
   8501      1.1  mrg   % Depending on whether it is recursive or not, we need some tailing
   8502      1.1  mrg   % \egroup .
   8503      1.1  mrg   \ifx\@tempb\gobble
   8504      1.1  mrg      \let\@tempc\relax
   8505      1.1  mrg   \else
   8506      1.1  mrg      \let\@tempc\egroup
   8507      1.1  mrg   \fi
   8508      1.1  mrg   % And now we do the real job:
   8509      1.1  mrg   \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}%
   8510      1.1  mrg   \@tempd
   8511      1.1  mrg }
   8512      1.1  mrg 
   8513      1.1  mrg \def\putargsintokens@#1,{%
   8514      1.1  mrg   \if#1;\let\next\relax
   8515      1.1  mrg   \else
   8516      1.1  mrg     \let\next\putargsintokens@
   8517      1.1  mrg     % First we allocate the new token list register, and give it a temporary
   8518      1.1  mrg     % alias \@tempb .
   8519      1.1  mrg     \toksdef\@tempb\the\paramno
   8520      1.1  mrg     % Then we place the argument value into that token list register.
   8521      1.1  mrg     \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname
   8522      1.1  mrg     \expandafter\@tempb\expandafter{\@tempa}%
   8523      1.1  mrg     \advance\paramno by 1\relax
   8524      1.1  mrg   \fi
   8525  1.1.1.3  mrg   \next
   8526  1.1.1.3  mrg }
   8527      1.1  mrg 
   8528      1.1  mrg % Trailing missing arguments are set to empty.
   8529      1.1  mrg % 
   8530      1.1  mrg \def\setemptyargvalues@{%
   8531      1.1  mrg   \ifx\paramlist\nilm@
   8532      1.1  mrg     \let\next\macargexpandinbody@
   8533      1.1  mrg   \else
   8534      1.1  mrg     \expandafter\setemptyargvaluesparser@\paramlist\endargs@
   8535      1.1  mrg     \let\next\setemptyargvalues@
   8536      1.1  mrg   \fi
   8537      1.1  mrg   \next
   8538      1.1  mrg }
   8539      1.1  mrg 
   8540      1.1  mrg \def\setemptyargvaluesparser@#1,#2\endargs@{%
   8541      1.1  mrg   \expandafter\def\expandafter\@tempa\expandafter{%
   8542      1.1  mrg     \expandafter\def\csname macarg.#1\endcsname{}}%
   8543      1.1  mrg   \push@\@tempa\macargdeflist@
   8544      1.1  mrg   \def\paramlist{#2}%
   8545      1.1  mrg }
   8546      1.1  mrg 
   8547      1.1  mrg % #1 is the element target macro
   8548      1.1  mrg % #2 is the list macro
   8549      1.1  mrg % #3,#4\endargs@ is the list value
   8550      1.1  mrg \def\pop@#1#2#3,#4\endargs@{%
   8551      1.1  mrg    \def#1{#3}%
   8552      1.1  mrg    \def#2{#4}%
   8553      1.1  mrg }
   8554      1.1  mrg \long\def\longpop@#1#2#3,#4\endargs@{%
   8555      1.1  mrg    \long\def#1{#3}%
   8556  1.1.1.3  mrg    \long\def#2{#4}%
   8557  1.1.1.3  mrg }
   8558  1.1.1.3  mrg 
   8559  1.1.1.3  mrg 
   8560  1.1.1.3  mrg %%%%%%%%%%%%%% End of code for > 10 arguments %%%%%%%%%%%%%%%%%%
   8561  1.1.1.3  mrg 
   8562  1.1.1.3  mrg 
   8563  1.1.1.3  mrg % This defines a Texinfo @macro or @rmacro, called by \parsemacbody.
   8564  1.1.1.3  mrg %    \macrobody has the body of the macro in it, with placeholders for
   8565  1.1.1.3  mrg % its parameters, looking like "\xeatspaces{\hash 1}".
   8566      1.1  mrg %    \paramno is the number of parameters
   8567  1.1.1.3  mrg %    \paramlist is a TeX parameter text, e.g. "#1,#2,#3,"
   8568      1.1  mrg % There are four cases: macros of zero, one, up to nine, and many arguments.
   8569      1.1  mrg % \xdef is used so that macro definitions will survive the file
   8570      1.1  mrg % they're defined in: @include reads the file inside a group.
   8571  1.1.1.3  mrg %
   8572  1.1.1.3  mrg \def\defmacro{%
   8573  1.1.1.3  mrg   \let\hash=##% convert placeholders to macro parameter chars
   8574  1.1.1.3  mrg   \ifnum\paramno=1
   8575  1.1.1.3  mrg     \def\xeatspaces##1{##1}%
   8576  1.1.1.3  mrg     % This removes the pair of braces around the argument.  We don't
   8577  1.1.1.3  mrg     % use \eatspaces, because this can cause ends of lines to be lost
   8578  1.1.1.3  mrg     % when the argument to \eatspaces is read, leading to line-based
   8579  1.1.1.3  mrg     % commands like "@itemize" not being read correctly.
   8580  1.1.1.3  mrg   \else
   8581  1.1.1.3  mrg     \let\xeatspaces\relax % suppress expansion
   8582  1.1.1.3  mrg   \fi
   8583  1.1.1.3  mrg   \ifcase\paramno
   8584  1.1.1.3  mrg   % 0
   8585  1.1.1.3  mrg     \expandafter\xdef\csname\the\macname\endcsname{%
   8586  1.1.1.3  mrg       \bgroup
   8587  1.1.1.3  mrg         \noexpand\spaceisspace
   8588  1.1.1.3  mrg         \noexpand\endlineisspace
   8589  1.1.1.3  mrg         \noexpand\expandafter % skip any whitespace after the macro name.
   8590  1.1.1.3  mrg         \expandafter\noexpand\csname\the\macname @@@\endcsname}%
   8591  1.1.1.3  mrg     \expandafter\xdef\csname\the\macname @@@\endcsname{%
   8592  1.1.1.3  mrg       \egroup
   8593  1.1.1.3  mrg       \noexpand\scanmacro{\macrobody}}%
   8594  1.1.1.3  mrg   \or % 1
   8595  1.1.1.3  mrg     \expandafter\xdef\csname\the\macname\endcsname{%
   8596  1.1.1.3  mrg        \bgroup
   8597  1.1.1.3  mrg        \noexpand\braceorline
   8598  1.1.1.3  mrg        \expandafter\noexpand\csname\the\macname @@@\endcsname}%
   8599  1.1.1.3  mrg     \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
   8600  1.1.1.3  mrg       \egroup
   8601  1.1.1.3  mrg       \noexpand\scanmacro{\macrobody}%
   8602  1.1.1.3  mrg       }%
   8603  1.1.1.3  mrg   \else % at most 9
   8604  1.1.1.3  mrg     \ifnum\paramno<10\relax
   8605  1.1.1.3  mrg       % @MACNAME sets the context for reading the macro argument
   8606  1.1.1.3  mrg       % @MACNAME@@ gets the argument, processes backslashes and appends a 
   8607      1.1  mrg       % comma.
   8608  1.1.1.3  mrg       % @MACNAME@@@ removes braces surrounding the argument list.
   8609  1.1.1.3  mrg       % @MACNAME@@@@ scans the macro body with arguments substituted.
   8610  1.1.1.3  mrg       \expandafter\xdef\csname\the\macname\endcsname{%
   8611  1.1.1.3  mrg         \bgroup
   8612  1.1.1.3  mrg         \noexpand\expandafter  % This \expandafter skip any spaces after the
   8613  1.1.1.3  mrg         \noexpand\macroargctxt % macro before we change the catcode of space.
   8614  1.1.1.3  mrg         \noexpand\expandafter
   8615  1.1.1.3  mrg         \expandafter\noexpand\csname\the\macname @@\endcsname}%
   8616  1.1.1.3  mrg       \expandafter\xdef\csname\the\macname @@\endcsname##1{%
   8617  1.1.1.3  mrg           \noexpand\passargtomacro
   8618  1.1.1.3  mrg           \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}%
   8619  1.1.1.3  mrg       \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
   8620  1.1.1.3  mrg           \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}%
   8621  1.1.1.3  mrg       \expandafter\expandafter
   8622  1.1.1.3  mrg       \expandafter\xdef
   8623  1.1.1.3  mrg       \expandafter\expandafter
   8624      1.1  mrg         \csname\the\macname @@@@\endcsname\paramlist{%
   8625  1.1.1.3  mrg           \egroup\noexpand\scanmacro{\macrobody}}%
   8626  1.1.1.3  mrg     \else % 10 or more:
   8627  1.1.1.3  mrg       \expandafter\xdef\csname\the\macname\endcsname{%
   8628  1.1.1.3  mrg         \noexpand\getargvals@{\the\macname}{\argl}%
   8629      1.1  mrg       }%
   8630      1.1  mrg       \global\expandafter\let\csname mac.\the\macname .body\endcsname\macrobody
   8631      1.1  mrg       \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble
   8632  1.1.1.3  mrg     \fi
   8633      1.1  mrg   \fi}
   8634      1.1  mrg 
   8635      1.1  mrg \catcode `\@\texiatcatcode\relax % end private-to-Texinfo catcodes
   8636  1.1.1.3  mrg 
   8637  1.1.1.3  mrg \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
   8638  1.1.1.3  mrg 
   8639  1.1.1.3  mrg 
   8640  1.1.1.3  mrg %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8641  1.1.1.3  mrg %
   8642  1.1.1.3  mrg {\catcode`\@=0 \catcode`\\=13  % We need to manipulate \ so use @ as escape
   8643  1.1.1.3  mrg @catcode`@_=11  % private names
   8644  1.1.1.3  mrg @catcode`@!=11  % used as argument separator
   8645  1.1.1.3  mrg 
   8646  1.1.1.3  mrg % \passargtomacro#1#2 -
   8647  1.1.1.3  mrg % Call #1 with a list of tokens #2, with any doubled backslashes in #2
   8648  1.1.1.3  mrg % compressed to one.
   8649  1.1.1.3  mrg %
   8650  1.1.1.3  mrg % This implementation works by expansion, and not execution (so we cannot use 
   8651  1.1.1.3  mrg % \def or similar).  This reduces the risk of this failing in contexts where 
   8652  1.1.1.3  mrg % complete expansion is done with no execution (for example, in writing out to 
   8653  1.1.1.3  mrg % an auxiliary file for an index entry).
   8654  1.1.1.3  mrg % 
   8655  1.1.1.3  mrg % State is kept in the input stream: the argument passed to
   8656  1.1.1.3  mrg % @look_ahead, @gobble_and_check_finish and @add_segment is
   8657  1.1.1.3  mrg %
   8658  1.1.1.3  mrg % THE_MACRO ARG_RESULT ! {PENDING_BS} NEXT_TOKEN  (... rest of input)
   8659  1.1.1.3  mrg %
   8660  1.1.1.3  mrg % where:
   8661  1.1.1.3  mrg % THE_MACRO - name of the macro we want to call
   8662  1.1.1.3  mrg % ARG_RESULT - argument list we build to pass to that macro
   8663  1.1.1.3  mrg % PENDING_BS - either a backslash or nothing
   8664  1.1.1.3  mrg % NEXT_TOKEN - used to look ahead in the input stream to see what's coming next
   8665  1.1.1.3  mrg 
   8666  1.1.1.3  mrg @gdef@passargtomacro#1#2{%
   8667  1.1.1.3  mrg   @add_segment #1!{}@relax#2\@_finish\%
   8668  1.1.1.3  mrg }
   8669  1.1.1.3  mrg @gdef@_finish{@_finishx} @global@let@_finishx@relax
   8670  1.1.1.3  mrg 
   8671  1.1.1.3  mrg % #1 - THE_MACRO ARG_RESULT
   8672  1.1.1.3  mrg % #2 - PENDING_BS
   8673  1.1.1.3  mrg % #3 - NEXT_TOKEN
   8674  1.1.1.3  mrg % #4 used to look ahead
   8675  1.1.1.3  mrg %
   8676  1.1.1.3  mrg % If the next token is not a backslash, process the rest of the argument; 
   8677  1.1.1.3  mrg % otherwise, remove the next token.
   8678  1.1.1.3  mrg @gdef@look_ahead#1!#2#3#4{%
   8679  1.1.1.3  mrg   @ifx#4\%
   8680  1.1.1.3  mrg    @expandafter@gobble_and_check_finish 
   8681  1.1.1.3  mrg   @else
   8682  1.1.1.3  mrg    @expandafter@add_segment
   8683  1.1.1.3  mrg   @fi#1!{#2}#4#4%
   8684  1.1.1.3  mrg }
   8685  1.1.1.3  mrg 
   8686  1.1.1.3  mrg % #1 - THE_MACRO ARG_RESULT
   8687  1.1.1.3  mrg % #2 - PENDING_BS
   8688  1.1.1.3  mrg % #3 - NEXT_TOKEN
   8689  1.1.1.3  mrg % #4 should be a backslash, which is gobbled.
   8690  1.1.1.3  mrg % #5 looks ahead
   8691  1.1.1.3  mrg %
   8692  1.1.1.3  mrg % Double backslash found.  Add a single backslash, and look ahead.
   8693  1.1.1.3  mrg @gdef@gobble_and_check_finish#1!#2#3#4#5{%
   8694  1.1.1.3  mrg   @add_segment#1\!{}#5#5%
   8695  1.1.1.3  mrg }
   8696  1.1.1.3  mrg 
   8697  1.1.1.3  mrg @gdef@is_fi{@fi}
   8698  1.1.1.3  mrg 
   8699  1.1.1.3  mrg % #1 - THE_MACRO ARG_RESULT
   8700  1.1.1.3  mrg % #2 - PENDING_BS
   8701  1.1.1.3  mrg % #3 - NEXT_TOKEN
   8702  1.1.1.3  mrg % #4 is input stream until next backslash
   8703  1.1.1.3  mrg %
   8704  1.1.1.3  mrg % Input stream is either at the start of the argument, or just after a 
   8705  1.1.1.3  mrg % backslash sequence, either a lone backslash, or a doubled backslash.  
   8706  1.1.1.3  mrg % NEXT_TOKEN contains the first token in the input stream: if it is \finish, 
   8707  1.1.1.3  mrg % finish; otherwise, append to ARG_RESULT the segment of the argument up until
   8708  1.1.1.3  mrg % the next backslash.  PENDING_BACKSLASH contains a backslash to represent
   8709  1.1.1.3  mrg % a backslash just before the start of the input stream that has not been
   8710  1.1.1.3  mrg % added to ARG_RESULT.
   8711  1.1.1.3  mrg @gdef@add_segment#1!#2#3#4\{%
   8712  1.1.1.3  mrg @ifx#3@_finish
   8713  1.1.1.3  mrg   @call_the_macro#1!%
   8714  1.1.1.3  mrg @else
   8715  1.1.1.3  mrg   % append the pending backslash to the result, followed by the next segment
   8716  1.1.1.3  mrg   @expandafter@is_fi@look_ahead#1#2#4!{\}@fi
   8717  1.1.1.3  mrg   % this @fi is discarded by @look_ahead.
   8718  1.1.1.3  mrg   % we can't get rid of it with \expandafter because we don't know how 
   8719  1.1.1.3  mrg   % long #4 is.
   8720  1.1.1.3  mrg }
   8721  1.1.1.3  mrg 
   8722  1.1.1.3  mrg % #1 - THE_MACRO
   8723  1.1.1.3  mrg % #2 - ARG_RESULT
   8724  1.1.1.3  mrg % #3 discards the res of the conditional in @add_segment, and @is_fi ends the 
   8725  1.1.1.3  mrg % conditional.
   8726  1.1.1.3  mrg @gdef@call_the_macro#1#2!#3@fi{@is_fi #1{#2}}
   8727  1.1.1.3  mrg 
   8728  1.1.1.3  mrg }
   8729  1.1.1.3  mrg %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   8730  1.1.1.3  mrg 
   8731  1.1.1.3  mrg % \braceorline MAC is used for a one-argument macro MAC.  It checks
   8732  1.1.1.3  mrg % whether the next non-whitespace character is a {.  It sets the context
   8733      1.1  mrg % for reading the argument (slightly different in the two cases).  Then,
   8734      1.1  mrg % to read the argument, in the whole-line case, it then calls the regular
   8735      1.1  mrg % \parsearg MAC; in the lbrace case, it calls \passargtomacro MAC.
   8736  1.1.1.3  mrg % 
   8737  1.1.1.3  mrg \def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx}
   8738  1.1.1.3  mrg \def\braceorlinexxx{%
   8739  1.1.1.3  mrg   \ifx\nchar\bgroup
   8740  1.1.1.3  mrg     \macroargctxt
   8741      1.1  mrg     \expandafter\passargtomacro
   8742      1.1  mrg   \else
   8743      1.1  mrg     \macrolineargctxt\expandafter\parsearg
   8744      1.1  mrg   \fi \macnamexxx}
   8745      1.1  mrg 
   8746      1.1  mrg 
   8747      1.1  mrg % @alias.
   8748      1.1  mrg % We need some trickery to remove the optional spaces around the equal
   8749      1.1  mrg % sign.  Make them active and then expand them all to nothing.
   8750      1.1  mrg %
   8751      1.1  mrg \def\alias{\parseargusing\obeyspaces\aliasxxx}
   8752      1.1  mrg \def\aliasxxx #1{\aliasyyy#1\relax}
   8753      1.1  mrg \def\aliasyyy #1=#2\relax{%
   8754      1.1  mrg   {%
   8755      1.1  mrg     \expandafter\let\obeyedspace=\empty
   8756      1.1  mrg     \addtomacrolist{#1}%
   8757      1.1  mrg     \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}%
   8758      1.1  mrg   }%
   8759      1.1  mrg   \next
   8760      1.1  mrg }
   8761      1.1  mrg 
   8762      1.1  mrg 
   8763      1.1  mrg \message{cross references,}
   8764      1.1  mrg 
   8765      1.1  mrg \newwrite\auxfile
   8766      1.1  mrg \newif\ifhavexrefs    % True if xref values are known.
   8767      1.1  mrg \newif\ifwarnedxrefs  % True if we warned once that they aren't known.
   8768      1.1  mrg 
   8769      1.1  mrg % @inforef is relatively simple.
   8770      1.1  mrg \def\inforef #1{\inforefzzz #1,,,,**}
   8771      1.1  mrg \def\inforefzzz #1,#2,#3,#4**{%
   8772      1.1  mrg   \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
   8773      1.1  mrg   node \samp{\ignorespaces#1{}}}
   8774      1.1  mrg 
   8775      1.1  mrg % @node's only job in TeX is to define \lastnode, which is used in
   8776      1.1  mrg % cross-references.  The @node line might or might not have commas, and
   8777      1.1  mrg % might or might not have spaces before the first comma, like:
   8778      1.1  mrg % @node foo , bar , ...
   8779      1.1  mrg % We don't want such trailing spaces in the node name.
   8780      1.1  mrg %
   8781      1.1  mrg \parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse}
   8782      1.1  mrg %
   8783      1.1  mrg % also remove a trailing comma, in case of something like this:
   8784      1.1  mrg % @node Help-Cross,  ,  , Cross-refs
   8785      1.1  mrg \def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse}
   8786      1.1  mrg \def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}}
   8787      1.1  mrg 
   8788      1.1  mrg \let\nwnode=\node
   8789      1.1  mrg \let\lastnode=\empty
   8790      1.1  mrg 
   8791      1.1  mrg % Write a cross-reference definition for the current node.  #1 is the
   8792      1.1  mrg % type (Ynumbered, Yappendix, Ynothing).
   8793      1.1  mrg %
   8794      1.1  mrg \def\donoderef#1{%
   8795      1.1  mrg   \ifx\lastnode\empty\else
   8796      1.1  mrg     \setref{\lastnode}{#1}%
   8797      1.1  mrg     \global\let\lastnode=\empty
   8798      1.1  mrg   \fi
   8799      1.1  mrg }
   8800      1.1  mrg 
   8801      1.1  mrg % @anchor{NAME} -- define xref target at arbitrary point.
   8802      1.1  mrg %
   8803      1.1  mrg \newcount\savesfregister
   8804      1.1  mrg %
   8805      1.1  mrg \def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
   8806      1.1  mrg \def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
   8807      1.1  mrg \def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
   8808      1.1  mrg 
   8809      1.1  mrg % \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
   8810      1.1  mrg % anchor), which consists of three parts:
   8811      1.1  mrg % 1) NAME-title - the current sectioning name taken from \lastsection,
   8812      1.1  mrg %                 or the anchor name.
   8813      1.1  mrg % 2) NAME-snt   - section number and type, passed as the SNT arg, or
   8814      1.1  mrg %                 empty for anchors.
   8815      1.1  mrg % 3) NAME-pg    - the page number.
   8816      1.1  mrg %
   8817      1.1  mrg % This is called from \donoderef, \anchor, and \dofloat.  In the case of
   8818      1.1  mrg % floats, there is an additional part, which is not written here:
   8819      1.1  mrg % 4) NAME-lof   - the text as it should appear in a @listoffloats.
   8820      1.1  mrg %
   8821      1.1  mrg \def\setref#1#2{%
   8822  1.1.1.3  mrg   \pdfmkdest{#1}%
   8823      1.1  mrg   \iflinks
   8824  1.1.1.3  mrg     {%
   8825  1.1.1.3  mrg       \requireauxfile
   8826      1.1  mrg       \atdummies  % preserve commands, but don't expand them
   8827      1.1  mrg       % match definition in \xrdef, \refx, \xrefX.
   8828      1.1  mrg       \def\value##1{##1}%
   8829      1.1  mrg       \edef\writexrdef##1##2{%
   8830      1.1  mrg 	\write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef
   8831      1.1  mrg 	  ##1}{##2}}% these are parameters of \writexrdef
   8832      1.1  mrg       }%
   8833      1.1  mrg       \toks0 = \expandafter{\lastsection}%
   8834      1.1  mrg       \immediate \writexrdef{title}{\the\toks0 }%
   8835      1.1  mrg       \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
   8836      1.1  mrg       \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout
   8837      1.1  mrg     }%
   8838      1.1  mrg   \fi
   8839      1.1  mrg }
   8840      1.1  mrg 
   8841      1.1  mrg % @xrefautosectiontitle on|off says whether @section(ing) names are used
   8842      1.1  mrg % automatically in xrefs, if the third arg is not explicitly specified.
   8843      1.1  mrg % This was provided as a "secret" @set xref-automatic-section-title
   8844      1.1  mrg % variable, now it's official.
   8845      1.1  mrg % 
   8846      1.1  mrg \parseargdef\xrefautomaticsectiontitle{%
   8847      1.1  mrg   \def\temp{#1}%
   8848      1.1  mrg   \ifx\temp\onword
   8849      1.1  mrg     \expandafter\let\csname SETxref-automatic-section-title\endcsname
   8850      1.1  mrg       = \empty
   8851      1.1  mrg   \else\ifx\temp\offword
   8852      1.1  mrg     \expandafter\let\csname SETxref-automatic-section-title\endcsname
   8853      1.1  mrg       = \relax
   8854      1.1  mrg   \else
   8855      1.1  mrg     \errhelp = \EMsimple
   8856      1.1  mrg     \errmessage{Unknown @xrefautomaticsectiontitle value `\temp',
   8857      1.1  mrg                 must be on|off}%
   8858  1.1.1.2  mrg   \fi\fi
   8859      1.1  mrg }
   8860      1.1  mrg 
   8861      1.1  mrg % 
   8863      1.1  mrg % @xref, @pxref, and @ref generate cross-references.  For \xrefX, #1 is
   8864  1.1.1.3  mrg % the node name, #2 the name of the Info cross-reference, #3 the printed
   8865  1.1.1.3  mrg % node name, #4 the name of the Info file, #5 the name of the printed
   8866  1.1.1.3  mrg % manual.  All but the node name can be omitted.
   8867  1.1.1.3  mrg %
   8868  1.1.1.3  mrg \def\pxref{\putwordsee{} \xrefXX}
   8869  1.1.1.3  mrg \def\xref{\putwordSee{} \xrefXX}
   8870      1.1  mrg \def\ref{\xrefXX}
   8871  1.1.1.2  mrg 
   8872      1.1  mrg \def\xrefXX#1{\def\xrefXXarg{#1}\futurelet\tokenafterxref\xrefXXX}
   8873  1.1.1.2  mrg \def\xrefXXX{\expandafter\xrefX\expandafter[\xrefXXarg,,,,,,,]}
   8874      1.1  mrg %
   8875      1.1  mrg \newbox\toprefbox
   8876      1.1  mrg \newbox\printedrefnamebox
   8877      1.1  mrg \newbox\infofilenamebox
   8878      1.1  mrg \newbox\printedmanualbox
   8879  1.1.1.2  mrg %
   8880      1.1  mrg \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
   8881      1.1  mrg   \unsepspaces
   8882      1.1  mrg   %
   8883  1.1.1.2  mrg   % Get args without leading/trailing spaces.
   8884  1.1.1.2  mrg   \def\printedrefname{\ignorespaces #3}%
   8885  1.1.1.2  mrg   \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}%
   8886      1.1  mrg   %
   8887      1.1  mrg   \def\infofilename{\ignorespaces #4}%
   8888      1.1  mrg   \setbox\infofilenamebox = \hbox{\infofilename\unskip}%
   8889      1.1  mrg   %
   8890      1.1  mrg   \def\printedmanual{\ignorespaces #5}%
   8891      1.1  mrg   \setbox\printedmanualbox  = \hbox{\printedmanual\unskip}%
   8892      1.1  mrg   %
   8893      1.1  mrg   % If the printed reference name (arg #3) was not explicitly given in
   8894      1.1  mrg   % the @xref, figure out what we want to use.
   8895      1.1  mrg   \ifdim \wd\printedrefnamebox = 0pt
   8896      1.1  mrg     % No printed node name was explicitly given.
   8897      1.1  mrg     \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax
   8898      1.1  mrg       % Not auto section-title: use node name inside the square brackets.
   8899      1.1  mrg       \def\printedrefname{\ignorespaces #1}%
   8900      1.1  mrg     \else
   8901      1.1  mrg       % Auto section-title: use chapter/section title inside
   8902      1.1  mrg       % the square brackets if we have it.
   8903      1.1  mrg       \ifdim \wd\printedmanualbox > 0pt
   8904      1.1  mrg         % It is in another manual, so we don't have it; use node name.
   8905      1.1  mrg         \def\printedrefname{\ignorespaces #1}%
   8906      1.1  mrg       \else
   8907      1.1  mrg         \ifhavexrefs
   8908      1.1  mrg           % We (should) know the real title if we have the xref values.
   8909      1.1  mrg           \def\printedrefname{\refx{#1-title}{}}%
   8910      1.1  mrg         \else
   8911      1.1  mrg           % Otherwise just copy the Info node name.
   8912      1.1  mrg           \def\printedrefname{\ignorespaces #1}%
   8913      1.1  mrg         \fi%
   8914      1.1  mrg       \fi
   8915      1.1  mrg     \fi
   8916  1.1.1.3  mrg   \fi
   8917      1.1  mrg   %
   8918      1.1  mrg   % Make link in pdf output.
   8919  1.1.1.3  mrg   \ifpdf
   8920      1.1  mrg     % For pdfTeX and LuaTeX
   8921  1.1.1.2  mrg     {\indexnofonts
   8922  1.1.1.2  mrg      \makevalueexpandable
   8923      1.1  mrg      \turnoffactive
   8924      1.1  mrg      % This expands tokens, so do it after making catcode changes, so _
   8925  1.1.1.2  mrg      % etc. don't get their TeX definitions.  This ignores all spaces in
   8926  1.1.1.2  mrg      % #4, including (wrongly) those in the middle of the filename.
   8927  1.1.1.3  mrg      \getfilename{#4}%
   8928  1.1.1.3  mrg      %
   8929  1.1.1.3  mrg      % This (wrongly) does not take account of leading or trailing
   8930  1.1.1.3  mrg      % spaces in #1, which should be ignored.
   8931  1.1.1.2  mrg      \setpdfdestname{#1}%
   8932      1.1  mrg      %
   8933      1.1  mrg      \ifx\pdfdestname\empty
   8934      1.1  mrg        \def\pdfdestname{Top}% no empty targets
   8935      1.1  mrg      \fi
   8936  1.1.1.3  mrg      %
   8937      1.1  mrg      \leavevmode
   8938  1.1.1.3  mrg      \startlink attr{/Border [0 0 0]}%
   8939      1.1  mrg      \ifnum\filenamelength>0
   8940      1.1  mrg        goto file{\the\filename.pdf} name{\pdfdestname}%
   8941      1.1  mrg      \else
   8942  1.1.1.3  mrg        goto name{\pdfmkpgn{\pdfdestname}}%
   8943  1.1.1.3  mrg      \fi
   8944  1.1.1.3  mrg     }%
   8945  1.1.1.3  mrg     \setcolor{\linkcolor}%
   8946  1.1.1.3  mrg   \else
   8947  1.1.1.3  mrg     \ifx\XeTeXrevision\thisisundefined
   8948  1.1.1.3  mrg     \else
   8949  1.1.1.3  mrg       % For XeTeX
   8950  1.1.1.3  mrg       {\indexnofonts
   8951  1.1.1.3  mrg        \makevalueexpandable
   8952  1.1.1.3  mrg        \turnoffactive
   8953  1.1.1.3  mrg        % This expands tokens, so do it after making catcode changes, so _
   8954  1.1.1.3  mrg        % etc. don't get their TeX definitions.  This ignores all spaces in
   8955  1.1.1.3  mrg        % #4, including (wrongly) those in the middle of the filename.
   8956  1.1.1.3  mrg        \getfilename{#4}%
   8957  1.1.1.3  mrg        %
   8958  1.1.1.3  mrg        % This (wrongly) does not take account of leading or trailing
   8959  1.1.1.3  mrg        % spaces in #1, which should be ignored.
   8960  1.1.1.3  mrg        \setpdfdestname{#1}%
   8961  1.1.1.3  mrg        %
   8962  1.1.1.3  mrg        \ifx\pdfdestname\empty
   8963  1.1.1.3  mrg          \def\pdfdestname{Top}% no empty targets
   8964  1.1.1.3  mrg        \fi
   8965  1.1.1.3  mrg        %
   8966  1.1.1.3  mrg        \leavevmode
   8967  1.1.1.3  mrg        \ifnum\filenamelength>0
   8968  1.1.1.3  mrg          % With default settings,
   8969  1.1.1.3  mrg          % XeTeX (xdvipdfmx) replaces link destination names with integers.
   8970  1.1.1.3  mrg          % In this case, the replaced destination names of
   8971  1.1.1.3  mrg          % remote PDFs are no longer known.  In order to avoid a replacement,
   8972  1.1.1.3  mrg          % you can use xdvipdfmx's command line option `-C 0x0010'.
   8973  1.1.1.3  mrg          % If you use XeTeX 0.99996+ (TeX Live 2016+),
   8974  1.1.1.3  mrg          % this command line option is no longer necessary
   8975  1.1.1.3  mrg          % because we can use the `dvipdfmx:config' special.
   8976  1.1.1.3  mrg          \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A
   8977  1.1.1.3  mrg            << /S /GoToR /F (\the\filename.pdf) /D (\pdfdestname) >> >>}%
   8978  1.1.1.3  mrg        \else
   8979  1.1.1.3  mrg          \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A
   8980  1.1.1.3  mrg            << /S /GoTo /D (\pdfdestname) >> >>}%
   8981      1.1  mrg        \fi
   8982      1.1  mrg       }%
   8983      1.1  mrg       \setcolor{\linkcolor}%
   8984      1.1  mrg     \fi
   8985      1.1  mrg   \fi
   8986      1.1  mrg   {%
   8987  1.1.1.3  mrg     % Have to otherify everything special to allow the \csname to
   8988      1.1  mrg     % include an _ in the xref name, etc.
   8989      1.1  mrg     \indexnofonts
   8990      1.1  mrg     \turnoffactive
   8991  1.1.1.3  mrg     \def\value##1{##1}%
   8992  1.1.1.3  mrg     \expandafter\global\expandafter\let\expandafter\Xthisreftitle
   8993  1.1.1.3  mrg       \csname XR#1-title\endcsname
   8994  1.1.1.3  mrg   }%
   8995      1.1  mrg   %
   8996      1.1  mrg   % Float references are printed completely differently: "Figure 1.2"
   8997      1.1  mrg   % instead of "[somenode], p.3".  \iffloat distinguishes them by
   8998      1.1  mrg   % \Xthisreftitle being set to a magic string.
   8999      1.1  mrg   \iffloat\Xthisreftitle
   9000      1.1  mrg     % If the user specified the print name (third arg) to the ref,
   9001      1.1  mrg     % print it instead of our usual "Figure 1.2".
   9002      1.1  mrg     \ifdim\wd\printedrefnamebox = 0pt
   9003      1.1  mrg       \refx{#1-snt}{}%
   9004  1.1.1.2  mrg     \else
   9005      1.1  mrg       \printedrefname
   9006      1.1  mrg     \fi
   9007      1.1  mrg     %
   9008      1.1  mrg     % If the user also gave the printed manual name (fifth arg), append
   9009      1.1  mrg     % "in MANUALNAME".
   9010      1.1  mrg     \ifdim \wd\printedmanualbox > 0pt
   9011      1.1  mrg       \space \putwordin{} \cite{\printedmanual}%
   9012      1.1  mrg     \fi
   9013      1.1  mrg   \else
   9014      1.1  mrg     % node/anchor (non-float) references.
   9015      1.1  mrg     % 
   9016      1.1  mrg     % If we use \unhbox to print the node names, TeX does not insert
   9017      1.1  mrg     % empty discretionaries after hyphens, which means that it will not
   9018      1.1  mrg     % find a line break at a hyphen in a node names.  Since some manuals
   9019      1.1  mrg     % are best written with fairly long node names, containing hyphens,
   9020  1.1.1.2  mrg     % this is a loss.  Therefore, we give the text of the node name
   9021      1.1  mrg     % again, so it is as if TeX is seeing it for the first time.
   9022  1.1.1.2  mrg     % 
   9023  1.1.1.2  mrg     \ifdim \wd\printedmanualbox > 0pt
   9024  1.1.1.2  mrg       % Cross-manual reference with a printed manual name.
   9025  1.1.1.2  mrg       % 
   9026  1.1.1.2  mrg       \crossmanualxref{\cite{\printedmanual\unskip}}%
   9027  1.1.1.2  mrg     %
   9028      1.1  mrg     \else\ifdim \wd\infofilenamebox > 0pt
   9029  1.1.1.2  mrg       % Cross-manual reference with only an info filename (arg 4), no
   9030  1.1.1.2  mrg       % printed manual name (arg 5).  This is essentially the same as
   9031      1.1  mrg       % the case above; we output the filename, since we have nothing else.
   9032  1.1.1.2  mrg       % 
   9033      1.1  mrg       \crossmanualxref{\code{\infofilename\unskip}}%
   9034      1.1  mrg     %
   9035      1.1  mrg     \else
   9036      1.1  mrg       % Reference within this manual.
   9037      1.1  mrg       %
   9038      1.1  mrg       % _ (for example) has to be the character _ for the purposes of the
   9039      1.1  mrg       % control sequence corresponding to the node, but it has to expand
   9040      1.1  mrg       % into the usual \leavevmode...\vrule stuff for purposes of
   9041      1.1  mrg       % printing. So we \turnoffactive for the \refx-snt, back on for the
   9042      1.1  mrg       % printing, back off for the \refx-pg.
   9043      1.1  mrg       {\turnoffactive
   9044      1.1  mrg        % Only output a following space if the -snt ref is nonempty; for
   9045      1.1  mrg        % @unnumbered and @anchor, it won't be.
   9046      1.1  mrg        \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
   9047      1.1  mrg        \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
   9048      1.1  mrg       }%
   9049      1.1  mrg       % output the `[mynode]' via the macro below so it can be overridden.
   9050      1.1  mrg       \xrefprintnodename\printedrefname
   9051      1.1  mrg       %
   9052      1.1  mrg       % But we always want a comma and a space:
   9053  1.1.1.3  mrg       ,\space
   9054  1.1.1.3  mrg       %
   9055  1.1.1.3  mrg       % output the `page 3'.
   9056  1.1.1.3  mrg       \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
   9057  1.1.1.3  mrg       % Add a , if xref followed by a space
   9058  1.1.1.3  mrg       \if\space\noexpand\tokenafterxref ,%
   9059  1.1.1.3  mrg       \else\ifx\	\tokenafterxref ,% @TAB
   9060  1.1.1.3  mrg       \else\ifx\*\tokenafterxref ,%   @*
   9061  1.1.1.3  mrg       \else\ifx\ \tokenafterxref ,%   @SPACE
   9062  1.1.1.2  mrg       \else\ifx\
   9063      1.1  mrg                 \tokenafterxref ,%    @NL
   9064      1.1  mrg       \else\ifx\tie\tokenafterxref ,% @tie
   9065      1.1  mrg       \fi\fi\fi\fi\fi\fi
   9066      1.1  mrg     \fi\fi
   9067  1.1.1.2  mrg   \fi
   9068  1.1.1.2  mrg   \endlink
   9069  1.1.1.2  mrg \endgroup}
   9070  1.1.1.2  mrg 
   9071  1.1.1.2  mrg % Output a cross-manual xref to #1.  Used just above (twice).
   9072  1.1.1.2  mrg % 
   9073  1.1.1.2  mrg % Only include the text "Section ``foo'' in" if the foo is neither
   9074  1.1.1.2  mrg % missing or Top.  Thus, @xref{,,,foo,The Foo Manual} outputs simply
   9075  1.1.1.2  mrg % "see The Foo Manual", the idea being to refer to the whole manual.
   9076  1.1.1.2  mrg % 
   9077  1.1.1.2  mrg % But, this being TeX, we can't easily compare our node name against the
   9078  1.1.1.2  mrg % string "Top" while ignoring the possible spaces before and after in
   9079  1.1.1.2  mrg % the input.  By adding the arbitrary 7sp below, we make it much less
   9080  1.1.1.2  mrg % likely that a real node name would have the same width as "Top" (e.g.,
   9081  1.1.1.2  mrg % in a monospaced font).  Hopefully it will never happen in practice.
   9082  1.1.1.2  mrg % 
   9083  1.1.1.2  mrg % For the same basic reason, we retypeset the "Top" at every
   9084  1.1.1.2  mrg % reference, since the current font is indeterminate.
   9085  1.1.1.2  mrg % 
   9086  1.1.1.2  mrg \def\crossmanualxref#1{%
   9087  1.1.1.2  mrg   \setbox\toprefbox = \hbox{Top\kern7sp}%
   9088  1.1.1.2  mrg   \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}%
   9089  1.1.1.2  mrg   \ifdim \wd2 > 7sp  % nonempty?
   9090  1.1.1.2  mrg     \ifdim \wd2 = \wd\toprefbox \else  % same as Top?
   9091  1.1.1.2  mrg       \putwordSection{} ``\printedrefname'' \putwordin{}\space
   9092  1.1.1.2  mrg     \fi
   9093      1.1  mrg   \fi
   9094      1.1  mrg   #1%
   9095      1.1  mrg }
   9096      1.1  mrg 
   9097      1.1  mrg % This macro is called from \xrefX for the `[nodename]' part of xref
   9098      1.1  mrg % output.  It's a separate macro only so it can be changed more easily,
   9099      1.1  mrg % since square brackets don't work well in some documents.  Particularly
   9100      1.1  mrg % one that Bob is working on :).
   9101      1.1  mrg %
   9102      1.1  mrg \def\xrefprintnodename#1{[#1]}
   9103      1.1  mrg 
   9104      1.1  mrg % Things referred to by \setref.
   9105      1.1  mrg %
   9106      1.1  mrg \def\Ynothing{}
   9107      1.1  mrg \def\Yomitfromtoc{}
   9108      1.1  mrg \def\Ynumbered{%
   9109      1.1  mrg   \ifnum\secno=0
   9110      1.1  mrg     \putwordChapter@tie \the\chapno
   9111      1.1  mrg   \else \ifnum\subsecno=0
   9112      1.1  mrg     \putwordSection@tie \the\chapno.\the\secno
   9113      1.1  mrg   \else \ifnum\subsubsecno=0
   9114      1.1  mrg     \putwordSection@tie \the\chapno.\the\secno.\the\subsecno
   9115      1.1  mrg   \else
   9116      1.1  mrg     \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno
   9117      1.1  mrg   \fi\fi\fi
   9118      1.1  mrg }
   9119      1.1  mrg \def\Yappendix{%
   9120      1.1  mrg   \ifnum\secno=0
   9121      1.1  mrg      \putwordAppendix@tie @char\the\appendixno{}%
   9122      1.1  mrg   \else \ifnum\subsecno=0
   9123      1.1  mrg      \putwordSection@tie @char\the\appendixno.\the\secno
   9124      1.1  mrg   \else \ifnum\subsubsecno=0
   9125      1.1  mrg     \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno
   9126      1.1  mrg   \else
   9127      1.1  mrg     \putwordSection@tie
   9128  1.1.1.3  mrg       @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno
   9129  1.1.1.3  mrg   \fi\fi\fi
   9130      1.1  mrg }
   9131  1.1.1.3  mrg 
   9132      1.1  mrg % \refx{NAME}{SUFFIX} - reference a cross-reference string named NAME.  SUFFIX 
   9133      1.1  mrg % is output afterwards if non-empty.
   9134      1.1  mrg \def\refx#1#2{%
   9135  1.1.1.3  mrg   \requireauxfile
   9136      1.1  mrg   {%
   9137      1.1  mrg     \indexnofonts
   9138      1.1  mrg     \otherbackslash
   9139      1.1  mrg     \def\value##1{##1}%
   9140      1.1  mrg     \expandafter\global\expandafter\let\expandafter\thisrefX
   9141      1.1  mrg       \csname XR#1\endcsname
   9142      1.1  mrg   }%
   9143      1.1  mrg   \ifx\thisrefX\relax
   9144      1.1  mrg     % If not defined, say something at least.
   9145      1.1  mrg     \angleleft un\-de\-fined\angleright
   9146      1.1  mrg     \iflinks
   9147      1.1  mrg       \ifhavexrefs
   9148      1.1  mrg         {\toks0 = {#1}% avoid expansion of possibly-complex value
   9149      1.1  mrg          \message{\linenumber Undefined cross reference `\the\toks0'.}}%
   9150      1.1  mrg       \else
   9151      1.1  mrg         \ifwarnedxrefs\else
   9152      1.1  mrg           \global\warnedxrefstrue
   9153      1.1  mrg           \message{Cross reference values unknown; you must run TeX again.}%
   9154      1.1  mrg         \fi
   9155      1.1  mrg       \fi
   9156      1.1  mrg     \fi
   9157      1.1  mrg   \else
   9158      1.1  mrg     % It's defined, so just use it.
   9159      1.1  mrg     \thisrefX
   9160  1.1.1.3  mrg   \fi
   9161  1.1.1.3  mrg   #2% Output the suffix in any case.
   9162  1.1.1.3  mrg }
   9163  1.1.1.3  mrg 
   9164      1.1  mrg % This is the macro invoked by entries in the aux file.  Define a control 
   9165      1.1  mrg % sequence for a cross-reference target (we prepend XR to the control sequence 
   9166  1.1.1.3  mrg % name to avoid collisions).  The value is the page number.  If this is a float 
   9167  1.1.1.3  mrg % type, we have more work to do.
   9168  1.1.1.3  mrg %
   9169      1.1  mrg \def\xrdef#1#2{%
   9170      1.1  mrg   {% Expand the node or anchor name to remove control sequences.
   9171  1.1.1.3  mrg    % \turnoffactive stops 8-bit characters being changed to commands
   9172      1.1  mrg    % like @'e.  \refx does the same to retrieve the value in the definition.
   9173      1.1  mrg     \indexnofonts
   9174      1.1  mrg     \turnoffactive
   9175  1.1.1.3  mrg     \def\value##1{##1}%
   9176  1.1.1.3  mrg     \xdef\safexrefname{#1}%
   9177  1.1.1.3  mrg   }%
   9178  1.1.1.3  mrg   %
   9179  1.1.1.3  mrg   \bgroup
   9180  1.1.1.3  mrg     \expandafter\gdef\csname XR\safexrefname\endcsname{#2}%
   9181  1.1.1.3  mrg   \egroup
   9182      1.1  mrg   % We put the \gdef inside a group to avoid the definitions building up on 
   9183      1.1  mrg   % TeX's save stack, which can cause it to run out of space for aux files with 
   9184      1.1  mrg   % thousands of lines.  \gdef doesn't use the save stack, but \csname does
   9185      1.1  mrg   % when it defines an unknown control sequence as \relax. 
   9186      1.1  mrg   %
   9187      1.1  mrg   % Was that xref control sequence that we just defined for a float?
   9188      1.1  mrg   \expandafter\iffloat\csname XR\safexrefname\endcsname
   9189      1.1  mrg     % it was a float, and we have the (safe) float type in \iffloattype.
   9190      1.1  mrg     \expandafter\let\expandafter\floatlist
   9191      1.1  mrg       \csname floatlist\iffloattype\endcsname
   9192      1.1  mrg     %
   9193      1.1  mrg     % Is this the first time we've seen this float type?
   9194      1.1  mrg     \expandafter\ifx\floatlist\relax
   9195      1.1  mrg       \toks0 = {\do}% yes, so just \do
   9196      1.1  mrg     \else
   9197      1.1  mrg       % had it before, so preserve previous elements in list.
   9198      1.1  mrg       \toks0 = \expandafter{\floatlist\do}%
   9199      1.1  mrg     \fi
   9200      1.1  mrg     %
   9201      1.1  mrg     % Remember this xref in the control sequence \floatlistFLOATTYPE,
   9202      1.1  mrg     % for later use in \listoffloats.
   9203      1.1  mrg     \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0
   9204  1.1.1.3  mrg       {\safexrefname}}%
   9205  1.1.1.3  mrg   \fi
   9206  1.1.1.3  mrg }
   9207  1.1.1.3  mrg 
   9208  1.1.1.3  mrg % If working on a large document in chapters, it is convenient to
   9209  1.1.1.3  mrg % be able to disable indexing, cross-referencing, and contents, for test runs.
   9210  1.1.1.3  mrg % This is done with @novalidate at the beginning of the file.
   9211  1.1.1.3  mrg %
   9212  1.1.1.3  mrg \newif\iflinks \linkstrue % by default we want the aux files.
   9213  1.1.1.3  mrg \let\novalidate = \linksfalse
   9214  1.1.1.3  mrg 
   9215  1.1.1.3  mrg % Used when writing to the aux file, or when using data from it.
   9216  1.1.1.3  mrg \def\requireauxfile{%
   9217  1.1.1.3  mrg   \iflinks
   9218  1.1.1.3  mrg     \tryauxfile
   9219  1.1.1.3  mrg     % Open the new aux file.  TeX will close it automatically at exit.
   9220  1.1.1.3  mrg     \immediate\openout\auxfile=\jobname.aux
   9221      1.1  mrg   \fi
   9222      1.1  mrg   \global\let\requireauxfile=\relax   % Only do this once.
   9223      1.1  mrg }
   9224      1.1  mrg 
   9225      1.1  mrg % Read the last existing aux file, if any.  No error if none exists.
   9226      1.1  mrg %
   9227      1.1  mrg \def\tryauxfile{%
   9228      1.1  mrg   \openin 1 \jobname.aux
   9229      1.1  mrg   \ifeof 1 \else
   9230      1.1  mrg     \readdatafile{aux}%
   9231      1.1  mrg     \global\havexrefstrue
   9232      1.1  mrg   \fi
   9233      1.1  mrg   \closein 1
   9234      1.1  mrg }
   9235      1.1  mrg 
   9236      1.1  mrg \def\setupdatafile{%
   9237      1.1  mrg   \catcode`\^^@=\other
   9238      1.1  mrg   \catcode`\^^A=\other
   9239      1.1  mrg   \catcode`\^^B=\other
   9240      1.1  mrg   \catcode`\^^C=\other
   9241      1.1  mrg   \catcode`\^^D=\other
   9242      1.1  mrg   \catcode`\^^E=\other
   9243      1.1  mrg   \catcode`\^^F=\other
   9244      1.1  mrg   \catcode`\^^G=\other
   9245      1.1  mrg   \catcode`\^^H=\other
   9246      1.1  mrg   \catcode`\^^K=\other
   9247      1.1  mrg   \catcode`\^^L=\other
   9248      1.1  mrg   \catcode`\^^N=\other
   9249      1.1  mrg   \catcode`\^^P=\other
   9250      1.1  mrg   \catcode`\^^Q=\other
   9251      1.1  mrg   \catcode`\^^R=\other
   9252      1.1  mrg   \catcode`\^^S=\other
   9253      1.1  mrg   \catcode`\^^T=\other
   9254      1.1  mrg   \catcode`\^^U=\other
   9255      1.1  mrg   \catcode`\^^V=\other
   9256      1.1  mrg   \catcode`\^^W=\other
   9257      1.1  mrg   \catcode`\^^X=\other
   9258      1.1  mrg   \catcode`\^^Z=\other
   9259      1.1  mrg   \catcode`\^^[=\other
   9260      1.1  mrg   \catcode`\^^\=\other
   9261      1.1  mrg   \catcode`\^^]=\other
   9262      1.1  mrg   \catcode`\^^^=\other
   9263      1.1  mrg   \catcode`\^^_=\other
   9264      1.1  mrg   % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc.
   9265      1.1  mrg   % in xref tags, i.e., node names.  But since ^^e4 notation isn't
   9266      1.1  mrg   % supported in the main text, it doesn't seem desirable.  Furthermore,
   9267      1.1  mrg   % that is not enough: for node names that actually contain a ^
   9268      1.1  mrg   % character, we would end up writing a line like this: 'xrdef {'hat
   9269      1.1  mrg   % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
   9270      1.1  mrg   % argument, and \hat is not an expandable control sequence.  It could
   9271      1.1  mrg   % all be worked out, but why?  Either we support ^^ or we don't.
   9272      1.1  mrg   %
   9273      1.1  mrg   % The other change necessary for this was to define \auxhat:
   9274      1.1  mrg   % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
   9275      1.1  mrg   % and then to call \auxhat in \setq.
   9276      1.1  mrg   %
   9277      1.1  mrg   \catcode`\^=\other
   9278      1.1  mrg   %
   9279      1.1  mrg   % Special characters.  Should be turned off anyway, but...
   9280      1.1  mrg   \catcode`\~=\other
   9281      1.1  mrg   \catcode`\[=\other
   9282      1.1  mrg   \catcode`\]=\other
   9283      1.1  mrg   \catcode`\"=\other
   9284      1.1  mrg   \catcode`\_=\other
   9285      1.1  mrg   \catcode`\|=\other
   9286      1.1  mrg   \catcode`\<=\other
   9287      1.1  mrg   \catcode`\>=\other
   9288      1.1  mrg   \catcode`\$=\other
   9289      1.1  mrg   \catcode`\#=\other
   9290      1.1  mrg   \catcode`\&=\other
   9291      1.1  mrg   \catcode`\%=\other
   9292      1.1  mrg   \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
   9293      1.1  mrg   %
   9294      1.1  mrg   % This is to support \ in node names and titles, since the \
   9295      1.1  mrg   % characters end up in a \csname.  It's easier than
   9296      1.1  mrg   % leaving it active and making its active definition an actual \
   9297      1.1  mrg   % character.  What I don't understand is why it works in the *value*
   9298      1.1  mrg   % of the xrdef.  Seems like it should be a catcode12 \, and that
   9299      1.1  mrg   % should not typeset properly.  But it works, so I'm moving on for
   9300      1.1  mrg   % now.  --karl, 15jan04.
   9301      1.1  mrg   \catcode`\\=\other
   9302      1.1  mrg   %
   9303      1.1  mrg   % @ is our escape character in .aux files, and we need braces.
   9304      1.1  mrg   \catcode`\{=1
   9305      1.1  mrg   \catcode`\}=2
   9306      1.1  mrg   \catcode`\@=0
   9307      1.1  mrg }
   9308      1.1  mrg 
   9309      1.1  mrg \def\readdatafile#1{%
   9310      1.1  mrg \begingroup
   9311      1.1  mrg   \setupdatafile
   9312      1.1  mrg   \input\jobname.#1
   9313      1.1  mrg \endgroup}
   9314      1.1  mrg 
   9315      1.1  mrg 
   9316      1.1  mrg \message{insertions,}
   9317      1.1  mrg % including footnotes.
   9318      1.1  mrg 
   9319      1.1  mrg \newcount \footnoteno
   9320      1.1  mrg 
   9321      1.1  mrg % The trailing space in the following definition for supereject is
   9322      1.1  mrg % vital for proper filling; pages come out unaligned when you do a
   9323      1.1  mrg % pagealignmacro call if that space before the closing brace is
   9324      1.1  mrg % removed. (Generally, numeric constants should always be followed by a
   9325      1.1  mrg % space to prevent strange expansion errors.)
   9326      1.1  mrg \def\supereject{\par\penalty -20000\footnoteno =0 }
   9327      1.1  mrg 
   9328      1.1  mrg % @footnotestyle is meaningful for Info output only.
   9329      1.1  mrg \let\footnotestyle=\comment
   9330      1.1  mrg 
   9331      1.1  mrg {\catcode `\@=11
   9332      1.1  mrg %
   9333      1.1  mrg % Auto-number footnotes.  Otherwise like plain.
   9334      1.1  mrg \gdef\footnote{%
   9335      1.1  mrg   \global\advance\footnoteno by \@ne
   9336      1.1  mrg   \edef\thisfootno{$^{\the\footnoteno}$}%
   9337      1.1  mrg   %
   9338      1.1  mrg   % In case the footnote comes at the end of a sentence, preserve the
   9339      1.1  mrg   % extra spacing after we do the footnote number.
   9340      1.1  mrg   \let\@sf\empty
   9341      1.1  mrg   \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi
   9342      1.1  mrg   %
   9343      1.1  mrg   % Remove inadvertent blank space before typesetting the footnote number.
   9344      1.1  mrg   \unskip
   9345      1.1  mrg   \thisfootno\@sf
   9346      1.1  mrg   \dofootnote
   9347      1.1  mrg }%
   9348      1.1  mrg 
   9349      1.1  mrg % Don't bother with the trickery in plain.tex to not require the
   9350      1.1  mrg % footnote text as a parameter.  Our footnotes don't need to be so general.
   9351      1.1  mrg %
   9352      1.1  mrg % Oh yes, they do; otherwise, @ifset (and anything else that uses
   9353      1.1  mrg % \parseargline) fails inside footnotes because the tokens are fixed when
   9354  1.1.1.3  mrg % the footnote is read.  --karl, 16nov96.
   9355  1.1.1.3  mrg %
   9356  1.1.1.3  mrg \gdef\dofootnote{%
   9357  1.1.1.3  mrg   \insert\footins\bgroup
   9358  1.1.1.3  mrg   %
   9359      1.1  mrg   % Nested footnotes are not supported in TeX, that would take a lot
   9360      1.1  mrg   % more work.  (\startsavinginserts does not suffice.)
   9361      1.1  mrg   \let\footnote=\errfootnotenest
   9362  1.1.1.3  mrg   %
   9363      1.1  mrg   % We want to typeset this text as a normal paragraph, even if the
   9364      1.1  mrg   % footnote reference occurs in (for example) a display environment.
   9365      1.1  mrg   % So reset some parameters.
   9366      1.1  mrg   \hsize=\txipagewidth
   9367      1.1  mrg   \interlinepenalty\interfootnotelinepenalty
   9368      1.1  mrg   \splittopskip\ht\strutbox % top baseline for broken footnotes
   9369      1.1  mrg   \splitmaxdepth\dp\strutbox
   9370      1.1  mrg   \floatingpenalty\@MM
   9371      1.1  mrg   \leftskip\z@skip
   9372      1.1  mrg   \rightskip\z@skip
   9373      1.1  mrg   \spaceskip\z@skip
   9374      1.1  mrg   \xspaceskip\z@skip
   9375      1.1  mrg   \parindent\defaultparindent
   9376      1.1  mrg   %
   9377      1.1  mrg   \smallfonts \rm
   9378      1.1  mrg   %
   9379      1.1  mrg   % Because we use hanging indentation in footnotes, a @noindent appears
   9380      1.1  mrg   % to exdent this text, so make it be a no-op.  makeinfo does not use
   9381      1.1  mrg   % hanging indentation so @noindent can still be needed within footnote
   9382      1.1  mrg   % text after an @example or the like (not that this is good style).
   9383      1.1  mrg   \let\noindent = \relax
   9384      1.1  mrg   %
   9385      1.1  mrg   % Hang the footnote text off the number.  Use \everypar in case the
   9386      1.1  mrg   % footnote extends for more than one paragraph.
   9387      1.1  mrg   \everypar = {\hang}%
   9388      1.1  mrg   \textindent{\thisfootno}%
   9389      1.1  mrg   %
   9390      1.1  mrg   % Don't crash into the line above the footnote text.  Since this
   9391      1.1  mrg   % expands into a box, it must come within the paragraph, lest it
   9392      1.1  mrg   % provide a place where TeX can split the footnote.
   9393      1.1  mrg   \footstrut
   9394      1.1  mrg   %
   9395      1.1  mrg   % Invoke rest of plain TeX footnote routine.
   9396  1.1.1.3  mrg   \futurelet\next\fo@t
   9397  1.1.1.3  mrg }
   9398  1.1.1.3  mrg }%end \catcode `\@=11
   9399  1.1.1.3  mrg 
   9400  1.1.1.3  mrg \def\errfootnotenest{%
   9401  1.1.1.3  mrg   \errhelp=\EMsimple
   9402  1.1.1.3  mrg   \errmessage{Nested footnotes not supported in texinfo.tex,
   9403  1.1.1.3  mrg     even though they work in makeinfo; sorry}
   9404  1.1.1.3  mrg }
   9405  1.1.1.3  mrg 
   9406  1.1.1.3  mrg \def\errfootnoteheading{%
   9407      1.1  mrg   \errhelp=\EMsimple
   9408      1.1  mrg   \errmessage{Footnotes in chapters, sections, etc., are not supported}
   9409      1.1  mrg }
   9410      1.1  mrg 
   9411      1.1  mrg % In case a @footnote appears in a vbox, save the footnote text and create
   9412      1.1  mrg % the real \insert just after the vbox finished.  Otherwise, the insertion
   9413  1.1.1.3  mrg % would be lost.
   9414      1.1  mrg % Similarly, if a @footnote appears inside an alignment, save the footnote
   9415      1.1  mrg % text to a box and make the \insert when a row of the table is finished.
   9416      1.1  mrg % And the same can be done for other insert classes.  --kasal, 16nov03.
   9417      1.1  mrg %
   9418      1.1  mrg % Replace the \insert primitive by a cheating macro.
   9419      1.1  mrg % Deeper inside, just make sure that the saved insertions are not spilled
   9420      1.1  mrg % out prematurely.
   9421      1.1  mrg %
   9422      1.1  mrg \def\startsavinginserts{%
   9423      1.1  mrg   \ifx \insert\ptexinsert
   9424      1.1  mrg     \let\insert\saveinsert
   9425      1.1  mrg   \else
   9426      1.1  mrg     \let\checkinserts\relax
   9427      1.1  mrg   \fi
   9428      1.1  mrg }
   9429      1.1  mrg 
   9430      1.1  mrg % This \insert replacement works for both \insert\footins{foo} and
   9431      1.1  mrg % \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}.
   9432      1.1  mrg %
   9433      1.1  mrg \def\saveinsert#1{%
   9434      1.1  mrg   \edef\next{\noexpand\savetobox \makeSAVEname#1}%
   9435      1.1  mrg   \afterassignment\next
   9436      1.1  mrg   % swallow the left brace
   9437      1.1  mrg   \let\temp =
   9438      1.1  mrg }
   9439      1.1  mrg \def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}}
   9440      1.1  mrg \def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1}
   9441      1.1  mrg 
   9442      1.1  mrg \def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi}
   9443      1.1  mrg 
   9444      1.1  mrg \def\placesaveins#1{%
   9445      1.1  mrg   \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname
   9446      1.1  mrg     {\box#1}%
   9447      1.1  mrg }
   9448      1.1  mrg 
   9449      1.1  mrg % eat @SAVE -- beware, all of them have catcode \other:
   9450      1.1  mrg {
   9451      1.1  mrg   \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials  %  ;-)
   9452      1.1  mrg   \gdef\gobblesave @SAVE{}
   9453      1.1  mrg }
   9454      1.1  mrg 
   9455      1.1  mrg % initialization:
   9456      1.1  mrg \def\newsaveins #1{%
   9457      1.1  mrg   \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}%
   9458      1.1  mrg   \next
   9459      1.1  mrg }
   9460      1.1  mrg \def\newsaveinsX #1{%
   9461      1.1  mrg   \csname newbox\endcsname #1%
   9462      1.1  mrg   \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts
   9463      1.1  mrg     \checksaveins #1}%
   9464      1.1  mrg }
   9465      1.1  mrg 
   9466      1.1  mrg % initialize:
   9467      1.1  mrg \let\checkinserts\empty
   9468      1.1  mrg \newsaveins\footins
   9469      1.1  mrg \newsaveins\margin
   9470      1.1  mrg 
   9471      1.1  mrg 
   9472      1.1  mrg % @image.  We use the macros from epsf.tex to support this.
   9473      1.1  mrg % If epsf.tex is not installed and @image is used, we complain.
   9474      1.1  mrg %
   9475      1.1  mrg % Check for and read epsf.tex up front.  If we read it only at @image
   9476      1.1  mrg % time, we might be inside a group, and then its definitions would get
   9477      1.1  mrg % undone and the next image would fail.
   9478      1.1  mrg \openin 1 = epsf.tex
   9479      1.1  mrg \ifeof 1 \else
   9480      1.1  mrg   % Do not bother showing banner with epsf.tex v2.7k (available in
   9481      1.1  mrg   % doc/epsf.tex and on ctan).
   9482      1.1  mrg   \def\epsfannounce{\toks0 = }%
   9483      1.1  mrg   \input epsf.tex
   9484      1.1  mrg \fi
   9485      1.1  mrg \closein 1
   9486      1.1  mrg %
   9487  1.1.1.3  mrg % We will only complain once about lack of epsf.tex.
   9488      1.1  mrg \newif\ifwarnednoepsf
   9489      1.1  mrg \newhelp\noepsfhelp{epsf.tex must be installed for images to
   9490      1.1  mrg   work.  It is also included in the Texinfo distribution, or you can get
   9491      1.1  mrg   it from https://ctan.org/texarchive/macros/texinfo/texinfo/doc/epsf.tex.}
   9492      1.1  mrg %
   9493      1.1  mrg \def\image#1{%
   9494      1.1  mrg   \ifx\epsfbox\thisisundefined
   9495      1.1  mrg     \ifwarnednoepsf \else
   9496      1.1  mrg       \errhelp = \noepsfhelp
   9497      1.1  mrg       \errmessage{epsf.tex not found, images will be ignored}%
   9498      1.1  mrg       \global\warnednoepsftrue
   9499      1.1  mrg     \fi
   9500      1.1  mrg   \else
   9501      1.1  mrg     \imagexxx #1,,,,,\finish
   9502      1.1  mrg   \fi
   9503      1.1  mrg }
   9504      1.1  mrg %
   9505      1.1  mrg % Arguments to @image:
   9506      1.1  mrg % #1 is (mandatory) image filename; we tack on .eps extension.
   9507      1.1  mrg % #2 is (optional) width, #3 is (optional) height.
   9508      1.1  mrg % #4 is (ignored optional) html alt text.
   9509      1.1  mrg % #5 is (ignored optional) extension.
   9510      1.1  mrg % #6 is just the usual extra ignored arg for parsing stuff.
   9511  1.1.1.3  mrg \newif\ifimagevmode
   9512      1.1  mrg \def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
   9513      1.1  mrg   \catcode`\^^M = 5     % in case we're inside an example
   9514      1.1  mrg   \normalturnoffactive  % allow _ et al. in names
   9515      1.1  mrg   \def\xprocessmacroarg{\eatspaces}% in case we are being used via a macro
   9516      1.1  mrg   % If the image is by itself, center it.
   9517      1.1  mrg   \ifvmode
   9518      1.1  mrg     \imagevmodetrue
   9519      1.1  mrg   \else \ifx\centersub\centerV
   9520      1.1  mrg     % for @center @image, we need a vbox so we can have our vertical space
   9521      1.1  mrg     \imagevmodetrue
   9522      1.1  mrg     \vbox\bgroup % vbox has better behavior than vtop herev
   9523      1.1  mrg   \fi\fi
   9524      1.1  mrg   %
   9525      1.1  mrg   \ifimagevmode
   9526      1.1  mrg     \nobreak\medskip
   9527      1.1  mrg     % Usually we'll have text after the image which will insert
   9528      1.1  mrg     % \parskip glue, so insert it here too to equalize the space
   9529      1.1  mrg     % above and below.
   9530      1.1  mrg     \nobreak\vskip\parskip
   9531      1.1  mrg     \nobreak
   9532      1.1  mrg   \fi
   9533      1.1  mrg   %
   9534      1.1  mrg   % Leave vertical mode so that indentation from an enclosing
   9535      1.1  mrg   %  environment such as @quotation is respected.
   9536      1.1  mrg   % However, if we're at the top level, we don't want the
   9537      1.1  mrg   %  normal paragraph indentation.
   9538      1.1  mrg   % On the other hand, if we are in the case of @center @image, we don't
   9539      1.1  mrg   %  want to start a paragraph, which will create a hsize-width box and
   9540      1.1  mrg   %  eradicate the centering.
   9541  1.1.1.3  mrg   \ifx\centersub\centerV\else \noindent \fi
   9542      1.1  mrg   %
   9543      1.1  mrg   % Output the image.
   9544  1.1.1.3  mrg   \ifpdf
   9545  1.1.1.3  mrg     % For pdfTeX and LuaTeX <= 0.80
   9546  1.1.1.3  mrg     \dopdfimage{#1}{#2}{#3}%
   9547  1.1.1.3  mrg   \else
   9548  1.1.1.3  mrg     \ifx\XeTeXrevision\thisisundefined
   9549  1.1.1.3  mrg       % For epsf.tex
   9550  1.1.1.3  mrg       % \epsfbox itself resets \epsf?size at each figure.
   9551  1.1.1.3  mrg       \setbox0 = \hbox{\ignorespaces #2}%
   9552  1.1.1.3  mrg         \ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
   9553  1.1.1.3  mrg       \setbox0 = \hbox{\ignorespaces #3}%
   9554  1.1.1.3  mrg         \ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
   9555  1.1.1.3  mrg       \epsfbox{#1.eps}%
   9556      1.1  mrg     \else
   9557      1.1  mrg       % For XeTeX
   9558      1.1  mrg       \doxeteximage{#1}{#2}{#3}%
   9559      1.1  mrg     \fi
   9560      1.1  mrg   \fi
   9561      1.1  mrg   %
   9562      1.1  mrg   \ifimagevmode
   9563      1.1  mrg     \medskip  % space after a standalone image
   9564      1.1  mrg   \fi  
   9565      1.1  mrg   \ifx\centersub\centerV \egroup \fi
   9566      1.1  mrg \endgroup}
   9567      1.1  mrg 
   9568      1.1  mrg 
   9569      1.1  mrg % @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables,
   9570      1.1  mrg % etc.  We don't actually implement floating yet, we always include the
   9571      1.1  mrg % float "here".  But it seemed the best name for the future.
   9572      1.1  mrg %
   9573      1.1  mrg \envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish}
   9574      1.1  mrg 
   9575      1.1  mrg % There may be a space before second and/or third parameter; delete it.
   9576      1.1  mrg \def\eatcommaspace#1, {#1,}
   9577      1.1  mrg 
   9578      1.1  mrg % #1 is the optional FLOATTYPE, the text label for this float, typically
   9579      1.1  mrg % "Figure", "Table", "Example", etc.  Can't contain commas.  If omitted,
   9580      1.1  mrg % this float will not be numbered and cannot be referred to.
   9581      1.1  mrg %
   9582      1.1  mrg % #2 is the optional xref label.  Also must be present for the float to
   9583      1.1  mrg % be referable.
   9584      1.1  mrg %
   9585      1.1  mrg % #3 is the optional positioning argument; for now, it is ignored.  It
   9586      1.1  mrg % will somehow specify the positions allowed to float to (here, top, bottom).
   9587      1.1  mrg %
   9588      1.1  mrg % We keep a separate counter for each FLOATTYPE, which we reset at each
   9589      1.1  mrg % chapter-level command.
   9590      1.1  mrg \let\resetallfloatnos=\empty
   9591      1.1  mrg %
   9592      1.1  mrg \def\dofloat#1,#2,#3,#4\finish{%
   9593      1.1  mrg   \let\thiscaption=\empty
   9594      1.1  mrg   \let\thisshortcaption=\empty
   9595      1.1  mrg   %
   9596      1.1  mrg   % don't lose footnotes inside @float.
   9597      1.1  mrg   %
   9598      1.1  mrg   % BEWARE: when the floats start float, we have to issue warning whenever an
   9599      1.1  mrg   % insert appears inside a float which could possibly float. --kasal, 26may04
   9600      1.1  mrg   %
   9601      1.1  mrg   \startsavinginserts
   9602      1.1  mrg   %
   9603      1.1  mrg   % We can't be used inside a paragraph.
   9604      1.1  mrg   \par
   9605      1.1  mrg   %
   9606      1.1  mrg   \vtop\bgroup
   9607      1.1  mrg     \def\floattype{#1}%
   9608      1.1  mrg     \def\floatlabel{#2}%
   9609      1.1  mrg     \def\floatloc{#3}% we do nothing with this yet.
   9610      1.1  mrg     %
   9611      1.1  mrg     \ifx\floattype\empty
   9612      1.1  mrg       \let\safefloattype=\empty
   9613      1.1  mrg     \else
   9614      1.1  mrg       {%
   9615      1.1  mrg         % the floattype might have accents or other special characters,
   9616      1.1  mrg         % but we need to use it in a control sequence name.
   9617      1.1  mrg         \indexnofonts
   9618      1.1  mrg         \turnoffactive
   9619      1.1  mrg         \xdef\safefloattype{\floattype}%
   9620      1.1  mrg       }%
   9621      1.1  mrg     \fi
   9622      1.1  mrg     %
   9623      1.1  mrg     % If label is given but no type, we handle that as the empty type.
   9624      1.1  mrg     \ifx\floatlabel\empty \else
   9625      1.1  mrg       % We want each FLOATTYPE to be numbered separately (Figure 1,
   9626      1.1  mrg       % Table 1, Figure 2, ...).  (And if no label, no number.)
   9627      1.1  mrg       %
   9628      1.1  mrg       \expandafter\getfloatno\csname\safefloattype floatno\endcsname
   9629      1.1  mrg       \global\advance\floatno by 1
   9630      1.1  mrg       %
   9631      1.1  mrg       {%
   9632      1.1  mrg         % This magic value for \lastsection is output by \setref as the
   9633      1.1  mrg         % XREFLABEL-title value.  \xrefX uses it to distinguish float
   9634      1.1  mrg         % labels (which have a completely different output format) from
   9635      1.1  mrg         % node and anchor labels.  And \xrdef uses it to construct the
   9636      1.1  mrg         % lists of floats.
   9637      1.1  mrg         %
   9638      1.1  mrg         \edef\lastsection{\floatmagic=\safefloattype}%
   9639      1.1  mrg         \setref{\floatlabel}{Yfloat}%
   9640      1.1  mrg       }%
   9641      1.1  mrg     \fi
   9642      1.1  mrg     %
   9643      1.1  mrg     % start with \parskip glue, I guess.
   9644      1.1  mrg     \vskip\parskip
   9645      1.1  mrg     %
   9646      1.1  mrg     % Don't suppress indentation if a float happens to start a section.
   9647      1.1  mrg     \restorefirstparagraphindent
   9648      1.1  mrg }
   9649      1.1  mrg 
   9650      1.1  mrg % we have these possibilities:
   9651      1.1  mrg % @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap
   9652      1.1  mrg % @float Foo,lbl & no caption:    Foo 1.1
   9653      1.1  mrg % @float Foo & @caption{Cap}:     Foo: Cap
   9654      1.1  mrg % @float Foo & no caption:        Foo
   9655      1.1  mrg % @float ,lbl & Caption{Cap}:     1.1: Cap
   9656      1.1  mrg % @float ,lbl & no caption:       1.1
   9657      1.1  mrg % @float & @caption{Cap}:         Cap
   9658      1.1  mrg % @float & no caption:
   9659      1.1  mrg %
   9660      1.1  mrg \def\Efloat{%
   9661      1.1  mrg     \let\floatident = \empty
   9662      1.1  mrg     %
   9663      1.1  mrg     % In all cases, if we have a float type, it comes first.
   9664      1.1  mrg     \ifx\floattype\empty \else \def\floatident{\floattype}\fi
   9665      1.1  mrg     %
   9666      1.1  mrg     % If we have an xref label, the number comes next.
   9667      1.1  mrg     \ifx\floatlabel\empty \else
   9668      1.1  mrg       \ifx\floattype\empty \else % if also had float type, need tie first.
   9669      1.1  mrg         \appendtomacro\floatident{\tie}%
   9670      1.1  mrg       \fi
   9671      1.1  mrg       % the number.
   9672      1.1  mrg       \appendtomacro\floatident{\chaplevelprefix\the\floatno}%
   9673      1.1  mrg     \fi
   9674      1.1  mrg     %
   9675      1.1  mrg     % Start the printed caption with what we've constructed in
   9676      1.1  mrg     % \floatident, but keep it separate; we need \floatident again.
   9677  1.1.1.3  mrg     \let\captionline = \floatident
   9678      1.1  mrg     %
   9679      1.1  mrg     \ifx\thiscaption\empty \else
   9680      1.1  mrg       \ifx\floatident\empty \else
   9681      1.1  mrg         \appendtomacro\captionline{: }% had ident, so need a colon between
   9682      1.1  mrg       \fi
   9683      1.1  mrg       %
   9684      1.1  mrg       % caption text.
   9685      1.1  mrg       \appendtomacro\captionline{\scanexp\thiscaption}%
   9686      1.1  mrg     \fi
   9687      1.1  mrg     %
   9688      1.1  mrg     % If we have anything to print, print it, with space before.
   9689      1.1  mrg     % Eventually this needs to become an \insert.
   9690      1.1  mrg     \ifx\captionline\empty \else
   9691      1.1  mrg       \vskip.5\parskip
   9692      1.1  mrg       \captionline
   9693      1.1  mrg       %
   9694      1.1  mrg       % Space below caption.
   9695      1.1  mrg       \vskip\parskip
   9696      1.1  mrg     \fi
   9697      1.1  mrg     %
   9698      1.1  mrg     % If have an xref label, write the list of floats info.  Do this
   9699      1.1  mrg     % after the caption, to avoid chance of it being a breakpoint.
   9700      1.1  mrg     \ifx\floatlabel\empty \else
   9701  1.1.1.3  mrg       % Write the text that goes in the lof to the aux file as
   9702      1.1  mrg       % \floatlabel-lof.  Besides \floatident, we include the short
   9703      1.1  mrg       % caption if specified, else the full caption if specified, else nothing.
   9704  1.1.1.3  mrg       {%
   9705  1.1.1.3  mrg         \requireauxfile
   9706  1.1.1.3  mrg         \atdummies
   9707  1.1.1.3  mrg         %
   9708  1.1.1.3  mrg         \ifx\thisshortcaption\empty
   9709      1.1  mrg           \def\gtemp{\thiscaption}%
   9710  1.1.1.3  mrg         \else
   9711      1.1  mrg           \def\gtemp{\thisshortcaption}%
   9712      1.1  mrg         \fi
   9713      1.1  mrg         \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident
   9714      1.1  mrg           \ifx\gtemp\empty \else : \gtemp \fi}}%
   9715      1.1  mrg       }%
   9716      1.1  mrg     \fi
   9717      1.1  mrg   \egroup  % end of \vtop
   9718      1.1  mrg   %
   9719      1.1  mrg   \checkinserts
   9720      1.1  mrg }
   9721      1.1  mrg 
   9722      1.1  mrg % Append the tokens #2 to the definition of macro #1, not expanding either.
   9723      1.1  mrg %
   9724      1.1  mrg \def\appendtomacro#1#2{%
   9725      1.1  mrg   \expandafter\def\expandafter#1\expandafter{#1#2}%
   9726      1.1  mrg }
   9727      1.1  mrg 
   9728      1.1  mrg % @caption, @shortcaption
   9729      1.1  mrg %
   9730      1.1  mrg \def\caption{\docaption\thiscaption}
   9731      1.1  mrg \def\shortcaption{\docaption\thisshortcaption}
   9732      1.1  mrg \def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption}
   9733      1.1  mrg \def\defcaption#1#2{\egroup \def#1{#2}}
   9734      1.1  mrg 
   9735      1.1  mrg % The parameter is the control sequence identifying the counter we are
   9736      1.1  mrg % going to use.  Create it if it doesn't exist and assign it to \floatno.
   9737      1.1  mrg \def\getfloatno#1{%
   9738      1.1  mrg   \ifx#1\relax
   9739      1.1  mrg       % Haven't seen this figure type before.
   9740      1.1  mrg       \csname newcount\endcsname #1%
   9741      1.1  mrg       %
   9742      1.1  mrg       % Remember to reset this floatno at the next chap.
   9743      1.1  mrg       \expandafter\gdef\expandafter\resetallfloatnos
   9744      1.1  mrg         \expandafter{\resetallfloatnos #1=0 }%
   9745      1.1  mrg   \fi
   9746      1.1  mrg   \let\floatno#1%
   9747      1.1  mrg }
   9748      1.1  mrg 
   9749      1.1  mrg % \setref calls this to get the XREFLABEL-snt value.  We want an @xref
   9750      1.1  mrg % to the FLOATLABEL to expand to "Figure 3.1".  We call \setref when we
   9751      1.1  mrg % first read the @float command.
   9752      1.1  mrg %
   9753      1.1  mrg \def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}%
   9754      1.1  mrg 
   9755      1.1  mrg % Magic string used for the XREFLABEL-title value, so \xrefX can
   9756      1.1  mrg % distinguish floats from other xref types.
   9757      1.1  mrg \def\floatmagic{!!float!!}
   9758      1.1  mrg 
   9759      1.1  mrg % #1 is the control sequence we are passed; we expand into a conditional
   9760      1.1  mrg % which is true if #1 represents a float ref.  That is, the magic
   9761      1.1  mrg % \lastsection value which we \setref above.
   9762      1.1  mrg %
   9763      1.1  mrg \def\iffloat#1{\expandafter\doiffloat#1==\finish}
   9764      1.1  mrg %
   9765      1.1  mrg % #1 is (maybe) the \floatmagic string.  If so, #2 will be the
   9766      1.1  mrg % (safe) float type for this float.  We set \iffloattype to #2.
   9767      1.1  mrg %
   9768      1.1  mrg \def\doiffloat#1=#2=#3\finish{%
   9769      1.1  mrg   \def\temp{#1}%
   9770      1.1  mrg   \def\iffloattype{#2}%
   9771      1.1  mrg   \ifx\temp\floatmagic
   9772      1.1  mrg }
   9773      1.1  mrg 
   9774      1.1  mrg % @listoffloats FLOATTYPE - print a list of floats like a table of contents.
   9775      1.1  mrg %
   9776      1.1  mrg \parseargdef\listoffloats{%
   9777      1.1  mrg   \def\floattype{#1}% floattype
   9778      1.1  mrg   {%
   9779      1.1  mrg     % the floattype might have accents or other special characters,
   9780      1.1  mrg     % but we need to use it in a control sequence name.
   9781      1.1  mrg     \indexnofonts
   9782      1.1  mrg     \turnoffactive
   9783      1.1  mrg     \xdef\safefloattype{\floattype}%
   9784      1.1  mrg   }%
   9785      1.1  mrg   %
   9786      1.1  mrg   % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE.
   9787      1.1  mrg   \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax
   9788      1.1  mrg     \ifhavexrefs
   9789      1.1  mrg       % if the user said @listoffloats foo but never @float foo.
   9790      1.1  mrg       \message{\linenumber No `\safefloattype' floats to list.}%
   9791      1.1  mrg     \fi
   9792      1.1  mrg   \else
   9793      1.1  mrg     \begingroup
   9794      1.1  mrg       \leftskip=\tocindent  % indent these entries like a toc
   9795      1.1  mrg       \let\do=\listoffloatsdo
   9796      1.1  mrg       \csname floatlist\safefloattype\endcsname
   9797      1.1  mrg     \endgroup
   9798      1.1  mrg   \fi
   9799      1.1  mrg }
   9800      1.1  mrg 
   9801      1.1  mrg % This is called on each entry in a list of floats.  We're passed the
   9802      1.1  mrg % xref label, in the form LABEL-title, which is how we save it in the
   9803      1.1  mrg % aux file.  We strip off the -title and look up \XRLABEL-lof, which
   9804      1.1  mrg % has the text we're supposed to typeset here.
   9805      1.1  mrg %
   9806      1.1  mrg % Figures without xref labels will not be included in the list (since
   9807      1.1  mrg % they won't appear in the aux file).
   9808      1.1  mrg %
   9809      1.1  mrg \def\listoffloatsdo#1{\listoffloatsdoentry#1\finish}
   9810      1.1  mrg \def\listoffloatsdoentry#1-title\finish{{%
   9811      1.1  mrg   % Can't fully expand XR#1-lof because it can contain anything.  Just
   9812      1.1  mrg   % pass the control sequence.  On the other hand, XR#1-pg is just the
   9813      1.1  mrg   % page number, and we want to fully expand that so we can get a link
   9814      1.1  mrg   % in pdf output.
   9815      1.1  mrg   \toksA = \expandafter{\csname XR#1-lof\endcsname}%
   9816      1.1  mrg   %
   9817      1.1  mrg   % use the same \entry macro we use to generate the TOC and index.
   9818      1.1  mrg   \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}%
   9819      1.1  mrg   \writeentry
   9820      1.1  mrg }}
   9821      1.1  mrg 
   9822      1.1  mrg 
   9823      1.1  mrg \message{localization,}
   9824      1.1  mrg 
   9825      1.1  mrg % For single-language documents, @documentlanguage is usually given very
   9826      1.1  mrg % early, just after @documentencoding.  Single argument is the language
   9827      1.1  mrg % (de) or locale (de_DE) abbreviation.
   9828  1.1.1.3  mrg %
   9829      1.1  mrg {
   9830      1.1  mrg   \catcode`\_ = \active
   9831  1.1.1.3  mrg   \globaldefs=1
   9832      1.1  mrg \parseargdef\documentlanguage{%
   9833      1.1  mrg   \tex % read txi-??.tex file in plain TeX.
   9834  1.1.1.3  mrg     % Read the file by the name they passed if it exists.
   9835      1.1  mrg     \let_ = \normalunderscore  % normal _ character for filename test
   9836      1.1  mrg     \openin 1 txi-#1.tex
   9837      1.1  mrg     \ifeof 1
   9838      1.1  mrg       \documentlanguagetrywithoutunderscore #1_\finish
   9839      1.1  mrg     \else
   9840      1.1  mrg       \globaldefs = 1  % everything in the txi-LL files needs to persist
   9841  1.1.1.3  mrg       \input txi-#1.tex
   9842      1.1  mrg     \fi
   9843      1.1  mrg     \closein 1
   9844      1.1  mrg   \endgroup % end raw TeX
   9845      1.1  mrg }
   9846      1.1  mrg %
   9847      1.1  mrg % If they passed de_DE, and txi-de_DE.tex doesn't exist,
   9848      1.1  mrg % try txi-de.tex.
   9849      1.1  mrg %
   9850      1.1  mrg \gdef\documentlanguagetrywithoutunderscore#1_#2\finish{%
   9851      1.1  mrg   \openin 1 txi-#1.tex
   9852      1.1  mrg   \ifeof 1
   9853      1.1  mrg     \errhelp = \nolanghelp
   9854      1.1  mrg     \errmessage{Cannot read language file txi-#1.tex}%
   9855      1.1  mrg   \else
   9856      1.1  mrg     \globaldefs = 1  % everything in the txi-LL files needs to persist
   9857      1.1  mrg     \input txi-#1.tex
   9858      1.1  mrg   \fi
   9859      1.1  mrg   \closein 1
   9860      1.1  mrg }
   9861      1.1  mrg }% end of special _ catcode
   9862      1.1  mrg %
   9863      1.1  mrg \newhelp\nolanghelp{The given language definition file cannot be found or
   9864      1.1  mrg is empty.  Maybe you need to install it?  Putting it in the current
   9865      1.1  mrg directory should work if nowhere else does.}
   9866      1.1  mrg 
   9867      1.1  mrg % This macro is called from txi-??.tex files; the first argument is the
   9868      1.1  mrg % \language name to set (without the "\lang@" prefix), the second and
   9869      1.1  mrg % third args are \{left,right}hyphenmin.
   9870      1.1  mrg %
   9871      1.1  mrg % The language names to pass are determined when the format is built.
   9872      1.1  mrg % See the etex.log file created at that time, e.g.,
   9873      1.1  mrg % /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log.
   9874      1.1  mrg %
   9875      1.1  mrg % With TeX Live 2008, etex now includes hyphenation patterns for all
   9876      1.1  mrg % available languages.  This means we can support hyphenation in
   9877      1.1  mrg % Texinfo, at least to some extent.  (This still doesn't solve the
   9878      1.1  mrg % accented characters problem.)
   9879      1.1  mrg %
   9880      1.1  mrg \catcode`@=11
   9881      1.1  mrg \def\txisetlanguage#1#2#3{%
   9882      1.1  mrg   % do not set the language if the name is undefined in the current TeX.
   9883      1.1  mrg   \expandafter\ifx\csname lang@#1\endcsname \relax
   9884      1.1  mrg     \message{no patterns for #1}%
   9885      1.1  mrg   \else
   9886      1.1  mrg     \global\language = \csname lang@#1\endcsname
   9887      1.1  mrg   \fi
   9888      1.1  mrg   % but there is no harm in adjusting the hyphenmin values regardless.
   9889  1.1.1.3  mrg   \global\lefthyphenmin = #2\relax
   9890  1.1.1.3  mrg   \global\righthyphenmin = #3\relax
   9891  1.1.1.3  mrg }
   9892  1.1.1.3  mrg 
   9893  1.1.1.3  mrg % XeTeX and LuaTeX can handle Unicode natively.
   9894  1.1.1.3  mrg % Their default I/O uses UTF-8 sequences instead of a byte-wise operation.
   9895  1.1.1.3  mrg % Other TeX engines' I/O (pdfTeX, etc.) is byte-wise.
   9896  1.1.1.3  mrg %
   9897  1.1.1.3  mrg \newif\iftxinativeunicodecapable
   9898  1.1.1.3  mrg \newif\iftxiusebytewiseio
   9899  1.1.1.3  mrg 
   9900  1.1.1.3  mrg \ifx\XeTeXrevision\thisisundefined
   9901  1.1.1.3  mrg   \ifx\luatexversion\thisisundefined
   9902  1.1.1.3  mrg     \txinativeunicodecapablefalse
   9903  1.1.1.3  mrg     \txiusebytewiseiotrue
   9904  1.1.1.3  mrg   \else
   9905  1.1.1.3  mrg     \txinativeunicodecapabletrue
   9906  1.1.1.3  mrg     \txiusebytewiseiofalse
   9907  1.1.1.3  mrg   \fi
   9908  1.1.1.3  mrg \else
   9909  1.1.1.3  mrg   \txinativeunicodecapabletrue
   9910  1.1.1.3  mrg   \txiusebytewiseiofalse
   9911  1.1.1.3  mrg \fi
   9912  1.1.1.3  mrg 
   9913  1.1.1.3  mrg % Set I/O by bytes instead of UTF-8 sequence for XeTeX and LuaTex
   9914  1.1.1.3  mrg % for non-UTF-8 (byte-wise) encodings.
   9915  1.1.1.3  mrg %
   9916  1.1.1.3  mrg \def\setbytewiseio{%
   9917  1.1.1.3  mrg   \ifx\XeTeXrevision\thisisundefined
   9918  1.1.1.3  mrg   \else
   9919  1.1.1.3  mrg     \XeTeXdefaultencoding "bytes"  % For subsequent files to be read
   9920  1.1.1.3  mrg     \XeTeXinputencoding "bytes"  % For document root file
   9921  1.1.1.3  mrg     % Unfortunately, there seems to be no corresponding XeTeX command for
   9922  1.1.1.3  mrg     % output encoding.  This is a problem for auxiliary index and TOC files.
   9923  1.1.1.3  mrg     % The only solution would be perhaps to write out @U{...} sequences in
   9924  1.1.1.3  mrg     % place of non-ASCII characters.
   9925  1.1.1.3  mrg   \fi
   9926  1.1.1.3  mrg 
   9927  1.1.1.3  mrg   \ifx\luatexversion\thisisundefined
   9928  1.1.1.3  mrg   \else
   9929  1.1.1.3  mrg     \directlua{
   9930  1.1.1.3  mrg     local utf8_char, byte, gsub = unicode.utf8.char, string.byte, string.gsub
   9931  1.1.1.3  mrg     local function convert_char (char)
   9932  1.1.1.3  mrg       return utf8_char(byte(char))
   9933  1.1.1.3  mrg     end
   9934  1.1.1.3  mrg 
   9935  1.1.1.3  mrg     local function convert_line (line)
   9936  1.1.1.3  mrg       return gsub(line, ".", convert_char)
   9937  1.1.1.3  mrg     end
   9938  1.1.1.3  mrg 
   9939  1.1.1.3  mrg     callback.register("process_input_buffer", convert_line)
   9940  1.1.1.3  mrg 
   9941  1.1.1.3  mrg     local function convert_line_out (line)
   9942  1.1.1.3  mrg       local line_out = ""
   9943  1.1.1.3  mrg       for c in string.utfvalues(line) do
   9944  1.1.1.3  mrg          line_out = line_out .. string.char(c)
   9945  1.1.1.3  mrg       end
   9946  1.1.1.3  mrg       return line_out
   9947  1.1.1.3  mrg     end
   9948  1.1.1.3  mrg 
   9949  1.1.1.3  mrg     callback.register("process_output_buffer", convert_line_out)
   9950  1.1.1.3  mrg     }
   9951  1.1.1.3  mrg   \fi
   9952  1.1.1.3  mrg 
   9953      1.1  mrg   \txiusebytewiseiotrue
   9954      1.1  mrg }
   9955      1.1  mrg 
   9956      1.1  mrg 
   9957      1.1  mrg % Helpers for encodings.
   9958      1.1  mrg % Set the catcode of characters 128 through 255 to the specified number.
   9959      1.1  mrg %
   9960      1.1  mrg \def\setnonasciicharscatcode#1{%
   9961      1.1  mrg    \count255=128
   9962      1.1  mrg    \loop\ifnum\count255<256
   9963      1.1  mrg       \global\catcode\count255=#1\relax
   9964      1.1  mrg       \advance\count255 by 1
   9965      1.1  mrg    \repeat
   9966      1.1  mrg }
   9967      1.1  mrg 
   9968      1.1  mrg \def\setnonasciicharscatcodenonglobal#1{%
   9969      1.1  mrg    \count255=128
   9970      1.1  mrg    \loop\ifnum\count255<256
   9971      1.1  mrg       \catcode\count255=#1\relax
   9972      1.1  mrg       \advance\count255 by 1
   9973      1.1  mrg    \repeat
   9974      1.1  mrg }
   9975  1.1.1.3  mrg 
   9976  1.1.1.3  mrg % @documentencoding sets the definition of non-ASCII characters
   9977  1.1.1.3  mrg % according to the specified encoding.
   9978      1.1  mrg %
   9979      1.1  mrg \def\documentencoding{\parseargusing\filenamecatcodes\documentencodingzzz}
   9980      1.1  mrg \def\documentencodingzzz#1{%
   9981      1.1  mrg   %
   9982      1.1  mrg   % Encoding being declared for the document.
   9983      1.1  mrg   \def\declaredencoding{\csname #1.enc\endcsname}%
   9984      1.1  mrg   %
   9985      1.1  mrg   % Supported encodings: names converted to tokens in order to be able
   9986      1.1  mrg   % to compare them with \ifx.
   9987      1.1  mrg   \def\ascii{\csname US-ASCII.enc\endcsname}%
   9988      1.1  mrg   \def\latnine{\csname ISO-8859-15.enc\endcsname}%
   9989      1.1  mrg   \def\latone{\csname ISO-8859-1.enc\endcsname}%
   9990      1.1  mrg   \def\lattwo{\csname ISO-8859-2.enc\endcsname}%
   9991      1.1  mrg   \def\utfeight{\csname UTF-8.enc\endcsname}%
   9992      1.1  mrg   %
   9993  1.1.1.3  mrg   \ifx \declaredencoding \ascii
   9994  1.1.1.3  mrg      \asciichardefs
   9995  1.1.1.3  mrg   %
   9996      1.1  mrg   \else \ifx \declaredencoding \lattwo
   9997      1.1  mrg      \iftxinativeunicodecapable
   9998      1.1  mrg        \setbytewiseio
   9999      1.1  mrg      \fi
   10000  1.1.1.3  mrg      \setnonasciicharscatcode\active
   10001  1.1.1.3  mrg      \lattwochardefs
   10002  1.1.1.3  mrg   %
   10003      1.1  mrg   \else \ifx \declaredencoding \latone
   10004      1.1  mrg      \iftxinativeunicodecapable
   10005      1.1  mrg        \setbytewiseio
   10006      1.1  mrg      \fi
   10007  1.1.1.3  mrg      \setnonasciicharscatcode\active
   10008  1.1.1.3  mrg      \latonechardefs
   10009  1.1.1.3  mrg   %
   10010      1.1  mrg   \else \ifx \declaredencoding \latnine
   10011      1.1  mrg      \iftxinativeunicodecapable
   10012      1.1  mrg        \setbytewiseio
   10013      1.1  mrg      \fi
   10014  1.1.1.3  mrg      \setnonasciicharscatcode\active
   10015  1.1.1.3  mrg      \latninechardefs
   10016  1.1.1.3  mrg   %
   10017  1.1.1.3  mrg   \else \ifx \declaredencoding \utfeight
   10018  1.1.1.3  mrg      \iftxinativeunicodecapable
   10019  1.1.1.3  mrg        % For native Unicode handling (XeTeX and LuaTeX)
   10020  1.1.1.3  mrg        \nativeunicodechardefs
   10021  1.1.1.3  mrg      \else
   10022  1.1.1.3  mrg        % For treating UTF-8 as byte sequences (TeX, eTeX and pdfTeX)
   10023  1.1.1.3  mrg        \setnonasciicharscatcode\active
   10024  1.1.1.3  mrg        % since we already invoked \utfeightchardefs at the top level
   10025      1.1  mrg        % (below), do not re-invoke it, otherwise our check for duplicated
   10026      1.1  mrg        % definitions gets triggered.  Making non-ascii chars active is
   10027  1.1.1.3  mrg        % sufficient.
   10028      1.1  mrg      \fi
   10029      1.1  mrg   %
   10030      1.1  mrg   \else
   10031      1.1  mrg     \message{Ignoring unknown document encoding: #1.}%
   10032      1.1  mrg   %
   10033      1.1  mrg   \fi % utfeight
   10034  1.1.1.3  mrg   \fi % latnine
   10035  1.1.1.3  mrg   \fi % latone
   10036  1.1.1.3  mrg   \fi % lattwo
   10037  1.1.1.3  mrg   \fi % ascii
   10038  1.1.1.3  mrg   %
   10039  1.1.1.3  mrg   \ifx\XeTeXrevision\thisisundefined
   10040  1.1.1.3  mrg   \else
   10041  1.1.1.3  mrg     \ifx \declaredencoding \utfeight
   10042  1.1.1.3  mrg     \else
   10043  1.1.1.3  mrg       \ifx \declaredencoding \ascii
   10044  1.1.1.3  mrg       \else
   10045  1.1.1.3  mrg         \message{Warning: XeTeX with non-UTF-8 encodings cannot handle %
   10046      1.1  mrg         non-ASCII characters in auxiliary files.}%
   10047      1.1  mrg       \fi
   10048  1.1.1.3  mrg     \fi
   10049      1.1  mrg   \fi
   10050      1.1  mrg }
   10051      1.1  mrg 
   10052  1.1.1.3  mrg % emacs-page
   10053      1.1  mrg % A message to be logged when using a character that isn't available
   10054      1.1  mrg % the default font encoding (OT1).
   10055      1.1  mrg %
   10056      1.1  mrg \def\missingcharmsg#1{\message{Character missing, sorry: #1.}}
   10057      1.1  mrg 
   10058      1.1  mrg % Take account of \c (plain) vs. \, (Texinfo) difference.
   10059      1.1  mrg \def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi}
   10060      1.1  mrg 
   10061      1.1  mrg % First, make active non-ASCII characters in order for them to be
   10062  1.1.1.3  mrg % correctly categorized when TeX reads the replacement text of
   10063  1.1.1.3  mrg % macros containing the character definitions.
   10064  1.1.1.3  mrg \setnonasciicharscatcode\active
   10065  1.1.1.3  mrg %
   10066  1.1.1.3  mrg 
   10067  1.1.1.3  mrg \def\gdefchar#1#2{%
   10068  1.1.1.3  mrg \gdef#1{%
   10069  1.1.1.3  mrg    \ifpassthroughchars
   10070  1.1.1.3  mrg      \string#1%
   10071  1.1.1.3  mrg    \else
   10072      1.1  mrg      #2%
   10073      1.1  mrg    \fi
   10074  1.1.1.3  mrg }}
   10075  1.1.1.3  mrg 
   10076  1.1.1.3  mrg % Latin1 (ISO-8859-1) character definitions.
   10077  1.1.1.3  mrg \def\latonechardefs{%
   10078  1.1.1.3  mrg   \gdefchar^^a0{\tie}
   10079  1.1.1.3  mrg   \gdefchar^^a1{\exclamdown}
   10080  1.1.1.3  mrg   \gdefchar^^a2{{\tcfont \char162}} % cent
   10081  1.1.1.3  mrg   \gdefchar^^a3{\pounds{}}
   10082  1.1.1.3  mrg   \gdefchar^^a4{{\tcfont \char164}} % currency
   10083  1.1.1.3  mrg   \gdefchar^^a5{{\tcfont \char165}} % yen
   10084  1.1.1.3  mrg   \gdefchar^^a6{{\tcfont \char166}} % broken bar
   10085  1.1.1.3  mrg   \gdefchar^^a7{\S}
   10086  1.1.1.3  mrg   \gdefchar^^a8{\"{}}
   10087  1.1.1.3  mrg   \gdefchar^^a9{\copyright{}}
   10088  1.1.1.3  mrg   \gdefchar^^aa{\ordf}
   10089  1.1.1.3  mrg   \gdefchar^^ab{\guillemetleft{}}
   10090  1.1.1.3  mrg   \gdefchar^^ac{\ensuremath\lnot}
   10091  1.1.1.3  mrg   \gdefchar^^ad{\-}
   10092  1.1.1.3  mrg   \gdefchar^^ae{\registeredsymbol{}}
   10093  1.1.1.3  mrg   \gdefchar^^af{\={}}
   10094  1.1.1.3  mrg   %
   10095  1.1.1.3  mrg   \gdefchar^^b0{\textdegree}
   10096  1.1.1.3  mrg   \gdefchar^^b1{$\pm$}
   10097  1.1.1.3  mrg   \gdefchar^^b2{$^2$}
   10098  1.1.1.3  mrg   \gdefchar^^b3{$^3$}
   10099  1.1.1.3  mrg   \gdefchar^^b4{\'{}}
   10100  1.1.1.3  mrg   \gdefchar^^b5{$\mu$}
   10101  1.1.1.3  mrg   \gdefchar^^b6{\P}
   10102  1.1.1.3  mrg   \gdefchar^^b7{\ensuremath\cdot}
   10103  1.1.1.3  mrg   \gdefchar^^b8{\cedilla\ }
   10104  1.1.1.3  mrg   \gdefchar^^b9{$^1$}
   10105  1.1.1.3  mrg   \gdefchar^^ba{\ordm}
   10106  1.1.1.3  mrg   \gdefchar^^bb{\guillemetright{}}
   10107  1.1.1.3  mrg   \gdefchar^^bc{$1\over4$}
   10108  1.1.1.3  mrg   \gdefchar^^bd{$1\over2$}
   10109  1.1.1.3  mrg   \gdefchar^^be{$3\over4$}
   10110  1.1.1.3  mrg   \gdefchar^^bf{\questiondown}
   10111  1.1.1.3  mrg   %
   10112  1.1.1.3  mrg   \gdefchar^^c0{\`A}
   10113  1.1.1.3  mrg   \gdefchar^^c1{\'A}
   10114  1.1.1.3  mrg   \gdefchar^^c2{\^A}
   10115  1.1.1.3  mrg   \gdefchar^^c3{\~A}
   10116  1.1.1.3  mrg   \gdefchar^^c4{\"A}
   10117  1.1.1.3  mrg   \gdefchar^^c5{\ringaccent A}
   10118  1.1.1.3  mrg   \gdefchar^^c6{\AE}
   10119  1.1.1.3  mrg   \gdefchar^^c7{\cedilla C}
   10120  1.1.1.3  mrg   \gdefchar^^c8{\`E}
   10121  1.1.1.3  mrg   \gdefchar^^c9{\'E}
   10122  1.1.1.3  mrg   \gdefchar^^ca{\^E}
   10123  1.1.1.3  mrg   \gdefchar^^cb{\"E}
   10124  1.1.1.3  mrg   \gdefchar^^cc{\`I}
   10125  1.1.1.3  mrg   \gdefchar^^cd{\'I}
   10126  1.1.1.3  mrg   \gdefchar^^ce{\^I}
   10127  1.1.1.3  mrg   \gdefchar^^cf{\"I}
   10128  1.1.1.3  mrg   %
   10129  1.1.1.3  mrg   \gdefchar^^d0{\DH}
   10130  1.1.1.3  mrg   \gdefchar^^d1{\~N}
   10131  1.1.1.3  mrg   \gdefchar^^d2{\`O}
   10132  1.1.1.3  mrg   \gdefchar^^d3{\'O}
   10133  1.1.1.3  mrg   \gdefchar^^d4{\^O}
   10134  1.1.1.3  mrg   \gdefchar^^d5{\~O}
   10135  1.1.1.3  mrg   \gdefchar^^d6{\"O}
   10136  1.1.1.3  mrg   \gdefchar^^d7{$\times$}
   10137  1.1.1.3  mrg   \gdefchar^^d8{\O}
   10138  1.1.1.3  mrg   \gdefchar^^d9{\`U}
   10139  1.1.1.3  mrg   \gdefchar^^da{\'U}
   10140  1.1.1.3  mrg   \gdefchar^^db{\^U}
   10141  1.1.1.3  mrg   \gdefchar^^dc{\"U}
   10142  1.1.1.3  mrg   \gdefchar^^dd{\'Y}
   10143  1.1.1.3  mrg   \gdefchar^^de{\TH}
   10144  1.1.1.3  mrg   \gdefchar^^df{\ss}
   10145  1.1.1.3  mrg   %
   10146  1.1.1.3  mrg   \gdefchar^^e0{\`a}
   10147  1.1.1.3  mrg   \gdefchar^^e1{\'a}
   10148  1.1.1.3  mrg   \gdefchar^^e2{\^a}
   10149  1.1.1.3  mrg   \gdefchar^^e3{\~a}
   10150  1.1.1.3  mrg   \gdefchar^^e4{\"a}
   10151  1.1.1.3  mrg   \gdefchar^^e5{\ringaccent a}
   10152  1.1.1.3  mrg   \gdefchar^^e6{\ae}
   10153  1.1.1.3  mrg   \gdefchar^^e7{\cedilla c}
   10154  1.1.1.3  mrg   \gdefchar^^e8{\`e}
   10155  1.1.1.3  mrg   \gdefchar^^e9{\'e}
   10156  1.1.1.3  mrg   \gdefchar^^ea{\^e}
   10157  1.1.1.3  mrg   \gdefchar^^eb{\"e}
   10158  1.1.1.3  mrg   \gdefchar^^ec{\`{\dotless i}}
   10159  1.1.1.3  mrg   \gdefchar^^ed{\'{\dotless i}}
   10160  1.1.1.3  mrg   \gdefchar^^ee{\^{\dotless i}}
   10161  1.1.1.3  mrg   \gdefchar^^ef{\"{\dotless i}}
   10162  1.1.1.3  mrg   %
   10163  1.1.1.3  mrg   \gdefchar^^f0{\dh}
   10164  1.1.1.3  mrg   \gdefchar^^f1{\~n}
   10165  1.1.1.3  mrg   \gdefchar^^f2{\`o}
   10166  1.1.1.3  mrg   \gdefchar^^f3{\'o}
   10167  1.1.1.3  mrg   \gdefchar^^f4{\^o}
   10168  1.1.1.3  mrg   \gdefchar^^f5{\~o}
   10169  1.1.1.3  mrg   \gdefchar^^f6{\"o}
   10170  1.1.1.3  mrg   \gdefchar^^f7{$\div$}
   10171  1.1.1.3  mrg   \gdefchar^^f8{\o}
   10172  1.1.1.3  mrg   \gdefchar^^f9{\`u}
   10173  1.1.1.3  mrg   \gdefchar^^fa{\'u}
   10174  1.1.1.3  mrg   \gdefchar^^fb{\^u}
   10175      1.1  mrg   \gdefchar^^fc{\"u}
   10176      1.1  mrg   \gdefchar^^fd{\'y}
   10177      1.1  mrg   \gdefchar^^fe{\th}
   10178      1.1  mrg   \gdefchar^^ff{\"y}
   10179      1.1  mrg }
   10180      1.1  mrg 
   10181      1.1  mrg % Latin9 (ISO-8859-15) encoding character definitions.
   10182  1.1.1.3  mrg \def\latninechardefs{%
   10183  1.1.1.3  mrg   % Encoding is almost identical to Latin1.
   10184  1.1.1.3  mrg   \latonechardefs
   10185  1.1.1.3  mrg   %
   10186  1.1.1.3  mrg   \gdefchar^^a4{\euro{}}
   10187  1.1.1.3  mrg   \gdefchar^^a6{\v S}
   10188  1.1.1.3  mrg   \gdefchar^^a8{\v s}
   10189  1.1.1.3  mrg   \gdefchar^^b4{\v Z}
   10190      1.1  mrg   \gdefchar^^b8{\v z}
   10191      1.1  mrg   \gdefchar^^bc{\OE}
   10192      1.1  mrg   \gdefchar^^bd{\oe}
   10193      1.1  mrg   \gdefchar^^be{\"Y}
   10194  1.1.1.3  mrg }
   10195  1.1.1.3  mrg 
   10196  1.1.1.3  mrg % Latin2 (ISO-8859-2) character definitions.
   10197  1.1.1.3  mrg \def\lattwochardefs{%
   10198  1.1.1.3  mrg   \gdefchar^^a0{\tie}
   10199  1.1.1.3  mrg   \gdefchar^^a1{\ogonek{A}}
   10200  1.1.1.3  mrg   \gdefchar^^a2{\u{}}
   10201  1.1.1.3  mrg   \gdefchar^^a3{\L}
   10202  1.1.1.3  mrg   \gdefchar^^a4{\missingcharmsg{CURRENCY SIGN}}
   10203  1.1.1.3  mrg   \gdefchar^^a5{\v L}
   10204  1.1.1.3  mrg   \gdefchar^^a6{\'S}
   10205  1.1.1.3  mrg   \gdefchar^^a7{\S}
   10206  1.1.1.3  mrg   \gdefchar^^a8{\"{}}
   10207  1.1.1.3  mrg   \gdefchar^^a9{\v S}
   10208  1.1.1.3  mrg   \gdefchar^^aa{\cedilla S}
   10209  1.1.1.3  mrg   \gdefchar^^ab{\v T}
   10210  1.1.1.3  mrg   \gdefchar^^ac{\'Z}
   10211  1.1.1.3  mrg   \gdefchar^^ad{\-}
   10212  1.1.1.3  mrg   \gdefchar^^ae{\v Z}
   10213  1.1.1.3  mrg   \gdefchar^^af{\dotaccent Z}
   10214  1.1.1.3  mrg   %
   10215  1.1.1.3  mrg   \gdefchar^^b0{\textdegree{}}
   10216  1.1.1.3  mrg   \gdefchar^^b1{\ogonek{a}}
   10217  1.1.1.3  mrg   \gdefchar^^b2{\ogonek{ }}
   10218  1.1.1.3  mrg   \gdefchar^^b3{\l}
   10219  1.1.1.3  mrg   \gdefchar^^b4{\'{}}
   10220  1.1.1.3  mrg   \gdefchar^^b5{\v l}
   10221  1.1.1.3  mrg   \gdefchar^^b6{\'s}
   10222  1.1.1.3  mrg   \gdefchar^^b7{\v{}}
   10223  1.1.1.3  mrg   \gdefchar^^b8{\cedilla\ }
   10224  1.1.1.3  mrg   \gdefchar^^b9{\v s}
   10225  1.1.1.3  mrg   \gdefchar^^ba{\cedilla s}
   10226  1.1.1.3  mrg   \gdefchar^^bb{\v t}
   10227  1.1.1.3  mrg   \gdefchar^^bc{\'z}
   10228  1.1.1.3  mrg   \gdefchar^^bd{\H{}}
   10229  1.1.1.3  mrg   \gdefchar^^be{\v z}
   10230  1.1.1.3  mrg   \gdefchar^^bf{\dotaccent z}
   10231  1.1.1.3  mrg   %
   10232  1.1.1.3  mrg   \gdefchar^^c0{\'R}
   10233  1.1.1.3  mrg   \gdefchar^^c1{\'A}
   10234  1.1.1.3  mrg   \gdefchar^^c2{\^A}
   10235  1.1.1.3  mrg   \gdefchar^^c3{\u A}
   10236  1.1.1.3  mrg   \gdefchar^^c4{\"A}
   10237  1.1.1.3  mrg   \gdefchar^^c5{\'L}
   10238  1.1.1.3  mrg   \gdefchar^^c6{\'C}
   10239  1.1.1.3  mrg   \gdefchar^^c7{\cedilla C}
   10240  1.1.1.3  mrg   \gdefchar^^c8{\v C}
   10241  1.1.1.3  mrg   \gdefchar^^c9{\'E}
   10242  1.1.1.3  mrg   \gdefchar^^ca{\ogonek{E}}
   10243  1.1.1.3  mrg   \gdefchar^^cb{\"E}
   10244  1.1.1.3  mrg   \gdefchar^^cc{\v E}
   10245  1.1.1.3  mrg   \gdefchar^^cd{\'I}
   10246  1.1.1.3  mrg   \gdefchar^^ce{\^I}
   10247  1.1.1.3  mrg   \gdefchar^^cf{\v D}
   10248  1.1.1.3  mrg   %
   10249  1.1.1.3  mrg   \gdefchar^^d0{\DH}
   10250  1.1.1.3  mrg   \gdefchar^^d1{\'N}
   10251  1.1.1.3  mrg   \gdefchar^^d2{\v N}
   10252  1.1.1.3  mrg   \gdefchar^^d3{\'O}
   10253  1.1.1.3  mrg   \gdefchar^^d4{\^O}
   10254  1.1.1.3  mrg   \gdefchar^^d5{\H O}
   10255  1.1.1.3  mrg   \gdefchar^^d6{\"O}
   10256  1.1.1.3  mrg   \gdefchar^^d7{$\times$}
   10257  1.1.1.3  mrg   \gdefchar^^d8{\v R}
   10258  1.1.1.3  mrg   \gdefchar^^d9{\ringaccent U}
   10259  1.1.1.3  mrg   \gdefchar^^da{\'U}
   10260  1.1.1.3  mrg   \gdefchar^^db{\H U}
   10261  1.1.1.3  mrg   \gdefchar^^dc{\"U}
   10262  1.1.1.3  mrg   \gdefchar^^dd{\'Y}
   10263  1.1.1.3  mrg   \gdefchar^^de{\cedilla T}
   10264  1.1.1.3  mrg   \gdefchar^^df{\ss}
   10265  1.1.1.3  mrg   %
   10266  1.1.1.3  mrg   \gdefchar^^e0{\'r}
   10267  1.1.1.3  mrg   \gdefchar^^e1{\'a}
   10268  1.1.1.3  mrg   \gdefchar^^e2{\^a}
   10269  1.1.1.3  mrg   \gdefchar^^e3{\u a}
   10270  1.1.1.3  mrg   \gdefchar^^e4{\"a}
   10271  1.1.1.3  mrg   \gdefchar^^e5{\'l}
   10272  1.1.1.3  mrg   \gdefchar^^e6{\'c}
   10273  1.1.1.3  mrg   \gdefchar^^e7{\cedilla c}
   10274  1.1.1.3  mrg   \gdefchar^^e8{\v c}
   10275  1.1.1.3  mrg   \gdefchar^^e9{\'e}
   10276  1.1.1.3  mrg   \gdefchar^^ea{\ogonek{e}}
   10277  1.1.1.3  mrg   \gdefchar^^eb{\"e}
   10278  1.1.1.3  mrg   \gdefchar^^ec{\v e}
   10279  1.1.1.3  mrg   \gdefchar^^ed{\'{\dotless{i}}}
   10280  1.1.1.3  mrg   \gdefchar^^ee{\^{\dotless{i}}}
   10281  1.1.1.3  mrg   \gdefchar^^ef{\v d}
   10282  1.1.1.3  mrg   %
   10283  1.1.1.3  mrg   \gdefchar^^f0{\dh}
   10284  1.1.1.3  mrg   \gdefchar^^f1{\'n}
   10285  1.1.1.3  mrg   \gdefchar^^f2{\v n}
   10286  1.1.1.3  mrg   \gdefchar^^f3{\'o}
   10287  1.1.1.3  mrg   \gdefchar^^f4{\^o}
   10288  1.1.1.3  mrg   \gdefchar^^f5{\H o}
   10289  1.1.1.3  mrg   \gdefchar^^f6{\"o}
   10290  1.1.1.3  mrg   \gdefchar^^f7{$\div$}
   10291  1.1.1.3  mrg   \gdefchar^^f8{\v r}
   10292  1.1.1.3  mrg   \gdefchar^^f9{\ringaccent u}
   10293  1.1.1.3  mrg   \gdefchar^^fa{\'u}
   10294  1.1.1.3  mrg   \gdefchar^^fb{\H u}
   10295      1.1  mrg   \gdefchar^^fc{\"u}
   10296      1.1  mrg   \gdefchar^^fd{\'y}
   10297      1.1  mrg   \gdefchar^^fe{\cedilla t}
   10298      1.1  mrg   \gdefchar^^ff{\dotaccent{}}
   10299      1.1  mrg }
   10300      1.1  mrg 
   10301      1.1  mrg % UTF-8 character definitions.
   10302      1.1  mrg %
   10303      1.1  mrg % This code to support UTF-8 is based on LaTeX's utf8.def, with some
   10304      1.1  mrg % changes for Texinfo conventions.  It is included here under the GPL by
   10305      1.1  mrg % permission from Frank Mittelbach and the LaTeX team.
   10306      1.1  mrg %
   10307      1.1  mrg \newcount\countUTFx
   10308      1.1  mrg \newcount\countUTFy
   10309      1.1  mrg \newcount\countUTFz
   10310      1.1  mrg 
   10311      1.1  mrg \gdef\UTFviiiTwoOctets#1#2{\expandafter
   10312      1.1  mrg    \UTFviiiDefined\csname u8:#1\string #2\endcsname}
   10313      1.1  mrg %
   10314      1.1  mrg \gdef\UTFviiiThreeOctets#1#2#3{\expandafter
   10315      1.1  mrg    \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname}
   10316      1.1  mrg %
   10317      1.1  mrg \gdef\UTFviiiFourOctets#1#2#3#4{\expandafter
   10318      1.1  mrg    \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname}
   10319      1.1  mrg 
   10320      1.1  mrg \gdef\UTFviiiDefined#1{%
   10321      1.1  mrg   \ifx #1\relax
   10322      1.1  mrg     \message{\linenumber Unicode char \string #1 not defined for Texinfo}%
   10323      1.1  mrg   \else
   10324  1.1.1.3  mrg     \expandafter #1%
   10325      1.1  mrg   \fi
   10326      1.1  mrg }
   10327  1.1.1.3  mrg 
   10328      1.1  mrg % Give non-ASCII bytes the active definitions for processing UTF-8 sequences
   10329      1.1  mrg \begingroup
   10330  1.1.1.3  mrg   \catcode`\~13
   10331  1.1.1.3  mrg   \catcode`\$12
   10332      1.1  mrg   \catcode`\"12
   10333      1.1  mrg 
   10334      1.1  mrg   % Loop from \countUTFx to \countUTFy, performing \UTFviiiTmp
   10335  1.1.1.3  mrg   % substituting ~ and $ with a character token of that value.
   10336      1.1  mrg   \def\UTFviiiLoop{%
   10337      1.1  mrg     \global\catcode\countUTFx\active
   10338      1.1  mrg     \uccode`\~\countUTFx
   10339      1.1  mrg     \uccode`\$\countUTFx
   10340      1.1  mrg     \uppercase\expandafter{\UTFviiiTmp}%
   10341      1.1  mrg     \advance\countUTFx by 1
   10342  1.1.1.3  mrg     \ifnum\countUTFx < \countUTFy
   10343  1.1.1.3  mrg       \expandafter\UTFviiiLoop
   10344  1.1.1.3  mrg     \fi}
   10345  1.1.1.3  mrg 
   10346  1.1.1.3  mrg   % For bytes other than the first in a UTF-8 sequence.  Not expected to
   10347  1.1.1.3  mrg   % be expanded except when writing to auxiliary files.
   10348  1.1.1.3  mrg   \countUTFx = "80
   10349  1.1.1.3  mrg   \countUTFy = "C2
   10350  1.1.1.3  mrg   \def\UTFviiiTmp{%
   10351      1.1  mrg     \gdef~{%
   10352      1.1  mrg         \ifpassthroughchars $\fi}}%
   10353      1.1  mrg   \UTFviiiLoop
   10354  1.1.1.3  mrg 
   10355  1.1.1.3  mrg   \countUTFx = "C2
   10356  1.1.1.3  mrg   \countUTFy = "E0
   10357      1.1  mrg   \def\UTFviiiTmp{%
   10358      1.1  mrg     \gdef~{%
   10359      1.1  mrg         \ifpassthroughchars $%
   10360      1.1  mrg         \else\expandafter\UTFviiiTwoOctets\expandafter$\fi}}%
   10361      1.1  mrg   \UTFviiiLoop
   10362  1.1.1.3  mrg 
   10363  1.1.1.3  mrg   \countUTFx = "E0
   10364  1.1.1.3  mrg   \countUTFy = "F0
   10365      1.1  mrg   \def\UTFviiiTmp{%
   10366      1.1  mrg     \gdef~{%
   10367      1.1  mrg         \ifpassthroughchars $%
   10368      1.1  mrg         \else\expandafter\UTFviiiThreeOctets\expandafter$\fi}}%
   10369      1.1  mrg   \UTFviiiLoop
   10370  1.1.1.3  mrg 
   10371  1.1.1.3  mrg   \countUTFx = "F0
   10372  1.1.1.3  mrg   \countUTFy = "F4
   10373  1.1.1.3  mrg   \def\UTFviiiTmp{%
   10374      1.1  mrg     \gdef~{%
   10375      1.1  mrg         \ifpassthroughchars $%
   10376      1.1  mrg         \else\expandafter\UTFviiiFourOctets\expandafter$\fi
   10377  1.1.1.3  mrg         }}%
   10378  1.1.1.3  mrg   \UTFviiiLoop
   10379  1.1.1.3  mrg \endgroup
   10380  1.1.1.3  mrg 
   10381  1.1.1.3  mrg \def\globallet{\global\let} % save some \expandafter's below
   10382  1.1.1.3  mrg 
   10383  1.1.1.3  mrg % @U{xxxx} to produce U+xxxx, if we support it.
   10384  1.1.1.3  mrg \def\U#1{%
   10385  1.1.1.3  mrg   \expandafter\ifx\csname uni:#1\endcsname \relax
   10386  1.1.1.3  mrg     \iftxinativeunicodecapable
   10387  1.1.1.3  mrg       % All Unicode characters can be used if native Unicode handling is
   10388  1.1.1.3  mrg       % active.  However, if the font does not have the glyph,
   10389  1.1.1.3  mrg       % letters are missing.
   10390  1.1.1.3  mrg       \begingroup
   10391  1.1.1.3  mrg         \uccode`\.="#1\relax
   10392  1.1.1.3  mrg         \uppercase{.}
   10393  1.1.1.3  mrg       \endgroup
   10394  1.1.1.3  mrg     \else
   10395  1.1.1.3  mrg       \errhelp = \EMsimple	
   10396  1.1.1.3  mrg       \errmessage{Unicode character U+#1 not supported, sorry}%
   10397  1.1.1.3  mrg     \fi
   10398  1.1.1.3  mrg   \else
   10399  1.1.1.3  mrg     \csname uni:#1\endcsname
   10400  1.1.1.3  mrg   \fi
   10401  1.1.1.3  mrg }
   10402  1.1.1.3  mrg 
   10403  1.1.1.3  mrg % These macros are used here to construct the name of a control
   10404  1.1.1.3  mrg % sequence to be defined.
   10405  1.1.1.3  mrg \def\UTFviiiTwoOctetsName#1#2{%
   10406  1.1.1.3  mrg   \csname u8:#1\string #2\endcsname}%
   10407  1.1.1.3  mrg \def\UTFviiiThreeOctetsName#1#2#3{%
   10408  1.1.1.3  mrg   \csname u8:#1\string #2\string #3\endcsname}%
   10409  1.1.1.3  mrg \def\UTFviiiFourOctetsName#1#2#3#4{%
   10410  1.1.1.3  mrg   \csname u8:#1\string #2\string #3\string #4\endcsname}%
   10411  1.1.1.3  mrg 
   10412      1.1  mrg % For UTF-8 byte sequences (TeX, e-TeX and pdfTeX),
   10413      1.1  mrg % provide a definition macro to replace a Unicode character;
   10414      1.1  mrg % this gets used by the @U command
   10415      1.1  mrg %
   10416      1.1  mrg \begingroup
   10417      1.1  mrg   \catcode`\"=12
   10418      1.1  mrg   \catcode`\<=12
   10419      1.1  mrg   \catcode`\.=12
   10420  1.1.1.3  mrg   \catcode`\,=12
   10421      1.1  mrg   \catcode`\;=12
   10422      1.1  mrg   \catcode`\!=12
   10423      1.1  mrg   \catcode`\~=13
   10424  1.1.1.3  mrg   \gdef\DeclareUnicodeCharacterUTFviii#1#2{%
   10425  1.1.1.3  mrg     \countUTFz = "#1\relax
   10426  1.1.1.3  mrg     \begingroup
   10427  1.1.1.3  mrg       \parseXMLCharref
   10428  1.1.1.3  mrg     
   10429  1.1.1.3  mrg       % Give \u8:... its definition.  The sequence of seven \expandafter's
   10430  1.1.1.3  mrg       % expands after the \gdef three times, e.g.
   10431  1.1.1.3  mrg       %
   10432  1.1.1.3  mrg       % 1.  \UTFviiTwoOctetsName B1 B2
   10433  1.1.1.3  mrg       % 2.  \csname u8:B1 \string B2 \endcsname
   10434  1.1.1.3  mrg       % 3.  \u8: B1 B2  (a single control sequence token)
   10435  1.1.1.3  mrg       %
   10436  1.1.1.3  mrg       \expandafter\expandafter
   10437  1.1.1.3  mrg       \expandafter\expandafter
   10438  1.1.1.3  mrg       \expandafter\expandafter
   10439  1.1.1.3  mrg       \expandafter\gdef       \UTFviiiTmp{#2}%
   10440  1.1.1.3  mrg       % 
   10441  1.1.1.3  mrg       \expandafter\ifx\csname uni:#1\endcsname \relax \else
   10442  1.1.1.3  mrg        \message{Internal error, already defined: #1}%
   10443      1.1  mrg       \fi
   10444  1.1.1.3  mrg       %
   10445  1.1.1.3  mrg       % define an additional control sequence for this code point.
   10446  1.1.1.3  mrg       \expandafter\globallet\csname uni:#1\endcsname \UTFviiiTmp
   10447      1.1  mrg     \endgroup}
   10448      1.1  mrg   %
   10449      1.1  mrg   % Given the value in \countUTFz as a Unicode code point, set \UTFviiiTmp
   10450      1.1  mrg   % to the corresponding UTF-8 sequence.
   10451      1.1  mrg   \gdef\parseXMLCharref{%
   10452      1.1  mrg     \ifnum\countUTFz < "A0\relax
   10453  1.1.1.3  mrg       \errhelp = \EMsimple
   10454      1.1  mrg       \errmessage{Cannot define Unicode char value < 00A0}%
   10455      1.1  mrg     \else\ifnum\countUTFz < "800\relax
   10456      1.1  mrg       \parseUTFviiiA,%
   10457  1.1.1.3  mrg       \parseUTFviiiB C\UTFviiiTwoOctetsName.,%
   10458      1.1  mrg     \else\ifnum\countUTFz < "10000\relax
   10459      1.1  mrg       \parseUTFviiiA;%
   10460      1.1  mrg       \parseUTFviiiA,%
   10461      1.1  mrg       \parseUTFviiiB E\UTFviiiThreeOctetsName.{,;}%
   10462  1.1.1.3  mrg     \else
   10463      1.1  mrg       \parseUTFviiiA;%
   10464      1.1  mrg       \parseUTFviiiA,%
   10465      1.1  mrg       \parseUTFviiiA!%
   10466  1.1.1.3  mrg       \parseUTFviiiB F\UTFviiiFourOctetsName.{!,;}%
   10467  1.1.1.3  mrg     \fi\fi\fi
   10468  1.1.1.3  mrg   }
   10469  1.1.1.3  mrg 
   10470      1.1  mrg   % Extract a byte from the end of the UTF-8 representation of \countUTFx.
   10471      1.1  mrg   % It must be a non-initial byte in the sequence.
   10472      1.1  mrg   % Change \uccode of #1 for it to be used in \parseUTFviiiB as one
   10473  1.1.1.3  mrg   % of the bytes.
   10474      1.1  mrg   \gdef\parseUTFviiiA#1{%
   10475  1.1.1.3  mrg     \countUTFx = \countUTFz
   10476  1.1.1.3  mrg     \divide\countUTFz by 64
   10477  1.1.1.3  mrg     \countUTFy = \countUTFz  % Save to be the future value of \countUTFz.
   10478      1.1  mrg     \multiply\countUTFz by 64
   10479  1.1.1.3  mrg     
   10480  1.1.1.3  mrg     % \countUTFz is now \countUTFx with the last 5 bits cleared.  Subtract
   10481      1.1  mrg     % in order to get the last five bits.
   10482      1.1  mrg     \advance\countUTFx by -\countUTFz
   10483      1.1  mrg 
   10484      1.1  mrg     % Convert this to the byte in the UTF-8 sequence.
   10485  1.1.1.3  mrg     \advance\countUTFx by 128
   10486  1.1.1.3  mrg     \uccode `#1\countUTFx
   10487  1.1.1.3  mrg     \countUTFz = \countUTFy}
   10488  1.1.1.3  mrg 
   10489  1.1.1.3  mrg   % Used to put a UTF-8 byte sequence into \UTFviiiTmp
   10490  1.1.1.3  mrg   % #1 is the increment for \countUTFz to yield a the first byte of the UTF-8
   10491  1.1.1.3  mrg   %    sequence.
   10492      1.1  mrg   % #2 is one of the \UTFviii*OctetsName macros.
   10493      1.1  mrg   % #3 is always a full stop (.)
   10494      1.1  mrg   % #4 is a template for the other bytes in the sequence.  The values for these
   10495      1.1  mrg   %    bytes is substituted in here with \uppercase using the \uccode's.
   10496      1.1  mrg   \gdef\parseUTFviiiB#1#2#3#4{%
   10497      1.1  mrg     \advance\countUTFz by "#10\relax
   10498  1.1.1.3  mrg     \uccode `#3\countUTFz
   10499  1.1.1.3  mrg     \uppercase{\gdef\UTFviiiTmp{#2#3#4}}}
   10500  1.1.1.3  mrg \endgroup
   10501  1.1.1.3  mrg 
   10502  1.1.1.3  mrg % For native Unicode handling (XeTeX and LuaTeX),
   10503  1.1.1.3  mrg % provide a definition macro that sets a catcode to `other' non-globally
   10504  1.1.1.3  mrg %
   10505  1.1.1.3  mrg \def\DeclareUnicodeCharacterNativeOther#1#2{%
   10506  1.1.1.3  mrg   \catcode"#1=\other
   10507  1.1.1.3  mrg }
   10508  1.1.1.3  mrg 
   10509  1.1.1.3  mrg % https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_M
   10510  1.1.1.3  mrg % U+0000..U+007F = https://en.wikipedia.org/wiki/Basic_Latin_(Unicode_block)
   10511  1.1.1.3  mrg % U+0080..U+00FF = https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)
   10512  1.1.1.3  mrg % U+0100..U+017F = https://en.wikipedia.org/wiki/Latin_Extended-A
   10513  1.1.1.3  mrg % U+0180..U+024F = https://en.wikipedia.org/wiki/Latin_Extended-B
   10514  1.1.1.3  mrg % 
   10515  1.1.1.3  mrg % Many of our renditions are less than wonderful, and all the missing
   10516  1.1.1.3  mrg % characters are available somewhere.  Loading the necessary fonts
   10517  1.1.1.3  mrg % awaits user request.  We can't truly support Unicode without
   10518  1.1.1.3  mrg % reimplementing everything that's been done in LaTeX for many years,
   10519  1.1.1.3  mrg % plus probably using luatex or xetex, and who knows what else.
   10520  1.1.1.3  mrg % We won't be doing that here in this simple file.  But we can try to at
   10521  1.1.1.3  mrg % least make most of the characters not bomb out.
   10522  1.1.1.3  mrg %
   10523  1.1.1.3  mrg \def\unicodechardefs{%
   10524  1.1.1.3  mrg   \DeclareUnicodeCharacter{00A0}{\tie}%
   10525  1.1.1.3  mrg   \DeclareUnicodeCharacter{00A1}{\exclamdown}%
   10526  1.1.1.3  mrg   \DeclareUnicodeCharacter{00A2}{{\tcfont \char162}}% 0242=cent
   10527  1.1.1.3  mrg   \DeclareUnicodeCharacter{00A3}{\pounds{}}%
   10528  1.1.1.3  mrg   \DeclareUnicodeCharacter{00A4}{{\tcfont \char164}}% 0244=currency
   10529  1.1.1.3  mrg   \DeclareUnicodeCharacter{00A5}{{\tcfont \char165}}% 0245=yen
   10530  1.1.1.3  mrg   \DeclareUnicodeCharacter{00A6}{{\tcfont \char166}}% 0246=brokenbar
   10531  1.1.1.3  mrg   \DeclareUnicodeCharacter{00A7}{\S}%
   10532  1.1.1.3  mrg   \DeclareUnicodeCharacter{00A8}{\"{ }}%
   10533  1.1.1.3  mrg   \DeclareUnicodeCharacter{00A9}{\copyright{}}%
   10534  1.1.1.3  mrg   \DeclareUnicodeCharacter{00AA}{\ordf}%
   10535  1.1.1.3  mrg   \DeclareUnicodeCharacter{00AB}{\guillemetleft{}}%
   10536  1.1.1.3  mrg   \DeclareUnicodeCharacter{00AC}{\ensuremath\lnot}%
   10537  1.1.1.3  mrg   \DeclareUnicodeCharacter{00AD}{\-}%
   10538  1.1.1.3  mrg   \DeclareUnicodeCharacter{00AE}{\registeredsymbol{}}%
   10539  1.1.1.3  mrg   \DeclareUnicodeCharacter{00AF}{\={ }}%
   10540  1.1.1.3  mrg   %
   10541  1.1.1.3  mrg   \DeclareUnicodeCharacter{00B0}{\ringaccent{ }}%
   10542  1.1.1.3  mrg   \DeclareUnicodeCharacter{00B1}{\ensuremath\pm}%
   10543  1.1.1.3  mrg   \DeclareUnicodeCharacter{00B2}{$^2$}%
   10544  1.1.1.3  mrg   \DeclareUnicodeCharacter{00B3}{$^3$}%
   10545  1.1.1.3  mrg   \DeclareUnicodeCharacter{00B4}{\'{ }}%
   10546  1.1.1.3  mrg   \DeclareUnicodeCharacter{00B5}{$\mu$}%
   10547  1.1.1.3  mrg   \DeclareUnicodeCharacter{00B6}{\P}%
   10548  1.1.1.3  mrg   \DeclareUnicodeCharacter{00B7}{\ensuremath\cdot}%
   10549  1.1.1.3  mrg   \DeclareUnicodeCharacter{00B8}{\cedilla{ }}%
   10550  1.1.1.3  mrg   \DeclareUnicodeCharacter{00B9}{$^1$}%
   10551  1.1.1.3  mrg   \DeclareUnicodeCharacter{00BA}{\ordm}%
   10552  1.1.1.3  mrg   \DeclareUnicodeCharacter{00BB}{\guillemetright{}}%
   10553  1.1.1.3  mrg   \DeclareUnicodeCharacter{00BC}{$1\over4$}%
   10554  1.1.1.3  mrg   \DeclareUnicodeCharacter{00BD}{$1\over2$}%
   10555  1.1.1.3  mrg   \DeclareUnicodeCharacter{00BE}{$3\over4$}%
   10556  1.1.1.3  mrg   \DeclareUnicodeCharacter{00BF}{\questiondown}%
   10557  1.1.1.3  mrg   %
   10558  1.1.1.3  mrg   \DeclareUnicodeCharacter{00C0}{\`A}%
   10559  1.1.1.3  mrg   \DeclareUnicodeCharacter{00C1}{\'A}%
   10560  1.1.1.3  mrg   \DeclareUnicodeCharacter{00C2}{\^A}%
   10561  1.1.1.3  mrg   \DeclareUnicodeCharacter{00C3}{\~A}%
   10562  1.1.1.3  mrg   \DeclareUnicodeCharacter{00C4}{\"A}%
   10563  1.1.1.3  mrg   \DeclareUnicodeCharacter{00C5}{\AA}%
   10564  1.1.1.3  mrg   \DeclareUnicodeCharacter{00C6}{\AE}%
   10565  1.1.1.3  mrg   \DeclareUnicodeCharacter{00C7}{\cedilla{C}}%
   10566  1.1.1.3  mrg   \DeclareUnicodeCharacter{00C8}{\`E}%
   10567  1.1.1.3  mrg   \DeclareUnicodeCharacter{00C9}{\'E}%
   10568  1.1.1.3  mrg   \DeclareUnicodeCharacter{00CA}{\^E}%
   10569  1.1.1.3  mrg   \DeclareUnicodeCharacter{00CB}{\"E}%
   10570  1.1.1.3  mrg   \DeclareUnicodeCharacter{00CC}{\`I}%
   10571  1.1.1.3  mrg   \DeclareUnicodeCharacter{00CD}{\'I}%
   10572  1.1.1.3  mrg   \DeclareUnicodeCharacter{00CE}{\^I}%
   10573  1.1.1.3  mrg   \DeclareUnicodeCharacter{00CF}{\"I}%
   10574  1.1.1.3  mrg   %
   10575  1.1.1.3  mrg   \DeclareUnicodeCharacter{00D0}{\DH}%
   10576  1.1.1.3  mrg   \DeclareUnicodeCharacter{00D1}{\~N}%
   10577  1.1.1.3  mrg   \DeclareUnicodeCharacter{00D2}{\`O}%
   10578  1.1.1.3  mrg   \DeclareUnicodeCharacter{00D3}{\'O}%
   10579  1.1.1.3  mrg   \DeclareUnicodeCharacter{00D4}{\^O}%
   10580  1.1.1.3  mrg   \DeclareUnicodeCharacter{00D5}{\~O}%
   10581  1.1.1.3  mrg   \DeclareUnicodeCharacter{00D6}{\"O}%
   10582  1.1.1.3  mrg   \DeclareUnicodeCharacter{00D7}{\ensuremath\times}%
   10583  1.1.1.3  mrg   \DeclareUnicodeCharacter{00D8}{\O}%
   10584  1.1.1.3  mrg   \DeclareUnicodeCharacter{00D9}{\`U}%
   10585  1.1.1.3  mrg   \DeclareUnicodeCharacter{00DA}{\'U}%
   10586  1.1.1.3  mrg   \DeclareUnicodeCharacter{00DB}{\^U}%
   10587  1.1.1.3  mrg   \DeclareUnicodeCharacter{00DC}{\"U}%
   10588  1.1.1.3  mrg   \DeclareUnicodeCharacter{00DD}{\'Y}%
   10589  1.1.1.3  mrg   \DeclareUnicodeCharacter{00DE}{\TH}%
   10590  1.1.1.3  mrg   \DeclareUnicodeCharacter{00DF}{\ss}%
   10591  1.1.1.3  mrg   %
   10592  1.1.1.3  mrg   \DeclareUnicodeCharacter{00E0}{\`a}%
   10593  1.1.1.3  mrg   \DeclareUnicodeCharacter{00E1}{\'a}%
   10594  1.1.1.3  mrg   \DeclareUnicodeCharacter{00E2}{\^a}%
   10595  1.1.1.3  mrg   \DeclareUnicodeCharacter{00E3}{\~a}%
   10596  1.1.1.3  mrg   \DeclareUnicodeCharacter{00E4}{\"a}%
   10597  1.1.1.3  mrg   \DeclareUnicodeCharacter{00E5}{\aa}%
   10598  1.1.1.3  mrg   \DeclareUnicodeCharacter{00E6}{\ae}%
   10599  1.1.1.3  mrg   \DeclareUnicodeCharacter{00E7}{\cedilla{c}}%
   10600  1.1.1.3  mrg   \DeclareUnicodeCharacter{00E8}{\`e}%
   10601  1.1.1.3  mrg   \DeclareUnicodeCharacter{00E9}{\'e}%
   10602  1.1.1.3  mrg   \DeclareUnicodeCharacter{00EA}{\^e}%
   10603  1.1.1.3  mrg   \DeclareUnicodeCharacter{00EB}{\"e}%
   10604  1.1.1.3  mrg   \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}}%
   10605  1.1.1.3  mrg   \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}}%
   10606  1.1.1.3  mrg   \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}}%
   10607  1.1.1.3  mrg   \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}}%
   10608  1.1.1.3  mrg   %
   10609  1.1.1.3  mrg   \DeclareUnicodeCharacter{00F0}{\dh}%
   10610  1.1.1.3  mrg   \DeclareUnicodeCharacter{00F1}{\~n}%
   10611  1.1.1.3  mrg   \DeclareUnicodeCharacter{00F2}{\`o}%
   10612  1.1.1.3  mrg   \DeclareUnicodeCharacter{00F3}{\'o}%
   10613  1.1.1.3  mrg   \DeclareUnicodeCharacter{00F4}{\^o}%
   10614  1.1.1.3  mrg   \DeclareUnicodeCharacter{00F5}{\~o}%
   10615  1.1.1.3  mrg   \DeclareUnicodeCharacter{00F6}{\"o}%
   10616  1.1.1.3  mrg   \DeclareUnicodeCharacter{00F7}{\ensuremath\div}%
   10617  1.1.1.3  mrg   \DeclareUnicodeCharacter{00F8}{\o}%
   10618  1.1.1.3  mrg   \DeclareUnicodeCharacter{00F9}{\`u}%
   10619  1.1.1.3  mrg   \DeclareUnicodeCharacter{00FA}{\'u}%
   10620  1.1.1.3  mrg   \DeclareUnicodeCharacter{00FB}{\^u}%
   10621  1.1.1.3  mrg   \DeclareUnicodeCharacter{00FC}{\"u}%
   10622  1.1.1.3  mrg   \DeclareUnicodeCharacter{00FD}{\'y}%
   10623  1.1.1.3  mrg   \DeclareUnicodeCharacter{00FE}{\th}%
   10624  1.1.1.3  mrg   \DeclareUnicodeCharacter{00FF}{\"y}%
   10625  1.1.1.3  mrg   %
   10626  1.1.1.3  mrg   \DeclareUnicodeCharacter{0100}{\=A}%
   10627  1.1.1.3  mrg   \DeclareUnicodeCharacter{0101}{\=a}%
   10628  1.1.1.3  mrg   \DeclareUnicodeCharacter{0102}{\u{A}}%
   10629  1.1.1.3  mrg   \DeclareUnicodeCharacter{0103}{\u{a}}%
   10630  1.1.1.3  mrg   \DeclareUnicodeCharacter{0104}{\ogonek{A}}%
   10631  1.1.1.3  mrg   \DeclareUnicodeCharacter{0105}{\ogonek{a}}%
   10632  1.1.1.3  mrg   \DeclareUnicodeCharacter{0106}{\'C}%
   10633  1.1.1.3  mrg   \DeclareUnicodeCharacter{0107}{\'c}%
   10634  1.1.1.3  mrg   \DeclareUnicodeCharacter{0108}{\^C}%
   10635  1.1.1.3  mrg   \DeclareUnicodeCharacter{0109}{\^c}%
   10636  1.1.1.3  mrg   \DeclareUnicodeCharacter{010A}{\dotaccent{C}}%
   10637  1.1.1.3  mrg   \DeclareUnicodeCharacter{010B}{\dotaccent{c}}%
   10638  1.1.1.3  mrg   \DeclareUnicodeCharacter{010C}{\v{C}}%
   10639  1.1.1.3  mrg   \DeclareUnicodeCharacter{010D}{\v{c}}%
   10640  1.1.1.3  mrg   \DeclareUnicodeCharacter{010E}{\v{D}}%
   10641  1.1.1.3  mrg   \DeclareUnicodeCharacter{010F}{d'}%
   10642  1.1.1.3  mrg   %
   10643  1.1.1.3  mrg   \DeclareUnicodeCharacter{0110}{\DH}%
   10644  1.1.1.3  mrg   \DeclareUnicodeCharacter{0111}{\dh}%
   10645  1.1.1.3  mrg   \DeclareUnicodeCharacter{0112}{\=E}%
   10646  1.1.1.3  mrg   \DeclareUnicodeCharacter{0113}{\=e}%
   10647  1.1.1.3  mrg   \DeclareUnicodeCharacter{0114}{\u{E}}%
   10648  1.1.1.3  mrg   \DeclareUnicodeCharacter{0115}{\u{e}}%
   10649  1.1.1.3  mrg   \DeclareUnicodeCharacter{0116}{\dotaccent{E}}%
   10650  1.1.1.3  mrg   \DeclareUnicodeCharacter{0117}{\dotaccent{e}}%
   10651  1.1.1.3  mrg   \DeclareUnicodeCharacter{0118}{\ogonek{E}}%
   10652  1.1.1.3  mrg   \DeclareUnicodeCharacter{0119}{\ogonek{e}}%
   10653  1.1.1.3  mrg   \DeclareUnicodeCharacter{011A}{\v{E}}%
   10654  1.1.1.3  mrg   \DeclareUnicodeCharacter{011B}{\v{e}}%
   10655  1.1.1.3  mrg   \DeclareUnicodeCharacter{011C}{\^G}%
   10656  1.1.1.3  mrg   \DeclareUnicodeCharacter{011D}{\^g}%
   10657  1.1.1.3  mrg   \DeclareUnicodeCharacter{011E}{\u{G}}%
   10658  1.1.1.3  mrg   \DeclareUnicodeCharacter{011F}{\u{g}}%
   10659  1.1.1.3  mrg   %
   10660  1.1.1.3  mrg   \DeclareUnicodeCharacter{0120}{\dotaccent{G}}%
   10661  1.1.1.3  mrg   \DeclareUnicodeCharacter{0121}{\dotaccent{g}}%
   10662  1.1.1.3  mrg   \DeclareUnicodeCharacter{0122}{\cedilla{G}}%
   10663  1.1.1.3  mrg   \DeclareUnicodeCharacter{0123}{\cedilla{g}}%
   10664  1.1.1.3  mrg   \DeclareUnicodeCharacter{0124}{\^H}%
   10665  1.1.1.3  mrg   \DeclareUnicodeCharacter{0125}{\^h}%
   10666  1.1.1.3  mrg   \DeclareUnicodeCharacter{0126}{\missingcharmsg{H WITH STROKE}}%
   10667  1.1.1.3  mrg   \DeclareUnicodeCharacter{0127}{\missingcharmsg{h WITH STROKE}}%
   10668  1.1.1.3  mrg   \DeclareUnicodeCharacter{0128}{\~I}%
   10669  1.1.1.3  mrg   \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}}%
   10670  1.1.1.3  mrg   \DeclareUnicodeCharacter{012A}{\=I}%
   10671  1.1.1.3  mrg   \DeclareUnicodeCharacter{012B}{\={\dotless{i}}}%
   10672  1.1.1.3  mrg   \DeclareUnicodeCharacter{012C}{\u{I}}%
   10673  1.1.1.3  mrg   \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}}%
   10674  1.1.1.3  mrg   \DeclareUnicodeCharacter{012E}{\ogonek{I}}%
   10675  1.1.1.3  mrg   \DeclareUnicodeCharacter{012F}{\ogonek{i}}%
   10676  1.1.1.3  mrg   %
   10677  1.1.1.3  mrg   \DeclareUnicodeCharacter{0130}{\dotaccent{I}}%
   10678  1.1.1.3  mrg   \DeclareUnicodeCharacter{0131}{\dotless{i}}%
   10679  1.1.1.3  mrg   \DeclareUnicodeCharacter{0132}{IJ}%
   10680  1.1.1.3  mrg   \DeclareUnicodeCharacter{0133}{ij}%
   10681  1.1.1.3  mrg   \DeclareUnicodeCharacter{0134}{\^J}%
   10682  1.1.1.3  mrg   \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}}%
   10683  1.1.1.3  mrg   \DeclareUnicodeCharacter{0136}{\cedilla{K}}%
   10684  1.1.1.3  mrg   \DeclareUnicodeCharacter{0137}{\cedilla{k}}%
   10685  1.1.1.3  mrg   \DeclareUnicodeCharacter{0138}{\ensuremath\kappa}%
   10686  1.1.1.3  mrg   \DeclareUnicodeCharacter{0139}{\'L}%
   10687  1.1.1.3  mrg   \DeclareUnicodeCharacter{013A}{\'l}%
   10688  1.1.1.3  mrg   \DeclareUnicodeCharacter{013B}{\cedilla{L}}%
   10689  1.1.1.3  mrg   \DeclareUnicodeCharacter{013C}{\cedilla{l}}%
   10690  1.1.1.3  mrg   \DeclareUnicodeCharacter{013D}{L'}% should kern
   10691  1.1.1.3  mrg   \DeclareUnicodeCharacter{013E}{l'}% should kern
   10692  1.1.1.3  mrg   \DeclareUnicodeCharacter{013F}{L\U{00B7}}%
   10693  1.1.1.3  mrg   %
   10694  1.1.1.3  mrg   \DeclareUnicodeCharacter{0140}{l\U{00B7}}%
   10695  1.1.1.3  mrg   \DeclareUnicodeCharacter{0141}{\L}%
   10696  1.1.1.3  mrg   \DeclareUnicodeCharacter{0142}{\l}%
   10697  1.1.1.3  mrg   \DeclareUnicodeCharacter{0143}{\'N}%
   10698  1.1.1.3  mrg   \DeclareUnicodeCharacter{0144}{\'n}%
   10699  1.1.1.3  mrg   \DeclareUnicodeCharacter{0145}{\cedilla{N}}%
   10700  1.1.1.3  mrg   \DeclareUnicodeCharacter{0146}{\cedilla{n}}%
   10701  1.1.1.3  mrg   \DeclareUnicodeCharacter{0147}{\v{N}}%
   10702  1.1.1.3  mrg   \DeclareUnicodeCharacter{0148}{\v{n}}%
   10703  1.1.1.3  mrg   \DeclareUnicodeCharacter{0149}{'n}%
   10704  1.1.1.3  mrg   \DeclareUnicodeCharacter{014A}{\missingcharmsg{ENG}}%
   10705  1.1.1.3  mrg   \DeclareUnicodeCharacter{014B}{\missingcharmsg{eng}}%
   10706  1.1.1.3  mrg   \DeclareUnicodeCharacter{014C}{\=O}%
   10707  1.1.1.3  mrg   \DeclareUnicodeCharacter{014D}{\=o}%
   10708  1.1.1.3  mrg   \DeclareUnicodeCharacter{014E}{\u{O}}%
   10709  1.1.1.3  mrg   \DeclareUnicodeCharacter{014F}{\u{o}}%
   10710  1.1.1.3  mrg   %
   10711  1.1.1.3  mrg   \DeclareUnicodeCharacter{0150}{\H{O}}%
   10712  1.1.1.3  mrg   \DeclareUnicodeCharacter{0151}{\H{o}}%
   10713  1.1.1.3  mrg   \DeclareUnicodeCharacter{0152}{\OE}%
   10714  1.1.1.3  mrg   \DeclareUnicodeCharacter{0153}{\oe}%
   10715  1.1.1.3  mrg   \DeclareUnicodeCharacter{0154}{\'R}%
   10716  1.1.1.3  mrg   \DeclareUnicodeCharacter{0155}{\'r}%
   10717  1.1.1.3  mrg   \DeclareUnicodeCharacter{0156}{\cedilla{R}}%
   10718  1.1.1.3  mrg   \DeclareUnicodeCharacter{0157}{\cedilla{r}}%
   10719  1.1.1.3  mrg   \DeclareUnicodeCharacter{0158}{\v{R}}%
   10720  1.1.1.3  mrg   \DeclareUnicodeCharacter{0159}{\v{r}}%
   10721  1.1.1.3  mrg   \DeclareUnicodeCharacter{015A}{\'S}%
   10722  1.1.1.3  mrg   \DeclareUnicodeCharacter{015B}{\'s}%
   10723  1.1.1.3  mrg   \DeclareUnicodeCharacter{015C}{\^S}%
   10724  1.1.1.3  mrg   \DeclareUnicodeCharacter{015D}{\^s}%
   10725  1.1.1.3  mrg   \DeclareUnicodeCharacter{015E}{\cedilla{S}}%
   10726  1.1.1.3  mrg   \DeclareUnicodeCharacter{015F}{\cedilla{s}}%
   10727  1.1.1.3  mrg   %
   10728  1.1.1.3  mrg   \DeclareUnicodeCharacter{0160}{\v{S}}%
   10729  1.1.1.3  mrg   \DeclareUnicodeCharacter{0161}{\v{s}}%
   10730  1.1.1.3  mrg   \DeclareUnicodeCharacter{0162}{\cedilla{T}}%
   10731  1.1.1.3  mrg   \DeclareUnicodeCharacter{0163}{\cedilla{t}}%
   10732  1.1.1.3  mrg   \DeclareUnicodeCharacter{0164}{\v{T}}%
   10733  1.1.1.3  mrg   \DeclareUnicodeCharacter{0165}{\v{t}}%
   10734  1.1.1.3  mrg   \DeclareUnicodeCharacter{0166}{\missingcharmsg{H WITH STROKE}}%
   10735  1.1.1.3  mrg   \DeclareUnicodeCharacter{0167}{\missingcharmsg{h WITH STROKE}}%
   10736  1.1.1.3  mrg   \DeclareUnicodeCharacter{0168}{\~U}%
   10737  1.1.1.3  mrg   \DeclareUnicodeCharacter{0169}{\~u}%
   10738  1.1.1.3  mrg   \DeclareUnicodeCharacter{016A}{\=U}%
   10739  1.1.1.3  mrg   \DeclareUnicodeCharacter{016B}{\=u}%
   10740  1.1.1.3  mrg   \DeclareUnicodeCharacter{016C}{\u{U}}%
   10741  1.1.1.3  mrg   \DeclareUnicodeCharacter{016D}{\u{u}}%
   10742  1.1.1.3  mrg   \DeclareUnicodeCharacter{016E}{\ringaccent{U}}%
   10743  1.1.1.3  mrg   \DeclareUnicodeCharacter{016F}{\ringaccent{u}}%
   10744  1.1.1.3  mrg   %
   10745  1.1.1.3  mrg   \DeclareUnicodeCharacter{0170}{\H{U}}%
   10746  1.1.1.3  mrg   \DeclareUnicodeCharacter{0171}{\H{u}}%
   10747  1.1.1.3  mrg   \DeclareUnicodeCharacter{0172}{\ogonek{U}}%
   10748  1.1.1.3  mrg   \DeclareUnicodeCharacter{0173}{\ogonek{u}}%
   10749  1.1.1.3  mrg   \DeclareUnicodeCharacter{0174}{\^W}%
   10750  1.1.1.3  mrg   \DeclareUnicodeCharacter{0175}{\^w}%
   10751  1.1.1.3  mrg   \DeclareUnicodeCharacter{0176}{\^Y}%
   10752  1.1.1.3  mrg   \DeclareUnicodeCharacter{0177}{\^y}%
   10753  1.1.1.3  mrg   \DeclareUnicodeCharacter{0178}{\"Y}%
   10754  1.1.1.3  mrg   \DeclareUnicodeCharacter{0179}{\'Z}%
   10755  1.1.1.3  mrg   \DeclareUnicodeCharacter{017A}{\'z}%
   10756  1.1.1.3  mrg   \DeclareUnicodeCharacter{017B}{\dotaccent{Z}}%
   10757  1.1.1.3  mrg   \DeclareUnicodeCharacter{017C}{\dotaccent{z}}%
   10758  1.1.1.3  mrg   \DeclareUnicodeCharacter{017D}{\v{Z}}%
   10759  1.1.1.3  mrg   \DeclareUnicodeCharacter{017E}{\v{z}}%
   10760  1.1.1.3  mrg   \DeclareUnicodeCharacter{017F}{\missingcharmsg{LONG S}}%
   10761  1.1.1.3  mrg   %
   10762  1.1.1.3  mrg   \DeclareUnicodeCharacter{01C4}{D\v{Z}}%
   10763  1.1.1.3  mrg   \DeclareUnicodeCharacter{01C5}{D\v{z}}%
   10764  1.1.1.3  mrg   \DeclareUnicodeCharacter{01C6}{d\v{z}}%
   10765  1.1.1.3  mrg   \DeclareUnicodeCharacter{01C7}{LJ}%
   10766  1.1.1.3  mrg   \DeclareUnicodeCharacter{01C8}{Lj}%
   10767  1.1.1.3  mrg   \DeclareUnicodeCharacter{01C9}{lj}%
   10768  1.1.1.3  mrg   \DeclareUnicodeCharacter{01CA}{NJ}%
   10769  1.1.1.3  mrg   \DeclareUnicodeCharacter{01CB}{Nj}%
   10770  1.1.1.3  mrg   \DeclareUnicodeCharacter{01CC}{nj}%
   10771  1.1.1.3  mrg   \DeclareUnicodeCharacter{01CD}{\v{A}}%
   10772  1.1.1.3  mrg   \DeclareUnicodeCharacter{01CE}{\v{a}}%
   10773  1.1.1.3  mrg   \DeclareUnicodeCharacter{01CF}{\v{I}}%
   10774  1.1.1.3  mrg   %
   10775  1.1.1.3  mrg   \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}}%
   10776  1.1.1.3  mrg   \DeclareUnicodeCharacter{01D1}{\v{O}}%
   10777  1.1.1.3  mrg   \DeclareUnicodeCharacter{01D2}{\v{o}}%
   10778  1.1.1.3  mrg   \DeclareUnicodeCharacter{01D3}{\v{U}}%
   10779  1.1.1.3  mrg   \DeclareUnicodeCharacter{01D4}{\v{u}}%
   10780  1.1.1.3  mrg   %
   10781  1.1.1.3  mrg   \DeclareUnicodeCharacter{01E2}{\={\AE}}%
   10782  1.1.1.3  mrg   \DeclareUnicodeCharacter{01E3}{\={\ae}}%
   10783  1.1.1.3  mrg   \DeclareUnicodeCharacter{01E6}{\v{G}}%
   10784  1.1.1.3  mrg   \DeclareUnicodeCharacter{01E7}{\v{g}}%
   10785  1.1.1.3  mrg   \DeclareUnicodeCharacter{01E8}{\v{K}}%
   10786  1.1.1.3  mrg   \DeclareUnicodeCharacter{01E9}{\v{k}}%
   10787  1.1.1.3  mrg   %
   10788  1.1.1.3  mrg   \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}}%
   10789  1.1.1.3  mrg   \DeclareUnicodeCharacter{01F1}{DZ}%
   10790  1.1.1.3  mrg   \DeclareUnicodeCharacter{01F2}{Dz}%
   10791  1.1.1.3  mrg   \DeclareUnicodeCharacter{01F3}{dz}%
   10792  1.1.1.3  mrg   \DeclareUnicodeCharacter{01F4}{\'G}%
   10793  1.1.1.3  mrg   \DeclareUnicodeCharacter{01F5}{\'g}%
   10794  1.1.1.3  mrg   \DeclareUnicodeCharacter{01F8}{\`N}%
   10795  1.1.1.3  mrg   \DeclareUnicodeCharacter{01F9}{\`n}%
   10796  1.1.1.3  mrg   \DeclareUnicodeCharacter{01FC}{\'{\AE}}%
   10797  1.1.1.3  mrg   \DeclareUnicodeCharacter{01FD}{\'{\ae}}%
   10798  1.1.1.3  mrg   \DeclareUnicodeCharacter{01FE}{\'{\O}}%
   10799  1.1.1.3  mrg   \DeclareUnicodeCharacter{01FF}{\'{\o}}%
   10800  1.1.1.3  mrg   %
   10801  1.1.1.3  mrg   \DeclareUnicodeCharacter{021E}{\v{H}}%
   10802  1.1.1.3  mrg   \DeclareUnicodeCharacter{021F}{\v{h}}%
   10803  1.1.1.3  mrg   %
   10804  1.1.1.3  mrg   \DeclareUnicodeCharacter{0226}{\dotaccent{A}}%
   10805  1.1.1.3  mrg   \DeclareUnicodeCharacter{0227}{\dotaccent{a}}%
   10806  1.1.1.3  mrg   \DeclareUnicodeCharacter{0228}{\cedilla{E}}%
   10807  1.1.1.3  mrg   \DeclareUnicodeCharacter{0229}{\cedilla{e}}%
   10808  1.1.1.3  mrg   \DeclareUnicodeCharacter{022E}{\dotaccent{O}}%
   10809  1.1.1.3  mrg   \DeclareUnicodeCharacter{022F}{\dotaccent{o}}%
   10810  1.1.1.3  mrg   %
   10811  1.1.1.3  mrg   \DeclareUnicodeCharacter{0232}{\=Y}%
   10812  1.1.1.3  mrg   \DeclareUnicodeCharacter{0233}{\=y}%
   10813  1.1.1.3  mrg   \DeclareUnicodeCharacter{0237}{\dotless{j}}%
   10814  1.1.1.3  mrg   %
   10815  1.1.1.3  mrg   \DeclareUnicodeCharacter{02DB}{\ogonek{ }}%
   10816  1.1.1.3  mrg   %
   10817  1.1.1.3  mrg   % Greek letters upper case
   10818  1.1.1.3  mrg   \DeclareUnicodeCharacter{0391}{{\it A}}%
   10819  1.1.1.3  mrg   \DeclareUnicodeCharacter{0392}{{\it B}}%
   10820  1.1.1.3  mrg   \DeclareUnicodeCharacter{0393}{\ensuremath{\mit\Gamma}}%
   10821  1.1.1.3  mrg   \DeclareUnicodeCharacter{0394}{\ensuremath{\mit\Delta}}%
   10822  1.1.1.3  mrg   \DeclareUnicodeCharacter{0395}{{\it E}}%
   10823  1.1.1.3  mrg   \DeclareUnicodeCharacter{0396}{{\it Z}}%
   10824  1.1.1.3  mrg   \DeclareUnicodeCharacter{0397}{{\it H}}%
   10825  1.1.1.3  mrg   \DeclareUnicodeCharacter{0398}{\ensuremath{\mit\Theta}}%
   10826  1.1.1.3  mrg   \DeclareUnicodeCharacter{0399}{{\it I}}%
   10827  1.1.1.3  mrg   \DeclareUnicodeCharacter{039A}{{\it K}}%
   10828  1.1.1.3  mrg   \DeclareUnicodeCharacter{039B}{\ensuremath{\mit\Lambda}}%
   10829  1.1.1.3  mrg   \DeclareUnicodeCharacter{039C}{{\it M}}%
   10830  1.1.1.3  mrg   \DeclareUnicodeCharacter{039D}{{\it N}}%
   10831  1.1.1.3  mrg   \DeclareUnicodeCharacter{039E}{\ensuremath{\mit\Xi}}%
   10832  1.1.1.3  mrg   \DeclareUnicodeCharacter{039F}{{\it O}}%
   10833  1.1.1.3  mrg   \DeclareUnicodeCharacter{03A0}{\ensuremath{\mit\Pi}}%
   10834  1.1.1.3  mrg   \DeclareUnicodeCharacter{03A1}{{\it P}}%
   10835  1.1.1.3  mrg   %\DeclareUnicodeCharacter{03A2}{} % none - corresponds to final sigma
   10836  1.1.1.3  mrg   \DeclareUnicodeCharacter{03A3}{\ensuremath{\mit\Sigma}}%
   10837  1.1.1.3  mrg   \DeclareUnicodeCharacter{03A4}{{\it T}}%
   10838  1.1.1.3  mrg   \DeclareUnicodeCharacter{03A5}{\ensuremath{\mit\Upsilon}}%
   10839  1.1.1.3  mrg   \DeclareUnicodeCharacter{03A6}{\ensuremath{\mit\Phi}}%
   10840  1.1.1.3  mrg   \DeclareUnicodeCharacter{03A7}{{\it X}}%
   10841  1.1.1.3  mrg   \DeclareUnicodeCharacter{03A8}{\ensuremath{\mit\Psi}}%
   10842  1.1.1.3  mrg   \DeclareUnicodeCharacter{03A9}{\ensuremath{\mit\Omega}}%
   10843  1.1.1.3  mrg   %
   10844  1.1.1.3  mrg   % Vowels with accents
   10845  1.1.1.3  mrg   \DeclareUnicodeCharacter{0390}{\ensuremath{\ddot{\acute\iota}}}%
   10846  1.1.1.3  mrg   \DeclareUnicodeCharacter{03AC}{\ensuremath{\acute\alpha}}%
   10847  1.1.1.3  mrg   \DeclareUnicodeCharacter{03AD}{\ensuremath{\acute\epsilon}}%
   10848  1.1.1.3  mrg   \DeclareUnicodeCharacter{03AE}{\ensuremath{\acute\eta}}%
   10849  1.1.1.3  mrg   \DeclareUnicodeCharacter{03AF}{\ensuremath{\acute\iota}}%
   10850  1.1.1.3  mrg   \DeclareUnicodeCharacter{03B0}{\ensuremath{\acute{\ddot\upsilon}}}%
   10851  1.1.1.3  mrg   %
   10852  1.1.1.3  mrg   % Standalone accent
   10853  1.1.1.3  mrg   \DeclareUnicodeCharacter{0384}{\ensuremath{\acute{\ }}}%
   10854  1.1.1.3  mrg   %
   10855  1.1.1.3  mrg   % Greek letters lower case
   10856  1.1.1.3  mrg   \DeclareUnicodeCharacter{03B1}{\ensuremath\alpha}%
   10857  1.1.1.3  mrg   \DeclareUnicodeCharacter{03B2}{\ensuremath\beta}%
   10858  1.1.1.3  mrg   \DeclareUnicodeCharacter{03B3}{\ensuremath\gamma}%
   10859  1.1.1.3  mrg   \DeclareUnicodeCharacter{03B4}{\ensuremath\delta}%
   10860  1.1.1.3  mrg   \DeclareUnicodeCharacter{03B5}{\ensuremath\epsilon}%
   10861  1.1.1.3  mrg   \DeclareUnicodeCharacter{03B6}{\ensuremath\zeta}%
   10862  1.1.1.3  mrg   \DeclareUnicodeCharacter{03B7}{\ensuremath\eta}%
   10863  1.1.1.3  mrg   \DeclareUnicodeCharacter{03B8}{\ensuremath\theta}%
   10864  1.1.1.3  mrg   \DeclareUnicodeCharacter{03B9}{\ensuremath\iota}%
   10865  1.1.1.3  mrg   \DeclareUnicodeCharacter{03BA}{\ensuremath\kappa}%
   10866  1.1.1.3  mrg   \DeclareUnicodeCharacter{03BB}{\ensuremath\lambda}%
   10867  1.1.1.3  mrg   \DeclareUnicodeCharacter{03BC}{\ensuremath\mu}%
   10868  1.1.1.3  mrg   \DeclareUnicodeCharacter{03BD}{\ensuremath\nu}%
   10869  1.1.1.3  mrg   \DeclareUnicodeCharacter{03BE}{\ensuremath\xi}%
   10870  1.1.1.3  mrg   \DeclareUnicodeCharacter{03BF}{{\it o}}% omicron
   10871  1.1.1.3  mrg   \DeclareUnicodeCharacter{03C0}{\ensuremath\pi}%
   10872  1.1.1.3  mrg   \DeclareUnicodeCharacter{03C1}{\ensuremath\rho}%
   10873  1.1.1.3  mrg   \DeclareUnicodeCharacter{03C2}{\ensuremath\varsigma}%
   10874  1.1.1.3  mrg   \DeclareUnicodeCharacter{03C3}{\ensuremath\sigma}%
   10875  1.1.1.3  mrg   \DeclareUnicodeCharacter{03C4}{\ensuremath\tau}%
   10876  1.1.1.3  mrg   \DeclareUnicodeCharacter{03C5}{\ensuremath\upsilon}%
   10877  1.1.1.3  mrg   \DeclareUnicodeCharacter{03C6}{\ensuremath\phi}%
   10878  1.1.1.3  mrg   \DeclareUnicodeCharacter{03C7}{\ensuremath\chi}%
   10879  1.1.1.3  mrg   \DeclareUnicodeCharacter{03C8}{\ensuremath\psi}%
   10880  1.1.1.3  mrg   \DeclareUnicodeCharacter{03C9}{\ensuremath\omega}%
   10881  1.1.1.3  mrg   %
   10882  1.1.1.3  mrg   % More Greek vowels with accents
   10883  1.1.1.3  mrg   \DeclareUnicodeCharacter{03CA}{\ensuremath{\ddot\iota}}%
   10884  1.1.1.3  mrg   \DeclareUnicodeCharacter{03CB}{\ensuremath{\ddot\upsilon}}%
   10885  1.1.1.3  mrg   \DeclareUnicodeCharacter{03CC}{\ensuremath{\acute o}}%
   10886  1.1.1.3  mrg   \DeclareUnicodeCharacter{03CD}{\ensuremath{\acute\upsilon}}%
   10887  1.1.1.3  mrg   \DeclareUnicodeCharacter{03CE}{\ensuremath{\acute\omega}}%
   10888  1.1.1.3  mrg   %
   10889  1.1.1.3  mrg   % Variant Greek letters
   10890  1.1.1.3  mrg   \DeclareUnicodeCharacter{03D1}{\ensuremath\vartheta}%
   10891  1.1.1.3  mrg   \DeclareUnicodeCharacter{03D6}{\ensuremath\varpi}%
   10892  1.1.1.3  mrg   \DeclareUnicodeCharacter{03F1}{\ensuremath\varrho}%
   10893  1.1.1.3  mrg   %
   10894  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E02}{\dotaccent{B}}%
   10895  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E03}{\dotaccent{b}}%
   10896  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E04}{\udotaccent{B}}%
   10897  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E05}{\udotaccent{b}}%
   10898  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}}%
   10899  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}}%
   10900  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}}%
   10901  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}}%
   10902  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}}%
   10903  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}}%
   10904  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}}%
   10905  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}}%
   10906  1.1.1.3  mrg   %
   10907  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}}%
   10908  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}}%
   10909  1.1.1.3  mrg   %
   10910  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E20}{\=G}%
   10911  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E21}{\=g}%
   10912  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E22}{\dotaccent{H}}%
   10913  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E23}{\dotaccent{h}}%
   10914  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E24}{\udotaccent{H}}%
   10915  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E25}{\udotaccent{h}}%
   10916  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E26}{\"H}%
   10917  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E27}{\"h}%
   10918  1.1.1.3  mrg   %
   10919  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E30}{\'K}%
   10920  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E31}{\'k}%
   10921  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E32}{\udotaccent{K}}%
   10922  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E33}{\udotaccent{k}}%
   10923  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}}%
   10924  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}}%
   10925  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E36}{\udotaccent{L}}%
   10926  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E37}{\udotaccent{l}}%
   10927  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}}%
   10928  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}}%
   10929  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E3E}{\'M}%
   10930  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E3F}{\'m}%
   10931  1.1.1.3  mrg   %
   10932  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E40}{\dotaccent{M}}%
   10933  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E41}{\dotaccent{m}}%
   10934  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E42}{\udotaccent{M}}%
   10935  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E43}{\udotaccent{m}}%
   10936  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E44}{\dotaccent{N}}%
   10937  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E45}{\dotaccent{n}}%
   10938  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E46}{\udotaccent{N}}%
   10939  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E47}{\udotaccent{n}}%
   10940  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}}%
   10941  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}}%
   10942  1.1.1.3  mrg   %
   10943  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E54}{\'P}%
   10944  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E55}{\'p}%
   10945  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E56}{\dotaccent{P}}%
   10946  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E57}{\dotaccent{p}}%
   10947  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E58}{\dotaccent{R}}%
   10948  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E59}{\dotaccent{r}}%
   10949  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}}%
   10950  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}}%
   10951  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}}%
   10952  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}}%
   10953  1.1.1.3  mrg   %
   10954  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E60}{\dotaccent{S}}%
   10955  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E61}{\dotaccent{s}}%
   10956  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E62}{\udotaccent{S}}%
   10957  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E63}{\udotaccent{s}}%
   10958  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}}%
   10959  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}}%
   10960  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}}%
   10961  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}}%
   10962  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}}%
   10963  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}}%
   10964  1.1.1.3  mrg   %
   10965  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E7C}{\~V}%
   10966  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E7D}{\~v}%
   10967  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}}%
   10968  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}}%
   10969  1.1.1.3  mrg   %
   10970  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E80}{\`W}%
   10971  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E81}{\`w}%
   10972  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E82}{\'W}%
   10973  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E83}{\'w}%
   10974  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E84}{\"W}%
   10975  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E85}{\"w}%
   10976  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E86}{\dotaccent{W}}%
   10977  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E87}{\dotaccent{w}}%
   10978  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E88}{\udotaccent{W}}%
   10979  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E89}{\udotaccent{w}}%
   10980  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}}%
   10981  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}}%
   10982  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E8C}{\"X}%
   10983  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E8D}{\"x}%
   10984  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}}%
   10985  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}}%
   10986  1.1.1.3  mrg   %
   10987  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E90}{\^Z}%
   10988  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E91}{\^z}%
   10989  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}}%
   10990  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E93}{\udotaccent{z}}%
   10991  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}}%
   10992  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}}%
   10993  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}}%
   10994  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E97}{\"t}%
   10995  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E98}{\ringaccent{w}}%
   10996  1.1.1.3  mrg   \DeclareUnicodeCharacter{1E99}{\ringaccent{y}}%
   10997  1.1.1.3  mrg   %
   10998  1.1.1.3  mrg   \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}}%
   10999  1.1.1.3  mrg   \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}}%
   11000  1.1.1.3  mrg   %
   11001  1.1.1.3  mrg   \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}}%
   11002  1.1.1.3  mrg   \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}}%
   11003  1.1.1.3  mrg   \DeclareUnicodeCharacter{1EBC}{\~E}%
   11004  1.1.1.3  mrg   \DeclareUnicodeCharacter{1EBD}{\~e}%
   11005  1.1.1.3  mrg   %
   11006  1.1.1.3  mrg   \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}}%
   11007  1.1.1.3  mrg   \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}}%
   11008  1.1.1.3  mrg   \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}}%
   11009  1.1.1.3  mrg   \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}}%
   11010  1.1.1.3  mrg   %
   11011  1.1.1.3  mrg   \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}}%
   11012  1.1.1.3  mrg   \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}}%
   11013  1.1.1.3  mrg   %
   11014  1.1.1.3  mrg   \DeclareUnicodeCharacter{1EF2}{\`Y}%
   11015  1.1.1.3  mrg   \DeclareUnicodeCharacter{1EF3}{\`y}%
   11016  1.1.1.3  mrg   \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}}%
   11017  1.1.1.3  mrg   %
   11018  1.1.1.3  mrg   \DeclareUnicodeCharacter{1EF8}{\~Y}%
   11019  1.1.1.3  mrg   \DeclareUnicodeCharacter{1EF9}{\~y}%
   11020  1.1.1.3  mrg   %
   11021  1.1.1.3  mrg   % Punctuation
   11022  1.1.1.3  mrg   \DeclareUnicodeCharacter{2013}{--}%
   11023  1.1.1.3  mrg   \DeclareUnicodeCharacter{2014}{---}%
   11024  1.1.1.3  mrg   \DeclareUnicodeCharacter{2018}{\quoteleft{}}%
   11025  1.1.1.3  mrg   \DeclareUnicodeCharacter{2019}{\quoteright{}}%
   11026  1.1.1.3  mrg   \DeclareUnicodeCharacter{201A}{\quotesinglbase{}}%
   11027  1.1.1.3  mrg   \DeclareUnicodeCharacter{201C}{\quotedblleft{}}%
   11028  1.1.1.3  mrg   \DeclareUnicodeCharacter{201D}{\quotedblright{}}%
   11029  1.1.1.3  mrg   \DeclareUnicodeCharacter{201E}{\quotedblbase{}}%
   11030  1.1.1.3  mrg   \DeclareUnicodeCharacter{2020}{\ensuremath\dagger}%
   11031  1.1.1.3  mrg   \DeclareUnicodeCharacter{2021}{\ensuremath\ddagger}%
   11032  1.1.1.3  mrg   \DeclareUnicodeCharacter{2022}{\bullet{}}%
   11033  1.1.1.3  mrg   \DeclareUnicodeCharacter{202F}{\thinspace}%
   11034  1.1.1.3  mrg   \DeclareUnicodeCharacter{2026}{\dots{}}%
   11035  1.1.1.3  mrg   \DeclareUnicodeCharacter{2039}{\guilsinglleft{}}%
   11036  1.1.1.3  mrg   \DeclareUnicodeCharacter{203A}{\guilsinglright{}}%
   11037  1.1.1.3  mrg   %
   11038  1.1.1.3  mrg   \DeclareUnicodeCharacter{20AC}{\euro{}}%
   11039  1.1.1.3  mrg   %
   11040  1.1.1.3  mrg   \DeclareUnicodeCharacter{2192}{\expansion{}}%
   11041  1.1.1.3  mrg   \DeclareUnicodeCharacter{21D2}{\result{}}%
   11042  1.1.1.3  mrg   %
   11043  1.1.1.3  mrg   % Mathematical symbols
   11044  1.1.1.3  mrg   \DeclareUnicodeCharacter{2200}{\ensuremath\forall}%
   11045  1.1.1.3  mrg   \DeclareUnicodeCharacter{2203}{\ensuremath\exists}%
   11046  1.1.1.3  mrg   \DeclareUnicodeCharacter{2208}{\ensuremath\in}%
   11047  1.1.1.3  mrg   \DeclareUnicodeCharacter{2212}{\minus{}}%
   11048  1.1.1.3  mrg   \DeclareUnicodeCharacter{2217}{\ast}%
   11049  1.1.1.3  mrg   \DeclareUnicodeCharacter{221E}{\ensuremath\infty}%
   11050  1.1.1.3  mrg   \DeclareUnicodeCharacter{2225}{\ensuremath\parallel}%
   11051  1.1.1.3  mrg   \DeclareUnicodeCharacter{2227}{\ensuremath\wedge}%
   11052  1.1.1.3  mrg   \DeclareUnicodeCharacter{2229}{\ensuremath\cap}%
   11053  1.1.1.3  mrg   \DeclareUnicodeCharacter{2261}{\equiv{}}%
   11054  1.1.1.3  mrg   \DeclareUnicodeCharacter{2264}{\ensuremath\leq}%
   11055  1.1.1.3  mrg   \DeclareUnicodeCharacter{2265}{\ensuremath\geq}%
   11056  1.1.1.3  mrg   \DeclareUnicodeCharacter{2282}{\ensuremath\subset}%
   11057  1.1.1.3  mrg   \DeclareUnicodeCharacter{2287}{\ensuremath\supseteq}%
   11058  1.1.1.3  mrg   %
   11059  1.1.1.3  mrg   \DeclareUnicodeCharacter{2016}{\ensuremath\Vert}%
   11060  1.1.1.3  mrg   \DeclareUnicodeCharacter{2032}{\ensuremath\prime}%
   11061  1.1.1.3  mrg   \DeclareUnicodeCharacter{210F}{\ensuremath\hbar}%
   11062  1.1.1.3  mrg   \DeclareUnicodeCharacter{2111}{\ensuremath\Im}%
   11063  1.1.1.3  mrg   \DeclareUnicodeCharacter{2113}{\ensuremath\ell}%
   11064  1.1.1.3  mrg   \DeclareUnicodeCharacter{2118}{\ensuremath\wp}%
   11065  1.1.1.3  mrg   \DeclareUnicodeCharacter{211C}{\ensuremath\Re}%
   11066  1.1.1.3  mrg   \DeclareUnicodeCharacter{2135}{\ensuremath\aleph}%
   11067  1.1.1.3  mrg   \DeclareUnicodeCharacter{2190}{\ensuremath\leftarrow}%
   11068  1.1.1.3  mrg   \DeclareUnicodeCharacter{2191}{\ensuremath\uparrow}%
   11069  1.1.1.3  mrg   \DeclareUnicodeCharacter{2193}{\ensuremath\downarrow}%
   11070  1.1.1.3  mrg   \DeclareUnicodeCharacter{2194}{\ensuremath\leftrightarrow}%
   11071  1.1.1.3  mrg   \DeclareUnicodeCharacter{2195}{\ensuremath\updownarrow}%
   11072  1.1.1.3  mrg   \DeclareUnicodeCharacter{2196}{\ensuremath\nwarrow}%
   11073  1.1.1.3  mrg   \DeclareUnicodeCharacter{2197}{\ensuremath\nearrow}%
   11074  1.1.1.3  mrg   \DeclareUnicodeCharacter{2198}{\ensuremath\searrow}%
   11075  1.1.1.3  mrg   \DeclareUnicodeCharacter{2199}{\ensuremath\swarrow}%
   11076  1.1.1.3  mrg   \DeclareUnicodeCharacter{21A6}{\ensuremath\mapsto}%
   11077  1.1.1.3  mrg   \DeclareUnicodeCharacter{21A9}{\ensuremath\hookleftarrow}%
   11078  1.1.1.3  mrg   \DeclareUnicodeCharacter{21AA}{\ensuremath\hookrightarrow}%
   11079  1.1.1.3  mrg   \DeclareUnicodeCharacter{21BC}{\ensuremath\leftharpoonup}%
   11080  1.1.1.3  mrg   \DeclareUnicodeCharacter{21BD}{\ensuremath\leftharpoondown}%
   11081  1.1.1.3  mrg   \DeclareUnicodeCharacter{21C0}{\ensuremath\rightharpoonup}%
   11082  1.1.1.3  mrg   \DeclareUnicodeCharacter{21C1}{\ensuremath\rightharpoondown}%
   11083  1.1.1.3  mrg   \DeclareUnicodeCharacter{21CC}{\ensuremath\rightleftharpoons}%
   11084  1.1.1.3  mrg   \DeclareUnicodeCharacter{21D0}{\ensuremath\Leftarrow}%
   11085  1.1.1.3  mrg   \DeclareUnicodeCharacter{21D1}{\ensuremath\Uparrow}%
   11086  1.1.1.3  mrg   \DeclareUnicodeCharacter{21D3}{\ensuremath\Downarrow}%
   11087  1.1.1.3  mrg   \DeclareUnicodeCharacter{21D4}{\ensuremath\Leftrightarrow}%
   11088  1.1.1.3  mrg   \DeclareUnicodeCharacter{21D5}{\ensuremath\Updownarrow}%
   11089  1.1.1.3  mrg   \DeclareUnicodeCharacter{2202}{\ensuremath\partial}%
   11090  1.1.1.3  mrg   \DeclareUnicodeCharacter{2205}{\ensuremath\emptyset}%
   11091  1.1.1.3  mrg   \DeclareUnicodeCharacter{2207}{\ensuremath\nabla}%
   11092  1.1.1.3  mrg   \DeclareUnicodeCharacter{2209}{\ensuremath\notin}%
   11093  1.1.1.3  mrg   \DeclareUnicodeCharacter{220B}{\ensuremath\owns}%
   11094  1.1.1.3  mrg   \DeclareUnicodeCharacter{220F}{\ensuremath\prod}%
   11095  1.1.1.3  mrg   \DeclareUnicodeCharacter{2210}{\ensuremath\coprod}%
   11096  1.1.1.3  mrg   \DeclareUnicodeCharacter{2211}{\ensuremath\sum}%
   11097  1.1.1.3  mrg   \DeclareUnicodeCharacter{2213}{\ensuremath\mp}%
   11098  1.1.1.3  mrg   \DeclareUnicodeCharacter{2218}{\ensuremath\circ}%
   11099  1.1.1.3  mrg   \DeclareUnicodeCharacter{221A}{\ensuremath\surd}%
   11100  1.1.1.3  mrg   \DeclareUnicodeCharacter{221D}{\ensuremath\propto}%
   11101  1.1.1.3  mrg   \DeclareUnicodeCharacter{2220}{\ensuremath\angle}%
   11102  1.1.1.3  mrg   \DeclareUnicodeCharacter{2223}{\ensuremath\mid}%
   11103  1.1.1.3  mrg   \DeclareUnicodeCharacter{2228}{\ensuremath\vee}%
   11104  1.1.1.3  mrg   \DeclareUnicodeCharacter{222A}{\ensuremath\cup}%
   11105  1.1.1.3  mrg   \DeclareUnicodeCharacter{222B}{\ensuremath\smallint}%
   11106  1.1.1.3  mrg   \DeclareUnicodeCharacter{222E}{\ensuremath\oint}%
   11107  1.1.1.3  mrg   \DeclareUnicodeCharacter{223C}{\ensuremath\sim}%
   11108  1.1.1.3  mrg   \DeclareUnicodeCharacter{2240}{\ensuremath\wr}%
   11109  1.1.1.3  mrg   \DeclareUnicodeCharacter{2243}{\ensuremath\simeq}%
   11110  1.1.1.3  mrg   \DeclareUnicodeCharacter{2245}{\ensuremath\cong}%
   11111  1.1.1.3  mrg   \DeclareUnicodeCharacter{2248}{\ensuremath\approx}%
   11112  1.1.1.3  mrg   \DeclareUnicodeCharacter{224D}{\ensuremath\asymp}%
   11113  1.1.1.3  mrg   \DeclareUnicodeCharacter{2250}{\ensuremath\doteq}%
   11114  1.1.1.3  mrg   \DeclareUnicodeCharacter{2260}{\ensuremath\neq}%
   11115  1.1.1.3  mrg   \DeclareUnicodeCharacter{226A}{\ensuremath\ll}%
   11116  1.1.1.3  mrg   \DeclareUnicodeCharacter{226B}{\ensuremath\gg}%
   11117  1.1.1.3  mrg   \DeclareUnicodeCharacter{227A}{\ensuremath\prec}%
   11118  1.1.1.3  mrg   \DeclareUnicodeCharacter{227B}{\ensuremath\succ}%
   11119  1.1.1.3  mrg   \DeclareUnicodeCharacter{2283}{\ensuremath\supset}%
   11120  1.1.1.3  mrg   \DeclareUnicodeCharacter{2286}{\ensuremath\subseteq}%
   11121  1.1.1.3  mrg   \DeclareUnicodeCharacter{228E}{\ensuremath\uplus}%
   11122  1.1.1.3  mrg   \DeclareUnicodeCharacter{2291}{\ensuremath\sqsubseteq}%
   11123  1.1.1.3  mrg   \DeclareUnicodeCharacter{2292}{\ensuremath\sqsupseteq}%
   11124  1.1.1.3  mrg   \DeclareUnicodeCharacter{2293}{\ensuremath\sqcap}%
   11125  1.1.1.3  mrg   \DeclareUnicodeCharacter{2294}{\ensuremath\sqcup}%
   11126  1.1.1.3  mrg   \DeclareUnicodeCharacter{2295}{\ensuremath\oplus}%
   11127  1.1.1.3  mrg   \DeclareUnicodeCharacter{2296}{\ensuremath\ominus}%
   11128  1.1.1.3  mrg   \DeclareUnicodeCharacter{2297}{\ensuremath\otimes}%
   11129  1.1.1.3  mrg   \DeclareUnicodeCharacter{2298}{\ensuremath\oslash}%
   11130  1.1.1.3  mrg   \DeclareUnicodeCharacter{2299}{\ensuremath\odot}%
   11131  1.1.1.3  mrg   \DeclareUnicodeCharacter{22A2}{\ensuremath\vdash}%
   11132  1.1.1.3  mrg   \DeclareUnicodeCharacter{22A3}{\ensuremath\dashv}%
   11133  1.1.1.3  mrg   \DeclareUnicodeCharacter{22A4}{\ensuremath\ptextop}%
   11134  1.1.1.3  mrg   \DeclareUnicodeCharacter{22A5}{\ensuremath\bot}%
   11135  1.1.1.3  mrg   \DeclareUnicodeCharacter{22A8}{\ensuremath\models}%
   11136  1.1.1.3  mrg   \DeclareUnicodeCharacter{22C0}{\ensuremath\bigwedge}%
   11137  1.1.1.3  mrg   \DeclareUnicodeCharacter{22C1}{\ensuremath\bigvee}%
   11138  1.1.1.3  mrg   \DeclareUnicodeCharacter{22C2}{\ensuremath\bigcap}%
   11139  1.1.1.3  mrg   \DeclareUnicodeCharacter{22C3}{\ensuremath\bigcup}%
   11140  1.1.1.3  mrg   \DeclareUnicodeCharacter{22C4}{\ensuremath\diamond}%
   11141  1.1.1.3  mrg   \DeclareUnicodeCharacter{22C5}{\ensuremath\cdot}%
   11142  1.1.1.3  mrg   \DeclareUnicodeCharacter{22C6}{\ensuremath\star}%
   11143  1.1.1.3  mrg   \DeclareUnicodeCharacter{22C8}{\ensuremath\bowtie}%
   11144  1.1.1.3  mrg   \DeclareUnicodeCharacter{2308}{\ensuremath\lceil}%
   11145  1.1.1.3  mrg   \DeclareUnicodeCharacter{2309}{\ensuremath\rceil}%
   11146  1.1.1.3  mrg   \DeclareUnicodeCharacter{230A}{\ensuremath\lfloor}%
   11147  1.1.1.3  mrg   \DeclareUnicodeCharacter{230B}{\ensuremath\rfloor}%
   11148  1.1.1.3  mrg   \DeclareUnicodeCharacter{2322}{\ensuremath\frown}%
   11149  1.1.1.3  mrg   \DeclareUnicodeCharacter{2323}{\ensuremath\smile}%
   11150  1.1.1.3  mrg   %
   11151  1.1.1.3  mrg   \DeclareUnicodeCharacter{25B3}{\ensuremath\triangle}%
   11152  1.1.1.3  mrg   \DeclareUnicodeCharacter{25B7}{\ensuremath\triangleright}%
   11153  1.1.1.3  mrg   \DeclareUnicodeCharacter{25BD}{\ensuremath\bigtriangledown}%
   11154  1.1.1.3  mrg   \DeclareUnicodeCharacter{25C1}{\ensuremath\triangleleft}%
   11155  1.1.1.3  mrg   \DeclareUnicodeCharacter{25C7}{\ensuremath\diamond}%
   11156  1.1.1.3  mrg   \DeclareUnicodeCharacter{2660}{\ensuremath\spadesuit}%
   11157  1.1.1.3  mrg   \DeclareUnicodeCharacter{2661}{\ensuremath\heartsuit}%
   11158  1.1.1.3  mrg   \DeclareUnicodeCharacter{2662}{\ensuremath\diamondsuit}%
   11159  1.1.1.3  mrg   \DeclareUnicodeCharacter{2663}{\ensuremath\clubsuit}%
   11160  1.1.1.3  mrg   \DeclareUnicodeCharacter{266D}{\ensuremath\flat}%
   11161  1.1.1.3  mrg   \DeclareUnicodeCharacter{266E}{\ensuremath\natural}%
   11162  1.1.1.3  mrg   \DeclareUnicodeCharacter{266F}{\ensuremath\sharp}%
   11163  1.1.1.3  mrg   \DeclareUnicodeCharacter{26AA}{\ensuremath\bigcirc}%
   11164  1.1.1.3  mrg   \DeclareUnicodeCharacter{27B9}{\ensuremath\rangle}%
   11165  1.1.1.3  mrg   \DeclareUnicodeCharacter{27C2}{\ensuremath\perp}%
   11166  1.1.1.3  mrg   \DeclareUnicodeCharacter{27E8}{\ensuremath\langle}%
   11167  1.1.1.3  mrg   \DeclareUnicodeCharacter{27F5}{\ensuremath\longleftarrow}%
   11168  1.1.1.3  mrg   \DeclareUnicodeCharacter{27F6}{\ensuremath\longrightarrow}%
   11169  1.1.1.3  mrg   \DeclareUnicodeCharacter{27F7}{\ensuremath\longleftrightarrow}%
   11170  1.1.1.3  mrg   \DeclareUnicodeCharacter{27FC}{\ensuremath\longmapsto}%
   11171  1.1.1.3  mrg   \DeclareUnicodeCharacter{29F5}{\ensuremath\setminus}%
   11172  1.1.1.3  mrg   \DeclareUnicodeCharacter{2A00}{\ensuremath\bigodot}%
   11173  1.1.1.3  mrg   \DeclareUnicodeCharacter{2A01}{\ensuremath\bigoplus}%
   11174  1.1.1.3  mrg   \DeclareUnicodeCharacter{2A02}{\ensuremath\bigotimes}%
   11175  1.1.1.3  mrg   \DeclareUnicodeCharacter{2A04}{\ensuremath\biguplus}%
   11176  1.1.1.3  mrg   \DeclareUnicodeCharacter{2A06}{\ensuremath\bigsqcup}%
   11177  1.1.1.3  mrg   \DeclareUnicodeCharacter{2A3F}{\ensuremath\amalg}%
   11178  1.1.1.3  mrg   \DeclareUnicodeCharacter{2AAF}{\ensuremath\preceq}%
   11179  1.1.1.3  mrg   \DeclareUnicodeCharacter{2AB0}{\ensuremath\succeq}%
   11180  1.1.1.3  mrg   %
   11181  1.1.1.3  mrg   \global\mathchardef\checkmark="1370% actually the square root sign
   11182  1.1.1.3  mrg   \DeclareUnicodeCharacter{2713}{\ensuremath\checkmark}%
   11183      1.1  mrg }% end of \unicodechardefs
   11184  1.1.1.3  mrg 
   11185  1.1.1.3  mrg % UTF-8 byte sequence (pdfTeX) definitions (replacing and @U command)
   11186  1.1.1.3  mrg % It makes the setting that replace UTF-8 byte sequence.
   11187  1.1.1.3  mrg \def\utfeightchardefs{%
   11188  1.1.1.3  mrg   \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterUTFviii
   11189  1.1.1.3  mrg   \unicodechardefs
   11190  1.1.1.3  mrg }
   11191  1.1.1.3  mrg 
   11192  1.1.1.3  mrg % Whether the active definitions of non-ASCII characters expand to
   11193  1.1.1.3  mrg % non-active tokens with the same character code.  This is used to
   11194  1.1.1.3  mrg % write characters literally, instead of using active definitions for
   11195  1.1.1.3  mrg % printing the correct glyphs.
   11196  1.1.1.3  mrg \newif\ifpassthroughchars
   11197  1.1.1.3  mrg \passthroughcharsfalse
   11198  1.1.1.3  mrg 
   11199  1.1.1.3  mrg % For native Unicode handling (XeTeX and LuaTeX),
   11200  1.1.1.3  mrg % provide a definition macro to replace/pass-through a Unicode character
   11201  1.1.1.3  mrg %
   11202  1.1.1.3  mrg \def\DeclareUnicodeCharacterNative#1#2{%
   11203  1.1.1.3  mrg   \catcode"#1=\active
   11204  1.1.1.3  mrg   \def\dodeclareunicodecharacternative##1##2##3{%
   11205  1.1.1.3  mrg     \begingroup
   11206  1.1.1.3  mrg       \uccode`\~="##2\relax
   11207  1.1.1.3  mrg       \uppercase{\gdef~}{%
   11208  1.1.1.3  mrg         \ifpassthroughchars
   11209  1.1.1.3  mrg           ##1%
   11210  1.1.1.3  mrg         \else
   11211  1.1.1.3  mrg           ##3%
   11212  1.1.1.3  mrg         \fi
   11213  1.1.1.3  mrg       }
   11214  1.1.1.3  mrg     \endgroup
   11215  1.1.1.3  mrg   }
   11216  1.1.1.3  mrg   \begingroup
   11217  1.1.1.3  mrg     \uccode`\.="#1\relax
   11218      1.1  mrg     \uppercase{\def\UTFNativeTmp{.}}%
   11219  1.1.1.3  mrg     \expandafter\dodeclareunicodecharacternative\UTFNativeTmp{#1}{#2}%
   11220  1.1.1.3  mrg   \endgroup
   11221  1.1.1.3  mrg }
   11222  1.1.1.3  mrg 
   11223  1.1.1.3  mrg % Native Unicode handling (XeTeX and LuaTeX) character replacing definition.
   11224  1.1.1.3  mrg % It activates the setting that replaces Unicode characters.
   11225  1.1.1.3  mrg \def\nativeunicodechardefs{%
   11226  1.1.1.3  mrg   \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNative
   11227  1.1.1.3  mrg   \unicodechardefs
   11228  1.1.1.3  mrg }
   11229  1.1.1.3  mrg 
   11230  1.1.1.3  mrg % For native Unicode handling (XeTeX and LuaTeX),
   11231  1.1.1.3  mrg % make the character token expand
   11232  1.1.1.3  mrg % to the sequences given in \unicodechardefs for printing.
   11233  1.1.1.3  mrg \def\DeclareUnicodeCharacterNativeAtU#1#2{%
   11234  1.1.1.3  mrg   \def\UTFAtUTmp{#2}
   11235  1.1.1.3  mrg   \expandafter\globallet\csname uni:#1\endcsname \UTFAtUTmp
   11236  1.1.1.3  mrg }
   11237  1.1.1.3  mrg 
   11238  1.1.1.3  mrg % @U command definitions for native Unicode handling (XeTeX and LuaTeX).
   11239      1.1  mrg \def\nativeunicodechardefsatu{%
   11240      1.1  mrg   \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNativeAtU
   11241      1.1  mrg   \unicodechardefs
   11242      1.1  mrg }
   11243      1.1  mrg 
   11244      1.1  mrg % US-ASCII character definitions.
   11245  1.1.1.3  mrg \def\asciichardefs{% nothing need be done
   11246  1.1.1.3  mrg    \relax
   11247  1.1.1.3  mrg }
   11248  1.1.1.3  mrg 
   11249  1.1.1.3  mrg % define all Unicode characters we know about, for the sake of @U.
   11250  1.1.1.3  mrg \iftxinativeunicodecapable
   11251  1.1.1.3  mrg   \nativeunicodechardefsatu
   11252  1.1.1.3  mrg \else
   11253      1.1  mrg   \utfeightchardefs
   11254      1.1  mrg \fi
   11255      1.1  mrg 
   11256      1.1  mrg 
   11257      1.1  mrg % Make non-ASCII characters printable again for compatibility with
   11258      1.1  mrg % existing Texinfo documents that may use them, even without declaring a
   11259      1.1  mrg % document encoding.
   11260      1.1  mrg %
   11261      1.1  mrg \setnonasciicharscatcode \other
   11262      1.1  mrg 
   11263      1.1  mrg 
   11264      1.1  mrg \message{formatting,}
   11265      1.1  mrg 
   11266      1.1  mrg \newdimen\defaultparindent \defaultparindent = 15pt
   11267      1.1  mrg 
   11268      1.1  mrg \chapheadingskip = 15pt plus 4pt minus 2pt
   11269      1.1  mrg \secheadingskip = 12pt plus 3pt minus 2pt
   11270      1.1  mrg \subsecheadingskip = 9pt plus 2pt minus 2pt
   11271      1.1  mrg 
   11272      1.1  mrg % Prevent underfull vbox error messages.
   11273      1.1  mrg \vbadness = 10000
   11274      1.1  mrg 
   11275      1.1  mrg % Don't be very finicky about underfull hboxes, either.
   11276      1.1  mrg \hbadness = 6666
   11277      1.1  mrg 
   11278      1.1  mrg % Following George Bush, get rid of widows and orphans.
   11279      1.1  mrg \widowpenalty=10000
   11280      1.1  mrg \clubpenalty=10000
   11281      1.1  mrg 
   11282      1.1  mrg % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
   11283      1.1  mrg % using an old version of TeX, don't do anything.  We want the amount of
   11284      1.1  mrg % stretch added to depend on the line length, hence the dependence on
   11285      1.1  mrg % \hsize.  We call this whenever the paper size is set.
   11286      1.1  mrg %
   11287      1.1  mrg \def\setemergencystretch{%
   11288      1.1  mrg   \ifx\emergencystretch\thisisundefined
   11289      1.1  mrg     % Allow us to assign to \emergencystretch anyway.
   11290      1.1  mrg     \def\emergencystretch{\dimen0}%
   11291      1.1  mrg   \else
   11292      1.1  mrg     \emergencystretch = .15\hsize
   11293      1.1  mrg   \fi
   11294      1.1  mrg }
   11295      1.1  mrg 
   11296      1.1  mrg % Parameters in order: 1) textheight; 2) textwidth;
   11297      1.1  mrg % 3) voffset; 4) hoffset; 5) binding offset; 6) topskip;
   11298      1.1  mrg % 7) physical page height; 8) physical page width.
   11299      1.1  mrg %
   11300      1.1  mrg % We also call \setleading{\textleading}, so the caller should define
   11301      1.1  mrg % \textleading.  The caller should also set \parskip.
   11302      1.1  mrg %
   11303      1.1  mrg \def\internalpagesizes#1#2#3#4#5#6#7#8{%
   11304      1.1  mrg   \voffset = #3\relax
   11305      1.1  mrg   \topskip = #6\relax
   11306      1.1  mrg   \splittopskip = \topskip
   11307      1.1  mrg   %
   11308  1.1.1.3  mrg   \vsize = #1\relax
   11309      1.1  mrg   \advance\vsize by \topskip
   11310      1.1  mrg   \outervsize = \vsize
   11311      1.1  mrg   \advance\outervsize by 2\topandbottommargin
   11312      1.1  mrg   \txipageheight = \vsize
   11313  1.1.1.3  mrg   %
   11314      1.1  mrg   \hsize = #2\relax
   11315      1.1  mrg   \outerhsize = \hsize
   11316      1.1  mrg   \advance\outerhsize by 0.5in
   11317      1.1  mrg   \txipagewidth = \hsize
   11318      1.1  mrg   %
   11319      1.1  mrg   \normaloffset = #4\relax
   11320      1.1  mrg   \bindingoffset = #5\relax
   11321      1.1  mrg   %
   11322      1.1  mrg   \ifpdf
   11323      1.1  mrg     \pdfpageheight #7\relax
   11324      1.1  mrg     \pdfpagewidth #8\relax
   11325  1.1.1.3  mrg     % if we don't reset these, they will remain at "1 true in" of
   11326  1.1.1.3  mrg     % whatever layout pdftex was dumped with.
   11327  1.1.1.3  mrg     \pdfhorigin = 1 true in
   11328  1.1.1.3  mrg     \pdfvorigin = 1 true in
   11329  1.1.1.3  mrg   \else
   11330  1.1.1.3  mrg     \ifx\XeTeXrevision\thisisundefined
   11331  1.1.1.3  mrg       \special{papersize=#8,#7}%
   11332  1.1.1.3  mrg     \else
   11333      1.1  mrg       \pdfpageheight #7\relax
   11334      1.1  mrg       \pdfpagewidth #8\relax
   11335      1.1  mrg       % XeTeX does not have \pdfhorigin and \pdfvorigin.
   11336      1.1  mrg     \fi
   11337      1.1  mrg   \fi
   11338      1.1  mrg   %
   11339      1.1  mrg   \setleading{\textleading}
   11340      1.1  mrg   %
   11341      1.1  mrg   \parindent = \defaultparindent
   11342      1.1  mrg   \setemergencystretch
   11343      1.1  mrg }
   11344      1.1  mrg 
   11345      1.1  mrg % @letterpaper (the default).
   11346      1.1  mrg \def\letterpaper{{\globaldefs = 1
   11347      1.1  mrg   \parskip = 3pt plus 2pt minus 1pt
   11348      1.1  mrg   \textleading = 13.2pt
   11349      1.1  mrg   %
   11350      1.1  mrg   % If page is nothing but text, make it come out even.
   11351      1.1  mrg   \internalpagesizes{607.2pt}{6in}% that's 46 lines
   11352      1.1  mrg                     {\voffset}{.25in}%
   11353      1.1  mrg                     {\bindingoffset}{36pt}%
   11354      1.1  mrg                     {11in}{8.5in}%
   11355      1.1  mrg }}
   11356      1.1  mrg 
   11357      1.1  mrg % Use @smallbook to reset parameters for 7x9.25 trim size.
   11358      1.1  mrg \def\smallbook{{\globaldefs = 1
   11359      1.1  mrg   \parskip = 2pt plus 1pt
   11360      1.1  mrg   \textleading = 12pt
   11361      1.1  mrg   %
   11362      1.1  mrg   \internalpagesizes{7.5in}{5in}%
   11363      1.1  mrg                     {-.2in}{0in}%
   11364      1.1  mrg                     {\bindingoffset}{16pt}%
   11365      1.1  mrg                     {9.25in}{7in}%
   11366      1.1  mrg   %
   11367      1.1  mrg   \lispnarrowing = 0.3in
   11368      1.1  mrg   \tolerance = 700
   11369      1.1  mrg   \contentsrightmargin = 0pt
   11370      1.1  mrg   \defbodyindent = .5cm
   11371      1.1  mrg }}
   11372      1.1  mrg 
   11373      1.1  mrg % Use @smallerbook to reset parameters for 6x9 trim size.
   11374      1.1  mrg % (Just testing, parameters still in flux.)
   11375      1.1  mrg \def\smallerbook{{\globaldefs = 1
   11376      1.1  mrg   \parskip = 1.5pt plus 1pt
   11377      1.1  mrg   \textleading = 12pt
   11378      1.1  mrg   %
   11379      1.1  mrg   \internalpagesizes{7.4in}{4.8in}%
   11380      1.1  mrg                     {-.2in}{-.4in}%
   11381      1.1  mrg                     {0pt}{14pt}%
   11382      1.1  mrg                     {9in}{6in}%
   11383      1.1  mrg   %
   11384      1.1  mrg   \lispnarrowing = 0.25in
   11385      1.1  mrg   \tolerance = 700
   11386      1.1  mrg   \contentsrightmargin = 0pt
   11387      1.1  mrg   \defbodyindent = .4cm
   11388      1.1  mrg }}
   11389      1.1  mrg 
   11390      1.1  mrg % Use @afourpaper to print on European A4 paper.
   11391      1.1  mrg \def\afourpaper{{\globaldefs = 1
   11392      1.1  mrg   \parskip = 3pt plus 2pt minus 1pt
   11393      1.1  mrg   \textleading = 13.2pt
   11394      1.1  mrg   %
   11395      1.1  mrg   % Double-side printing via postscript on Laserjet 4050
   11396      1.1  mrg   % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm.
   11397      1.1  mrg   % To change the settings for a different printer or situation, adjust
   11398      1.1  mrg   % \normaloffset until the front-side and back-side texts align.  Then
   11399      1.1  mrg   % do the same for \bindingoffset.  You can set these for testing in
   11400      1.1  mrg   % your texinfo source file like this:
   11401      1.1  mrg   % @tex
   11402      1.1  mrg   % \global\normaloffset = -6mm
   11403      1.1  mrg   % \global\bindingoffset = 10mm
   11404      1.1  mrg   % @end tex
   11405      1.1  mrg   \internalpagesizes{673.2pt}{160mm}% that's 51 lines
   11406      1.1  mrg                     {\voffset}{\hoffset}%
   11407      1.1  mrg                     {\bindingoffset}{44pt}%
   11408      1.1  mrg                     {297mm}{210mm}%
   11409      1.1  mrg   %
   11410      1.1  mrg   \tolerance = 700
   11411      1.1  mrg   \contentsrightmargin = 0pt
   11412      1.1  mrg   \defbodyindent = 5mm
   11413      1.1  mrg }}
   11414      1.1  mrg 
   11415      1.1  mrg % Use @afivepaper to print on European A5 paper.
   11416      1.1  mrg % From romildo (a] urano.iceb.ufop.br, 2 July 2000.
   11417      1.1  mrg % He also recommends making @example and @lisp be small.
   11418      1.1  mrg \def\afivepaper{{\globaldefs = 1
   11419      1.1  mrg   \parskip = 2pt plus 1pt minus 0.1pt
   11420      1.1  mrg   \textleading = 12.5pt
   11421      1.1  mrg   %
   11422      1.1  mrg   \internalpagesizes{160mm}{120mm}%
   11423      1.1  mrg                     {\voffset}{\hoffset}%
   11424      1.1  mrg                     {\bindingoffset}{8pt}%
   11425      1.1  mrg                     {210mm}{148mm}%
   11426      1.1  mrg   %
   11427      1.1  mrg   \lispnarrowing = 0.2in
   11428      1.1  mrg   \tolerance = 800
   11429      1.1  mrg   \contentsrightmargin = 0pt
   11430      1.1  mrg   \defbodyindent = 2mm
   11431      1.1  mrg   \tableindent = 12mm
   11432      1.1  mrg }}
   11433      1.1  mrg 
   11434      1.1  mrg % A specific text layout, 24x15cm overall, intended for A4 paper.
   11435      1.1  mrg \def\afourlatex{{\globaldefs = 1
   11436      1.1  mrg   \afourpaper
   11437      1.1  mrg   \internalpagesizes{237mm}{150mm}%
   11438      1.1  mrg                     {\voffset}{4.6mm}%
   11439      1.1  mrg                     {\bindingoffset}{7mm}%
   11440      1.1  mrg                     {297mm}{210mm}%
   11441      1.1  mrg   %
   11442      1.1  mrg   % Must explicitly reset to 0 because we call \afourpaper.
   11443      1.1  mrg   \globaldefs = 0
   11444      1.1  mrg }}
   11445      1.1  mrg 
   11446      1.1  mrg % Use @afourwide to print on A4 paper in landscape format.
   11447      1.1  mrg \def\afourwide{{\globaldefs = 1
   11448      1.1  mrg   \afourpaper
   11449      1.1  mrg   \internalpagesizes{241mm}{165mm}%
   11450      1.1  mrg                     {\voffset}{-2.95mm}%
   11451      1.1  mrg                     {\bindingoffset}{7mm}%
   11452      1.1  mrg                     {297mm}{210mm}%
   11453      1.1  mrg   \globaldefs = 0
   11454      1.1  mrg }}
   11455      1.1  mrg 
   11456      1.1  mrg % @pagesizes TEXTHEIGHT[,TEXTWIDTH]
   11457      1.1  mrg % Perhaps we should allow setting the margins, \topskip, \parskip,
   11458      1.1  mrg % and/or leading, also. Or perhaps we should compute them somehow.
   11459      1.1  mrg %
   11460      1.1  mrg \parseargdef\pagesizes{\pagesizesyyy #1,,\finish}
   11461      1.1  mrg \def\pagesizesyyy#1,#2,#3\finish{{%
   11462      1.1  mrg   \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
   11463      1.1  mrg   \globaldefs = 1
   11464      1.1  mrg   %
   11465      1.1  mrg   \parskip = 3pt plus 2pt minus 1pt
   11466  1.1.1.3  mrg   \setleading{\textleading}%
   11467      1.1  mrg   %
   11468      1.1  mrg   \dimen0 = #1\relax
   11469      1.1  mrg   \advance\dimen0 by \voffset
   11470  1.1.1.3  mrg   \advance\dimen0 by 1in % reference point for DVI is 1 inch from top of page
   11471      1.1  mrg   %
   11472      1.1  mrg   \dimen2 = \hsize
   11473      1.1  mrg   \advance\dimen2 by \normaloffset
   11474      1.1  mrg   \advance\dimen2 by 1in % reference point is 1 inch from left edge of page
   11475      1.1  mrg   %
   11476      1.1  mrg   \internalpagesizes{#1}{\hsize}%
   11477      1.1  mrg                     {\voffset}{\normaloffset}%
   11478      1.1  mrg                     {\bindingoffset}{44pt}%
   11479      1.1  mrg                     {\dimen0}{\dimen2}%
   11480      1.1  mrg }}
   11481      1.1  mrg 
   11482  1.1.1.3  mrg % Set default to letter.
   11483  1.1.1.3  mrg %
   11484  1.1.1.3  mrg \letterpaper
   11485      1.1  mrg 
   11486      1.1  mrg % Default value of \hfuzz, for suppressing warnings about overfull hboxes.
   11487      1.1  mrg \hfuzz = 1pt
   11488      1.1  mrg 
   11489      1.1  mrg 
   11490      1.1  mrg \message{and turning on texinfo input format.}
   11491      1.1  mrg 
   11492      1.1  mrg \def^^L{\par} % remove \outer, so ^L can appear in an @comment
   11493      1.1  mrg 
   11494      1.1  mrg % DEL is a comment character, in case @c does not suffice.
   11495      1.1  mrg \catcode`\^^? = 14
   11496      1.1  mrg 
   11497      1.1  mrg % Define macros to output various characters with catcode for normal text.
   11498      1.1  mrg \catcode`\"=\other \def\normaldoublequote{"}
   11499      1.1  mrg \catcode`\$=\other \def\normaldollar{$}%$ font-lock fix
   11500      1.1  mrg \catcode`\+=\other \def\normalplus{+}
   11501      1.1  mrg \catcode`\<=\other \def\normalless{<}
   11502      1.1  mrg \catcode`\>=\other \def\normalgreater{>}
   11503      1.1  mrg \catcode`\^=\other \def\normalcaret{^}
   11504      1.1  mrg \catcode`\_=\other \def\normalunderscore{_}
   11505      1.1  mrg \catcode`\|=\other \def\normalverticalbar{|}
   11506      1.1  mrg \catcode`\~=\other \def\normaltilde{~}
   11507      1.1  mrg 
   11508      1.1  mrg % This macro is used to make a character print one way in \tt
   11509      1.1  mrg % (where it can probably be output as-is), and another way in other fonts,
   11510      1.1  mrg % where something hairier probably needs to be done.
   11511      1.1  mrg %
   11512      1.1  mrg % #1 is what to print if we are indeed using \tt; #2 is what to print
   11513      1.1  mrg % otherwise.  Since all the Computer Modern typewriter fonts have zero
   11514      1.1  mrg % interword stretch (and shrink), and it is reasonable to expect all
   11515      1.1  mrg % typewriter fonts to have this, we can check that font parameter.
   11516      1.1  mrg %
   11517      1.1  mrg \def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
   11518      1.1  mrg 
   11519      1.1  mrg % Same as above, but check for italic font.  Actually this also catches
   11520      1.1  mrg % non-italic slanted fonts since it is impossible to distinguish them from
   11521  1.1.1.3  mrg % italic fonts.  But since this is only used by $ and it uses \sl anyway
   11522  1.1.1.3  mrg % this is not a problem.
   11523  1.1.1.3  mrg \def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
   11524      1.1  mrg 
   11525      1.1  mrg % Set catcodes for Texinfo file
   11526  1.1.1.3  mrg 
   11527      1.1  mrg % Active characters for printing the wanted glyph.
   11528      1.1  mrg % Most of these we simply print from the \tt font, but for some, we can
   11529      1.1  mrg % use math or other variants that look better in normal text.
   11530  1.1.1.3  mrg %
   11531  1.1.1.3  mrg \catcode`\"=\active
   11532  1.1.1.3  mrg \def\activedoublequote{{\tt\char34}}
   11533      1.1  mrg \let"=\activedoublequote
   11534      1.1  mrg \catcode`\~=\active \def\activetilde{{\tt\char126}} \let~ = \activetilde
   11535      1.1  mrg \chardef\hatchar=`\^
   11536      1.1  mrg \catcode`\^=\active \def\activehat{{\tt \hatchar}} \let^ = \activehat
   11537  1.1.1.3  mrg 
   11538  1.1.1.3  mrg \catcode`\_=\active
   11539  1.1.1.3  mrg \def_{\ifusingtt\normalunderscore\_}
   11540      1.1  mrg \def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }
   11541      1.1  mrg \let\realunder=_
   11542  1.1.1.3  mrg 
   11543      1.1  mrg \catcode`\|=\active \def|{{\tt\char124}}
   11544  1.1.1.3  mrg 
   11545  1.1.1.3  mrg \chardef \less=`\<
   11546  1.1.1.3  mrg \catcode`\<=\active \def\activeless{{\tt \less}}\let< = \activeless
   11547  1.1.1.3  mrg \chardef \gtr=`\>
   11548  1.1.1.3  mrg \catcode`\>=\active \def\activegtr{{\tt \gtr}}\let> = \activegtr
   11549  1.1.1.3  mrg \catcode`\+=\active \def+{{\tt \char 43}}
   11550  1.1.1.3  mrg \catcode`\$=\active \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
   11551  1.1.1.3  mrg \catcode`\-=\active \let-=\normaldash
   11552  1.1.1.3  mrg 
   11553  1.1.1.3  mrg 
   11554  1.1.1.3  mrg % used for headline/footline in the output routine, in case the page
   11555  1.1.1.3  mrg % breaks in the middle of an @tex block.
   11556  1.1.1.3  mrg \def\texinfochars{%
   11557  1.1.1.3  mrg   \let< = \activeless
   11558  1.1.1.3  mrg   \let> = \activegtr
   11559  1.1.1.3  mrg   \let~ = \activetilde 
   11560  1.1.1.3  mrg   \let^ = \activehat
   11561  1.1.1.3  mrg   \markupsetuplqdefault \markupsetuprqdefault 
   11562      1.1  mrg   \let\b = \strong
   11563      1.1  mrg   \let\i = \smartitalic
   11564      1.1  mrg   % in principle, all other definitions in \tex have to be undone too.
   11565      1.1  mrg }
   11566      1.1  mrg 
   11567      1.1  mrg % Used sometimes to turn off (effectively) the active characters even after
   11568      1.1  mrg % parsing them.
   11569      1.1  mrg \def\turnoffactive{%
   11570      1.1  mrg   \normalturnoffactive
   11571      1.1  mrg   \otherbackslash
   11572      1.1  mrg }
   11573      1.1  mrg 
   11574      1.1  mrg \catcode`\@=0
   11575      1.1  mrg 
   11576      1.1  mrg % \backslashcurfont outputs one backslash character in current font,
   11577      1.1  mrg % as in \char`\\.
   11578      1.1  mrg \global\chardef\backslashcurfont=`\\
   11579      1.1  mrg \global\let\rawbackslashxx=\backslashcurfont  % let existing .??s files work
   11580      1.1  mrg 
   11581  1.1.1.3  mrg % \realbackslash is an actual character `\' with catcode other, and
   11582      1.1  mrg % \doublebackslash is two of them (for the pdf outlines).
   11583      1.1  mrg {\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}}
   11584      1.1  mrg 
   11585  1.1.1.3  mrg % In Texinfo, backslash is an active character; it prints the backslash
   11586  1.1.1.3  mrg % in fixed width font.
   11587  1.1.1.3  mrg \catcode`\\=\active  % @ for escape char from now on.
   11588  1.1.1.3  mrg 
   11589  1.1.1.3  mrg % Print a typewriter backslash.  For math mode, we can't simply use
   11590      1.1  mrg % \backslashcurfont: the story here is that in math mode, the \char
   11591      1.1  mrg % of \backslashcurfont ends up printing the roman \ from the math symbol
   11592      1.1  mrg % font (because \char in math mode uses the \mathcode, and plain.tex
   11593      1.1  mrg % sets \mathcode`\\="026E).  Hence we use an explicit \mathchar,
   11594  1.1.1.3  mrg % which is the decimal equivalent of "715c (class 7, e.g., use \fam;
   11595  1.1.1.3  mrg % ignored family value; char position "5C).  We can't use " for the
   11596  1.1.1.3  mrg % usual hex value because it has already been made active.
   11597      1.1  mrg 
   11598      1.1  mrg @def@ttbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}}
   11599      1.1  mrg @let@backslashchar = @ttbackslash % @backslashchar{} is for user documents.
   11600      1.1  mrg 
   11601      1.1  mrg % \rawbackslash defines an active \ to do \backslashcurfont.
   11602      1.1  mrg % \otherbackslash defines an active \ to be a literal `\' character with
   11603      1.1  mrg % catcode other.  We switch back and forth between these.
   11604  1.1.1.3  mrg @gdef@rawbackslash{@let\=@backslashcurfont}
   11605      1.1  mrg @gdef@otherbackslash{@let\=@realbackslash}
   11606  1.1.1.2  mrg 
   11607  1.1.1.2  mrg % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
   11608  1.1.1.3  mrg % the literal character `\'.
   11609  1.1.1.2  mrg %
   11610  1.1.1.2  mrg {@catcode`- = @active
   11611  1.1.1.2  mrg  @gdef@normalturnoffactive{%
   11612  1.1.1.2  mrg    @passthroughcharstrue
   11613  1.1.1.2  mrg    @let-=@normaldash
   11614  1.1.1.2  mrg    @let"=@normaldoublequote
   11615  1.1.1.2  mrg    @let$=@normaldollar %$ font-lock fix
   11616  1.1.1.2  mrg    @let+=@normalplus
   11617  1.1.1.2  mrg    @let<=@normalless
   11618  1.1.1.2  mrg    @let>=@normalgreater
   11619  1.1.1.3  mrg    @let^=@normalcaret
   11620  1.1.1.2  mrg    @let_=@normalunderscore
   11621  1.1.1.2  mrg    @let|=@normalverticalbar
   11622  1.1.1.2  mrg    @let~=@normaltilde
   11623  1.1.1.2  mrg    @let\=@ttbackslash
   11624      1.1  mrg    @markupsetuplqdefault
   11625      1.1  mrg    @markupsetuprqdefault
   11626  1.1.1.3  mrg    @unsepspaces
   11627  1.1.1.3  mrg  }
   11628  1.1.1.3  mrg }
   11629  1.1.1.3  mrg 
   11630      1.1  mrg % If a .fmt file is being used, characters that might appear in a file
   11631  1.1.1.3  mrg % name cannot be active until we have parsed the command line.
   11632  1.1.1.3  mrg % So turn them off again, and have @fixbackslash turn them back on.
   11633      1.1  mrg @catcode`+=@other @catcode`@_=@other
   11634      1.1  mrg 
   11635      1.1  mrg % \enablebackslashhack - allow file to begin `\input texinfo'
   11636  1.1.1.3  mrg %
   11637  1.1.1.3  mrg % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
   11638  1.1.1.3  mrg % That is what \eatinput is for; after that, the `\' should revert to printing
   11639  1.1.1.3  mrg % a backslash.
   11640  1.1.1.3  mrg % If the file did not have a `\input texinfo', then it is turned off after
   11641  1.1.1.3  mrg % the first line; otherwise the first `\' in the file would cause an error.
   11642  1.1.1.3  mrg % This is used on the very last line of this file, texinfo.tex.
   11643  1.1.1.3  mrg % We also use @c to call @fixbackslash, in case ends of lines are hidden.
   11644  1.1.1.3  mrg {
   11645  1.1.1.3  mrg @catcode`@^=7
   11646  1.1.1.3  mrg @catcode`@^^M=13@gdef@enablebackslashhack{%
   11647  1.1.1.3  mrg   @global@let\ = @eatinput%
   11648  1.1.1.3  mrg   @catcode`@^^M=13%
   11649  1.1.1.3  mrg   @def@c{@fixbackslash@c}%
   11650  1.1.1.3  mrg   % Definition for the newline at the end of this file.
   11651  1.1.1.3  mrg   @def ^^M{@let^^M@secondlinenl}%
   11652  1.1.1.3  mrg   % Definition for a newline in the main Texinfo file.
   11653  1.1.1.3  mrg   @gdef @secondlinenl{@fixbackslash}%
   11654  1.1.1.3  mrg   % In case the first line has a whole-line command on it
   11655  1.1.1.3  mrg   @let@originalparsearg@parsearg
   11656  1.1.1.3  mrg   @def@parsearg{@fixbackslash@originalparsearg}
   11657  1.1.1.3  mrg }}
   11658  1.1.1.3  mrg 
   11659  1.1.1.3  mrg {@catcode`@^=7 @catcode`@^^M=13%
   11660  1.1.1.3  mrg @gdef@eatinput input texinfo#1^^M{@fixbackslash}}
   11661  1.1.1.3  mrg 
   11662  1.1.1.3  mrg % Emergency active definition of newline, in case an active newline token
   11663  1.1.1.3  mrg % appears by mistake.
   11664  1.1.1.3  mrg {@catcode`@^=7 @catcode13=13%
   11665  1.1.1.3  mrg @gdef@enableemergencynewline{%
   11666  1.1.1.3  mrg   @gdef^^M{%
   11667      1.1  mrg     @par%
   11668      1.1  mrg     %<warning: active newline>@par%
   11669  1.1.1.3  mrg }}}
   11670  1.1.1.3  mrg 
   11671  1.1.1.3  mrg 
   11672  1.1.1.3  mrg @gdef@fixbackslash{%
   11673  1.1.1.3  mrg   @ifx\@eatinput @let\ = @ttbackslash @fi
   11674  1.1.1.3  mrg   @catcode13=5 % regular end of line
   11675  1.1.1.3  mrg   @enableemergencynewline
   11676      1.1  mrg   @let@c=@texinfoc
   11677      1.1  mrg   @let@parsearg@originalparsearg
   11678  1.1.1.3  mrg   % Also turn back on active characters that might appear in the input
   11679  1.1.1.3  mrg   % file name, in case not using a pre-dumped format.
   11680  1.1.1.3  mrg   @catcode`+=@active
   11681  1.1.1.3  mrg   @catcode`@_=@active
   11682  1.1.1.3  mrg   %
   11683  1.1.1.3  mrg   % If texinfo.cnf is present on the system, read it.
   11684  1.1.1.3  mrg   % Useful for site-wide @afourpaper, etc.  This macro, @fixbackslash, gets
   11685  1.1.1.3  mrg   % called at the beginning of every Texinfo file.  Not opening texinfo.cnf
   11686  1.1.1.3  mrg   % directly in this file, texinfo.tex, makes it possible to make a format
   11687  1.1.1.3  mrg   % file for Texinfo.
   11688      1.1  mrg   %
   11689      1.1  mrg   @openin 1 texinfo.cnf
   11690  1.1.1.3  mrg   @ifeof 1 @else @input texinfo.cnf @fi
   11691      1.1  mrg   @closein 1
   11692      1.1  mrg }
   11693      1.1  mrg 
   11694      1.1  mrg 
   11695      1.1  mrg % Say @foo, not \foo, in error messages.
   11696      1.1  mrg @escapechar = `@@
   11697      1.1  mrg 
   11698      1.1  mrg % These (along with & and #) are made active for url-breaking, so need
   11699      1.1  mrg % active definitions as the normal characters.
   11700      1.1  mrg @def@normaldot{.}
   11701      1.1  mrg @def@normalquest{?}
   11702      1.1  mrg @def@normalslash{/}
   11703      1.1  mrg 
   11704      1.1  mrg % These look ok in all fonts, so just make them not special.
   11705      1.1  mrg % @hashchar{} gets its own user-level command, because of #line.
   11706      1.1  mrg @catcode`@& = @other @def@normalamp{&}
   11707      1.1  mrg @catcode`@# = @other @def@normalhash{#}
   11708      1.1  mrg @catcode`@% = @other @def@normalpercent{%}
   11709      1.1  mrg 
   11710      1.1  mrg @let @hashchar = @normalhash
   11711      1.1  mrg 
   11712      1.1  mrg @c Finally, make ` and ' active, so that txicodequoteundirected and
   11713      1.1  mrg @c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}.  If we
   11714      1.1  mrg @c don't make ` and ' active, @code will not get them as active chars.
   11715      1.1  mrg @c Do this last of all since we use ` in the previous @catcode assignments.
   11716      1.1  mrg @catcode`@'=@active
   11717      1.1  mrg @catcode`@`=@active
   11718      1.1  mrg @markupsetuplqdefault
   11719  1.1.1.3  mrg @markupsetuprqdefault
   11720      1.1  mrg 
   11721      1.1  mrg @c Local variables:
   11722      1.1  mrg @c eval: (add-hook 'write-file-hooks 'time-stamp)
   11723      1.1  mrg @c page-delimiter: "^\\\\message\\|emacs-page"
   11724      1.1  mrg @c time-stamp-start: "def\\\\texinfoversion{"
   11725      1.1  mrg @c time-stamp-format: "%:y-%02m-%02d.%02H"
   11726      1.1  mrg @c time-stamp-end: "}"
   11727  1.1.1.3  mrg @c End:
   11728               
   11729               @c vim:sw=2:
   11730               
   11731               @enablebackslashhack
   11732