Annotation of freem/doc/texinfo.tex, revision 1.2

1.1       snw         1: % texinfo.tex -- TeX macros to handle Texinfo files.
                      2: %
                      3: % Load plain if necessary, i.e., if running under initex.
                      4: \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
                      5: %
1.2     ! snw         6: \def\texinfoversion{2024-02-10.22}
1.1       snw         7: %
1.2     ! snw         8: % Copyright 1985, 1986, 1988, 1990-2024 Free Software Foundation, Inc.
1.1       snw         9: %
                     10: % This texinfo.tex file is free software: you can redistribute it and/or
                     11: % modify it under the terms of the GNU General Public License as
                     12: % published by the Free Software Foundation, either version 3 of the
                     13: % License, or (at your option) any later version.
                     14: %
                     15: % This texinfo.tex file is distributed in the hope that it will be
                     16: % useful, but WITHOUT ANY WARRANTY; without even the implied warranty
                     17: % of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
                     18: % General Public License for more details.
                     19: %
                     20: % You should have received a copy of the GNU General Public License
                     21: % along with this program.  If not, see <https://www.gnu.org/licenses/>.
                     22: %
                     23: % As a special exception, when this file is read by TeX when processing
                     24: % a Texinfo source document, you may use the result without
                     25: % restriction. This Exception is an additional permission under section 7
                     26: % of the GNU General Public License, version 3 ("GPLv3").
                     27: %
                     28: % Please try the latest version of texinfo.tex before submitting bug
                     29: % reports; you can get the latest version from:
                     30: %   https://ftp.gnu.org/gnu/texinfo/ (the Texinfo release area), or
                     31: %   https://ftpmirror.gnu.org/texinfo/ (same, via a mirror), or
                     32: %   https://www.gnu.org/software/texinfo/ (the Texinfo home page)
                     33: % The texinfo.tex in any given distribution could well be out
                     34: % of date, so if that's what you're using, please check.
                     35: %
                     36: % Send bug reports to bug-texinfo@gnu.org.  Please include a
                     37: % complete document in each bug report with which we can reproduce the
                     38: % problem.  Patches are, of course, greatly appreciated.
                     39: %
                     40: % To process a Texinfo manual with TeX, it's most reliable to use the
                     41: % texi2dvi shell script that comes with the distribution.  For a simple
                     42: % manual foo.texi, however, you can get away with this:
                     43: %   tex foo.texi
                     44: %   texindex foo.??
                     45: %   tex foo.texi
                     46: %   tex foo.texi
                     47: %   dvips foo.dvi -o  # or whatever; this makes foo.ps.
                     48: % The extra TeX runs get the cross-reference information correct.
                     49: % Sometimes one run after texindex suffices, and sometimes you need more
                     50: % than two; texi2dvi does it as many times as necessary.
                     51: %
                     52: % It is possible to adapt texinfo.tex for other languages, to some
                     53: % extent.  You can get the existing language-specific files from the
                     54: % full Texinfo distribution.
                     55: %
                     56: % The GNU Texinfo home page is https://www.gnu.org/software/texinfo.
                     57: 
                     58: 
                     59: \message{Loading texinfo [version \texinfoversion]:}
                     60: 
                     61: % LaTeX's \typeout.  This ensures that the messages it is used for
                     62: % are identical in format to the corresponding ones from latex/pdflatex.
                     63: \def\typeout{\immediate\write17}%
                     64: 
                     65: \chardef\other=12
                     66: 
                     67: % We never want plain's \outer definition of \+ in Texinfo.
                     68: % For @tex, we can use \tabalign.
                     69: \let\+ = \relax
                     70: 
                     71: % Save some plain tex macros whose names we will redefine.
                     72: \let\ptexb=\b
                     73: \let\ptexbullet=\bullet
                     74: \let\ptexc=\c
                     75: \let\ptexcomma=\,
                     76: \let\ptexdot=\.
                     77: \let\ptexdots=\dots
                     78: \let\ptexend=\end
                     79: \let\ptexequiv=\equiv
                     80: \let\ptexexclam=\!
                     81: \let\ptexfootnote=\footnote
                     82: \let\ptexgtr=>
                     83: \let\ptexhat=^
                     84: \let\ptexi=\i
                     85: \let\ptexindent=\indent
                     86: \let\ptexinsert=\insert
                     87: \let\ptexlbrace=\{
                     88: \let\ptexless=<
                     89: \let\ptexnewwrite\newwrite
                     90: \let\ptexnoindent=\noindent
                     91: \let\ptexplus=+
                     92: \let\ptexraggedright=\raggedright
                     93: \let\ptexrbrace=\}
                     94: \let\ptexslash=\/
                     95: \let\ptexsp=\sp
                     96: \let\ptexstar=\*
                     97: \let\ptexsup=\sup
                     98: \let\ptext=\t
                     99: \let\ptextop=\top
                    100: {\catcode`\'=\active \global\let\ptexquoteright'}% active in plain's math mode
                    101: 
                    102: % If this character appears in an error message or help string, it
                    103: % starts a new line in the output.
                    104: \newlinechar = `^^J
                    105: 
                    106: % Use TeX 3.0's \inputlineno to get the line number, for better error
                    107: % messages, but if we're using an old version of TeX, don't do anything.
                    108: %
                    109: \ifx\inputlineno\thisisundefined
                    110:   \let\linenumber = \empty % Pre-3.0.
                    111: \else
                    112:   \def\linenumber{l.\the\inputlineno:\space}
                    113: \fi
                    114: 
                    115: % Set up fixed words for English if not already set.
                    116: \ifx\putwordAppendix\undefined  \gdef\putwordAppendix{Appendix}\fi
                    117: \ifx\putwordChapter\undefined   \gdef\putwordChapter{Chapter}\fi
                    118: \ifx\putworderror\undefined     \gdef\putworderror{error}\fi
                    119: \ifx\putwordfile\undefined      \gdef\putwordfile{file}\fi
                    120: \ifx\putwordin\undefined        \gdef\putwordin{in}\fi
                    121: \ifx\putwordIndexIsEmpty\undefined       \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
                    122: \ifx\putwordIndexNonexistent\undefined   \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
                    123: \ifx\putwordInfo\undefined      \gdef\putwordInfo{Info}\fi
                    124: \ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
                    125: \ifx\putwordMethodon\undefined  \gdef\putwordMethodon{Method on}\fi
                    126: \ifx\putwordNoTitle\undefined   \gdef\putwordNoTitle{No Title}\fi
                    127: \ifx\putwordof\undefined        \gdef\putwordof{of}\fi
                    128: \ifx\putwordon\undefined        \gdef\putwordon{on}\fi
                    129: \ifx\putwordpage\undefined      \gdef\putwordpage{page}\fi
                    130: \ifx\putwordsection\undefined   \gdef\putwordsection{section}\fi
                    131: \ifx\putwordSection\undefined   \gdef\putwordSection{Section}\fi
                    132: \ifx\putwordsee\undefined       \gdef\putwordsee{see}\fi
                    133: \ifx\putwordSee\undefined       \gdef\putwordSee{See}\fi
                    134: \ifx\putwordShortTOC\undefined  \gdef\putwordShortTOC{Short Contents}\fi
                    135: \ifx\putwordTOC\undefined       \gdef\putwordTOC{Table of Contents}\fi
                    136: %
                    137: \ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
                    138: \ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
                    139: \ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
                    140: \ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
                    141: \ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
                    142: \ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
                    143: \ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
                    144: \ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
                    145: \ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
                    146: \ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
                    147: \ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
                    148: \ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
                    149: %
                    150: \ifx\putwordDefmac\undefined    \gdef\putwordDefmac{Macro}\fi
                    151: \ifx\putwordDefspec\undefined   \gdef\putwordDefspec{Special Form}\fi
                    152: \ifx\putwordDefvar\undefined    \gdef\putwordDefvar{Variable}\fi
                    153: \ifx\putwordDefopt\undefined    \gdef\putwordDefopt{User Option}\fi
                    154: \ifx\putwordDeffunc\undefined   \gdef\putwordDeffunc{Function}\fi
                    155: 
                    156: % Give the space character the catcode for a space.
                    157: \def\spaceisspace{\catcode`\ =10\relax}
                    158: 
                    159: % Likewise for ^^M, the end of line character.
                    160: \def\endlineisspace{\catcode13=10\relax}
                    161: 
                    162: \chardef\dashChar  = `\-
                    163: \chardef\slashChar = `\/
                    164: \chardef\underChar = `\_
                    165: 
                    166: % Ignore a token.
                    167: %
                    168: \def\gobble#1{}
                    169: 
                    170: % The following is used inside several \edef's.
                    171: \def\makecsname#1{\expandafter\noexpand\csname#1\endcsname}
                    172: 
                    173: % Hyphenation fixes.
                    174: \hyphenation{
                    175:   Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script
                    176:   ap-pen-dix bit-map bit-maps
                    177:   data-base data-bases eshell fall-ing half-way long-est man-u-script
                    178:   man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm
                    179:   par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces
                    180:   spell-ing spell-ings
                    181:   stand-alone strong-est time-stamp time-stamps which-ever white-space
                    182:   wide-spread wrap-around
                    183: }
                    184: 
                    185: % Sometimes it is convenient to have everything in the transcript file
                    186: % and nothing on the terminal.  We don't just call \tracingall here,
                    187: % since that produces some useless output on the terminal.  We also make
                    188: % some effort to order the tracing commands to reduce output in the log
                    189: % file; cf. trace.sty in LaTeX.
                    190: %
                    191: \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
                    192: \def\loggingall{%
                    193:   \tracingstats2
                    194:   \tracingpages1
                    195:   \tracinglostchars2  % 2 gives us more in etex
                    196:   \tracingparagraphs1
                    197:   \tracingoutput1
                    198:   \tracingmacros2
                    199:   \tracingrestores1
                    200:   \showboxbreadth\maxdimen \showboxdepth\maxdimen
                    201:   \ifx\eTeXversion\thisisundefined\else % etex gives us more logging
                    202:     \tracingscantokens1
                    203:     \tracingifs1
                    204:     \tracinggroups1
                    205:     \tracingnesting2
                    206:     \tracingassigns1
                    207:   \fi
                    208:   \tracingcommands3  % 3 gives us more in etex
                    209:   \errorcontextlines16
                    210: }%
                    211: 
                    212: % @errormsg{MSG}.  Do the index-like expansions on MSG, but if things
                    213: % aren't perfect, it's not the end of the world, being an error message,
                    214: % after all.
                    215: %
                    216: \def\errormsg{\begingroup \indexnofonts \doerrormsg}
                    217: \def\doerrormsg#1{\errmessage{#1}}
                    218: 
                    219: % add check for \lastpenalty to plain's definitions.  If the last thing
                    220: % we did was a \nobreak, we don't want to insert more space.
                    221: %
                    222: \def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount
                    223:   \removelastskip\penalty-50\smallskip\fi\fi}
                    224: \def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount
                    225:   \removelastskip\penalty-100\medskip\fi\fi}
                    226: \def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
                    227:   \removelastskip\penalty-200\bigskip\fi\fi}
                    228: 
                    229: % Output routine
                    230: %
                    231: 
                    232: % For a final copy, take out the rectangles
                    233: % that mark overfull boxes (in case you have decided
                    234: % that the text looks ok even though it passes the margin).
                    235: %
                    236: \def\finalout{\overfullrule=0pt }
                    237: 
                    238: % Output a mark which sets \thischapter, \thissection and \thiscolor.
                    239: % We dump everything together because we only have one kind of mark.
                    240: % This works because we only use \botmark / \topmark, not \firstmark.
                    241: %
                    242: % A mark contains a subexpression of the \ifcase ... \fi construct.
                    243: % \get*marks macros below extract the needed part using \ifcase.
                    244: %
                    245: % Another complication is to let the user choose whether \thischapter
                    246: % (\thissection) refers to the chapter (section) in effect at the top
                    247: % of a page, or that at the bottom of a page.
                    248: 
                    249: % \domark is called twice inside \chapmacro, to add one
                    250: % mark before the section break, and one after.
                    251: %   In the second call \prevchapterdefs is the same as \currentchapterdefs,
                    252: % and \prevsectiondefs is the same as \currentsectiondefs.
                    253: %   Then if the page is not broken at the mark, some of the previous
                    254: % section appears on the page, and we can get the name of this section
                    255: % from \firstmark for @everyheadingmarks top.
                    256: %   @everyheadingmarks bottom uses \botmark.
                    257: %
                    258: % See page 260 of The TeXbook.
                    259: \def\domark{%
                    260:   \toks0=\expandafter{\currentchapterdefs}%
                    261:   \toks2=\expandafter{\currentsectiondefs}%
                    262:   \toks4=\expandafter{\prevchapterdefs}%
                    263:   \toks6=\expandafter{\prevsectiondefs}%
                    264:   \toks8=\expandafter{\currentcolordefs}%
                    265:   \mark{%
                    266:                    \the\toks0 \the\toks2  % 0: marks for @everyheadingmarks top
                    267:       \noexpand\or \the\toks4 \the\toks6  % 1: for @everyheadingmarks bottom
                    268:     \noexpand\else \the\toks8             % 2: color marks
                    269:   }%
                    270: }
                    271: 
                    272: % \gettopheadingmarks, \getbottomheadingmarks,
                    273: % \getcolormarks - extract needed part of mark.
                    274: %
                    275: % \topmark doesn't work for the very first chapter (after the title
                    276: % page or the contents), so we use \firstmark there -- this gets us
                    277: % the mark with the chapter defs, unless the user sneaks in, e.g.,
1.2     ! snw       278: % @setcolor (or @url etc.) between @contents and the very first @chapter.
1.1       snw       279: \def\gettopheadingmarks{%
                    280:   \ifcase0\the\savedtopmark\fi
                    281:   \ifx\thischapter\empty \ifcase0\firstmark\fi \fi
                    282: }
                    283: \def\getbottomheadingmarks{\ifcase1\botmark\fi}
                    284: \def\getcolormarks{\ifcase2\the\savedtopmark\fi}
                    285: 
                    286: % Avoid "undefined control sequence" errors.
                    287: \def\currentchapterdefs{}
                    288: \def\currentsectiondefs{}
                    289: \def\currentsection{}
                    290: \def\prevchapterdefs{}
                    291: \def\prevsectiondefs{}
                    292: \def\currentcolordefs{}
                    293: 
                    294: % Margin to add to right of even pages, to left of odd pages.
                    295: \newdimen\bindingoffset
                    296: \newdimen\normaloffset
                    297: \newdimen\txipagewidth \newdimen\txipageheight
                    298: 
                    299: % Main output routine.
                    300: %
                    301: \chardef\PAGE = 255
                    302: \newtoks\defaultoutput
                    303: \defaultoutput = {\savetopmark\onepageout{\pagecontents\PAGE}}
                    304: \output=\expandafter{\the\defaultoutput}
                    305: 
                    306: \newbox\headlinebox
                    307: \newbox\footlinebox
                    308: 
                    309: % When outputting the double column layout for indices, an output routine
1.2     ! snw       310: % is run several times, hiding the original value of \topmark.  Hence, save
        !           311: % \topmark at the beginning.
1.1       snw       312: %
                    313: \newtoks\savedtopmark
                    314: \newif\iftopmarksaved
                    315: \topmarksavedtrue
                    316: \def\savetopmark{%
                    317:   \iftopmarksaved\else
                    318:     \global\savedtopmark=\expandafter{\topmark}%
                    319:     \global\topmarksavedtrue
                    320:   \fi
                    321: }
                    322: 
                    323: % \onepageout takes a vbox as an argument.
                    324: % \shipout a vbox for a single page, adding an optional header, footer
                    325: % and footnote.  This also causes index entries for this page to be written
                    326: % to the auxiliary files.
                    327: %
                    328: \def\onepageout#1{%
                    329:   \hoffset=\normaloffset
                    330:   %
                    331:   \ifodd\pageno  \advance\hoffset by \bindingoffset
                    332:   \else \advance\hoffset by -\bindingoffset\fi
                    333:   %
                    334:   \checkchapterpage
                    335:   %
1.2     ! snw       336:   % Make the heading and footing.  \makeheadline and \makefootline
        !           337:   % use the contents of \headline and \footline.
1.1       snw       338:   \def\commonheadfootline{\let\hsize=\txipagewidth \texinfochars}
                    339:   \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
                    340:   \global\setbox\headlinebox = \vbox{\commonheadfootline \makeheadline}%
                    341:   \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi
                    342:   \global\setbox\footlinebox = \vbox{\commonheadfootline \makefootline}%
                    343:   %
                    344:   {%
                    345:     % Set context for writing to auxiliary files like index files.
                    346:     % Have to do this stuff outside the \shipout because we want it to
                    347:     % take effect in \write's, yet the group defined by the \vbox ends
                    348:     % before the \shipout runs.
                    349:     %
                    350:     \atdummies         % don't expand commands in the output.
                    351:     \turnoffactive
                    352:     \shipout\vbox{%
                    353:       % Do this early so pdf references go to the beginning of the page.
                    354:       \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi
                    355:       %
                    356:       \unvbox\headlinebox
                    357:       \pagebody{#1}%
                    358:       \ifdim\ht\footlinebox > 0pt
                    359:         % Only leave this space if the footline is nonempty.
                    360:         % (We lessened \vsize for it in \oddfootingyyy.)
                    361:         % The \baselineskip=24pt in plain's \makefootline has no effect.
                    362:         \vskip 24pt
                    363:         \unvbox\footlinebox
                    364:       \fi
                    365:       %
                    366:     }%
                    367:   }%
                    368:   \global\topmarksavedfalse
                    369:   \advancepageno
                    370:   \ifnum\outputpenalty>-20000 \else\dosupereject\fi
                    371: }
                    372: 
                    373: \newinsert\margin \dimen\margin=\maxdimen
                    374: 
                    375: % Main part of page, including any footnotes
                    376: \def\pagebody#1{\vbox to\txipageheight{\boxmaxdepth=\maxdepth #1}}
                    377: {\catcode`\@ =11
                    378: \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
                    379: % marginal hacks, juha@viisa.uucp (Juha Takala)
                    380: \ifvoid\margin\else % marginal info is present
                    381:   \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
                    382: \dimen@=\dp#1\relax \unvbox#1\relax
                    383: \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
                    384: \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
                    385: }
                    386: 
                    387: % Check if we are on the first page of a chapter.  Used for printing headings.
                    388: \newif\ifchapterpage
                    389: \def\checkchapterpage{%
                    390:   % Get the chapter that was current at the end of the last page
                    391:   \ifcase1\the\savedtopmark\fi
                    392:   \let\prevchaptername\thischaptername
                    393:   %
                    394:   \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
                    395:   \let\curchaptername\thischaptername
                    396:   %
                    397:   \ifx\curchaptername\prevchaptername
                    398:     \chapterpagefalse
                    399:   \else
                    400:     \chapterpagetrue
                    401:   \fi
                    402: }
                    403: 
                    404: % Argument parsing
                    405: 
                    406: % Parse an argument, then pass it to #1.  The argument is the rest of
                    407: % the input line (except we remove a trailing comment).  #1 should be a
                    408: % macro which expects an ordinary undelimited TeX argument.
                    409: % For example, \def\foo{\parsearg\fooxxx}.
                    410: %
                    411: \def\parsearg{\parseargusing{}}
                    412: \def\parseargusing#1#2{%
                    413:   \def\argtorun{#2}%
                    414:   \begingroup
                    415:     \obeylines
                    416:     \spaceisspace
                    417:     #1%
                    418:     \parseargline\empty% Insert the \empty token, see \finishparsearg below.
                    419: }
                    420: 
                    421: {\obeylines %
                    422:   \gdef\parseargline#1^^M{%
                    423:     \endgroup % End of the group started in \parsearg.
                    424:     \argremovecomment #1\comment\ArgTerm%
                    425:   }%
                    426: }
                    427: 
                    428: % First remove any @comment, then any @c comment.  Pass the result on to
1.2     ! snw       429: % \argremovespace.
1.1       snw       430: \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
1.2     ! snw       431: \def\argremovec#1\c#2\ArgTerm{\argremovespace#1$ $\ArgTerm}
        !           432: % \argremovec might leave us with trailing space, though; e.g.,
1.1       snw       433: %    @end itemize  @c foo
1.2     ! snw       434: % Note that the argument cannot contain the TeX $, as its catcode is
        !           435: % changed to \other when Texinfo source is read.
        !           436: \def\argremovespace#1 $#2\ArgTerm{\finishparsearg#1$\ArgTerm}
1.1       snw       437: 
                    438: % If a _delimited_ argument is enclosed in braces, they get stripped; so
                    439: % to get _exactly_ the rest of the line, we had to prevent such situation.
1.2     ! snw       440: % We prepended an \empty token at the very beginning and we expand it
        !           441: % just before passing the control to \next.
        !           442: % (But first, we have to remove the remaining $ or two.)
        !           443: \def\finishparsearg#1$#2\ArgTerm{\expandafter\argtorun\expandafter{#1}}
1.1       snw       444: 
                    445: 
                    446: % \parseargdef - define a command taking an argument on the line
                    447: %
                    448: % \parseargdef\foo{...}
                    449: %      is roughly equivalent to
                    450: % \def\foo{\parsearg\Xfoo}
                    451: % \def\Xfoo#1{...}
                    452: \def\parseargdef#1{%
                    453:   \expandafter \doparseargdef \csname\string#1\endcsname #1%
                    454: }
                    455: \def\doparseargdef#1#2{%
                    456:   \def#2{\parsearg#1}%
                    457:   \def#1##1%
                    458: }
                    459: 
                    460: % Several utility definitions with active space:
                    461: {
                    462:   \obeyspaces
                    463:   \gdef\obeyedspace{ }
                    464: 
                    465:   % Make each space character in the input produce a normal interword
                    466:   % space in the output.  Don't allow a line break at this space, as this
                    467:   % is used only in environments like @example, where each line of input
                    468:   % should produce a line of output anyway.
                    469:   %
                    470:   \gdef\sepspaces{\obeyspaces\let =\tie}
                    471: 
                    472:   % If an index command is used in an @example environment, any spaces
                    473:   % therein should become regular spaces in the raw index file, not the
                    474:   % expansion of \tie (\leavevmode \penalty \@M \ ).
                    475:   \gdef\unsepspaces{\let =\space}
                    476: }
                    477: 
                    478: 
                    479: \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
                    480: 
                    481: % Define the framework for environments in texinfo.tex.  It's used like this:
                    482: %
                    483: %   \envdef\foo{...}
                    484: %   \def\Efoo{...}
                    485: %
                    486: % It's the responsibility of \envdef to insert \begingroup before the
                    487: % actual body; @end closes the group after calling \Efoo.  \envdef also
                    488: % defines \thisenv, so the current environment is known; @end checks
                    489: % whether the environment name matches.  The \checkenv macro can also be
                    490: % used to check whether the current environment is the one expected.
                    491: %
                    492: % Non-false conditionals (@iftex, @ifset) don't fit into this, so they
                    493: % are not treated as environments; they don't open a group.  (The
                    494: % implementation of @end takes care not to call \endgroup in this
                    495: % special case.)
                    496: 
                    497: 
                    498: % At run-time, environments start with this:
                    499: \def\startenvironment#1{\begingroup\def\thisenv{#1}}
                    500: % initialize
                    501: \let\thisenv\empty
                    502: 
                    503: % ... but they get defined via ``\envdef\foo{...}'':
                    504: \long\def\envdef#1#2{\def#1{\startenvironment#1#2}}
1.2     ! snw       505: \long\def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}}
1.1       snw       506: 
                    507: % Check whether we're in the right environment:
                    508: \def\checkenv#1{%
                    509:   \def\temp{#1}%
                    510:   \ifx\thisenv\temp
                    511:   \else
                    512:     \badenverr
                    513:   \fi
                    514: }
                    515: 
                    516: % Environment mismatch, #1 expected:
                    517: \def\badenverr{%
                    518:   \errhelp = \EMsimple
                    519:   \errmessage{This command can appear only \inenvironment\temp,
                    520:     not \inenvironment\thisenv}%
                    521: }
                    522: \def\inenvironment#1{%
                    523:   \ifx#1\empty
                    524:     outside of any environment%
                    525:   \else
                    526:     in environment \expandafter\string#1%
                    527:   \fi
                    528: }
                    529: 
                    530: 
                    531: % @end foo calls \checkenv and executes the definition of \Efoo.
                    532: \parseargdef\end{%
                    533:   \if 1\csname iscond.#1\endcsname
                    534:   \else
                    535:     % The general wording of \badenverr may not be ideal.
                    536:     \expandafter\checkenv\csname#1\endcsname
                    537:     \csname E#1\endcsname
                    538:     \endgroup
                    539:   \fi
                    540: }
                    541: 
                    542: \newhelp\EMsimple{Press RETURN to continue.}
                    543: 
                    544: 
                    545: % Be sure we're in horizontal mode when doing a tie, since we make space
                    546: % equivalent to this in @example-like environments. Otherwise, a space
                    547: % at the beginning of a line will start with \penalty -- and
                    548: % since \penalty is valid in vertical mode, we'd end up putting the
                    549: % penalty on the vertical list instead of in the new paragraph.
                    550: {\catcode`@ = 11
                    551:  % Avoid using \@M directly, because that causes trouble
                    552:  % if the definition is written into an index file.
                    553:  \global\let\tiepenalty = \@M
                    554:  \gdef\tie{\leavevmode\penalty\tiepenalty\ }
                    555: }
                    556: 
                    557: % @: forces normal size whitespace following.
                    558: \def\:{\spacefactor=1000 }
                    559: 
                    560: % @* forces a line break.
                    561: \def\*{\unskip\hfil\break\hbox{}\ignorespaces}
                    562: 
                    563: % @/ allows a line break.
                    564: \let\/=\allowbreak
                    565: 
1.2     ! snw       566: % @- allows explicit insertion of hyphenation points
        !           567: \def\-{\discretionary{\normaldash}{}{}}%
        !           568: 
1.1       snw       569: % @. is an end-of-sentence period.
                    570: \def\.{.\spacefactor=\endofsentencespacefactor\space}
                    571: 
                    572: % @! is an end-of-sentence bang.
                    573: \def\!{!\spacefactor=\endofsentencespacefactor\space}
                    574: 
                    575: % @? is an end-of-sentence query.
                    576: \def\?{?\spacefactor=\endofsentencespacefactor\space}
                    577: 
                    578: % @w prevents a word break.  Without the \leavevmode, @w at the
                    579: % beginning of a paragraph, when TeX is still in vertical mode, would
                    580: % produce a whole line of output instead of starting the paragraph.
                    581: \def\w#1{\leavevmode\hbox{#1}}
                    582: 
                    583: % @group ... @end group forces ... to be all on one page, by enclosing
                    584: % it in a TeX vbox.  We use \vtop instead of \vbox to construct the box
                    585: % to keep its height that of a normal line.  According to the rules for
                    586: % \topskip (p.114 of the TeXbook), the glue inserted is
                    587: % max (\topskip - \ht (first item), 0).  If that height is large,
                    588: % therefore, no glue is inserted, and the space between the headline and
                    589: % the text is small, which looks bad.
                    590: %
                    591: % Another complication is that the group might be very large.  This can
                    592: % cause the glue on the previous page to be unduly stretched, because it
                    593: % does not have much material.  In this case, it's better to add an
                    594: % explicit \vfill so that the extra space is at the bottom.  The
                    595: % threshold for doing this is if the group is more than \vfilllimit
                    596: % percent of a page (\vfilllimit can be changed inside of @tex).
                    597: %
                    598: \newbox\groupbox
                    599: \def\vfilllimit{0.7}
                    600: %
                    601: \envdef\group{%
                    602:   \ifnum\catcode`\^^M=\active \else
                    603:     \errhelp = \groupinvalidhelp
                    604:     \errmessage{@group invalid in context where filling is enabled}%
                    605:   \fi
                    606:   \startsavinginserts
                    607:   %
                    608:   \setbox\groupbox = \vtop\bgroup
                    609:     % Do @comment since we are called inside an environment such as
                    610:     % @example, where each end-of-line in the input causes an
                    611:     % end-of-line in the output.  We don't want the end-of-line after
                    612:     % the `@group' to put extra space in the output.  Since @group
                    613:     % should appear on a line by itself (according to the Texinfo
                    614:     % manual), we don't worry about eating any user text.
                    615:     \comment
                    616: }
                    617: %
                    618: % The \vtop produces a box with normal height and large depth; thus, TeX puts
                    619: % \baselineskip glue before it, and (when the next line of text is done)
                    620: % \lineskip glue after it.  Thus, space below is not quite equal to space
                    621: % above.  But it's pretty close.
                    622: \def\Egroup{%
                    623:     % To get correct interline space between the last line of the group
                    624:     % and the first line afterwards, we have to propagate \prevdepth.
                    625:     \endgraf % Not \par, as it may have been set to \lisppar.
                    626:     \global\dimen1 = \prevdepth
                    627:   \egroup           % End the \vtop.
                    628:   \addgroupbox
                    629:   \prevdepth = \dimen1
                    630:   \checkinserts
                    631: }
                    632: 
                    633: \def\addgroupbox{
                    634:   % \dimen0 is the vertical size of the group's box.
                    635:   \dimen0 = \ht\groupbox  \advance\dimen0 by \dp\groupbox
                    636:   % \dimen2 is how much space is left on the page (more or less).
                    637:   \dimen2 = \txipageheight   \advance\dimen2 by -\pagetotal
                    638:   % if the group doesn't fit on the current page, and it's a big big
                    639:   % group, force a page break.
                    640:   \ifdim \dimen0 > \dimen2
                    641:     \ifdim \pagetotal < \vfilllimit\txipageheight
                    642:       \page
                    643:     \fi
                    644:   \fi
                    645:   \box\groupbox
                    646: }
                    647: 
                    648: %
                    649: % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
                    650: % message, so this ends up printing `@group can only ...'.
                    651: %
                    652: \newhelp\groupinvalidhelp{%
                    653: group can only be used in environments such as @example,^^J%
                    654: where each line of input produces a line of output.}
                    655: 
                    656: % @need space-in-mils
                    657: % forces a page break if there is not space-in-mils remaining.
                    658: 
                    659: \newdimen\mil  \mil=0.001in
                    660: 
                    661: \parseargdef\need{%
                    662:   % Ensure vertical mode, so we don't make a big box in the middle of a
                    663:   % paragraph.
                    664:   \par
                    665:   %
                    666:   % If the @need value is less than one line space, it's useless.
                    667:   \dimen0 = #1\mil
                    668:   \dimen2 = \ht\strutbox
                    669:   \advance\dimen2 by \dp\strutbox
                    670:   \ifdim\dimen0 > \dimen2
1.2     ! snw       671:     % This is similar to the 'needspace' module in LaTeX.
        !           672:     % The first penalty allows a break if the end of the page is
        !           673:     % not too far away.  Following penalties and skips are discarded.
        !           674:     % Otherwise, require at least \dimen0 of vertical space.
        !           675:     %
        !           676:     % (We used to use a \vtop to reserve space, but this had spacing issues
        !           677:     % when followed by a section heading, as it was not a "discardable item".
        !           678:     % This also has the benefit of providing glue before the page break if
        !           679:     % there isn't enough space.)
        !           680:     \vskip0pt plus \dimen0
        !           681:     \penalty-100
        !           682:     \vskip0pt plus -\dimen0
        !           683:     \vskip \dimen0
1.1       snw       684:     \penalty9999
1.2     ! snw       685:     \vskip -\dimen0
        !           686:     \penalty0\relax % this hides the above glue from \safewhatsit and \dobreak
1.1       snw       687:   \fi
                    688: }
                    689: 
                    690: % @br   forces paragraph break (and is undocumented).
                    691: 
                    692: \let\br = \par
                    693: 
                    694: % @page forces the start of a new page.
                    695: %
                    696: \def\page{\par\vfill\supereject}
                    697: 
                    698: % @exdent text....
                    699: % outputs text on separate line in roman font, starting at standard page margin
                    700: 
                    701: % This records the amount of indent in the innermost environment.
                    702: % That's how much \exdent should take out.
                    703: \newskip\exdentamount
                    704: 
                    705: % This defn is used inside fill environments such as @defun.
                    706: \parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}
                    707: 
                    708: % This defn is used inside nofill environments such as @example.
                    709: \parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount
                    710:   \leftline{\hskip\leftskip{\rm#1}}}}
                    711: 
                    712: % @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
                    713: % paragraph.  For more general purposes, use the \margin insertion
                    714: % class.  WHICH is `l' or `r'.  Not documented, written for gawk manual.
                    715: %
                    716: \newskip\inmarginspacing \inmarginspacing=1cm
                    717: \def\strutdepth{\dp\strutbox}
                    718: %
                    719: \def\doinmargin#1#2{\strut\vadjust{%
                    720:   \nobreak
                    721:   \kern-\strutdepth
                    722:   \vtop to \strutdepth{%
                    723:     \baselineskip=\strutdepth
                    724:     \vss
                    725:     % if you have multiple lines of stuff to put here, you'll need to
                    726:     % make the vbox yourself of the appropriate size.
                    727:     \ifx#1l%
                    728:       \llap{\ignorespaces #2\hskip\inmarginspacing}%
                    729:     \else
                    730:       \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
                    731:     \fi
                    732:     \null
                    733:   }%
                    734: }}
                    735: \def\inleftmargin{\doinmargin l}
                    736: \def\inrightmargin{\doinmargin r}
                    737: %
                    738: % @inmargin{TEXT [, RIGHT-TEXT]}
                    739: % (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
                    740: % else use TEXT for both).
                    741: %
                    742: \def\inmargin#1{\parseinmargin #1,,\finish}
                    743: \def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
                    744:   \setbox0 = \hbox{\ignorespaces #2}%
                    745:   \ifdim\wd0 > 0pt
                    746:     \def\lefttext{#1}%  have both texts
                    747:     \def\righttext{#2}%
                    748:   \else
                    749:     \def\lefttext{#1}%  have only one text
                    750:     \def\righttext{#1}%
                    751:   \fi
                    752:   %
                    753:   \ifodd\pageno
                    754:     \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
                    755:   \else
                    756:     \def\temp{\inleftmargin\lefttext}%
                    757:   \fi
                    758:   \temp
                    759: }
                    760: 
                    761: % @include FILE -- \input text of FILE.
                    762: %
                    763: \def\include{\parseargusing\filenamecatcodes\includezzz}
                    764: \def\includezzz#1{%
                    765:   \pushthisfilestack
                    766:   \def\thisfile{#1}%
                    767:   {%
                    768:     \makevalueexpandable  % we want to expand any @value in FILE.
                    769:     \turnoffactive        % and allow special characters in the expansion
                    770:     \indexnofonts         % Allow `@@' and other weird things in file names.
                    771:     \wlog{texinfo.tex: doing @include of #1^^J}%
                    772:     \edef\temp{\noexpand\input #1 }%
                    773:     %
                    774:     % This trickery is to read FILE outside of a group, in case it makes
                    775:     % definitions, etc.
                    776:     \expandafter
                    777:   }\temp
                    778:   \popthisfilestack
                    779: }
                    780: \def\filenamecatcodes{%
                    781:   \catcode`\\=\other
                    782:   \catcode`~=\other
                    783:   \catcode`^=\other
                    784:   \catcode`_=\other
                    785:   \catcode`|=\other
                    786:   \catcode`<=\other
                    787:   \catcode`>=\other
                    788:   \catcode`+=\other
                    789:   \catcode`-=\other
                    790:   \catcode`\`=\other
                    791:   \catcode`\'=\other
                    792: }
                    793: 
                    794: \def\pushthisfilestack{%
                    795:   \expandafter\pushthisfilestackX\popthisfilestack\StackTerm
                    796: }
                    797: \def\pushthisfilestackX{%
                    798:   \expandafter\pushthisfilestackY\thisfile\StackTerm
                    799: }
                    800: \def\pushthisfilestackY #1\StackTerm #2\StackTerm {%
                    801:   \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}%
                    802: }
                    803: 
                    804: \def\popthisfilestack{\errthisfilestackempty}
                    805: \def\errthisfilestackempty{\errmessage{Internal error:
                    806:   the stack of filenames is empty.}}
                    807: %
                    808: \def\thisfile{}
                    809: 
                    810: % @center line
                    811: % outputs that line, centered.
                    812: %
                    813: \parseargdef\center{%
                    814:   \ifhmode
                    815:     \let\centersub\centerH
                    816:   \else
                    817:     \let\centersub\centerV
                    818:   \fi
                    819:   \centersub{\hfil \ignorespaces#1\unskip \hfil}%
                    820:   \let\centersub\relax % don't let the definition persist, just in case
                    821: }
                    822: \def\centerH#1{{%
                    823:   \hfil\break
                    824:   \advance\hsize by -\leftskip
                    825:   \advance\hsize by -\rightskip
                    826:   \line{#1}%
                    827:   \break
                    828: }}
                    829: %
                    830: \newcount\centerpenalty
                    831: \def\centerV#1{%
                    832:   % The idea here is the same as in \startdefun, \cartouche, etc.: if
                    833:   % @center is the first thing after a section heading, we need to wipe
                    834:   % out the negative parskip inserted by \sectionheading, but still
                    835:   % prevent a page break here.
                    836:   \centerpenalty = \lastpenalty
                    837:   \ifnum\centerpenalty>10000 \vskip\parskip \fi
                    838:   \ifnum\centerpenalty>9999 \penalty\centerpenalty \fi
                    839:   \line{\kern\leftskip #1\kern\rightskip}%
                    840: }
                    841: 
                    842: % @sp n   outputs n lines of vertical space
                    843: %
                    844: \parseargdef\sp{\vskip #1\baselineskip}
                    845: 
                    846: % @comment ...line which is ignored...
                    847: % @c is the same as @comment
                    848: % @ignore ... @end ignore  is another way to write a comment
                    849: 
                    850: 
                    851: \def\c{\begingroup \catcode`\^^M=\active%
                    852: \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
                    853: \cxxx}
                    854: {\catcode`\^^M=\active \gdef\cxxx#1^^M{\endgroup}}
                    855: %
                    856: \let\comment\c
                    857: 
                    858: % @paragraphindent NCHARS
                    859: % We'll use ems for NCHARS, close enough.
                    860: % NCHARS can also be the word `asis' or `none'.
                    861: % We cannot feasibly implement @paragraphindent asis, though.
                    862: %
                    863: \def\asisword{asis} % no translation, these are keywords
                    864: \def\noneword{none}
                    865: %
                    866: \parseargdef\paragraphindent{%
                    867:   \def\temp{#1}%
                    868:   \ifx\temp\asisword
                    869:   \else
                    870:     \ifx\temp\noneword
                    871:       \defaultparindent = 0pt
                    872:     \else
                    873:       \defaultparindent = #1em
                    874:     \fi
                    875:   \fi
                    876:   \parindent = \defaultparindent
                    877: }
                    878: 
                    879: % @exampleindent NCHARS
                    880: % We'll use ems for NCHARS like @paragraphindent.
                    881: % It seems @exampleindent asis isn't necessary, but
                    882: % I preserve it to make it similar to @paragraphindent.
                    883: \parseargdef\exampleindent{%
                    884:   \def\temp{#1}%
                    885:   \ifx\temp\asisword
                    886:   \else
                    887:     \ifx\temp\noneword
                    888:       \lispnarrowing = 0pt
                    889:     \else
                    890:       \lispnarrowing = #1em
                    891:     \fi
                    892:   \fi
                    893: }
                    894: 
                    895: % @firstparagraphindent WORD
                    896: % If WORD is `none', then suppress indentation of the first paragraph
                    897: % after a section heading.  If WORD is `insert', then do indent at such
                    898: % paragraphs.
                    899: %
                    900: % The paragraph indentation is suppressed or not by calling
                    901: % \suppressfirstparagraphindent, which the sectioning commands do.
                    902: % We switch the definition of this back and forth according to WORD.
                    903: % By default, we suppress indentation.
                    904: %
                    905: \def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
                    906: \def\insertword{insert}
                    907: %
                    908: \parseargdef\firstparagraphindent{%
                    909:   \def\temp{#1}%
                    910:   \ifx\temp\noneword
                    911:     \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
                    912:   \else\ifx\temp\insertword
                    913:     \let\suppressfirstparagraphindent = \relax
                    914:   \else
                    915:     \errhelp = \EMsimple
                    916:     \errmessage{Unknown @firstparagraphindent option `\temp'}%
                    917:   \fi\fi
                    918: }
                    919: 
                    920: % Here is how we actually suppress indentation.  Redefine \everypar to
                    921: % \kern backwards by \parindent, and then reset itself to empty.
                    922: %
                    923: % We also make \indent itself not actually do anything until the next
                    924: % paragraph.
                    925: %
                    926: \gdef\dosuppressfirstparagraphindent{%
                    927:   \gdef\indent  {\restorefirstparagraphindent \indent}%
                    928:   \gdef\noindent{\restorefirstparagraphindent \noindent}%
                    929:   \global\everypar = {\kern -\parindent \restorefirstparagraphindent}%
                    930: }
                    931: %
                    932: \gdef\restorefirstparagraphindent{%
                    933:   \global\let\indent = \ptexindent
                    934:   \global\let\noindent = \ptexnoindent
                    935:   \global\everypar = {}%
                    936: }
                    937: 
                    938: % leave vertical mode without cancelling any first paragraph indent
                    939: \gdef\imageindent{%
                    940:   \toks0=\everypar
                    941:   \everypar={}%
                    942:   \ptexnoindent
                    943:   \global\everypar=\toks0
                    944: }
                    945: 
                    946: 
                    947: % @refill is a no-op.
                    948: \let\refill=\relax
                    949: 
                    950: % @setfilename INFO-FILENAME - ignored
                    951: \let\setfilename=\comment
                    952: 
                    953: % @bye.
                    954: \outer\def\bye{\chappager\pagelabels\tracingstats=1\ptexend}
                    955: 
                    956: 
                    957: \message{pdf,}
                    958: % adobe `portable' document format
                    959: \newcount\tempnum
                    960: \newcount\lnkcount
                    961: \newtoks\filename
                    962: \newcount\filenamelength
                    963: \newcount\pgn
                    964: \newtoks\toksA
                    965: \newtoks\toksB
                    966: \newtoks\toksC
                    967: \newtoks\toksD
                    968: \newbox\boxA
                    969: \newbox\boxB
                    970: \newcount\countA
                    971: \newif\ifpdf
                    972: \newif\ifpdfmakepagedest
                    973: 
                    974: %
                    975: % For LuaTeX
                    976: %
                    977: 
                    978: \newif\iftxiuseunicodedestname
                    979: \txiuseunicodedestnamefalse % For pdfTeX etc.
                    980: 
                    981: \ifx\luatexversion\thisisundefined
                    982: \else
                    983:   % Use Unicode destination names
                    984:   \txiuseunicodedestnametrue
                    985:   % Escape PDF strings with converting UTF-16 from UTF-8
                    986:   \begingroup
                    987:     \catcode`\%=12
                    988:     \directlua{
                    989:       function UTF16oct(str)
                    990:         tex.sprint(string.char(0x5c) .. '376' .. string.char(0x5c) .. '377')
                    991:         for c in string.utfvalues(str) do
                    992:           if c < 0x10000 then
                    993:             tex.sprint(
                    994:               string.format(string.char(0x5c) .. string.char(0x25) .. '03o' ..
                    995:                             string.char(0x5c) .. string.char(0x25) .. '03o',
                    996:                             math.floor(c / 256), math.floor(c % 256)))
                    997:           else
                    998:             c = c - 0x10000
                    999:             local c_hi = c / 1024 + 0xd800
                   1000:             local c_lo = c % 1024 + 0xdc00
                   1001:             tex.sprint(
                   1002:               string.format(string.char(0x5c) .. string.char(0x25) .. '03o' ..
                   1003:                             string.char(0x5c) .. string.char(0x25) .. '03o' ..
                   1004:                             string.char(0x5c) .. string.char(0x25) .. '03o' ..
                   1005:                             string.char(0x5c) .. string.char(0x25) .. '03o',
                   1006:                             math.floor(c_hi / 256), math.floor(c_hi % 256),
                   1007:                             math.floor(c_lo / 256), math.floor(c_lo % 256)))
                   1008:           end
                   1009:         end
                   1010:       end
                   1011:     }
                   1012:   \endgroup
                   1013:   \def\pdfescapestrutfsixteen#1{\directlua{UTF16oct('\luaescapestring{#1}')}}
                   1014:   % Escape PDF strings without converting
                   1015:   \begingroup
                   1016:     \directlua{
                   1017:       function PDFescstr(str)
                   1018:         for c in string.bytes(str) do
                   1019:           if c <= 0x20 or c >= 0x80 or c == 0x28 or c == 0x29 or c == 0x5c then
                   1020:             tex.sprint(-2,
                   1021:               string.format(string.char(0x5c) .. string.char(0x25) .. '03o',
                   1022:                             c))
                   1023:           else
                   1024:             tex.sprint(-2, string.char(c))
                   1025:           end
                   1026:         end
                   1027:       end
                   1028:     }
                   1029:     % The -2 in the arguments here gives all the input to TeX catcode 12
                   1030:     % (other) or 10 (space), preventing undefined control sequence errors. See
                   1031:     % https://lists.gnu.org/archive/html/bug-texinfo/2019-08/msg00031.html
                   1032:     %
                   1033:   \endgroup
                   1034:   \def\pdfescapestring#1{\directlua{PDFescstr('\luaescapestring{#1}')}}
                   1035:   \ifnum\luatexversion>84
                   1036:     % For LuaTeX >= 0.85
                   1037:     \def\pdfdest{\pdfextension dest}
                   1038:     \let\pdfoutput\outputmode
                   1039:     \def\pdfliteral{\pdfextension literal}
                   1040:     \def\pdfcatalog{\pdfextension catalog}
                   1041:     \def\pdftexversion{\numexpr\pdffeedback version\relax}
                   1042:     \let\pdfximage\saveimageresource
                   1043:     \let\pdfrefximage\useimageresource
                   1044:     \let\pdflastximage\lastsavedimageresourceindex
                   1045:     \def\pdfendlink{\pdfextension endlink\relax}
                   1046:     \def\pdfoutline{\pdfextension outline}
                   1047:     \def\pdfstartlink{\pdfextension startlink}
                   1048:     \def\pdffontattr{\pdfextension fontattr}
                   1049:     \def\pdfobj{\pdfextension obj}
                   1050:     \def\pdflastobj{\numexpr\pdffeedback lastobj\relax}
                   1051:     \let\pdfpagewidth\pagewidth
                   1052:     \let\pdfpageheight\pageheight
                   1053:     \edef\pdfhorigin{\pdfvariable horigin}
                   1054:     \edef\pdfvorigin{\pdfvariable vorigin}
                   1055:   \fi
                   1056: \fi
                   1057: 
                   1058: % when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
                   1059: % can be set).  So we test for \relax and 0 as well as being undefined.
                   1060: \ifx\pdfoutput\thisisundefined
                   1061: \else
                   1062:   \ifx\pdfoutput\relax
                   1063:   \else
                   1064:     \ifcase\pdfoutput
                   1065:     \else
                   1066:       \pdftrue
                   1067:     \fi
                   1068:   \fi
                   1069: \fi
                   1070: 
                   1071: \newif\ifpdforxetex
                   1072: \pdforxetexfalse
                   1073: \ifpdf
                   1074:   \pdforxetextrue
                   1075: \fi
                   1076: \ifx\XeTeXrevision\thisisundefined\else
                   1077:   \pdforxetextrue
                   1078: \fi
                   1079: 
                   1080: 
                   1081: % Output page labels information.
                   1082: % See PDF reference v.1.7 p.594, section 8.3.1.
1.2     ! snw      1083: % Page label ranges must be increasing.
1.1       snw      1084: \ifpdf
                   1085: \def\pagelabels{%
                   1086:   \def\title{0 << /P (T-) /S /D >>}%
                   1087:   %
1.2     ! snw      1088:   % support @contents at very end of document
        !          1089:   \ifnum\contentsendcount=\pagecount
        !          1090:     \ifnum\arabiccount<\romancount
        !          1091:       \pdfcatalog{/PageLabels << /Nums
        !          1092:                   [\title
        !          1093:                    \the\arabiccount << /S /D >>
        !          1094:                    \the\romancount << /S /r >>
        !          1095:                   ] >> }\relax
        !          1096:     \fi
        !          1097:   % no contents in document
        !          1098:   \else\ifnum\contentsendcount=0
        !          1099:     \pdfcatalog{/PageLabels << /Nums
        !          1100:                 [\title
        !          1101:                  \the\arabiccount << /S /D >>
        !          1102:                 ] >> }\relax
        !          1103:   \else
        !          1104:     \pdfcatalog{/PageLabels << /Nums
        !          1105:                 [\title
        !          1106:                  \the\romancount << /S /r >>
        !          1107:                  \the\contentsendcount << /S /D >>
        !          1108:                 ] >> }\relax
        !          1109:   \fi\fi
1.1       snw      1110: }
                   1111: \else
                   1112:   \let\pagelabels\relax
                   1113: \fi
                   1114: 
                   1115: \newcount\pagecount \pagecount=0
                   1116: \newcount\romancount \romancount=0
                   1117: \newcount\arabiccount \arabiccount=0
1.2     ! snw      1118: \newcount\contentsendcount \contentsendcount=0
        !          1119: 
1.1       snw      1120: \ifpdf
                   1121:   \let\ptxadvancepageno\advancepageno
                   1122:   \def\advancepageno{%
                   1123:     \ptxadvancepageno\global\advance\pagecount by 1
                   1124:   }
                   1125: \fi
                   1126: 
                   1127: 
                   1128: % PDF uses PostScript string constants for the names of xref targets,
                   1129: % for display in the outlines, and in other places.  Thus, we have to
                   1130: % double any backslashes.  Otherwise, a name like "\node" will be
                   1131: % interpreted as a newline (\n), followed by o, d, e.  Not good.
                   1132: %
                   1133: % See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and
                   1134: % related messages.  The final outcome is that it is up to the TeX user
                   1135: % to double the backslashes and otherwise make the string valid, so
                   1136: % that's what we do.  pdftex 1.30.0 (ca.2005) introduced a primitive to
                   1137: % do this reliably, so we use it.
                   1138: 
                   1139: % #1 is a control sequence in which to do the replacements,
                   1140: % which we \xdef.
                   1141: \def\txiescapepdf#1{%
                   1142:   \ifx\pdfescapestring\thisisundefined
                   1143:     % No primitive available; should we give a warning or log?
                   1144:     % Many times it won't matter.
                   1145:     \xdef#1{#1}%
                   1146:   \else
                   1147:     % The expandable \pdfescapestring primitive escapes parentheses,
                   1148:     % backslashes, and other special chars.
                   1149:     \xdef#1{\pdfescapestring{#1}}%
                   1150:   \fi
                   1151: }
                   1152: \def\txiescapepdfutfsixteen#1{%
                   1153:   \ifx\pdfescapestrutfsixteen\thisisundefined
                   1154:     % No UTF-16 converting macro available.
                   1155:     \txiescapepdf{#1}%
                   1156:   \else
                   1157:     \xdef#1{\pdfescapestrutfsixteen{#1}}%
                   1158:   \fi
                   1159: }
                   1160: 
                   1161: \newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images
                   1162: with PDF output, and none of those formats could be found.  (.eps cannot
                   1163: be supported due to the design of the PDF format; use regular TeX (DVI
                   1164: output) for that.)}
                   1165: 
                   1166: \ifpdf
                   1167:   %
                   1168:   % Color manipulation macros using ideas from pdfcolor.tex,
                   1169:   % except using rgb instead of cmyk; the latter is said to render as a
                   1170:   % very dark gray on-screen and a very dark halftone in print, instead
                   1171:   % of actual black. The dark red here is dark enough to print on paper as
                   1172:   % nearly black, but still distinguishable for online viewing.  We use
                   1173:   % black by default, though.
                   1174:   \def\rgbDarkRed{0.50 0.09 0.12}
                   1175:   \def\rgbBlack{0 0 0}
                   1176:   %
                   1177:   % rg sets the color for filling (usual text, etc.);
                   1178:   % RG sets the color for stroking (thin rules, e.g., normal _'s).
                   1179:   \def\pdfsetcolor#1{\pdfliteral{#1 rg  #1 RG}}
                   1180:   %
                   1181:   % Set color, and create a mark which defines \thiscolor accordingly,
                   1182:   % so that \makeheadline knows which color to restore.
1.2     ! snw      1183:   \def\curcolor{0 0 0}%
1.1       snw      1184:   \def\setcolor#1{%
1.2     ! snw      1185:     \ifx#1\curcolor\else
        !          1186:       \xdef\currentcolordefs{\gdef\noexpand\thiscolor{#1}}%
        !          1187:       \domark
        !          1188:       \pdfsetcolor{#1}%
        !          1189:       \xdef\curcolor{#1}%
        !          1190:     \fi
1.1       snw      1191:   }
                   1192:   %
1.2     ! snw      1193:   \let\maincolor\rgbBlack
1.1       snw      1194:   \pdfsetcolor{\maincolor}
                   1195:   \edef\thiscolor{\maincolor}
                   1196:   \def\currentcolordefs{}
                   1197:   %
                   1198:   \def\makefootline{%
                   1199:     \baselineskip24pt
                   1200:     \line{\pdfsetcolor{\maincolor}\the\footline}%
                   1201:   }
                   1202:   %
                   1203:   \def\makeheadline{%
                   1204:     \vbox to 0pt{%
                   1205:       \vskip-22.5pt
                   1206:       \line{%
                   1207:         \vbox to8.5pt{}%
                   1208:         % Extract \thiscolor definition from the marks.
                   1209:         \getcolormarks
                   1210:         % Typeset the headline with \maincolor, then restore the color.
                   1211:         \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
                   1212:       }%
                   1213:       \vss
                   1214:     }%
                   1215:     \nointerlineskip
                   1216:   }
                   1217:   %
                   1218:   %
                   1219:   \pdfcatalog{/PageMode /UseOutlines}
                   1220:   %
                   1221:   % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
                   1222:   \def\dopdfimage#1#2#3{%
                   1223:     \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
                   1224:     \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
                   1225:     %
                   1226:     % pdftex (and the PDF format) support .pdf, .png, .jpg (among
                   1227:     % others).  Let's try in that order, PDF first since if
                   1228:     % someone has a scalable image, presumably better to use that than a
                   1229:     % bitmap.
                   1230:     \let\pdfimgext=\empty
                   1231:     \begingroup
                   1232:       \openin 1 #1.pdf \ifeof 1
                   1233:         \openin 1 #1.PDF \ifeof 1
                   1234:           \openin 1 #1.png \ifeof 1
                   1235:             \openin 1 #1.jpg \ifeof 1
                   1236:               \openin 1 #1.jpeg \ifeof 1
                   1237:                 \openin 1 #1.JPG \ifeof 1
                   1238:                   \errhelp = \nopdfimagehelp
                   1239:                   \errmessage{Could not find image file #1 for pdf}%
                   1240:                 \else \gdef\pdfimgext{JPG}%
                   1241:                 \fi
                   1242:               \else \gdef\pdfimgext{jpeg}%
                   1243:               \fi
                   1244:             \else \gdef\pdfimgext{jpg}%
                   1245:             \fi
                   1246:           \else \gdef\pdfimgext{png}%
                   1247:           \fi
                   1248:         \else \gdef\pdfimgext{PDF}%
                   1249:         \fi
                   1250:       \else \gdef\pdfimgext{pdf}%
                   1251:       \fi
                   1252:       \closein 1
                   1253:     \endgroup
                   1254:     %
                   1255:     % without \immediate, ancient pdftex seg faults when the same image is
                   1256:     % included twice.  (Version 3.14159-pre-1.0-unofficial-20010704.)
                   1257:     \ifnum\pdftexversion < 14
                   1258:       \immediate\pdfimage
                   1259:     \else
                   1260:       \immediate\pdfximage
                   1261:     \fi
                   1262:       \ifdim \wd0 >0pt width \pdfimagewidth \fi
                   1263:       \ifdim \wd2 >0pt height \pdfimageheight \fi
                   1264:       \ifnum\pdftexversion<13
                   1265:          #1.\pdfimgext
                   1266:        \else
                   1267:          {#1.\pdfimgext}%
                   1268:        \fi
                   1269:     \ifnum\pdftexversion < 14 \else
                   1270:       \pdfrefximage \pdflastximage
                   1271:     \fi}
                   1272:   %
                   1273:   \def\setpdfdestname#1{{%
                   1274:     % We have to set dummies so commands such as @code, and characters
                   1275:     % such as \, aren't expanded when present in a section title.
                   1276:     \indexnofonts
                   1277:     \makevalueexpandable
                   1278:     \turnoffactive
                   1279:     \iftxiuseunicodedestname
                   1280:       \ifx \declaredencoding \latone
                   1281:         % Pass through Latin-1 characters.
                   1282:         % LuaTeX with byte wise I/O converts Latin-1 characters to Unicode.
                   1283:       \else
                   1284:         \ifx \declaredencoding \utfeight
                   1285:           % Pass through Unicode characters.
                   1286:         \else
                   1287:           % Use ASCII approximations in destination names.
                   1288:           \passthroughcharsfalse
                   1289:         \fi
                   1290:       \fi
                   1291:     \else
                   1292:       % Use ASCII approximations in destination names.
                   1293:       \passthroughcharsfalse
                   1294:     \fi
                   1295:     \def\pdfdestname{#1}%
                   1296:     \txiescapepdf\pdfdestname
                   1297:   }}
                   1298:   %
                   1299:   \def\setpdfoutlinetext#1{{%
                   1300:     \indexnofonts
                   1301:     \makevalueexpandable
                   1302:     \turnoffactive
                   1303:     \ifx \declaredencoding \latone
                   1304:       % The PDF format can use an extended form of Latin-1 in bookmark
                   1305:       % strings.  See Appendix D of the PDF Reference, Sixth Edition, for
                   1306:       % the "PDFDocEncoding".
                   1307:       \passthroughcharstrue
                   1308:       % Pass through Latin-1 characters.
                   1309:       %   LuaTeX: Convert to Unicode
                   1310:       %   pdfTeX: Use Latin-1 as PDFDocEncoding
                   1311:       \def\pdfoutlinetext{#1}%
                   1312:     \else
                   1313:       \ifx \declaredencoding \utfeight
                   1314:         \ifx\luatexversion\thisisundefined
                   1315:           % For pdfTeX  with UTF-8.
                   1316:           % TODO: the PDF format can use UTF-16 in bookmark strings,
                   1317:           % but the code for this isn't done yet.
                   1318:           % Use ASCII approximations.
                   1319:           \passthroughcharsfalse
                   1320:           \def\pdfoutlinetext{#1}%
                   1321:         \else
                   1322:           % For LuaTeX with UTF-8.
                   1323:           % Pass through Unicode characters for title texts.
                   1324:           \passthroughcharstrue
                   1325:           \def\pdfoutlinetext{#1}%
                   1326:         \fi
                   1327:       \else
                   1328:         % For non-Latin-1 or non-UTF-8 encodings.
                   1329:         % Use ASCII approximations.
                   1330:         \passthroughcharsfalse
                   1331:         \def\pdfoutlinetext{#1}%
                   1332:       \fi
                   1333:     \fi
                   1334:     % LuaTeX: Convert to UTF-16
                   1335:     % pdfTeX: Use Latin-1 as PDFDocEncoding
                   1336:     \txiescapepdfutfsixteen\pdfoutlinetext
                   1337:   }}
                   1338:   %
                   1339:   \def\pdfmkdest#1{%
                   1340:     \setpdfdestname{#1}%
                   1341:     \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
                   1342:   }
                   1343:   %
                   1344:   % used to mark target names; must be expandable.
                   1345:   \def\pdfmkpgn#1{#1}
                   1346:   %
                   1347:   % by default, use black for everything.
                   1348:   \def\urlcolor{\rgbBlack}
1.2     ! snw      1349:   \let\linkcolor\rgbBlack
1.1       snw      1350:   \def\endlink{\setcolor{\maincolor}\pdfendlink}
                   1351:   %
                   1352:   % Adding outlines to PDF; macros for calculating structure of outlines
                   1353:   % come from Petr Olsak
                   1354:   \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
                   1355:     \else \csname#1\endcsname \fi}
                   1356:   \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
                   1357:     \advance\tempnum by 1
                   1358:     \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
                   1359:   %
                   1360:   % #1 is the section text, which is what will be displayed in the
                   1361:   % outline by the pdf viewer.  #2 is the pdf expression for the number
                   1362:   % of subentries (or empty, for subsubsections).  #3 is the node text,
                   1363:   % which might be empty if this toc entry had no corresponding node.
                   1364:   % #4 is the page number
                   1365:   %
                   1366:   \def\dopdfoutline#1#2#3#4{%
                   1367:     % Generate a link to the node text if that exists; else, use the
                   1368:     % page number.  We could generate a destination for the section
                   1369:     % text in the case where a section has no node, but it doesn't
                   1370:     % seem worth the trouble, since most documents are normally structured.
                   1371:     \setpdfoutlinetext{#1}
                   1372:     \setpdfdestname{#3}
                   1373:     \ifx\pdfdestname\empty
                   1374:       \def\pdfdestname{#4}%
                   1375:     \fi
                   1376:     %
                   1377:     \pdfoutline goto name{\pdfmkpgn{\pdfdestname}}#2{\pdfoutlinetext}%
                   1378:   }
                   1379:   %
                   1380:   \def\pdfmakeoutlines{%
                   1381:     \begingroup
                   1382:       % Read toc silently, to get counts of subentries for \pdfoutline.
                   1383:       \def\partentry##1##2##3##4{}% ignore parts in the outlines
                   1384:       \def\numchapentry##1##2##3##4{%
                   1385:        \def\thischapnum{##2}%
                   1386:        \def\thissecnum{0}%
                   1387:        \def\thissubsecnum{0}%
                   1388:       }%
                   1389:       \def\numsecentry##1##2##3##4{%
                   1390:        \advancenumber{chap\thischapnum}%
                   1391:        \def\thissecnum{##2}%
                   1392:        \def\thissubsecnum{0}%
                   1393:       }%
                   1394:       \def\numsubsecentry##1##2##3##4{%
                   1395:        \advancenumber{sec\thissecnum}%
                   1396:        \def\thissubsecnum{##2}%
                   1397:       }%
                   1398:       \def\numsubsubsecentry##1##2##3##4{%
                   1399:        \advancenumber{subsec\thissubsecnum}%
                   1400:       }%
                   1401:       \def\thischapnum{0}%
                   1402:       \def\thissecnum{0}%
                   1403:       \def\thissubsecnum{0}%
                   1404:       %
                   1405:       % use \def rather than \let here because we redefine \chapentry et
                   1406:       % al. a second time, below.
                   1407:       \def\appentry{\numchapentry}%
                   1408:       \def\appsecentry{\numsecentry}%
                   1409:       \def\appsubsecentry{\numsubsecentry}%
                   1410:       \def\appsubsubsecentry{\numsubsubsecentry}%
                   1411:       \def\unnchapentry{\numchapentry}%
                   1412:       \def\unnsecentry{\numsecentry}%
                   1413:       \def\unnsubsecentry{\numsubsecentry}%
                   1414:       \def\unnsubsubsecentry{\numsubsubsecentry}%
                   1415:       \readdatafile{toc}%
                   1416:       %
                   1417:       % Read toc second time, this time actually producing the outlines.
                   1418:       % The `-' means take the \expnumber as the absolute number of
                   1419:       % subentries, which we calculated on our first read of the .toc above.
                   1420:       %
                   1421:       % We use the node names as the destinations.
                   1422:       %
                   1423:       % Currently we prefix the section name with the section number
                   1424:       % for chapter and appendix headings only in order to avoid too much
                   1425:       % horizontal space being required in the PDF viewer.
                   1426:       \def\numchapentry##1##2##3##4{%
                   1427:         \dopdfoutline{##2 ##1}{count-\expnumber{chap##2}}{##3}{##4}}%
                   1428:       \def\unnchapentry##1##2##3##4{%
                   1429:         \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}%
                   1430:       \def\numsecentry##1##2##3##4{%
                   1431:         \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}%
                   1432:       \def\numsubsecentry##1##2##3##4{%
                   1433:         \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}%
                   1434:       \def\numsubsubsecentry##1##2##3##4{% count is always zero
                   1435:         \dopdfoutline{##1}{}{##3}{##4}}%
                   1436:       %
                   1437:       % PDF outlines are displayed using system fonts, instead of
                   1438:       % document fonts.  Therefore we cannot use special characters,
                   1439:       % since the encoding is unknown.  For example, the eogonek from
                   1440:       % Latin 2 (0xea) gets translated to a | character.  Info from
                   1441:       % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
                   1442:       %
                   1443:       % TODO this right, we have to translate 8-bit characters to
                   1444:       % their "best" equivalent, based on the @documentencoding.  Too
                   1445:       % much work for too little return.  Just use the ASCII equivalents
                   1446:       % we use for the index sort strings.
                   1447:       %
                   1448:       \indexnofonts
                   1449:       \setupdatafile
                   1450:       % We can have normal brace characters in the PDF outlines, unlike
                   1451:       % Texinfo index files.  So set that up.
                   1452:       \def\{{\lbracecharliteral}%
                   1453:       \def\}{\rbracecharliteral}%
                   1454:       \catcode`\\=\active \otherbackslash
                   1455:       \input \tocreadfilename
                   1456:     \endgroup
                   1457:   }
                   1458:   {\catcode`[=1 \catcode`]=2
                   1459:    \catcode`{=\other \catcode`}=\other
                   1460:    \gdef\lbracecharliteral[{]%
                   1461:    \gdef\rbracecharliteral[}]%
                   1462:   ]
                   1463:   %
                   1464:   \def\skipspaces#1{\def\PP{#1}\def\D{|}%
                   1465:     \ifx\PP\D\let\nextsp\relax
                   1466:     \else\let\nextsp\skipspaces
                   1467:       \addtokens{\filename}{\PP}%
                   1468:       \advance\filenamelength by 1
                   1469:     \fi
                   1470:     \nextsp}
                   1471:   \def\getfilename#1{%
                   1472:     \filenamelength=0
                   1473:     % If we don't expand the argument now, \skipspaces will get
                   1474:     % snagged on things like "@value{foo}".
                   1475:     \edef\temp{#1}%
                   1476:     \expandafter\skipspaces\temp|\relax
                   1477:   }
                   1478:   \ifnum\pdftexversion < 14
                   1479:     \let \startlink \pdfannotlink
                   1480:   \else
                   1481:     \let \startlink \pdfstartlink
                   1482:   \fi
                   1483:   % make a live url in pdf output.
                   1484:   \def\pdfurl#1{%
                   1485:     \begingroup
                   1486:       % it seems we really need yet another set of dummies; have not
                   1487:       % tried to figure out what each command should do in the context
                   1488:       % of @url.  for now, just make @/ a no-op, that's the only one
                   1489:       % people have actually reported a problem with.
                   1490:       %
                   1491:       \normalturnoffactive
                   1492:       \def\@{@}%
                   1493:       \let\/=\empty
                   1494:       \makevalueexpandable
                   1495:       % do we want to go so far as to use \indexnofonts instead of just
                   1496:       % special-casing \var here?
                   1497:       \def\var##1{##1}%
                   1498:       %
                   1499:       \leavevmode\setcolor{\urlcolor}%
                   1500:       \startlink attr{/Border [0 0 0]}%
                   1501:         user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
                   1502:     \endgroup}
                   1503:   % \pdfgettoks - Surround page numbers in #1 with @pdflink.  #1 may
                   1504:   % be a simple number, or a list of numbers in the case of an index
                   1505:   % entry.
                   1506:   \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
                   1507:   \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
                   1508:   \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
                   1509:   \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
                   1510:   \def\maketoks{%
                   1511:     \expandafter\poptoks\the\toksA|ENDTOKS|\relax
                   1512:     \ifx\first0\adn0
                   1513:     \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
                   1514:     \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
                   1515:     \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
                   1516:     \else
                   1517:       \ifnum0=\countA\else\makelink\fi
                   1518:       \ifx\first.\let\next=\done\else
                   1519:         \let\next=\maketoks
                   1520:         \addtokens{\toksB}{\the\toksD}
                   1521:         \ifx\first,\addtokens{\toksB}{\space}\fi
                   1522:       \fi
                   1523:     \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
                   1524:     \next}
                   1525:   \def\makelink{\addtokens{\toksB}%
                   1526:     {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
1.2     ! snw      1527:   \def\pdflink#1{\pdflinkpage{#1}{#1}}%
        !          1528:   \def\pdflinkpage#1#2{%
1.1       snw      1529:     \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
1.2     ! snw      1530:     \setcolor{\linkcolor}#2\endlink}
1.1       snw      1531:   \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
                   1532: \else
                   1533:   % non-pdf mode
                   1534:   \let\pdfmkdest = \gobble
                   1535:   \let\pdfurl = \gobble
                   1536:   \let\endlink = \relax
                   1537:   \let\setcolor = \gobble
                   1538:   \let\pdfsetcolor = \gobble
                   1539:   \let\pdfmakeoutlines = \relax
                   1540: \fi  % \ifx\pdfoutput
                   1541: 
                   1542: %
                   1543: % For XeTeX
                   1544: %
                   1545: \ifx\XeTeXrevision\thisisundefined
                   1546: \else
                   1547:   %
                   1548:   % XeTeX version check
                   1549:   %
                   1550:   \ifnum\strcmp{\the\XeTeXversion\XeTeXrevision}{0.99996}>-1
                   1551:     % TeX Live 2016 contains XeTeX 0.99996 and xdvipdfmx 20160307.
                   1552:     % It can use the `dvipdfmx:config' special (from TeX Live SVN r40941).
                   1553:     % For avoiding PDF destination name replacement, we use this special
                   1554:     % instead of xdvipdfmx's command line option `-C 0x0010'.
                   1555:     \special{dvipdfmx:config C 0x0010}
                   1556:     % XeTeX 0.99995+ comes with xdvipdfmx 20160307+.
                   1557:     % It can handle Unicode destination names for PDF.
                   1558:     \txiuseunicodedestnametrue
                   1559:   \else
                   1560:     % XeTeX < 0.99996 (TeX Live < 2016) cannot use the
                   1561:     % `dvipdfmx:config' special.
                   1562:     % So for avoiding PDF destination name replacement,
                   1563:     % xdvipdfmx's command line option `-C 0x0010' is necessary.
                   1564:     %
                   1565:     % XeTeX < 0.99995 can not handle Unicode destination names for PDF
                   1566:     % because xdvipdfmx 20150315 has a UTF-16 conversion issue.
                   1567:     % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753).
                   1568:     \txiuseunicodedestnamefalse
                   1569:   \fi
                   1570:   %
                   1571:   % Color support
                   1572:   %
                   1573:   \def\rgbDarkRed{0.50 0.09 0.12}
                   1574:   \def\rgbBlack{0 0 0}
                   1575:   %
                   1576:   \def\pdfsetcolor#1{\special{pdf:scolor [#1]}}
                   1577:   %
                   1578:   % Set color, and create a mark which defines \thiscolor accordingly,
                   1579:   % so that \makeheadline knows which color to restore.
                   1580:   \def\setcolor#1{%
                   1581:     \xdef\currentcolordefs{\gdef\noexpand\thiscolor{#1}}%
                   1582:     \domark
                   1583:     \pdfsetcolor{#1}%
                   1584:   }
                   1585:   %
                   1586:   \def\maincolor{\rgbBlack}
                   1587:   \pdfsetcolor{\maincolor}
                   1588:   \edef\thiscolor{\maincolor}
                   1589:   \def\currentcolordefs{}
                   1590:   %
                   1591:   \def\makefootline{%
                   1592:     \baselineskip24pt
                   1593:     \line{\pdfsetcolor{\maincolor}\the\footline}%
                   1594:   }
                   1595:   %
                   1596:   \def\makeheadline{%
                   1597:     \vbox to 0pt{%
                   1598:       \vskip-22.5pt
                   1599:       \line{%
                   1600:         \vbox to8.5pt{}%
                   1601:         % Extract \thiscolor definition from the marks.
                   1602:         \getcolormarks
                   1603:         % Typeset the headline with \maincolor, then restore the color.
                   1604:         \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
                   1605:       }%
                   1606:       \vss
                   1607:     }%
                   1608:     \nointerlineskip
                   1609:   }
                   1610:   %
                   1611:   % PDF outline support
                   1612:   %
                   1613:   % Emulate pdfTeX primitive
                   1614:   \def\pdfdest name#1 xyz{%
                   1615:     \special{pdf:dest (#1) [@thispage /XYZ @xpos @ypos null]}%
                   1616:   }
                   1617:   %
                   1618:   \def\setpdfdestname#1{{%
                   1619:     % We have to set dummies so commands such as @code, and characters
                   1620:     % such as \, aren't expanded when present in a section title.
                   1621:     \indexnofonts
                   1622:     \makevalueexpandable
                   1623:     \turnoffactive
                   1624:     \iftxiuseunicodedestname
                   1625:       % Pass through Unicode characters.
                   1626:     \else
                   1627:       % Use ASCII approximations in destination names.
                   1628:       \passthroughcharsfalse
                   1629:     \fi
                   1630:     \def\pdfdestname{#1}%
                   1631:     \txiescapepdf\pdfdestname
                   1632:   }}
                   1633:   %
                   1634:   \def\setpdfoutlinetext#1{{%
                   1635:     \turnoffactive
                   1636:     % Always use Unicode characters in title texts.
                   1637:     \def\pdfoutlinetext{#1}%
                   1638:     % For XeTeX, xdvipdfmx converts to UTF-16.
                   1639:     % So we do not convert.
                   1640:     \txiescapepdf\pdfoutlinetext
                   1641:   }}
                   1642:   %
                   1643:   \def\pdfmkdest#1{%
                   1644:     \setpdfdestname{#1}%
                   1645:     \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
                   1646:   }
                   1647:   %
                   1648:   % by default, use black for everything.
                   1649:   \def\urlcolor{\rgbBlack}
                   1650:   \def\linkcolor{\rgbBlack}
                   1651:   \def\endlink{\setcolor{\maincolor}\pdfendlink}
                   1652:   %
                   1653:   \def\dopdfoutline#1#2#3#4{%
                   1654:     \setpdfoutlinetext{#1}
                   1655:     \setpdfdestname{#3}
                   1656:     \ifx\pdfdestname\empty
                   1657:       \def\pdfdestname{#4}%
                   1658:     \fi
                   1659:     %
                   1660:     \special{pdf:out [-] #2 << /Title (\pdfoutlinetext) /A
                   1661:       << /S /GoTo /D (\pdfdestname) >> >> }%
                   1662:   }
                   1663:   %
                   1664:   \def\pdfmakeoutlines{%
                   1665:     \begingroup
                   1666:       %
                   1667:       % For XeTeX, counts of subentries are not necessary.
                   1668:       % Therefore, we read toc only once.
                   1669:       %
                   1670:       % We use node names as destinations.
                   1671:       %
                   1672:       % Currently we prefix the section name with the section number
                   1673:       % for chapter and appendix headings only in order to avoid too much
                   1674:       % horizontal space being required in the PDF viewer.
                   1675:       \def\partentry##1##2##3##4{}% ignore parts in the outlines
                   1676:       \def\numchapentry##1##2##3##4{%
                   1677:         \dopdfoutline{##2 ##1}{1}{##3}{##4}}%
                   1678:       \def\numsecentry##1##2##3##4{%
                   1679:         \dopdfoutline{##1}{2}{##3}{##4}}%
                   1680:       \def\numsubsecentry##1##2##3##4{%
                   1681:         \dopdfoutline{##1}{3}{##3}{##4}}%
                   1682:       \def\numsubsubsecentry##1##2##3##4{%
                   1683:         \dopdfoutline{##1}{4}{##3}{##4}}%
                   1684:       %
                   1685:       \let\appentry\numchapentry%
                   1686:       \let\appsecentry\numsecentry%
                   1687:       \let\appsubsecentry\numsubsecentry%
                   1688:       \let\appsubsubsecentry\numsubsubsecentry%
                   1689:       \def\unnchapentry##1##2##3##4{%
                   1690:         \dopdfoutline{##1}{1}{##3}{##4}}%
                   1691:       \let\unnsecentry\numsecentry%
                   1692:       \let\unnsubsecentry\numsubsecentry%
                   1693:       \let\unnsubsubsecentry\numsubsubsecentry%
                   1694:       %
                   1695:       % For XeTeX, xdvipdfmx converts strings to UTF-16.
                   1696:       % Therefore, the encoding and the language may not be considered.
                   1697:       %
                   1698:       \indexnofonts
                   1699:       \setupdatafile
                   1700:       % We can have normal brace characters in the PDF outlines, unlike
                   1701:       % Texinfo index files.  So set that up.
                   1702:       \def\{{\lbracecharliteral}%
                   1703:       \def\}{\rbracecharliteral}%
                   1704:       \catcode`\\=\active \otherbackslash
                   1705:       \input \tocreadfilename
                   1706:     \endgroup
                   1707:   }
                   1708:   {\catcode`[=1 \catcode`]=2
                   1709:    \catcode`{=\other \catcode`}=\other
                   1710:    \gdef\lbracecharliteral[{]%
                   1711:    \gdef\rbracecharliteral[}]%
                   1712:   ]
                   1713: 
                   1714:   \special{pdf:docview << /PageMode /UseOutlines >> }
                   1715:   % ``\special{pdf:tounicode ...}'' is not necessary
                   1716:   % because xdvipdfmx converts strings from UTF-8 to UTF-16 without it.
                   1717:   % However, due to a UTF-16 conversion issue of xdvipdfmx 20150315,
                   1718:   % ``\special{pdf:dest ...}'' cannot handle non-ASCII strings.
                   1719:   % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753).
                   1720: %
                   1721:   \def\skipspaces#1{\def\PP{#1}\def\D{|}%
                   1722:     \ifx\PP\D\let\nextsp\relax
                   1723:     \else\let\nextsp\skipspaces
                   1724:       \addtokens{\filename}{\PP}%
                   1725:       \advance\filenamelength by 1
                   1726:     \fi
                   1727:     \nextsp}
                   1728:   \def\getfilename#1{%
                   1729:     \filenamelength=0
                   1730:     % If we don't expand the argument now, \skipspaces will get
                   1731:     % snagged on things like "@value{foo}".
                   1732:     \edef\temp{#1}%
                   1733:     \expandafter\skipspaces\temp|\relax
                   1734:   }
                   1735:   % make a live url in pdf output.
                   1736:   \def\pdfurl#1{%
                   1737:     \begingroup
                   1738:       % it seems we really need yet another set of dummies; have not
                   1739:       % tried to figure out what each command should do in the context
                   1740:       % of @url.  for now, just make @/ a no-op, that's the only one
                   1741:       % people have actually reported a problem with.
                   1742:       %
                   1743:       \normalturnoffactive
                   1744:       \def\@{@}%
                   1745:       \let\/=\empty
                   1746:       \makevalueexpandable
                   1747:       % do we want to go so far as to use \indexnofonts instead of just
                   1748:       % special-casing \var here?
                   1749:       \def\var##1{##1}%
                   1750:       %
                   1751:       \leavevmode\setcolor{\urlcolor}%
                   1752:       \special{pdf:bann << /Border [0 0 0]
                   1753:         /Subtype /Link /A << /S /URI /URI (#1) >> >>}%
                   1754:     \endgroup}
                   1755:   \def\endlink{\setcolor{\maincolor}\special{pdf:eann}}
                   1756:   \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
                   1757:   \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
                   1758:   \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
                   1759:   \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
                   1760:   \def\maketoks{%
                   1761:     \expandafter\poptoks\the\toksA|ENDTOKS|\relax
                   1762:     \ifx\first0\adn0
                   1763:     \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
                   1764:     \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
                   1765:     \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
                   1766:     \else
                   1767:       \ifnum0=\countA\else\makelink\fi
                   1768:       \ifx\first.\let\next=\done\else
                   1769:         \let\next=\maketoks
                   1770:         \addtokens{\toksB}{\the\toksD}
                   1771:         \ifx\first,\addtokens{\toksB}{\space}\fi
                   1772:       \fi
                   1773:     \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
                   1774:     \next}
                   1775:   \def\makelink{\addtokens{\toksB}%
                   1776:     {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
1.2     ! snw      1777:   \def\pdflink#1{\pdflinkpage{#1}{#1}}%
        !          1778:   \def\pdflinkpage#1#2{%
1.1       snw      1779:     \special{pdf:bann << /Border [0 0 0]
                   1780:       /Type /Annot /Subtype /Link /A << /S /GoTo /D (#1) >> >>}%
1.2     ! snw      1781:     \setcolor{\linkcolor}#2\endlink}
1.1       snw      1782:   \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
                   1783: %
                   1784:   %
                   1785:   % @image support
                   1786:   %
                   1787:   % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
                   1788:   \def\doxeteximage#1#2#3{%
                   1789:     \def\xeteximagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
                   1790:     \def\xeteximageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
                   1791:     %
                   1792:     % XeTeX (and the PDF format) supports .pdf, .png, .jpg (among
                   1793:     % others).  Let's try in that order, PDF first since if
                   1794:     % someone has a scalable image, presumably better to use that than a
                   1795:     % bitmap.
                   1796:     \let\xeteximgext=\empty
                   1797:     \begingroup
                   1798:       \openin 1 #1.pdf \ifeof 1
                   1799:         \openin 1 #1.PDF \ifeof 1
                   1800:           \openin 1 #1.png \ifeof 1
                   1801:             \openin 1 #1.jpg \ifeof 1
                   1802:               \openin 1 #1.jpeg \ifeof 1
                   1803:                 \openin 1 #1.JPG \ifeof 1
                   1804:                   \errmessage{Could not find image file #1 for XeTeX}%
                   1805:                 \else \gdef\xeteximgext{JPG}%
                   1806:                 \fi
                   1807:               \else \gdef\xeteximgext{jpeg}%
                   1808:               \fi
                   1809:             \else \gdef\xeteximgext{jpg}%
                   1810:             \fi
                   1811:           \else \gdef\xeteximgext{png}%
                   1812:           \fi
                   1813:         \else \gdef\xeteximgext{PDF}%
                   1814:         \fi
                   1815:       \else \gdef\xeteximgext{pdf}%
                   1816:       \fi
                   1817:       \closein 1
                   1818:     \endgroup
                   1819:     %
                   1820:     % Putting an \hbox around the image can prevent an over-long line
                   1821:     % after the image.
                   1822:     \hbox\bgroup
                   1823:       \def\xetexpdfext{pdf}%
                   1824:       \ifx\xeteximgext\xetexpdfext
                   1825:         \XeTeXpdffile "#1".\xeteximgext ""
                   1826:       \else
                   1827:         \def\xetexpdfext{PDF}%
                   1828:         \ifx\xeteximgext\xetexpdfext
                   1829:           \XeTeXpdffile "#1".\xeteximgext ""
                   1830:         \else
                   1831:           \XeTeXpicfile "#1".\xeteximgext ""
                   1832:         \fi
                   1833:       \fi
                   1834:       \ifdim \wd0 >0pt width \xeteximagewidth \fi
                   1835:       \ifdim \wd2 >0pt height \xeteximageheight \fi \relax
                   1836:     \egroup
                   1837:   }
                   1838: \fi
                   1839: 
                   1840: 
                   1841: %
                   1842: \message{fonts,}
                   1843: 
                   1844: % Set the baselineskip to #1, and the lineskip and strut size
                   1845: % correspondingly.  There is no deep meaning behind these magic numbers
                   1846: % used as factors; they just match (closely enough) what Knuth defined.
                   1847: %
                   1848: \def\lineskipfactor{.08333}
                   1849: \def\strutheightpercent{.70833}
                   1850: \def\strutdepthpercent {.29167}
                   1851: %
                   1852: % can get a sort of poor man's double spacing by redefining this.
                   1853: \def\baselinefactor{1}
                   1854: %
                   1855: \newdimen\textleading
                   1856: \def\setleading#1{%
                   1857:   \dimen0 = #1\relax
                   1858:   \normalbaselineskip = \baselinefactor\dimen0
                   1859:   \normallineskip = \lineskipfactor\normalbaselineskip
                   1860:   \normalbaselines
                   1861:   \setbox\strutbox =\hbox{%
                   1862:     \vrule width0pt height\strutheightpercent\baselineskip
                   1863:                     depth \strutdepthpercent \baselineskip
                   1864:   }%
                   1865: }
                   1866: 
                   1867: % PDF CMaps.  See also LaTeX's t1.cmap.
                   1868: %
                   1869: % do nothing with this by default.
                   1870: \expandafter\let\csname cmapOT1\endcsname\gobble
                   1871: \expandafter\let\csname cmapOT1IT\endcsname\gobble
                   1872: \expandafter\let\csname cmapOT1TT\endcsname\gobble
                   1873: 
                   1874: % if we are producing pdf, and we have \pdffontattr, then define cmaps.
                   1875: % (\pdffontattr was introduced many years ago, but people still run
                   1876: % older pdftex's; it's easy to conditionalize, so we do.)
                   1877: \ifpdf \ifx\pdffontattr\thisisundefined \else
                   1878:   \begingroup
                   1879:     \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
                   1880:     \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
                   1881: %%DocumentNeededResources: ProcSet (CIDInit)
                   1882: %%IncludeResource: ProcSet (CIDInit)
                   1883: %%BeginResource: CMap (TeX-OT1-0)
                   1884: %%Title: (TeX-OT1-0 TeX OT1 0)
                   1885: %%Version: 1.000
                   1886: %%EndComments
                   1887: /CIDInit /ProcSet findresource begin
                   1888: 12 dict begin
                   1889: begincmap
                   1890: /CIDSystemInfo
                   1891: << /Registry (TeX)
                   1892: /Ordering (OT1)
                   1893: /Supplement 0
                   1894: >> def
                   1895: /CMapName /TeX-OT1-0 def
                   1896: /CMapType 2 def
                   1897: 1 begincodespacerange
                   1898: <00> <7F>
                   1899: endcodespacerange
                   1900: 8 beginbfrange
                   1901: <00> <01> <0393>
                   1902: <09> <0A> <03A8>
                   1903: <23> <26> <0023>
                   1904: <28> <3B> <0028>
                   1905: <3F> <5B> <003F>
                   1906: <5D> <5E> <005D>
                   1907: <61> <7A> <0061>
                   1908: <7B> <7C> <2013>
                   1909: endbfrange
                   1910: 40 beginbfchar
                   1911: <02> <0398>
                   1912: <03> <039B>
                   1913: <04> <039E>
                   1914: <05> <03A0>
                   1915: <06> <03A3>
                   1916: <07> <03D2>
                   1917: <08> <03A6>
                   1918: <0B> <00660066>
                   1919: <0C> <00660069>
                   1920: <0D> <0066006C>
                   1921: <0E> <006600660069>
                   1922: <0F> <00660066006C>
                   1923: <10> <0131>
                   1924: <11> <0237>
                   1925: <12> <0060>
                   1926: <13> <00B4>
                   1927: <14> <02C7>
                   1928: <15> <02D8>
                   1929: <16> <00AF>
                   1930: <17> <02DA>
                   1931: <18> <00B8>
                   1932: <19> <00DF>
                   1933: <1A> <00E6>
                   1934: <1B> <0153>
                   1935: <1C> <00F8>
                   1936: <1D> <00C6>
                   1937: <1E> <0152>
                   1938: <1F> <00D8>
                   1939: <21> <0021>
                   1940: <22> <201D>
                   1941: <27> <2019>
                   1942: <3C> <00A1>
                   1943: <3D> <003D>
                   1944: <3E> <00BF>
                   1945: <5C> <201C>
                   1946: <5F> <02D9>
                   1947: <60> <2018>
                   1948: <7D> <02DD>
                   1949: <7E> <007E>
                   1950: <7F> <00A8>
                   1951: endbfchar
                   1952: endcmap
                   1953: CMapName currentdict /CMap defineresource pop
                   1954: end
                   1955: end
                   1956: %%EndResource
                   1957: %%EOF
                   1958:     }\endgroup
                   1959:   \expandafter\edef\csname cmapOT1\endcsname#1{%
                   1960:     \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
                   1961:   }%
                   1962: %
                   1963: % \cmapOT1IT
                   1964:   \begingroup
                   1965:     \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
                   1966:     \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
                   1967: %%DocumentNeededResources: ProcSet (CIDInit)
                   1968: %%IncludeResource: ProcSet (CIDInit)
                   1969: %%BeginResource: CMap (TeX-OT1IT-0)
                   1970: %%Title: (TeX-OT1IT-0 TeX OT1IT 0)
                   1971: %%Version: 1.000
                   1972: %%EndComments
                   1973: /CIDInit /ProcSet findresource begin
                   1974: 12 dict begin
                   1975: begincmap
                   1976: /CIDSystemInfo
                   1977: << /Registry (TeX)
                   1978: /Ordering (OT1IT)
                   1979: /Supplement 0
                   1980: >> def
                   1981: /CMapName /TeX-OT1IT-0 def
                   1982: /CMapType 2 def
                   1983: 1 begincodespacerange
                   1984: <00> <7F>
                   1985: endcodespacerange
                   1986: 8 beginbfrange
                   1987: <00> <01> <0393>
                   1988: <09> <0A> <03A8>
                   1989: <25> <26> <0025>
                   1990: <28> <3B> <0028>
                   1991: <3F> <5B> <003F>
                   1992: <5D> <5E> <005D>
                   1993: <61> <7A> <0061>
                   1994: <7B> <7C> <2013>
                   1995: endbfrange
                   1996: 42 beginbfchar
                   1997: <02> <0398>
                   1998: <03> <039B>
                   1999: <04> <039E>
                   2000: <05> <03A0>
                   2001: <06> <03A3>
                   2002: <07> <03D2>
                   2003: <08> <03A6>
                   2004: <0B> <00660066>
                   2005: <0C> <00660069>
                   2006: <0D> <0066006C>
                   2007: <0E> <006600660069>
                   2008: <0F> <00660066006C>
                   2009: <10> <0131>
                   2010: <11> <0237>
                   2011: <12> <0060>
                   2012: <13> <00B4>
                   2013: <14> <02C7>
                   2014: <15> <02D8>
                   2015: <16> <00AF>
                   2016: <17> <02DA>
                   2017: <18> <00B8>
                   2018: <19> <00DF>
                   2019: <1A> <00E6>
                   2020: <1B> <0153>
                   2021: <1C> <00F8>
                   2022: <1D> <00C6>
                   2023: <1E> <0152>
                   2024: <1F> <00D8>
                   2025: <21> <0021>
                   2026: <22> <201D>
                   2027: <23> <0023>
                   2028: <24> <00A3>
                   2029: <27> <2019>
                   2030: <3C> <00A1>
                   2031: <3D> <003D>
                   2032: <3E> <00BF>
                   2033: <5C> <201C>
                   2034: <5F> <02D9>
                   2035: <60> <2018>
                   2036: <7D> <02DD>
                   2037: <7E> <007E>
                   2038: <7F> <00A8>
                   2039: endbfchar
                   2040: endcmap
                   2041: CMapName currentdict /CMap defineresource pop
                   2042: end
                   2043: end
                   2044: %%EndResource
                   2045: %%EOF
                   2046:     }\endgroup
                   2047:   \expandafter\edef\csname cmapOT1IT\endcsname#1{%
                   2048:     \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
                   2049:   }%
                   2050: %
                   2051: % \cmapOT1TT
                   2052:   \begingroup
                   2053:     \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
                   2054:     \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
                   2055: %%DocumentNeededResources: ProcSet (CIDInit)
                   2056: %%IncludeResource: ProcSet (CIDInit)
                   2057: %%BeginResource: CMap (TeX-OT1TT-0)
                   2058: %%Title: (TeX-OT1TT-0 TeX OT1TT 0)
                   2059: %%Version: 1.000
                   2060: %%EndComments
                   2061: /CIDInit /ProcSet findresource begin
                   2062: 12 dict begin
                   2063: begincmap
                   2064: /CIDSystemInfo
                   2065: << /Registry (TeX)
                   2066: /Ordering (OT1TT)
                   2067: /Supplement 0
                   2068: >> def
                   2069: /CMapName /TeX-OT1TT-0 def
                   2070: /CMapType 2 def
                   2071: 1 begincodespacerange
                   2072: <00> <7F>
                   2073: endcodespacerange
                   2074: 5 beginbfrange
                   2075: <00> <01> <0393>
                   2076: <09> <0A> <03A8>
                   2077: <21> <26> <0021>
                   2078: <28> <5F> <0028>
                   2079: <61> <7E> <0061>
                   2080: endbfrange
                   2081: 32 beginbfchar
                   2082: <02> <0398>
                   2083: <03> <039B>
                   2084: <04> <039E>
                   2085: <05> <03A0>
                   2086: <06> <03A3>
                   2087: <07> <03D2>
                   2088: <08> <03A6>
                   2089: <0B> <2191>
                   2090: <0C> <2193>
                   2091: <0D> <0027>
                   2092: <0E> <00A1>
                   2093: <0F> <00BF>
                   2094: <10> <0131>
                   2095: <11> <0237>
                   2096: <12> <0060>
                   2097: <13> <00B4>
                   2098: <14> <02C7>
                   2099: <15> <02D8>
                   2100: <16> <00AF>
                   2101: <17> <02DA>
                   2102: <18> <00B8>
                   2103: <19> <00DF>
                   2104: <1A> <00E6>
                   2105: <1B> <0153>
                   2106: <1C> <00F8>
                   2107: <1D> <00C6>
                   2108: <1E> <0152>
                   2109: <1F> <00D8>
                   2110: <20> <2423>
                   2111: <27> <2019>
                   2112: <60> <2018>
                   2113: <7F> <00A8>
                   2114: endbfchar
                   2115: endcmap
                   2116: CMapName currentdict /CMap defineresource pop
                   2117: end
                   2118: end
                   2119: %%EndResource
                   2120: %%EOF
                   2121:     }\endgroup
                   2122:   \expandafter\edef\csname cmapOT1TT\endcsname#1{%
                   2123:     \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
                   2124:   }%
                   2125: \fi\fi
1.2     ! snw      2126: %
        !          2127: % This is what gets called when #5 of \setfont is empty.
        !          2128: \let\cmap\gobble
        !          2129: %
        !          2130: % (end of cmaps)
1.1       snw      2131: 
                   2132: 
                   2133: % Set the font macro #1 to the font named \fontprefix#2.
                   2134: % #3 is the font's design size, #4 is a scale factor, #5 is the CMap
                   2135: % encoding (only OT1, OT1IT and OT1TT are allowed, or empty to omit).
                   2136: % Example:
                   2137: % #1 = \textrm
                   2138: % #2 = \rmshape
                   2139: % #3 = 10
                   2140: % #4 = \mainmagstep
                   2141: % #5 = OT1
                   2142: %
                   2143: \def\setfont#1#2#3#4#5{%
                   2144:   \font#1=\fontprefix#2#3 scaled #4
                   2145:   \csname cmap#5\endcsname#1%
1.2     ! snw      2146:   \ifx#2\ttshape\hyphenchar#1=-1 \fi
        !          2147:   \ifx#2\ttbshape\hyphenchar#1=-1 \fi
        !          2148:   \ifx#2\ttslshape\hyphenchar#1=-1 \fi
1.1       snw      2149: }
                   2150: 
                   2151: % Use cm as the default font prefix.
                   2152: % To specify the font prefix, you must define \fontprefix
                   2153: % before you read in texinfo.tex.
                   2154: \ifx\fontprefix\thisisundefined
                   2155: \def\fontprefix{cm}
                   2156: \fi
                   2157: % Support font families that don't use the same naming scheme as CM.
                   2158: \def\rmshape{r}
                   2159: \def\rmbshape{bx}               % where the normal face is bold
                   2160: \def\bfshape{b}
                   2161: \def\bxshape{bx}
                   2162: \def\ttshape{tt}
                   2163: \def\ttbshape{tt}
                   2164: \def\ttslshape{sltt}
                   2165: \def\itshape{ti}
                   2166: \def\itbshape{bxti}
                   2167: \def\slshape{sl}
                   2168: \def\slbshape{bxsl}
                   2169: \def\sfshape{ss}
                   2170: \def\sfbshape{ss}
                   2171: \def\scshape{csc}
                   2172: \def\scbshape{csc}
                   2173: 
                   2174: % Definitions for a main text size of 11pt.  (The default in Texinfo.)
                   2175: %
                   2176: \def\definetextfontsizexi{%
                   2177: % Text fonts (11.2pt, magstep1).
                   2178: \def\textnominalsize{11pt}
                   2179: \edef\mainmagstep{\magstephalf}
                   2180: \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
                   2181: \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
                   2182: \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
                   2183: \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
                   2184: \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
                   2185: \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
                   2186: \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
                   2187: \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
                   2188: \font\texti=cmmi10 scaled \mainmagstep
                   2189: \font\textsy=cmsy10 scaled \mainmagstep
                   2190: \def\textecsize{1095}
                   2191: 
                   2192: % A few fonts for @defun names and args.
                   2193: \setfont\defbf\bfshape{10}{\magstep1}{OT1}
                   2194: \setfont\deftt\ttshape{10}{\magstep1}{OT1TT}
                   2195: \setfont\defsl\slshape{10}{\magstep1}{OT1}
                   2196: \setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT}
                   2197: \def\df{\let\ttfont=\deftt \let\bffont = \defbf
                   2198: \let\ttslfont=\defttsl \let\slfont=\defsl \bf}
                   2199: 
                   2200: % Fonts for indices, footnotes, small examples (9pt).
                   2201: \def\smallnominalsize{9pt}
                   2202: \setfont\smallrm\rmshape{9}{1000}{OT1}
                   2203: \setfont\smalltt\ttshape{9}{1000}{OT1TT}
                   2204: \setfont\smallbf\bfshape{10}{900}{OT1}
                   2205: \setfont\smallit\itshape{9}{1000}{OT1IT}
                   2206: \setfont\smallsl\slshape{9}{1000}{OT1}
                   2207: \setfont\smallsf\sfshape{9}{1000}{OT1}
                   2208: \setfont\smallsc\scshape{10}{900}{OT1}
                   2209: \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
                   2210: \font\smalli=cmmi9
                   2211: \font\smallsy=cmsy9
                   2212: \def\smallecsize{0900}
                   2213: 
                   2214: % Fonts for small examples (8pt).
                   2215: \def\smallernominalsize{8pt}
                   2216: \setfont\smallerrm\rmshape{8}{1000}{OT1}
                   2217: \setfont\smallertt\ttshape{8}{1000}{OT1TT}
                   2218: \setfont\smallerbf\bfshape{10}{800}{OT1}
                   2219: \setfont\smallerit\itshape{8}{1000}{OT1IT}
                   2220: \setfont\smallersl\slshape{8}{1000}{OT1}
                   2221: \setfont\smallersf\sfshape{8}{1000}{OT1}
                   2222: \setfont\smallersc\scshape{10}{800}{OT1}
                   2223: \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
                   2224: \font\smalleri=cmmi8
                   2225: \font\smallersy=cmsy8
                   2226: \def\smallerecsize{0800}
                   2227: 
                   2228: % Fonts for math mode superscripts (7pt).
                   2229: \def\sevennominalsize{7pt}
                   2230: \setfont\sevenrm\rmshape{7}{1000}{OT1}
                   2231: \setfont\seventt\ttshape{10}{700}{OT1TT}
                   2232: \setfont\sevenbf\bfshape{10}{700}{OT1}
                   2233: \setfont\sevenit\itshape{7}{1000}{OT1IT}
                   2234: \setfont\sevensl\slshape{10}{700}{OT1}
                   2235: \setfont\sevensf\sfshape{10}{700}{OT1}
                   2236: \setfont\sevensc\scshape{10}{700}{OT1}
                   2237: \setfont\seventtsl\ttslshape{10}{700}{OT1TT}
                   2238: \font\seveni=cmmi7
                   2239: \font\sevensy=cmsy7
                   2240: \def\sevenecsize{0700}
                   2241: 
                   2242: % Fonts for title page (20.4pt):
                   2243: \def\titlenominalsize{20pt}
                   2244: \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
                   2245: \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
                   2246: \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
                   2247: \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
                   2248: \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
                   2249: \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
                   2250: \let\titlebf=\titlerm
                   2251: \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
                   2252: \font\titlei=cmmi12 scaled \magstep3
                   2253: \font\titlesy=cmsy10 scaled \magstep4
                   2254: \def\titleecsize{2074}
                   2255: 
                   2256: % Chapter (and unnumbered) fonts (17.28pt).
                   2257: \def\chapnominalsize{17pt}
                   2258: \setfont\chaprm\rmbshape{12}{\magstep2}{OT1}
                   2259: \setfont\chapit\itbshape{10}{\magstep3}{OT1IT}
                   2260: \setfont\chapsl\slbshape{10}{\magstep3}{OT1}
                   2261: \setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT}
                   2262: \setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT}
                   2263: \setfont\chapsf\sfbshape{17}{1000}{OT1}
                   2264: \let\chapbf=\chaprm
                   2265: \setfont\chapsc\scbshape{10}{\magstep3}{OT1}
                   2266: \font\chapi=cmmi12 scaled \magstep2
                   2267: \font\chapsy=cmsy10 scaled \magstep3
                   2268: \def\chapecsize{1728}
                   2269: 
                   2270: % Section fonts (14.4pt).
                   2271: \def\secnominalsize{14pt}
                   2272: \setfont\secrm\rmbshape{12}{\magstep1}{OT1}
                   2273: \setfont\secrmnotbold\rmshape{12}{\magstep1}{OT1}
                   2274: \setfont\secit\itbshape{10}{\magstep2}{OT1IT}
                   2275: \setfont\secsl\slbshape{10}{\magstep2}{OT1}
                   2276: \setfont\sectt\ttbshape{12}{\magstep1}{OT1TT}
                   2277: \setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT}
                   2278: \setfont\secsf\sfbshape{12}{\magstep1}{OT1}
                   2279: \let\secbf\secrm
                   2280: \setfont\secsc\scbshape{10}{\magstep2}{OT1}
                   2281: \font\seci=cmmi12 scaled \magstep1
                   2282: \font\secsy=cmsy10 scaled \magstep2
                   2283: \def\sececsize{1440}
                   2284: 
                   2285: % Subsection fonts (13.15pt).
                   2286: \def\ssecnominalsize{13pt}
                   2287: \setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1}
                   2288: \setfont\ssecit\itbshape{10}{1315}{OT1IT}
                   2289: \setfont\ssecsl\slbshape{10}{1315}{OT1}
                   2290: \setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT}
                   2291: \setfont\ssecttsl\ttslshape{10}{1315}{OT1TT}
                   2292: \setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1}
                   2293: \let\ssecbf\ssecrm
                   2294: \setfont\ssecsc\scbshape{10}{1315}{OT1}
                   2295: \font\sseci=cmmi12 scaled \magstephalf
                   2296: \font\ssecsy=cmsy10 scaled 1315
                   2297: \def\ssececsize{1200}
                   2298: 
                   2299: % Reduced fonts for @acronym in text (10pt).
                   2300: \def\reducednominalsize{10pt}
                   2301: \setfont\reducedrm\rmshape{10}{1000}{OT1}
                   2302: \setfont\reducedtt\ttshape{10}{1000}{OT1TT}
                   2303: \setfont\reducedbf\bfshape{10}{1000}{OT1}
                   2304: \setfont\reducedit\itshape{10}{1000}{OT1IT}
                   2305: \setfont\reducedsl\slshape{10}{1000}{OT1}
                   2306: \setfont\reducedsf\sfshape{10}{1000}{OT1}
                   2307: \setfont\reducedsc\scshape{10}{1000}{OT1}
                   2308: \setfont\reducedttsl\ttslshape{10}{1000}{OT1TT}
                   2309: \font\reducedi=cmmi10
                   2310: \font\reducedsy=cmsy10
                   2311: \def\reducedecsize{1000}
                   2312: 
                   2313: \textleading = 13.2pt % line spacing for 11pt CM
                   2314: \textfonts            % reset the current fonts
                   2315: \rm
                   2316: } % end of 11pt text font size definitions, \definetextfontsizexi
                   2317: 
                   2318: 
                   2319: % Definitions to make the main text be 10pt Computer Modern, with
                   2320: % section, chapter, etc., sizes following suit.  This is for the GNU
                   2321: % Press printing of the Emacs 22 manual.  Maybe other manuals in the
                   2322: % future.  Used with @smallbook, which sets the leading to 12pt.
                   2323: %
                   2324: \def\definetextfontsizex{%
                   2325: % Text fonts (10pt).
                   2326: \def\textnominalsize{10pt}
                   2327: \edef\mainmagstep{1000}
                   2328: \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
                   2329: \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
                   2330: \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
                   2331: \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
                   2332: \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
                   2333: \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
                   2334: \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
                   2335: \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
                   2336: \font\texti=cmmi10 scaled \mainmagstep
                   2337: \font\textsy=cmsy10 scaled \mainmagstep
                   2338: \def\textecsize{1000}
                   2339: 
                   2340: % A few fonts for @defun names and args.
                   2341: \setfont\defbf\bfshape{10}{\magstephalf}{OT1}
                   2342: \setfont\deftt\ttshape{10}{\magstephalf}{OT1TT}
                   2343: \setfont\defsl\slshape{10}{\magstephalf}{OT1}
                   2344: \setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT}
                   2345: \def\df{\let\ttfont=\deftt \let\bffont = \defbf
                   2346: \let\slfont=\defsl \let\ttslfont=\defttsl \bf}
                   2347: 
                   2348: % Fonts for indices, footnotes, small examples (9pt).
                   2349: \def\smallnominalsize{9pt}
                   2350: \setfont\smallrm\rmshape{9}{1000}{OT1}
                   2351: \setfont\smalltt\ttshape{9}{1000}{OT1TT}
                   2352: \setfont\smallbf\bfshape{10}{900}{OT1}
                   2353: \setfont\smallit\itshape{9}{1000}{OT1IT}
                   2354: \setfont\smallsl\slshape{9}{1000}{OT1}
                   2355: \setfont\smallsf\sfshape{9}{1000}{OT1}
                   2356: \setfont\smallsc\scshape{10}{900}{OT1}
                   2357: \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
                   2358: \font\smalli=cmmi9
                   2359: \font\smallsy=cmsy9
                   2360: \def\smallecsize{0900}
                   2361: 
                   2362: % Fonts for small examples (8pt).
                   2363: \def\smallernominalsize{8pt}
                   2364: \setfont\smallerrm\rmshape{8}{1000}{OT1}
                   2365: \setfont\smallertt\ttshape{8}{1000}{OT1TT}
                   2366: \setfont\smallerbf\bfshape{10}{800}{OT1}
                   2367: \setfont\smallerit\itshape{8}{1000}{OT1IT}
                   2368: \setfont\smallersl\slshape{8}{1000}{OT1}
                   2369: \setfont\smallersf\sfshape{8}{1000}{OT1}
                   2370: \setfont\smallersc\scshape{10}{800}{OT1}
                   2371: \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
                   2372: \font\smalleri=cmmi8
                   2373: \font\smallersy=cmsy8
                   2374: \def\smallerecsize{0800}
                   2375: 
                   2376: % Fonts for math mode superscripts (7pt).
                   2377: \def\sevennominalsize{7pt}
                   2378: \setfont\sevenrm\rmshape{7}{1000}{OT1}
                   2379: \setfont\seventt\ttshape{10}{700}{OT1TT}
                   2380: \setfont\sevenbf\bfshape{10}{700}{OT1}
                   2381: \setfont\sevenit\itshape{7}{1000}{OT1IT}
                   2382: \setfont\sevensl\slshape{10}{700}{OT1}
                   2383: \setfont\sevensf\sfshape{10}{700}{OT1}
                   2384: \setfont\sevensc\scshape{10}{700}{OT1}
                   2385: \setfont\seventtsl\ttslshape{10}{700}{OT1TT}
                   2386: \font\seveni=cmmi7
                   2387: \font\sevensy=cmsy7
                   2388: \def\sevenecsize{0700}
                   2389: 
                   2390: % Fonts for title page (20.4pt):
                   2391: \def\titlenominalsize{20pt}
                   2392: \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
                   2393: \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
                   2394: \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
                   2395: \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
                   2396: \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
                   2397: \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
                   2398: \let\titlebf=\titlerm
                   2399: \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
                   2400: \font\titlei=cmmi12 scaled \magstep3
                   2401: \font\titlesy=cmsy10 scaled \magstep4
                   2402: \def\titleecsize{2074}
                   2403: 
                   2404: % Chapter fonts (14.4pt).
                   2405: \def\chapnominalsize{14pt}
                   2406: \setfont\chaprm\rmbshape{12}{\magstep1}{OT1}
                   2407: \setfont\chapit\itbshape{10}{\magstep2}{OT1IT}
                   2408: \setfont\chapsl\slbshape{10}{\magstep2}{OT1}
                   2409: \setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT}
                   2410: \setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT}
                   2411: \setfont\chapsf\sfbshape{12}{\magstep1}{OT1}
                   2412: \let\chapbf\chaprm
                   2413: \setfont\chapsc\scbshape{10}{\magstep2}{OT1}
                   2414: \font\chapi=cmmi12 scaled \magstep1
                   2415: \font\chapsy=cmsy10 scaled \magstep2
                   2416: \def\chapecsize{1440}
                   2417: 
                   2418: % Section fonts (12pt).
                   2419: \def\secnominalsize{12pt}
                   2420: \setfont\secrm\rmbshape{12}{1000}{OT1}
                   2421: \setfont\secit\itbshape{10}{\magstep1}{OT1IT}
                   2422: \setfont\secsl\slbshape{10}{\magstep1}{OT1}
                   2423: \setfont\sectt\ttbshape{12}{1000}{OT1TT}
                   2424: \setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT}
                   2425: \setfont\secsf\sfbshape{12}{1000}{OT1}
                   2426: \let\secbf\secrm
                   2427: \setfont\secsc\scbshape{10}{\magstep1}{OT1}
                   2428: \font\seci=cmmi12
                   2429: \font\secsy=cmsy10 scaled \magstep1
                   2430: \def\sececsize{1200}
                   2431: 
                   2432: % Subsection fonts (10pt).
                   2433: \def\ssecnominalsize{10pt}
                   2434: \setfont\ssecrm\rmbshape{10}{1000}{OT1}
                   2435: \setfont\ssecit\itbshape{10}{1000}{OT1IT}
                   2436: \setfont\ssecsl\slbshape{10}{1000}{OT1}
                   2437: \setfont\ssectt\ttbshape{10}{1000}{OT1TT}
                   2438: \setfont\ssecttsl\ttslshape{10}{1000}{OT1TT}
                   2439: \setfont\ssecsf\sfbshape{10}{1000}{OT1}
                   2440: \let\ssecbf\ssecrm
                   2441: \setfont\ssecsc\scbshape{10}{1000}{OT1}
                   2442: \font\sseci=cmmi10
                   2443: \font\ssecsy=cmsy10
                   2444: \def\ssececsize{1000}
                   2445: 
                   2446: % Reduced fonts for @acronym in text (9pt).
                   2447: \def\reducednominalsize{9pt}
                   2448: \setfont\reducedrm\rmshape{9}{1000}{OT1}
                   2449: \setfont\reducedtt\ttshape{9}{1000}{OT1TT}
                   2450: \setfont\reducedbf\bfshape{10}{900}{OT1}
                   2451: \setfont\reducedit\itshape{9}{1000}{OT1IT}
                   2452: \setfont\reducedsl\slshape{9}{1000}{OT1}
                   2453: \setfont\reducedsf\sfshape{9}{1000}{OT1}
                   2454: \setfont\reducedsc\scshape{10}{900}{OT1}
                   2455: \setfont\reducedttsl\ttslshape{10}{900}{OT1TT}
                   2456: \font\reducedi=cmmi9
                   2457: \font\reducedsy=cmsy9
                   2458: \def\reducedecsize{0900}
                   2459: 
                   2460: \divide\parskip by 2  % reduce space between paragraphs
                   2461: \textleading = 12pt   % line spacing for 10pt CM
                   2462: \textfonts            % reset the current fonts
                   2463: \rm
                   2464: } % end of 10pt text font size definitions, \definetextfontsizex
                   2465: 
                   2466: % Fonts for short table of contents.
                   2467: \setfont\shortcontrm\rmshape{12}{1000}{OT1}
                   2468: \setfont\shortcontbf\bfshape{10}{\magstep1}{OT1}  % no cmb12
                   2469: \setfont\shortcontsl\slshape{12}{1000}{OT1}
                   2470: \setfont\shortconttt\ttshape{12}{1000}{OT1TT}
                   2471: 
                   2472: 
                   2473: % We provide the user-level command
                   2474: %   @fonttextsize 10
                   2475: % (or 11) to redefine the text font size.  pt is assumed.
                   2476: %
                   2477: \def\xiword{11}
                   2478: \def\xword{10}
                   2479: \def\xwordpt{10pt}
                   2480: %
                   2481: \parseargdef\fonttextsize{%
                   2482:   \def\textsizearg{#1}%
                   2483:   %\wlog{doing @fonttextsize \textsizearg}%
                   2484:   %
                   2485:   % Set \globaldefs so that documents can use this inside @tex, since
                   2486:   % makeinfo 4.8 does not support it, but we need it nonetheless.
                   2487:   %
                   2488:  \begingroup \globaldefs=1
                   2489:   \ifx\textsizearg\xword \definetextfontsizex
                   2490:   \else \ifx\textsizearg\xiword \definetextfontsizexi
                   2491:   \else
                   2492:     \errhelp=\EMsimple
                   2493:     \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'}
                   2494:   \fi\fi
                   2495:  \endgroup
                   2496: }
                   2497: 
                   2498: %
                   2499: % Change the current font style to #1, remembering it in \curfontstyle.
                   2500: % For now, we do not accumulate font styles: @b{@i{foo}} prints foo in
                   2501: % italics, not bold italics.
                   2502: %
                   2503: \def\setfontstyle#1{%
                   2504:   \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd.
                   2505:   \csname #1font\endcsname  % change the current font
                   2506: }
                   2507: 
                   2508: \def\rm{\fam=0 \setfontstyle{rm}}
                   2509: \def\it{\fam=\itfam \setfontstyle{it}}
                   2510: \def\sl{\fam=\slfam \setfontstyle{sl}}
                   2511: \def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
1.2     ! snw      2512: \def\tt{\fam=\ttfam \setfontstyle{tt}}
1.1       snw      2513: 
                   2514: % Texinfo sort of supports the sans serif font style, which plain TeX does not.
                   2515: % So we set up a \sf.
                   2516: \newfam\sffam
                   2517: \def\sf{\fam=\sffam \setfontstyle{sf}}
                   2518: 
                   2519: % We don't need math for this font style.
                   2520: \def\ttsl{\setfontstyle{ttsl}}
                   2521: 
                   2522: 
                   2523: % In order for the font changes to affect most math symbols and letters,
                   2524: % we have to define the \textfont of the standard families.
                   2525: % We don't bother to reset \scriptscriptfont; awaiting user need.
                   2526: %
                   2527: \def\resetmathfonts{%
                   2528:   \textfont0=\rmfont \textfont1=\ifont \textfont2=\syfont
                   2529:   \textfont\itfam=\itfont \textfont\slfam=\slfont \textfont\bffam=\bffont
                   2530:   \textfont\ttfam=\ttfont \textfont\sffam=\sffont
                   2531:   %
                   2532:   % Fonts for superscript.  Note that the 7pt fonts are used regardless
                   2533:   % of the current font size.
                   2534:   \scriptfont0=\sevenrm \scriptfont1=\seveni \scriptfont2=\sevensy
                   2535:   \scriptfont\itfam=\sevenit \scriptfont\slfam=\sevensl
                   2536:   \scriptfont\bffam=\sevenbf \scriptfont\ttfam=\seventt
                   2537:   \scriptfont\sffam=\sevensf
                   2538: }
                   2539: 
                   2540: 
1.2     ! snw      2541: 
        !          2542: % \defineassignfonts{SIZE} -
        !          2543: %   Define sequence \assignfontsSIZE, which switches between font sizes
        !          2544: % by redefining the meanings of \STYLEfont.  (Just \STYLE additionally sets
        !          2545: % the current \fam for math mode.)
        !          2546: %
        !          2547: \def\defineassignfonts#1{%
        !          2548:   \expandafter\edef\csname assignfonts#1\endcsname{%
        !          2549:     \let\noexpand\rmfont\csname #1rm\endcsname
        !          2550:     \let\noexpand\itfont\csname #1it\endcsname
        !          2551:     \let\noexpand\slfont\csname #1sl\endcsname
        !          2552:     \let\noexpand\bffont\csname #1bf\endcsname
        !          2553:     \let\noexpand\ttfont\csname #1tt\endcsname
        !          2554:     \let\noexpand\smallcaps\csname #1sc\endcsname
        !          2555:     \let\noexpand\sffont  \csname #1sf\endcsname
        !          2556:     \let\noexpand\ifont   \csname #1i\endcsname
        !          2557:     \let\noexpand\syfont  \csname #1sy\endcsname
        !          2558:     \let\noexpand\ttslfont\csname #1ttsl\endcsname
        !          2559:   }
        !          2560: }
1.1       snw      2561: 
                   2562: \def\assignfonts#1{%
1.2     ! snw      2563:   \csname assignfonts#1\endcsname
1.1       snw      2564: }
                   2565: 
                   2566: \newif\ifrmisbold
                   2567: 
                   2568: % Select smaller font size with the current style.  Used to change font size
                   2569: % in, e.g., the LaTeX logo and acronyms.  If we are using bold fonts for
                   2570: % normal roman text, also use bold fonts for roman text in the smaller size.
                   2571: \def\switchtolllsize{%
                   2572:    \expandafter\assignfonts\expandafter{\lllsize}%
                   2573:    \ifrmisbold
                   2574:      \let\rmfont\bffont
                   2575:    \fi
                   2576:    \csname\curfontstyle\endcsname
                   2577: }%
                   2578: 
                   2579: \def\switchtolsize{%
                   2580:    \expandafter\assignfonts\expandafter{\lsize}%
                   2581:    \ifrmisbold
                   2582:      \let\rmfont\bffont
                   2583:    \fi
                   2584:    \csname\curfontstyle\endcsname
                   2585: }%
                   2586: 
1.2     ! snw      2587: % Define the font-changing commands (all called \...fonts).
        !          2588: % Each font-changing command also sets the names \lsize (one size lower)
        !          2589: % and \lllsize (three sizes lower).  These relative commands are used
        !          2590: % in, e.g., the LaTeX logo and acronyms.
        !          2591: %
        !          2592: % Note: The fonts used for \ifont are for "math italics"  (\itfont is for
        !          2593: % italics in regular text).  \syfont is also used in math mode only.
        !          2594: %
1.1       snw      2595: \def\definefontsetatsize#1#2#3#4#5{%
1.2     ! snw      2596:   \defineassignfonts{#1}%
1.1       snw      2597: \expandafter\def\csname #1fonts\endcsname{%
                   2598:   \def\curfontsize{#1}%
                   2599:   \def\lsize{#2}\def\lllsize{#3}%
                   2600:   \csname rmisbold#5\endcsname
1.2     ! snw      2601:   \csname assignfonts#1\endcsname
1.1       snw      2602:   \resetmathfonts
                   2603:   \setleading{#4}%
                   2604: }}
                   2605: 
                   2606: \definefontsetatsize{text}   {reduced}{smaller}{\textleading}{false}
                   2607: \definefontsetatsize{title}  {chap}   {subsec} {27pt}  {true}
                   2608: \definefontsetatsize{chap}   {sec}    {text}   {19pt}  {true}
                   2609: \definefontsetatsize{sec}    {subsec} {reduced}{17pt}  {true}
                   2610: \definefontsetatsize{ssec}   {text}   {small}  {15pt}  {true}
                   2611: \definefontsetatsize{reduced}{small}  {smaller}{10.5pt}{false}
                   2612: \definefontsetatsize{small}  {smaller}{smaller}{10.5pt}{false}
                   2613: \definefontsetatsize{smaller}{smaller}{smaller}{9.5pt} {false}
                   2614: 
                   2615: \def\titlefont#1{{\titlefonts\rm #1}}
                   2616: \let\subsecfonts = \ssecfonts
                   2617: \let\subsubsecfonts = \ssecfonts
                   2618: 
                   2619: % Define these just so they can be easily changed for other fonts.
                   2620: \def\angleleft{$\langle$}
                   2621: \def\angleright{$\rangle$}
                   2622: 
                   2623: % Set the fonts to use with the @small... environments.
                   2624: \let\smallexamplefonts = \smallfonts
                   2625: 
                   2626: % About \smallexamplefonts.  If we use \smallfonts (9pt), @smallexample
                   2627: % can fit this many characters:
                   2628: %   8.5x11=86   smallbook=72  a4=90  a5=69
                   2629: % If we use \scriptfonts (8pt), then we can fit this many characters:
                   2630: %   8.5x11=90+  smallbook=80  a4=90+  a5=77
                   2631: % For me, subjectively, the few extra characters that fit aren't worth
                   2632: % the additional smallness of 8pt.  So I'm making the default 9pt.
                   2633: %
                   2634: % By the way, for comparison, here's what fits with @example (10pt):
                   2635: %   8.5x11=71  smallbook=60  a4=75  a5=58
                   2636: % --karl, 24jan03.
                   2637: 
                   2638: % Set up the default fonts, so we can use them for creating boxes.
                   2639: %
                   2640: \definetextfontsizexi
                   2641: 
                   2642: 
                   2643: % Check if we are currently using a typewriter font.  Since all the
                   2644: % Computer Modern typewriter fonts have zero interword stretch (and
                   2645: % shrink), and it is reasonable to expect all typewriter fonts to have
1.2     ! snw      2646: % this property, we can check that font parameter. #1 is what to
        !          2647: % print if we are indeed using \tt; #2 is what to print otherwise.
        !          2648: \def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
        !          2649: 
        !          2650: % Same as above, but check for italic font.  Actually this also catches
        !          2651: % non-italic slanted fonts since it is impossible to distinguish them from
        !          2652: % italic fonts.  But since this is only used by $ and it uses \sl anyway
        !          2653: % this is not a problem.
        !          2654: \def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
        !          2655: 
        !          2656: 
        !          2657: % Check if internal flag is clear, i.e. has not been @set.
        !          2658: \def\ifflagclear#1#2#3{%
        !          2659:   \expandafter\ifx\csname SET#1\endcsname\relax
        !          2660:   #2\else#3\fi
        !          2661: }
1.1       snw      2662: 
                   2663: {
                   2664: \catcode`\'=\active
                   2665: \catcode`\`=\active
                   2666: 
                   2667: \gdef\setcodequotes{\let`\codequoteleft \let'\codequoteright}
                   2668: \gdef\setregularquotes{\let`\lq \let'\rq}
                   2669: }
1.2     ! snw      2670: \setregularquotes
1.1       snw      2671: 
1.2     ! snw      2672: % output for ' in @code
        !          2673: % in tt font hex 0D (undirected) or 27 (curly right quote)
1.1       snw      2674: %
                   2675: \def\codequoteright{%
1.2     ! snw      2676:   \ifusingtt
        !          2677:       {\ifflagclear{txicodequoteundirected}%
        !          2678:           {\ifflagclear{codequoteundirected}%
        !          2679:               {'}%
        !          2680:               {\char"0D }}%
        !          2681:           {\char"0D }}%
        !          2682:       {'}%
1.1       snw      2683: }
1.2     ! snw      2684: 
        !          2685: % output for ` in @code
        !          2686: % in tt font hex 12 (grave accent) or 60 (curly left quote)
        !          2687: % \relax disables Spanish ligatures ?` and !` of \tt font.
1.1       snw      2688: %
                   2689: \def\codequoteleft{%
1.2     ! snw      2690:   \ifusingtt
        !          2691:       {\ifflagclear{txicodequotebacktick}%
        !          2692:           {\ifflagclear{codequotebacktick}%
        !          2693:               {\relax`}%
        !          2694:               {\char"12 }}%
        !          2695:           {\char"12 }}%
        !          2696:       {\relax`}%
1.1       snw      2697: }
                   2698: 
                   2699: % Commands to set the quote options.
                   2700: %
                   2701: \parseargdef\codequoteundirected{%
                   2702:   \def\temp{#1}%
                   2703:   \ifx\temp\onword
                   2704:     \expandafter\let\csname SETtxicodequoteundirected\endcsname
                   2705:       = t%
                   2706:   \else\ifx\temp\offword
                   2707:     \expandafter\let\csname SETtxicodequoteundirected\endcsname
                   2708:       = \relax
                   2709:   \else
                   2710:     \errhelp = \EMsimple
                   2711:     \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}%
                   2712:   \fi\fi
                   2713: }
1.2     ! snw      2714: 
1.1       snw      2715: \parseargdef\codequotebacktick{%
                   2716:   \def\temp{#1}%
                   2717:   \ifx\temp\onword
                   2718:     \expandafter\let\csname SETtxicodequotebacktick\endcsname
                   2719:       = t%
                   2720:   \else\ifx\temp\offword
                   2721:     \expandafter\let\csname SETtxicodequotebacktick\endcsname
                   2722:       = \relax
                   2723:   \else
                   2724:     \errhelp = \EMsimple
                   2725:     \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}%
                   2726:   \fi\fi
                   2727: }
                   2728: 
1.2     ! snw      2729: % Turn them on by default
        !          2730: \let\SETtxicodequoteundirected = t
        !          2731: \let\SETtxicodequotebacktick = t
        !          2732: 
        !          2733: 
1.1       snw      2734: % [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font.
                   2735: \def\noligaturesquoteleft{\relax\lq}
                   2736: 
                   2737: % Count depth in font-changes, for error checks
                   2738: \newcount\fontdepth \fontdepth=0
                   2739: 
                   2740: % Font commands.
                   2741: 
                   2742: % #1 is the font command (\sl or \it), #2 is the text to slant.
                   2743: % If we are in a monospaced environment, however, 1) always use \ttsl,
                   2744: % and 2) do not add an italic correction.
                   2745: \def\dosmartslant#1#2{%
                   2746:   \ifusingtt
                   2747:     {{\ttsl #2}\let\next=\relax}%
1.2     ! snw      2748:     {\def\next{{#1#2}\smartitaliccorrection}}%
1.1       snw      2749:   \next
                   2750: }
                   2751: \def\smartslanted{\dosmartslant\sl}
                   2752: \def\smartitalic{\dosmartslant\it}
                   2753: 
1.2     ! snw      2754: % Output an italic correction unless the following character is such as
        !          2755: % not to need one.
        !          2756: \def\smartitaliccorrection{\futurelet\next\smartitaliccorrectionx}
        !          2757: \def\smartitaliccorrectionx{%
1.1       snw      2758:   \ifx\next,%
                   2759:   \else\ifx\next-%
                   2760:   \else\ifx\next.%
                   2761:   \else\ifx\next\.%
                   2762:   \else\ifx\next\comma%
                   2763:   \else\ptexslash
                   2764:   \fi\fi\fi\fi\fi
                   2765:   \aftersmartic
                   2766: }
                   2767: 
1.2     ! snw      2768: % @cite unconditionally uses \sl with \smartitaliccorrection.
        !          2769: \def\cite#1{{\sl #1}\smartitaliccorrection}
1.1       snw      2770: 
1.2     ! snw      2771: % @var unconditionally uses \sl.  This gives consistency for
        !          2772: % parameter names whether they are in @def, @table @code or a
        !          2773: % regular paragraph.
        !          2774: %  To get ttsl font for @var when used in code context, @set txicodevaristt.
        !          2775: % The \null is to reset \spacefactor.
1.1       snw      2776: \def\aftersmartic{}
                   2777: \def\var#1{%
                   2778:   \let\saveaftersmartic = \aftersmartic
                   2779:   \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}%
1.2     ! snw      2780:   %
        !          2781:   \ifflagclear{txicodevaristt}%
        !          2782:     {\def\varnext{{{\sl #1}}\smartitaliccorrection}}%
        !          2783:     {\def\varnext{\smartslanted{#1}}}%
        !          2784:   \varnext
1.1       snw      2785: }
                   2786: 
1.2     ! snw      2787: % To be removed after next release
        !          2788: \def\SETtxicodevaristt{}% @set txicodevaristt
        !          2789: 
1.1       snw      2790: \let\i=\smartitalic
                   2791: \let\slanted=\smartslanted
                   2792: \let\dfn=\smartslanted
                   2793: \let\emph=\smartitalic
                   2794: 
1.2     ! snw      2795: % @r for roman font, used for code comment
        !          2796: \def\r#1{{%
        !          2797:   \usenormaldash % get --, --- ligatures even if in @code
        !          2798:   \defcharsdefault  % in case on def line
        !          2799:   \rm #1}}
        !          2800: {\catcode`-=\active \gdef\usenormaldash{\let-\normaldash}}
        !          2801: 
        !          2802: % @sc, undocumented @ii.
1.1       snw      2803: \def\sc#1{{\smallcaps#1}}       % smallcaps font
                   2804: \def\ii#1{{\it #1}}             % italic font
                   2805: 
                   2806: % @b, explicit bold.  Also @strong.
                   2807: \def\b#1{{\bf #1}}
                   2808: \let\strong=\b
                   2809: 
                   2810: % @sansserif, explicit sans.
                   2811: \def\sansserif#1{{\sf #1}}
                   2812: 
1.2     ! snw      2813: \newif\iffrenchspacing
        !          2814: \frenchspacingfalse
1.1       snw      2815: 
                   2816: % Set sfcode to normal for the chars that usually have another value.
                   2817: % Can't use plain's \frenchspacing because it uses the `\x notation, and
                   2818: % sometimes \x has an active definition that messes things up.
                   2819: %
                   2820: \catcode`@=11
                   2821:   \def\plainfrenchspacing{%
1.2     ! snw      2822:     \iffrenchspacing\else
        !          2823:       \frenchspacingtrue
        !          2824:       \sfcode`\.=\@m \sfcode`\?=\@m \sfcode`\!=\@m
        !          2825:       \sfcode`\:=\@m \sfcode`\;=\@m \sfcode`\,=\@m
        !          2826:       \def\endofsentencespacefactor{1000}% for @. and friends
        !          2827:     \fi
1.1       snw      2828:   }
                   2829:   \def\plainnonfrenchspacing{%
1.2     ! snw      2830:     \iffrenchspacing
        !          2831:       \frenchspacingfalse
        !          2832:        \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000
        !          2833:        \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250
        !          2834:        \def\endofsentencespacefactor{3000}% for @. and friends
        !          2835:     \fi
1.1       snw      2836:   }
                   2837: \catcode`@=\other
                   2838: \def\endofsentencespacefactor{3000}% default
                   2839: 
1.2     ! snw      2840: % @frenchspacing on|off  says whether to put extra space after punctuation.
        !          2841: %
        !          2842: \def\onword{on}
        !          2843: \def\offword{off}
        !          2844: %
        !          2845: \let\frenchspacingsetting\plainnonfrenchspacing % used in output routine
        !          2846: \parseargdef\frenchspacing{%
        !          2847:   \def\temp{#1}%
        !          2848:   \ifx\temp\onword \let\frenchspacingsetting\plainfrenchspacing
        !          2849:   \else\ifx\temp\offword \let\frenchspacingsetting\plainnonfrenchspacing
        !          2850:   \else
        !          2851:     \errhelp = \EMsimple
        !          2852:     \errmessage{Unknown @frenchspacing option `\temp', must be on|off}%
        !          2853:   \fi\fi
        !          2854:   \frenchspacingsetting
        !          2855: }
        !          2856: 
        !          2857: 
1.1       snw      2858: % @t, explicit typewriter.
                   2859: \def\t#1{%
1.2     ! snw      2860:   {\tt \defcharsdefault \plainfrenchspacing #1}%
1.1       snw      2861:   \null
                   2862: }
                   2863: 
                   2864: % @samp.
                   2865: \def\samp#1{{\setcodequotes\lq\tclose{#1}\rq\null}}
                   2866: 
                   2867: % @indicateurl is \samp, that is, with quotes.
                   2868: \let\indicateurl=\samp
                   2869: 
                   2870: % @code (and similar) prints in typewriter, but with spaces the same
                   2871: % size as normal in the surrounding text, without hyphenation, etc.
                   2872: % This is a subroutine for that.
                   2873: \def\tclose#1{%
                   2874:   {%
                   2875:     % Change normal interword space to be same as for the current font.
                   2876:     \spaceskip = \fontdimen2\font
                   2877:     %
                   2878:     % Switch to typewriter.
                   2879:     \tt
                   2880:     %
1.2     ! snw      2881:     % `\ ' produces the large typewriter interword space.
1.1       snw      2882:     \def\ {{\spaceskip = 0pt{} }}%
                   2883:     %
                   2884:     \plainfrenchspacing
                   2885:     #1%
                   2886:   }%
                   2887:   \null % reset spacefactor to 1000
                   2888: }
                   2889: 
1.2     ! snw      2890: % This is for LuaTeX: It is not sufficient to disable hyphenation at
        !          2891: % explicit dashes by setting `\hyphenchar` to -1.
        !          2892: \def\dashnobreak{%
        !          2893:   \normaldash
        !          2894:   \penalty 10000 }
        !          2895: 
        !          2896: % We must turn on hyphenation at `-' and `_' in @code.
1.1       snw      2897: % Otherwise, it is too hard to avoid overfull hboxes
                   2898: % in the Emacs manual, the Library manual, etc.
1.2     ! snw      2899: % We explicitly allow hyphenation at these characters
        !          2900: % using \discretionary.
1.1       snw      2901: %
1.2     ! snw      2902: % Hyphenation at - and hyphenation within words was turned off
        !          2903: % by default for the tt fonts using the \hyphenchar parameter of TeX.
1.1       snw      2904: {
                   2905:   \catcode`\-=\active \catcode`\_=\active
                   2906:   \catcode`\'=\active \catcode`\`=\active
                   2907:   \global\let'=\rq \global\let`=\lq  % default definitions
                   2908:   %
                   2909:   \global\def\code{\begingroup
                   2910:     \setcodequotes
                   2911:     \catcode\dashChar=\active  \catcode\underChar=\active
                   2912:     \ifallowcodebreaks
                   2913:      \let-\codedash
                   2914:      \let_\codeunder
                   2915:     \else
1.2     ! snw      2916:      \let-\dashnobreak
1.1       snw      2917:      \let_\realunder
                   2918:     \fi
                   2919:     \codex
                   2920:   }
                   2921:   %
                   2922:   \gdef\codedash{\futurelet\next\codedashfinish}
                   2923:   \gdef\codedashfinish{%
                   2924:     \normaldash % always output the dash character itself.
                   2925:     %
                   2926:     % Now, output a discretionary to allow a line break, unless
                   2927:     % (a) the next character is a -, or
1.2     ! snw      2928:     % (b) the preceding character is a -, or
        !          2929:     % (c) we are at the start of the string.
        !          2930:     % In both cases (b) and (c), \codedashnobreak should be set to \codedash.
        !          2931:     %
1.1       snw      2932:     % E.g., given --posix, we do not want to allow a break after either -.
                   2933:     % Given --foo-bar, we do want to allow a break between the - and the b.
                   2934:     \ifx\next\codedash \else
1.2     ! snw      2935:       \ifx\codedashnobreak\codedash
1.1       snw      2936:       \else \discretionary{}{}{}\fi
                   2937:     \fi
                   2938:     % we need the space after the = for the case when \next itself is a
                   2939:     % space token; it would get swallowed otherwise.  As in @code{- a}.
1.2     ! snw      2940:     \global\let\codedashnobreak= \next
1.1       snw      2941:   }
                   2942: }
                   2943: \def\normaldash{-}
                   2944: %
1.2     ! snw      2945: \def\codex #1{\tclose{%
        !          2946:   % Given -foo (with a single dash), we do not want to allow a break
        !          2947:   % after the -.  \codedashnobreak is set to the first character in
        !          2948:   % @code.
        !          2949:   \futurelet\codedashnobreak\relax
        !          2950:   #1%
        !          2951: }\endgroup}
1.1       snw      2952: 
                   2953: \def\codeunder{%
                   2954:   % this is all so @math{@code{var_name}+1} can work.  In math mode, _
                   2955:   % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
                   2956:   % will therefore expand the active definition of _, which is us
                   2957:   % (inside @code that is), therefore an endless loop.
                   2958:   \ifusingtt{\ifmmode
                   2959:                \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_.
                   2960:              \else\normalunderscore \fi
                   2961:              \discretionary{}{}{}}%
                   2962:             {\_}%
                   2963: }
                   2964: 
                   2965: % An additional complication: the above will allow breaks after, e.g.,
                   2966: % each of the four underscores in __typeof__.  This is bad.
                   2967: % @allowcodebreaks provides a document-level way to turn breaking at -
                   2968: % and _ on and off.
                   2969: %
                   2970: \newif\ifallowcodebreaks  \allowcodebreakstrue
                   2971: 
                   2972: \def\keywordtrue{true}
                   2973: \def\keywordfalse{false}
                   2974: 
                   2975: \parseargdef\allowcodebreaks{%
                   2976:   \def\txiarg{#1}%
                   2977:   \ifx\txiarg\keywordtrue
                   2978:     \allowcodebreakstrue
                   2979:   \else\ifx\txiarg\keywordfalse
                   2980:     \allowcodebreaksfalse
                   2981:   \else
                   2982:     \errhelp = \EMsimple
                   2983:     \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}%
                   2984:   \fi\fi
                   2985: }
                   2986: 
                   2987: % For @command, @env, @file, @option quotes seem unnecessary,
                   2988: % so use \code rather than \samp.
                   2989: \let\command=\code
                   2990: \let\env=\code
                   2991: \let\file=\code
                   2992: \let\option=\code
                   2993: 
                   2994: % @uref (abbreviation for `urlref') aka @url takes an optional
                   2995: % (comma-separated) second argument specifying the text to display and
                   2996: % an optional third arg as text to display instead of (rather than in
                   2997: % addition to) the url itself.  First (mandatory) arg is the url.
                   2998: 
                   2999: % TeX-only option to allow changing PDF output to show only the second
                   3000: % arg (if given), and not the url (which is then just the link target).
                   3001: \newif\ifurefurlonlylink
                   3002: 
                   3003: % The default \pretolerance setting stops the penalty inserted in
                   3004: % \urefallowbreak being a discouragement to line breaking.  Set it to
                   3005: % a negative value for this paragraph only.  Hopefully this does not
                   3006: % conflict with redefinitions of \par done elsewhere.
                   3007: \def\nopretolerance{%
                   3008: \pretolerance=-1
                   3009: \def\par{\endgraf\pretolerance=100 \let\par\endgraf}%
                   3010: }
                   3011: 
                   3012: % The main macro is \urefbreak, which allows breaking at expected
                   3013: % places within the url.
                   3014: \def\urefbreak{\nopretolerance \begingroup \urefcatcodes \dourefbreak}
                   3015: \let\uref=\urefbreak
                   3016: %
                   3017: \def\dourefbreak#1{\urefbreakfinish #1,,,\finish}
                   3018: \def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example
                   3019:   \unsepspaces
                   3020:   \pdfurl{#1}%
                   3021:   \setbox0 = \hbox{\ignorespaces #3}%
                   3022:   \ifdim\wd0 > 0pt
                   3023:     \unhbox0 % third arg given, show only that
                   3024:   \else
                   3025:     \setbox0 = \hbox{\ignorespaces #2}% look for second arg
                   3026:     \ifdim\wd0 > 0pt
                   3027:       \ifpdf
                   3028:         % For pdfTeX and LuaTeX
                   3029:         \ifurefurlonlylink
                   3030:           % PDF plus option to not display url, show just arg
                   3031:           \unhbox0
                   3032:         \else
                   3033:           % PDF, normally display both arg and url for consistency,
                   3034:           % visibility, if the pdf is eventually used to print, etc.
                   3035:           \unhbox0\ (\urefcode{#1})%
                   3036:         \fi
                   3037:       \else
                   3038:         \ifx\XeTeXrevision\thisisundefined
                   3039:           \unhbox0\ (\urefcode{#1})% DVI, always show arg and url
                   3040:         \else
                   3041:           % For XeTeX
                   3042:           \ifurefurlonlylink
                   3043:             % PDF plus option to not display url, show just arg
                   3044:             \unhbox0
                   3045:           \else
                   3046:             % PDF, normally display both arg and url for consistency,
                   3047:             % visibility, if the pdf is eventually used to print, etc.
                   3048:             \unhbox0\ (\urefcode{#1})%
                   3049:           \fi
                   3050:         \fi
                   3051:       \fi
                   3052:     \else
                   3053:       \urefcode{#1}% only url given, so show it
                   3054:     \fi
                   3055:   \fi
                   3056:   \endlink
                   3057: \endgroup}
                   3058: 
                   3059: % Allow line breaks around only a few characters (only).
                   3060: \def\urefcatcodes{%
                   3061:   \catcode`\&=\active \catcode`\.=\active
                   3062:   \catcode`\#=\active \catcode`\?=\active
                   3063:   \catcode`\/=\active
                   3064: }
                   3065: {
                   3066:   \urefcatcodes
                   3067:   %
                   3068:   \global\def\urefcode{\begingroup
                   3069:     \setcodequotes
                   3070:     \urefcatcodes
                   3071:     \let&\urefcodeamp
                   3072:     \let.\urefcodedot
                   3073:     \let#\urefcodehash
                   3074:     \let?\urefcodequest
                   3075:     \let/\urefcodeslash
                   3076:     \codex
                   3077:   }
                   3078:   %
                   3079:   % By default, they are just regular characters.
                   3080:   \global\def&{\normalamp}
                   3081:   \global\def.{\normaldot}
                   3082:   \global\def#{\normalhash}
                   3083:   \global\def?{\normalquest}
                   3084:   \global\def/{\normalslash}
                   3085: }
                   3086: 
                   3087: \def\urefcodeamp{\urefprebreak \&\urefpostbreak}
                   3088: \def\urefcodedot{\urefprebreak .\urefpostbreak}
                   3089: \def\urefcodehash{\urefprebreak \#\urefpostbreak}
                   3090: \def\urefcodequest{\urefprebreak ?\urefpostbreak}
                   3091: \def\urefcodeslash{\futurelet\next\urefcodeslashfinish}
                   3092: {
                   3093:   \catcode`\/=\active
                   3094:   \global\def\urefcodeslashfinish{%
                   3095:     \urefprebreak \slashChar
                   3096:     % Allow line break only after the final / in a sequence of
                   3097:     % slashes, to avoid line break between the slashes in http://.
                   3098:     \ifx\next/\else \urefpostbreak \fi
                   3099:   }
                   3100: }
                   3101: 
                   3102: % By default we'll break after the special characters, but some people like to
                   3103: % break before the special chars, so allow that.  Also allow no breaking at
                   3104: % all, for manual control.
                   3105: %
                   3106: \parseargdef\urefbreakstyle{%
                   3107:   \def\txiarg{#1}%
                   3108:   \ifx\txiarg\wordnone
                   3109:     \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak}
                   3110:   \else\ifx\txiarg\wordbefore
                   3111:     \def\urefprebreak{\urefallowbreak}\def\urefpostbreak{\nobreak}
                   3112:   \else\ifx\txiarg\wordafter
                   3113:     \def\urefprebreak{\nobreak}\def\urefpostbreak{\urefallowbreak}
                   3114:   \else
                   3115:     \errhelp = \EMsimple
                   3116:     \errmessage{Unknown @urefbreakstyle setting `\txiarg'}%
                   3117:   \fi\fi\fi
                   3118: }
                   3119: \def\wordafter{after}
                   3120: \def\wordbefore{before}
                   3121: \def\wordnone{none}
                   3122: 
                   3123: % Allow a ragged right output to aid breaking long URL's.  There can
                   3124: % be a break at the \allowbreak with no extra glue (if the existing stretch in
                   3125: % the line is sufficient), a break at the \penalty with extra glue added
                   3126: % at the end of the line, or no break at all here.
                   3127: %   Changing the value of the penalty and/or the amount of stretch affects how
                   3128: % preferable one choice is over the other.
                   3129: \def\urefallowbreak{%
                   3130:   \penalty0\relax
                   3131:   \hskip 0pt plus 2 em\relax
                   3132:   \penalty1000\relax
                   3133:   \hskip 0pt plus -2 em\relax
                   3134: }
                   3135: 
                   3136: \urefbreakstyle after
                   3137: 
                   3138: % @url synonym for @uref, since that's how everyone uses it.
                   3139: %
                   3140: \let\url=\uref
                   3141: 
                   3142: % rms does not like angle brackets --karl, 17may97.
                   3143: % So now @email is just like @uref, unless we are pdf.
                   3144: %
                   3145: %\def\email#1{\angleleft{\tt #1}\angleright}
                   3146: \ifpdforxetex
                   3147:   \def\email#1{\doemail#1,,\finish}
                   3148:   \def\doemail#1,#2,#3\finish{\begingroup
                   3149:     \unsepspaces
                   3150:     \pdfurl{mailto:#1}%
                   3151:     \setbox0 = \hbox{\ignorespaces #2}%
                   3152:     \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
                   3153:     \endlink
                   3154:   \endgroup}
                   3155: \else
                   3156:   \let\email=\uref
                   3157: \fi
                   3158: 
                   3159: % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
                   3160: %   `example' (@kbd uses ttsl only inside of @example and friends),
                   3161: %   or `code' (@kbd uses normal tty font always).
                   3162: \parseargdef\kbdinputstyle{%
                   3163:   \def\txiarg{#1}%
                   3164:   \ifx\txiarg\worddistinct
                   3165:     \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
                   3166:   \else\ifx\txiarg\wordexample
                   3167:     \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
                   3168:   \else\ifx\txiarg\wordcode
                   3169:     \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
                   3170:   \else
                   3171:     \errhelp = \EMsimple
                   3172:     \errmessage{Unknown @kbdinputstyle setting `\txiarg'}%
                   3173:   \fi\fi\fi
                   3174: }
                   3175: \def\worddistinct{distinct}
                   3176: \def\wordexample{example}
                   3177: \def\wordcode{code}
                   3178: 
                   3179: % Default is `distinct'.
                   3180: \kbdinputstyle distinct
                   3181: 
1.2     ! snw      3182: \def\kbd#1{%
        !          3183:   \tclose{\kbdfont\setcodequotes#1}%
1.1       snw      3184: }
                   3185: 
                   3186: % definition of @key that produces a lozenge.  Doesn't adjust to text size.
                   3187: %\setfont\keyrm\rmshape{8}{1000}{OT1}
                   3188: %\font\keysy=cmsy9
                   3189: %\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
                   3190: %  \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
                   3191: %    \vbox{\hrule\kern-0.4pt
                   3192: %     \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
                   3193: %    \kern-0.4pt\hrule}%
                   3194: %  \kern-.06em\raise0.4pt\hbox{\angleright}}}}
                   3195: 
1.2     ! snw      3196: % definition of @key with no lozenge.
        !          3197: %
        !          3198: \def\key#1{{\setregularquotes \tt #1}\null}
1.1       snw      3199: 
                   3200: % @clicksequence{File @click{} Open ...}
                   3201: \def\clicksequence#1{\begingroup #1\endgroup}
                   3202: 
                   3203: % @clickstyle @arrow   (by default)
                   3204: \parseargdef\clickstyle{\def\click{#1}}
                   3205: \def\click{\arrow}
                   3206: 
                   3207: % Typeset a dimension, e.g., `in' or `pt'.  The only reason for the
                   3208: % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
                   3209: %
                   3210: \def\dmn#1{\thinspace #1}
                   3211: 
                   3212: % @acronym for "FBI", "NATO", and the like.
                   3213: % We print this one point size smaller, since it's intended for
                   3214: % all-uppercase.
                   3215: %
                   3216: \def\acronym#1{\doacronym #1,,\finish}
                   3217: \def\doacronym#1,#2,#3\finish{%
                   3218:   {\switchtolsize #1}%
                   3219:   \def\temp{#2}%
                   3220:   \ifx\temp\empty \else
                   3221:     \space ({\unsepspaces \ignorespaces \temp \unskip})%
                   3222:   \fi
                   3223:   \null % reset \spacefactor=1000
                   3224: }
                   3225: 
                   3226: % @abbr for "Comput. J." and the like.
                   3227: % No font change, but don't do end-of-sentence spacing.
                   3228: %
                   3229: \def\abbr#1{\doabbr #1,,\finish}
                   3230: \def\doabbr#1,#2,#3\finish{%
                   3231:   {\plainfrenchspacing #1}%
                   3232:   \def\temp{#2}%
                   3233:   \ifx\temp\empty \else
                   3234:     \space ({\unsepspaces \ignorespaces \temp \unskip})%
                   3235:   \fi
                   3236:   \null % reset \spacefactor=1000
                   3237: }
                   3238: 
                   3239: % @asis just yields its argument.  Used with @table, for example.
                   3240: %
                   3241: \def\asis#1{#1}
                   3242: 
                   3243: % @math outputs its argument in math mode.
                   3244: %
                   3245: % One complication: _ usually means subscripts, but it could also mean
                   3246: % an actual _ character, as in @math{@var{some_variable} + 1}.  So make
                   3247: % _ active, and distinguish by seeing if the current family is \slfam,
                   3248: % which is what @var uses.
                   3249: {
                   3250:   \catcode`\_ = \active
                   3251:   \gdef\mathunderscore{%
                   3252:     \catcode`\_=\active
                   3253:     \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
                   3254:   }
                   3255: }
                   3256: % Another complication: we want \\ (and @\) to output a math (or tt) \.
                   3257: % FYI, plain.tex uses \\ as a temporary control sequence (for no
                   3258: % particular reason), but this is not advertised and we don't care.
                   3259: %
                   3260: % The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
                   3261: \def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
                   3262: %
                   3263: \def\math{%
                   3264:   \ifmmode\else % only go into math if not in math mode already
                   3265:     \tex
                   3266:     \mathunderscore
                   3267:     \let\\ = \mathbackslash
                   3268:     \mathactive
                   3269:     % make the texinfo accent commands work in math mode
                   3270:     \let\"=\ddot
                   3271:     \let\'=\acute
                   3272:     \let\==\bar
                   3273:     \let\^=\hat
                   3274:     \let\`=\grave
                   3275:     \let\u=\breve
                   3276:     \let\v=\check
                   3277:     \let\~=\tilde
                   3278:     \let\dotaccent=\dot
                   3279:     % have to provide another name for sup operator
                   3280:     \let\mathopsup=\sup
                   3281:   $\expandafter\finishmath\fi
                   3282: }
                   3283: \def\finishmath#1{#1$\endgroup}  % Close the group opened by \tex.
                   3284: 
                   3285: % Some active characters (such as <) are spaced differently in math.
                   3286: % We have to reset their definitions in case the @math was an argument
                   3287: % to a command which sets the catcodes (such as @item or @section).
                   3288: %
                   3289: {
                   3290:   \catcode`^ = \active
                   3291:   \catcode`< = \active
                   3292:   \catcode`> = \active
                   3293:   \catcode`+ = \active
                   3294:   \catcode`' = \active
                   3295:   \gdef\mathactive{%
                   3296:     \let^ = \ptexhat
                   3297:     \let< = \ptexless
                   3298:     \let> = \ptexgtr
                   3299:     \let+ = \ptexplus
                   3300:     \let' = \ptexquoteright
                   3301:   }
                   3302: }
                   3303: 
                   3304: % for @sub and @sup, if in math mode, just do a normal sub/superscript.
                   3305: % If in text, use math to place as sub/superscript, but switch
                   3306: % into text mode, with smaller fonts.  This is a different font than the
                   3307: % one used for real math sub/superscripts (8pt vs. 7pt), but let's not
                   3308: % fix it (significant additions to font machinery) until someone notices.
                   3309: %
                   3310: \def\sub{\ifmmode \expandafter\sb \else \expandafter\finishsub\fi}
                   3311: \def\finishsub#1{$\sb{\hbox{\switchtolllsize #1}}$}%
                   3312: %
                   3313: \def\sup{\ifmmode \expandafter\ptexsp \else \expandafter\finishsup\fi}
                   3314: \def\finishsup#1{$\ptexsp{\hbox{\switchtolllsize #1}}$}%
                   3315: 
                   3316: % provide this command from LaTeX as it is very common
                   3317: \def\frac#1#2{{{#1}\over{#2}}}
                   3318: 
                   3319: % @displaymath.
                   3320: % \globaldefs is needed to recognize the end lines in \tex and
                   3321: % \end tex.  Set \thisenv as @end displaymath is seen before @end tex.
                   3322: {\obeylines
                   3323: \globaldefs=1
                   3324: \envdef\displaymath{%
                   3325: \tex%
                   3326: \def\thisenv{\displaymath}%
                   3327: \begingroup\let\end\displaymathend%
                   3328: $$%
                   3329: }
                   3330: 
                   3331: \def\displaymathend{$$\endgroup\end}%
                   3332: 
                   3333: \def\Edisplaymath{%
                   3334: \def\thisenv{\tex}%
                   3335: \end tex
                   3336: }}
                   3337: 
                   3338: 
                   3339: % @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}.
                   3340: % Ignore unless FMTNAME == tex; then it is like @iftex and @tex,
                   3341: % except specified as a normal braced arg, so no newlines to worry about.
                   3342: %
                   3343: \def\outfmtnametex{tex}
                   3344: %
                   3345: \long\def\inlinefmt#1{\doinlinefmt #1,\finish}
                   3346: \long\def\doinlinefmt#1,#2,\finish{%
                   3347:   \def\inlinefmtname{#1}%
                   3348:   \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi
                   3349: }
                   3350: %
                   3351: % @inlinefmtifelse{FMTNAME,THEN-TEXT,ELSE-TEXT} expands THEN-TEXT if
                   3352: % FMTNAME is tex, else ELSE-TEXT.
                   3353: \long\def\inlinefmtifelse#1{\doinlinefmtifelse #1,,,\finish}
                   3354: \long\def\doinlinefmtifelse#1,#2,#3,#4,\finish{%
                   3355:   \def\inlinefmtname{#1}%
                   3356:   \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\else \ignorespaces #3\fi
                   3357: }
                   3358: %
                   3359: % For raw, must switch into @tex before parsing the argument, to avoid
                   3360: % setting catcodes prematurely.  Doing it this way means that, for
                   3361: % example, @inlineraw{html, foo{bar} gets a parse error instead of being
                   3362: % ignored.  But this isn't important because if people want a literal
                   3363: % *right* brace they would have to use a command anyway, so they may as
                   3364: % well use a command to get a left brace too.  We could re-use the
                   3365: % delimiter character idea from \verb, but it seems like overkill.
                   3366: %
                   3367: \long\def\inlineraw{\tex \doinlineraw}
                   3368: \long\def\doinlineraw#1{\doinlinerawtwo #1,\finish}
                   3369: \def\doinlinerawtwo#1,#2,\finish{%
                   3370:   \def\inlinerawname{#1}%
                   3371:   \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi
                   3372:   \endgroup % close group opened by \tex.
                   3373: }
                   3374: 
                   3375: % @inlineifset{VAR, TEXT} expands TEXT if VAR is @set.
                   3376: %
                   3377: \long\def\inlineifset#1{\doinlineifset #1,\finish}
                   3378: \long\def\doinlineifset#1,#2,\finish{%
                   3379:   \def\inlinevarname{#1}%
                   3380:   \expandafter\ifx\csname SET\inlinevarname\endcsname\relax
                   3381:   \else\ignorespaces#2\fi
                   3382: }
                   3383: 
                   3384: % @inlineifclear{VAR, TEXT} expands TEXT if VAR is not @set.
                   3385: %
                   3386: \long\def\inlineifclear#1{\doinlineifclear #1,\finish}
                   3387: \long\def\doinlineifclear#1,#2,\finish{%
                   3388:   \def\inlinevarname{#1}%
                   3389:   \expandafter\ifx\csname SET\inlinevarname\endcsname\relax \ignorespaces#2\fi
                   3390: }
                   3391: 
                   3392: 
                   3393: \message{glyphs,}
                   3394: % and logos.
                   3395: 
                   3396: % @@ prints an @, as does @atchar{}.
                   3397: \def\@{\char64 }
                   3398: \let\atchar=\@
                   3399: 
                   3400: % @{ @} @lbracechar{} @rbracechar{} all generate brace characters.
1.2     ! snw      3401: \def\lbracechar{{\ifusingtt{\char123}{\ensuremath\lbrace}}}
        !          3402: \def\rbracechar{{\ifusingtt{\char125}{\ensuremath\rbrace}}}
1.1       snw      3403: \let\{=\lbracechar
                   3404: \let\}=\rbracechar
                   3405: 
                   3406: % @comma{} to avoid , parsing problems.
                   3407: \let\comma = ,
                   3408: 
                   3409: % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
                   3410: % Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
                   3411: \let\, = \ptexc
                   3412: \let\dotaccent = \ptexdot
                   3413: \def\ringaccent#1{{\accent23 #1}}
                   3414: \let\tieaccent = \ptext
                   3415: \let\ubaraccent = \ptexb
                   3416: \let\udotaccent = \d
                   3417: 
                   3418: % Other special characters: @questiondown @exclamdown @ordf @ordm
                   3419: % Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
                   3420: \def\questiondown{?`}
                   3421: \def\exclamdown{!`}
                   3422: \def\ordf{\leavevmode\raise1ex\hbox{\switchtolllsize \underbar{a}}}
                   3423: \def\ordm{\leavevmode\raise1ex\hbox{\switchtolllsize \underbar{o}}}
                   3424: 
                   3425: % Dotless i and dotless j, used for accents.
                   3426: \def\imacro{i}
                   3427: \def\jmacro{j}
                   3428: \def\dotless#1{%
                   3429:   \def\temp{#1}%
                   3430:   \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi
                   3431:   \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi
                   3432:   \else \errmessage{@dotless can be used only with i or j}%
                   3433:   \fi\fi
                   3434: }
                   3435: 
                   3436: % The \TeX{} logo, as in plain, but resetting the spacing so that a
                   3437: % period following counts as ending a sentence.  (Idea found in latex.)
                   3438: %
                   3439: \edef\TeX{\TeX \spacefactor=1000 }
                   3440: 
                   3441: % @LaTeX{} logo.  Not quite the same results as the definition in
                   3442: % latex.ltx, since we use a different font for the raised A; it's most
                   3443: % convenient for us to use an explicitly smaller font, rather than using
                   3444: % the \scriptstyle font (since we don't reset \scriptstyle and
                   3445: % \scriptscriptstyle).
                   3446: %
                   3447: \def\LaTeX{%
                   3448:   L\kern-.36em
                   3449:   {\setbox0=\hbox{T}%
                   3450:    \vbox to \ht0{\hbox{%
                   3451:      \ifx\textnominalsize\xwordpt
                   3452:        % for 10pt running text, lllsize (8pt) is too small for the A in LaTeX.
                   3453:        % Revert to plain's \scriptsize, which is 7pt.
                   3454:        \count255=\the\fam $\fam\count255 \scriptstyle A$%
                   3455:      \else
1.2     ! snw      3456:        \ifx\curfontsize\smallword
        !          3457:          % For footnotes and indices
        !          3458:          \count255=\the\fam $\fam\count255 \scriptstyle A$%
        !          3459:        \else
        !          3460:          % For 11pt, we can use our lllsize.
        !          3461:          \switchtolllsize A%
        !          3462:        \fi
1.1       snw      3463:      \fi
                   3464:      }%
                   3465:      \vss
                   3466:   }}%
                   3467:   \kern-.15em
                   3468:   \TeX
                   3469: }
1.2     ! snw      3470: \def\smallword{small}
1.1       snw      3471: 
                   3472: % Some math mode symbols.  Define \ensuremath to switch into math mode
                   3473: % unless we are already there.  Expansion tricks may not be needed here,
                   3474: % but safer, and can't hurt.
                   3475: \def\ensuremath{\ifmmode \expandafter\asis \else\expandafter\ensuredmath \fi}
                   3476: \def\ensuredmath#1{$\relax#1$}
                   3477: %
                   3478: \def\bullet{\ensuremath\ptexbullet}
                   3479: \def\geq{\ensuremath\ge}
                   3480: \def\leq{\ensuremath\le}
                   3481: \def\minus{\ensuremath-}
                   3482: 
                   3483: % @dots{} outputs an ellipsis using the current font.
                   3484: % We do .5em per period so that it has the same spacing in the cm
                   3485: % typewriter fonts as three actual period characters; on the other hand,
                   3486: % in other typewriter fonts three periods are wider than 1.5em.  So do
                   3487: % whichever is larger.
                   3488: %
                   3489: \def\dots{%
                   3490:   \leavevmode
                   3491:   \setbox0=\hbox{...}% get width of three periods
                   3492:   \ifdim\wd0 > 1.5em
                   3493:     \dimen0 = \wd0
                   3494:   \else
                   3495:     \dimen0 = 1.5em
                   3496:   \fi
                   3497:   \hbox to \dimen0{%
                   3498:     \hskip 0pt plus.25fil
                   3499:     .\hskip 0pt plus1fil
                   3500:     .\hskip 0pt plus1fil
                   3501:     .\hskip 0pt plus.5fil
                   3502:   }%
                   3503: }
                   3504: 
                   3505: % @enddots{} is an end-of-sentence ellipsis.
                   3506: %
                   3507: \def\enddots{%
                   3508:   \dots
                   3509:   \spacefactor=\endofsentencespacefactor
                   3510: }
                   3511: 
                   3512: % @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
                   3513: %
                   3514: % Since these characters are used in examples, they should be an even number of
                   3515: % \tt widths. Each \tt character is 1en, so two makes it 1em.
                   3516: %
                   3517: \def\point{$\star$}
                   3518: \def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}}
                   3519: \def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
                   3520: \def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}}
                   3521: \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
                   3522: \def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}}
                   3523: 
                   3524: % The @error{} command.
                   3525: % Adapted from the TeXbook's \boxit.
                   3526: %
                   3527: \newbox\errorbox
                   3528: %
                   3529: {\ttfont \global\dimen0 = 3em}% Width of the box.
                   3530: \dimen2 = .55pt % Thickness of rules
                   3531: % The text. (`r' is open on the right, `e' somewhat less so on the left.)
                   3532: \setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt}
                   3533: %
                   3534: \setbox\errorbox=\hbox to \dimen0{\hfil
                   3535:    \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
                   3536:    \advance\hsize by -2\dimen2 % Rules.
                   3537:    \vbox{%
                   3538:       \hrule height\dimen2
                   3539:       \hbox{\vrule width\dimen2 \kern3pt          % Space to left of text.
                   3540:          \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
                   3541:          \kern3pt\vrule width\dimen2}% Space to right.
                   3542:       \hrule height\dimen2}
                   3543:     \hfil}
                   3544: %
                   3545: \def\error{\leavevmode\lower.7ex\copy\errorbox}
                   3546: 
                   3547: % @pounds{} is a sterling sign, which Knuth put in the CM italic font.
                   3548: %
1.2     ! snw      3549: \def\pounds{{\ifusingtt{\ecfont\char"BF}{\it\$}}}
1.1       snw      3550: 
                   3551: % @euro{} comes from a separate font, depending on the current style.
                   3552: % We use the free feym* fonts from the eurosym package by Henrik
                   3553: % Theiling, which support regular, slanted, bold and bold slanted (and
                   3554: % "outlined" (blackboard board, sort of) versions, which we don't need).
                   3555: % It is available from http://www.ctan.org/tex-archive/fonts/eurosym.
                   3556: %
                   3557: % Although only regular is the truly official Euro symbol, we ignore
                   3558: % that.  The Euro is designed to be slightly taller than the regular
                   3559: % font height.
                   3560: %
                   3561: % feymr - regular
                   3562: % feymo - slanted
                   3563: % feybr - bold
                   3564: % feybo - bold slanted
                   3565: %
                   3566: % There is no good (free) typewriter version, to my knowledge.
                   3567: % A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide.
                   3568: % Hmm.
                   3569: %
                   3570: % Also doesn't work in math.  Do we need to do math with euro symbols?
                   3571: % Hope not.
                   3572: %
                   3573: %
                   3574: \def\euro{{\eurofont e}}
                   3575: \def\eurofont{%
                   3576:   % We set the font at each command, rather than predefining it in
                   3577:   % \textfonts and the other font-switching commands, so that
                   3578:   % installations which never need the symbol don't have to have the
                   3579:   % font installed.
                   3580:   %
                   3581:   % There is only one designed size (nominal 10pt), so we always scale
                   3582:   % that to the current nominal size.
                   3583:   %
                   3584:   % By the way, simply using "at 1em" works for cmr10 and the like, but
                   3585:   % does not work for cmbx10 and other extended/shrunken fonts.
                   3586:   %
                   3587:   \def\eurosize{\csname\curfontsize nominalsize\endcsname}%
                   3588:   %
                   3589:   \ifx\curfontstyle\bfstylename
                   3590:     % bold:
                   3591:     \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize
                   3592:   \else
                   3593:     % regular:
                   3594:     \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize
                   3595:   \fi
                   3596:   \thiseurofont
                   3597: }
                   3598: 
                   3599: % Glyphs from the EC fonts.  We don't use \let for the aliases, because
                   3600: % sometimes we redefine the original macro, and the alias should reflect
                   3601: % the redefinition.
                   3602: %
                   3603: % Use LaTeX names for the Icelandic letters.
                   3604: \def\DH{{\ecfont \char"D0}} % Eth
                   3605: \def\dh{{\ecfont \char"F0}} % eth
                   3606: \def\TH{{\ecfont \char"DE}} % Thorn
                   3607: \def\th{{\ecfont \char"FE}} % thorn
                   3608: %
                   3609: \def\guillemetleft{{\ecfont \char"13}}
                   3610: \def\guillemotleft{\guillemetleft}
                   3611: \def\guillemetright{{\ecfont \char"14}}
                   3612: \def\guillemotright{\guillemetright}
                   3613: \def\guilsinglleft{{\ecfont \char"0E}}
                   3614: \def\guilsinglright{{\ecfont \char"0F}}
                   3615: \def\quotedblbase{{\ecfont \char"12}}
                   3616: \def\quotesinglbase{{\ecfont \char"0D}}
                   3617: %
1.2     ! snw      3618: \def\L{{\ecfont \char"8A}} % L with stroke
        !          3619: \def\l{{\ecfont \char"AA}} % l with stroke
        !          3620: %
1.1       snw      3621: % This positioning is not perfect (see the ogonek LaTeX package), but
                   3622: % we have the precomposed glyphs for the most common cases.  We put the
                   3623: % tests to use those glyphs in the single \ogonek macro so we have fewer
                   3624: % dummy definitions to worry about for index entries, etc.
                   3625: %
                   3626: % ogonek is also used with other letters in Lithuanian (IOU), but using
                   3627: % the precomposed glyphs for those is not so easy since they aren't in
                   3628: % the same EC font.
                   3629: \def\ogonek#1{{%
                   3630:   \def\temp{#1}%
                   3631:   \ifx\temp\macrocharA\Aogonek
                   3632:   \else\ifx\temp\macrochara\aogonek
                   3633:   \else\ifx\temp\macrocharE\Eogonek
                   3634:   \else\ifx\temp\macrochare\eogonek
                   3635:   \else
                   3636:     \ecfont \setbox0=\hbox{#1}%
                   3637:     \ifdim\ht0=1ex\accent"0C #1%
                   3638:     \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}%
                   3639:     \fi
                   3640:   \fi\fi\fi\fi
                   3641:   }%
                   3642: }
                   3643: \def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A}
                   3644: \def\aogonek{{\ecfont \char"A1}}\def\macrochara{a}
                   3645: \def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E}
                   3646: \def\eogonek{{\ecfont \char"A6}}\def\macrochare{e}
                   3647: %
                   3648: % Use the European Computer Modern fonts (cm-super in outline format)
                   3649: % for non-CM glyphs.  That is ec* for regular text and tc* for the text
                   3650: % companion symbols (LaTeX TS1 encoding).  Both are part of the ec
                   3651: % package and follow the same conventions.
                   3652: %
                   3653: \def\ecfont{\etcfont{e}}
                   3654: \def\tcfont{\etcfont{t}}
                   3655: %
                   3656: \def\etcfont#1{%
                   3657:   % We can't distinguish serif/sans and italic/slanted, but this
                   3658:   % is used for crude hacks anyway (like adding French and German
                   3659:   % quotes to documents typeset with CM, where we lose kerning), so
                   3660:   % hopefully nobody will notice/care.
                   3661:   \edef\ecsize{\csname\curfontsize ecsize\endcsname}%
                   3662:   \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}%
1.2     ! snw      3663:   \ifusingtt
        !          3664:       % typewriter:
        !          3665:      {\font\thisecfont = #1ctt\ecsize \space at \nominalsize}%
        !          3666:   % else
        !          3667:      {\ifx\curfontstyle\bfstylename
        !          3668:         % bold:
        !          3669:         \font\thisecfont = #1cb\ifusingit{i}{x}\ecsize \space at \nominalsize
        !          3670:       \else
        !          3671:         % regular:
        !          3672:         \font\thisecfont = #1c\ifusingit{ti}{rm}\ecsize \space at \nominalsize
        !          3673:       \fi}%
1.1       snw      3674:   \thisecfont
                   3675: }
                   3676: 
                   3677: % @registeredsymbol - R in a circle.  The font for the R should really
                   3678: % be smaller yet, but lllsize is the best we can do for now.
                   3679: % Adapted from the plain.tex definition of \copyright.
                   3680: %
                   3681: \def\registeredsymbol{%
                   3682:   $^{{\ooalign{\hfil\raise.07ex\hbox{\switchtolllsize R}%
                   3683:                \hfil\crcr\Orb}}%
                   3684:     }$%
                   3685: }
                   3686: 
                   3687: % @textdegree - the normal degrees sign.
                   3688: %
1.2     ! snw      3689: \def\textdegree{%
        !          3690:    \ifmmode ^\circ
        !          3691:    \else {\tcfont \char 176}%
        !          3692:    \fi}
1.1       snw      3693: 
                   3694: % Laurent Siebenmann reports \Orb undefined with:
                   3695: %  Textures 1.7.7 (preloaded format=plain 93.10.14)  (68K)  16 APR 2004 02:38
                   3696: % so we'll define it if necessary.
                   3697: %
                   3698: \ifx\Orb\thisisundefined
                   3699: \def\Orb{\mathhexbox20D}
                   3700: \fi
                   3701: 
                   3702: % Quotes.
                   3703: \chardef\quoteleft=`\`
                   3704: \chardef\quoteright=`\'
                   3705: 
                   3706: % only change font for tt for correct kerning and to avoid using
                   3707: % \ecfont unless necessary.
                   3708: \def\quotedblleft{%
1.2     ! snw      3709:   \ifusingtt{{\ecfont\char"10}}{{\char"5C}}%
1.1       snw      3710: }
                   3711: 
                   3712: \def\quotedblright{%
1.2     ! snw      3713:   \ifusingtt{{\ecfont\char"11}}{{\char`\"}}%
1.1       snw      3714: }
                   3715: 
                   3716: 
                   3717: \message{page headings,}
                   3718: 
                   3719: \newskip\titlepagetopglue \titlepagetopglue = 1.5in
                   3720: \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
                   3721: 
                   3722: % First the title page.  Must do @settitle before @titlepage.
                   3723: \newif\ifseenauthor
                   3724: \newif\iffinishedtitlepage
                   3725: 
                   3726: % @setcontentsaftertitlepage used to do an implicit @contents or
                   3727: % @shortcontents after @end titlepage, but it is now obsolete.
                   3728: \def\setcontentsaftertitlepage{%
                   3729:   \errmessage{@setcontentsaftertitlepage has been removed as a Texinfo
                   3730:               command; move your @contents command if you want the contents
                   3731:               after the title page.}}%
                   3732: \def\setshortcontentsaftertitlepage{%
                   3733:   \errmessage{@setshortcontentsaftertitlepage has been removed as a Texinfo
                   3734:               command; move your @shortcontents and @contents commands if you
                   3735:               want the contents after the title page.}}%
                   3736: 
                   3737: \parseargdef\shorttitlepage{%
1.2     ! snw      3738:   {\headingsoff \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}%
        !          3739:   \endgroup\page\hbox{}\page}\pageone}
1.1       snw      3740: 
                   3741: \envdef\titlepage{%
                   3742:   % Open one extra group, as we want to close it in the middle of \Etitlepage.
                   3743:   \begingroup
                   3744:     \parindent=0pt \textfonts
1.2     ! snw      3745:     \headingsoff
1.1       snw      3746:     % Leave some space at the very top of the page.
                   3747:     \vglue\titlepagetopglue
                   3748:     % No rule at page bottom unless we print one at the top with @title.
                   3749:     \finishedtitlepagetrue
                   3750:     %
                   3751:     % Most title ``pages'' are actually two pages long, with space
                   3752:     % at the top of the second.  We don't want the ragged left on the second.
                   3753:     \let\oldpage = \page
                   3754:     \def\page{%
                   3755:       \iffinishedtitlepage\else
                   3756:         \finishtitlepage
                   3757:       \fi
                   3758:       \let\page = \oldpage
                   3759:       \page
                   3760:       \null
                   3761:     }%
                   3762: }
                   3763: 
                   3764: \def\Etitlepage{%
                   3765:     \iffinishedtitlepage\else
                   3766:        \finishtitlepage
                   3767:     \fi
                   3768:     % It is important to do the page break before ending the group,
                   3769:     % because the headline and footline are only empty inside the group.
                   3770:     % If we use the new definition of \page, we always get a blank page
                   3771:     % after the title page, which we certainly don't want.
                   3772:     \oldpage
1.2     ! snw      3773:     \pageone
1.1       snw      3774:   \endgroup
                   3775:   %
                   3776: }
                   3777: 
                   3778: \def\finishtitlepage{%
                   3779:   \vskip4pt \hrule height 2pt width \hsize
                   3780:   \vskip\titlepagebottomglue
                   3781:   \finishedtitlepagetrue
                   3782: }
                   3783: 
                   3784: % Settings used for typesetting titles: no hyphenation, no indentation,
                   3785: % don't worry much about spacing, ragged right.  This should be used
                   3786: % inside a \vbox, and fonts need to be set appropriately first. \par should
                   3787: % be specified before the end of the \vbox, since a vbox is a group.
                   3788: %
                   3789: \def\raggedtitlesettings{%
                   3790:   \rm
                   3791:   \hyphenpenalty=10000
                   3792:   \parindent=0pt
                   3793:   \tolerance=5000
                   3794:   \ptexraggedright
                   3795: }
                   3796: 
                   3797: % Macros to be used within @titlepage:
                   3798: 
                   3799: \let\subtitlerm=\rmfont
                   3800: \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}
                   3801: 
                   3802: \parseargdef\title{%
                   3803:   \checkenv\titlepage
                   3804:   \vbox{\titlefonts \raggedtitlesettings #1\par}%
                   3805:   % print a rule at the page bottom also.
                   3806:   \finishedtitlepagefalse
                   3807:   \vskip4pt \hrule height 4pt width \hsize \vskip4pt
                   3808: }
                   3809: 
                   3810: \parseargdef\subtitle{%
                   3811:   \checkenv\titlepage
                   3812:   {\subtitlefont \rightline{#1}}%
                   3813: }
                   3814: 
                   3815: % @author should come last, but may come many times.
                   3816: % It can also be used inside @quotation.
                   3817: %
                   3818: \parseargdef\author{%
                   3819:   \def\temp{\quotation}%
                   3820:   \ifx\thisenv\temp
                   3821:     \def\quotationauthor{#1}% printed in \Equotation.
                   3822:   \else
                   3823:     \checkenv\titlepage
                   3824:     \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi
                   3825:     {\secfonts\rm \leftline{#1}}%
                   3826:   \fi
                   3827: }
                   3828: 
                   3829: 
                   3830: % Set up page headings and footings.
                   3831: 
                   3832: \let\thispage=\folio
                   3833: 
                   3834: \newtoks\evenheadline    % headline on even pages
                   3835: \newtoks\oddheadline     % headline on odd pages
                   3836: \newtoks\evenchapheadline% headline on even pages with a new chapter
                   3837: \newtoks\oddchapheadline % headline on odd pages with a new chapter
                   3838: \newtoks\evenfootline    % footline on even pages
                   3839: \newtoks\oddfootline     % footline on odd pages
                   3840: 
                   3841: % Now make \makeheadline and \makefootline in Plain TeX use those variables
1.2     ! snw      3842: \headline={{\textfonts\rm\frenchspacingsetting
1.1       snw      3843:             \ifchapterpage
                   3844:               \ifodd\pageno\the\oddchapheadline\else\the\evenchapheadline\fi
                   3845:             \else
                   3846:               \ifodd\pageno\the\oddheadline\else\the\evenheadline\fi
                   3847:             \fi}}
                   3848: 
1.2     ! snw      3849: \footline={{\textfonts\rm\frenchspacingsetting
        !          3850:             \ifodd\pageno \the\oddfootline \else \the\evenfootline \fi}%
        !          3851:            \HEADINGShook}
1.1       snw      3852: \let\HEADINGShook=\relax
                   3853: 
                   3854: % Commands to set those variables.
                   3855: % For example, this is what  @headings on  does
                   3856: % @evenheading @thistitle|@thispage|@thischapter
                   3857: % @oddheading @thischapter|@thispage|@thistitle
                   3858: % @evenfooting @thisfile||
                   3859: % @oddfooting ||@thisfile
                   3860: 
                   3861: 
                   3862: \def\evenheading{\parsearg\evenheadingxxx}
                   3863: \def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish}
                   3864: \def\evenheadingyyy #1\|#2\|#3\|#4\finish{%
                   3865:   \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
                   3866:   \global\evenchapheadline=\evenheadline}
                   3867: 
                   3868: \def\oddheading{\parsearg\oddheadingxxx}
                   3869: \def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish}
                   3870: \def\oddheadingyyy #1\|#2\|#3\|#4\finish{%
                   3871:   \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}%
                   3872:   \global\oddchapheadline=\oddheadline}
                   3873: 
                   3874: \parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
                   3875: 
                   3876: \def\evenfooting{\parsearg\evenfootingxxx}
                   3877: \def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish}
                   3878: \def\evenfootingyyy #1\|#2\|#3\|#4\finish{%
                   3879: \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
                   3880: 
                   3881: \def\oddfooting{\parsearg\oddfootingxxx}
                   3882: \def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish}
                   3883: \def\oddfootingyyy #1\|#2\|#3\|#4\finish{%
                   3884:   \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
                   3885:   %
                   3886:   % Leave some space for the footline.  Hopefully ok to assume
                   3887:   % @evenfooting will not be used by itself.
                   3888:   \global\advance\txipageheight by -12pt
                   3889:   \global\advance\vsize by -12pt
                   3890: }
                   3891: 
                   3892: \parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}}
                   3893: 
                   3894: % @evenheadingmarks top     \thischapter <- chapter at the top of a page
                   3895: % @evenheadingmarks bottom  \thischapter <- chapter at the bottom of a page
                   3896: %
                   3897: % The same set of arguments for:
                   3898: %
                   3899: % @oddheadingmarks
                   3900: % @evenfootingmarks
                   3901: % @oddfootingmarks
                   3902: % @everyheadingmarks
                   3903: % @everyfootingmarks
                   3904: 
                   3905: % These define \getoddheadingmarks, \getevenheadingmarks,
                   3906: % \getoddfootingmarks, and \getevenfootingmarks, each to one of
                   3907: % \gettopheadingmarks, \getbottomheadingmarks.
                   3908: %
                   3909: \def\evenheadingmarks{\headingmarks{even}{heading}}
                   3910: \def\oddheadingmarks{\headingmarks{odd}{heading}}
                   3911: \def\evenfootingmarks{\headingmarks{even}{footing}}
                   3912: \def\oddfootingmarks{\headingmarks{odd}{footing}}
                   3913: \parseargdef\everyheadingmarks{\headingmarks{even}{heading}{#1}
                   3914:                           \headingmarks{odd}{heading}{#1} }
                   3915: \parseargdef\everyfootingmarks{\headingmarks{even}{footing}{#1}
                   3916:                           \headingmarks{odd}{footing}{#1} }
                   3917: % #1 = even/odd, #2 = heading/footing, #3 = top/bottom.
                   3918: \def\headingmarks#1#2#3 {%
                   3919:   \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname
                   3920:   \global\expandafter\let\csname get#1#2marks\endcsname \temp
                   3921: }
                   3922: 
                   3923: \everyheadingmarks bottom
                   3924: \everyfootingmarks bottom
                   3925: 
                   3926: % @headings double      turns headings on for double-sided printing.
                   3927: % @headings single      turns headings on for single-sided printing.
                   3928: % @headings off         turns them off.
                   3929: % @headings on          same as @headings double, retained for compatibility.
                   3930: % @headings after       turns on double-sided headings after this page.
                   3931: % @headings doubleafter turns on double-sided headings after this page.
                   3932: % @headings singleafter turns on single-sided headings after this page.
                   3933: % By default, they are off at the start of a document,
                   3934: % and turned `on' after @end titlepage.
                   3935: 
                   3936: \parseargdef\headings{\csname HEADINGS#1\endcsname}
                   3937: 
                   3938: \def\headingsoff{% non-global headings elimination
                   3939:   \evenheadline={\hfil}\evenfootline={\hfil}\evenchapheadline={\hfil}%
                   3940:    \oddheadline={\hfil}\oddfootline={\hfil}\oddchapheadline={\hfil}%
                   3941: }
                   3942: 
                   3943: \def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting
                   3944: 
1.2     ! snw      3945: % Set the page number to 1.
1.1       snw      3946: \def\pageone{
                   3947:   \global\pageno=1
                   3948:   \global\arabiccount = \pagecount
                   3949: }
                   3950: 
1.2     ! snw      3951: \let\contentsalignmacro = \chappager
        !          3952: 
        !          3953: % \def\HEADINGSon{\HEADINGSdouble} % defined by \CHAPPAGon
        !          3954: 
1.1       snw      3955: % For double-sided printing, put current file name in lower left corner,
                   3956: % chapter name on inside top of right hand pages, document
                   3957: % title on inside top of left hand pages, and page numbers on outside top
                   3958: % edge of all pages.
1.2     ! snw      3959: \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdouble}
        !          3960: \let\HEADINGSdoubleafter=\HEADINGSafter
1.1       snw      3961: \def\HEADINGSdouble{%
                   3962: \global\evenfootline={\hfil}
                   3963: \global\oddfootline={\hfil}
                   3964: \global\evenheadline={\line{\folio\hfil\thistitle}}
                   3965: \global\oddheadline={\line{\thischapter\hfil\folio}}
1.2     ! snw      3966: \global\evenchapheadline={\line{\folio\hfil\thistitle}}
1.1       snw      3967: \global\oddchapheadline={\line{\hfil\folio}}
                   3968: \global\let\contentsalignmacro = \chapoddpage
                   3969: }
                   3970: 
1.2     ! snw      3971: % For single-sided printing, chapter title goes across top left of page,
        !          3972: % page number on top right.
        !          3973: \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsingle}
        !          3974: \def\HEADINGSsingle{%
1.1       snw      3975: \global\evenfootline={\hfil}
                   3976: \global\oddfootline={\hfil}
                   3977: \global\evenheadline={\line{\thischapter\hfil\folio}}
                   3978: \global\oddheadline={\line{\thischapter\hfil\folio}}
                   3979: \global\evenchapheadline={\line{\hfil\folio}}
                   3980: \global\oddchapheadline={\line{\hfil\folio}}
                   3981: \global\let\contentsalignmacro = \chappager
                   3982: }
                   3983: 
                   3984: % for @setchapternewpage off
                   3985: \def\HEADINGSsinglechapoff{%
                   3986: \global\evenfootline={\hfil}
                   3987: \global\oddfootline={\hfil}
                   3988: \global\evenheadline={\line{\thischapter\hfil\folio}}
                   3989: \global\oddheadline={\line{\thischapter\hfil\folio}}
                   3990: \global\evenchapheadline=\evenheadline
                   3991: \global\oddchapheadline=\oddheadline
                   3992: \global\let\contentsalignmacro = \chappager
                   3993: }
                   3994: 
                   3995: % Subroutines used in generating headings
                   3996: % This produces Day Month Year style of output.
                   3997: % Only define if not already defined, in case a txi-??.tex file has set
                   3998: % up a different format (e.g., txi-cs.tex does this).
                   3999: \ifx\today\thisisundefined
                   4000: \def\today{%
                   4001:   \number\day\space
                   4002:   \ifcase\month
                   4003:   \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
                   4004:   \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
                   4005:   \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
                   4006:   \fi
                   4007:   \space\number\year}
                   4008: \fi
                   4009: 
                   4010: % @settitle line...  specifies the title of the document, for headings.
                   4011: % It generates no output of its own.
                   4012: \def\thistitle{\putwordNoTitle}
                   4013: \def\settitle{\parsearg{\gdef\thistitle}}
                   4014: 
                   4015: 
                   4016: \message{tables,}
                   4017: % Tables -- @table, @ftable, @vtable, @item(x).
                   4018: 
                   4019: % default indentation of table text
                   4020: \newdimen\tableindent \tableindent=.8in
                   4021: % default indentation of @itemize and @enumerate text
                   4022: \newdimen\itemindent  \itemindent=.3in
                   4023: % margin between end of table item and start of table text.
                   4024: \newdimen\itemmargin  \itemmargin=.1in
                   4025: 
                   4026: % used internally for \itemindent minus \itemmargin
                   4027: \newdimen\itemmax
                   4028: 
                   4029: % Note @table, @ftable, and @vtable define @item, @itemx, etc., with
                   4030: % these defs.
                   4031: % They also define \itemindex
                   4032: % to index the item name in whatever manner is desired (perhaps none).
                   4033: 
                   4034: \newif\ifitemxneedsnegativevskip
                   4035: 
                   4036: \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
                   4037: 
                   4038: \def\internalBitem{\smallbreak \parsearg\itemzzz}
                   4039: \def\internalBitemx{\itemxpar \parsearg\itemzzz}
                   4040: 
                   4041: \def\itemzzz #1{\begingroup %
                   4042:   \advance\hsize by -\rightskip
                   4043:   \advance\hsize by -\tableindent
                   4044:   \setbox0=\hbox{\itemindicate{#1}}%
                   4045:   \itemindex{#1}%
                   4046:   \nobreak % This prevents a break before @itemx.
                   4047:   %
                   4048:   % If the item text does not fit in the space we have, put it on a line
                   4049:   % by itself, and do not allow a page break either before or after that
                   4050:   % line.  We do not start a paragraph here because then if the next
                   4051:   % command is, e.g., @kindex, the whatsit would get put into the
                   4052:   % horizontal list on a line by itself, resulting in extra blank space.
                   4053:   \ifdim \wd0>\itemmax
                   4054:     %
                   4055:     % Make this a paragraph so we get the \parskip glue and wrapping,
                   4056:     % but leave it ragged-right.
                   4057:     \begingroup
                   4058:       \advance\leftskip by-\tableindent
                   4059:       \advance\hsize by\tableindent
                   4060:       \advance\rightskip by0pt plus1fil\relax
                   4061:       \leavevmode\unhbox0\par
                   4062:     \endgroup
                   4063:     %
                   4064:     % We're going to be starting a paragraph, but we don't want the
                   4065:     % \parskip glue -- logically it's part of the @item we just started.
                   4066:     \nobreak \vskip-\parskip
                   4067:     %
                   4068:     % Stop a page break at the \parskip glue coming up.  However, if
                   4069:     % what follows is an environment such as @example, there will be no
                   4070:     % \parskip glue; then the negative vskip we just inserted would
                   4071:     % cause the example and the item to crash together.  So we use this
                   4072:     % bizarre value of 10001 as a signal to \aboveenvbreak to insert
                   4073:     % \parskip glue after all.  Section titles are handled this way also.
                   4074:     %
                   4075:     \penalty 10001
                   4076:     \endgroup
                   4077:     \itemxneedsnegativevskipfalse
                   4078:   \else
                   4079:     % The item text fits into the space.  Start a paragraph, so that the
                   4080:     % following text (if any) will end up on the same line.
                   4081:     \noindent
                   4082:     % Do this with kerns and \unhbox so that if there is a footnote in
                   4083:     % the item text, it can migrate to the main vertical list and
                   4084:     % eventually be printed.
                   4085:     \nobreak\kern-\tableindent
                   4086:     \dimen0 = \itemmax  \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
                   4087:     \unhbox0
                   4088:     \nobreak\kern\dimen0
                   4089:     \endgroup
                   4090:     \itemxneedsnegativevskiptrue
                   4091:   \fi
                   4092: }
                   4093: 
                   4094: \def\item{\errmessage{@item while not in a list environment}}
                   4095: \def\itemx{\errmessage{@itemx while not in a list environment}}
                   4096: 
                   4097: % @table, @ftable, @vtable.
                   4098: \envdef\table{%
                   4099:   \let\itemindex\gobble
                   4100:   \tablecheck{table}%
                   4101: }
                   4102: \envdef\ftable{%
                   4103:   \def\itemindex ##1{\doind {fn}{\code{##1}}}%
                   4104:   \tablecheck{ftable}%
                   4105: }
                   4106: \envdef\vtable{%
                   4107:   \def\itemindex ##1{\doind {vr}{\code{##1}}}%
                   4108:   \tablecheck{vtable}%
                   4109: }
                   4110: \def\tablecheck#1{%
                   4111:   \ifnum \the\catcode`\^^M=\active
                   4112:     \endgroup
                   4113:     \errmessage{This command won't work in this context; perhaps the problem is
                   4114:       that we are \inenvironment\thisenv}%
                   4115:     \def\next{\doignore{#1}}%
                   4116:   \else
                   4117:     \let\next\tablex
                   4118:   \fi
                   4119:   \next
                   4120: }
                   4121: \def\tablex#1{%
                   4122:   \def\itemindicate{#1}%
                   4123:   \parsearg\tabley
                   4124: }
                   4125: \def\tabley#1{%
                   4126:   {%
                   4127:     \makevalueexpandable
                   4128:     \edef\temp{\noexpand\tablez #1\space\space\space}%
                   4129:     \expandafter
                   4130:   }\temp \endtablez
                   4131: }
                   4132: \def\tablez #1 #2 #3 #4\endtablez{%
                   4133:   \aboveenvbreak
                   4134:   \ifnum 0#1>0 \advance \leftskip by #1\mil \fi
                   4135:   \ifnum 0#2>0 \tableindent=#2\mil \fi
                   4136:   \ifnum 0#3>0 \advance \rightskip by #3\mil \fi
                   4137:   \itemmax=\tableindent
                   4138:   \advance \itemmax by -\itemmargin
                   4139:   \advance \leftskip by \tableindent
                   4140:   \exdentamount=\tableindent
                   4141:   \parindent = 0pt
                   4142:   \parskip = \smallskipamount
                   4143:   \ifdim \parskip=0pt \parskip=2pt \fi
                   4144:   \let\item = \internalBitem
                   4145:   \let\itemx = \internalBitemx
                   4146: }
                   4147: \def\Etable{\endgraf\afterenvbreak}
                   4148: \let\Eftable\Etable
                   4149: \let\Evtable\Etable
                   4150: \let\Eitemize\Etable
                   4151: \let\Eenumerate\Etable
                   4152: 
                   4153: % This is the counter used by @enumerate, which is really @itemize
                   4154: 
                   4155: \newcount \itemno
                   4156: 
                   4157: \envdef\itemize{\parsearg\doitemize}
                   4158: 
                   4159: \def\doitemize#1{%
                   4160:   \aboveenvbreak
                   4161:   \itemmax=\itemindent
                   4162:   \advance\itemmax by -\itemmargin
                   4163:   \advance\leftskip by \itemindent
                   4164:   \exdentamount=\itemindent
                   4165:   \parindent=0pt
                   4166:   \parskip=\smallskipamount
                   4167:   \ifdim\parskip=0pt \parskip=2pt \fi
                   4168:   %
                   4169:   % Try typesetting the item mark so that if the document erroneously says
                   4170:   % something like @itemize @samp (intending @table), there's an error
                   4171:   % right away at the @itemize.  It's not the best error message in the
                   4172:   % world, but it's better than leaving it to the @item.  This means if
                   4173:   % the user wants an empty mark, they have to say @w{} not just @w.
                   4174:   \def\itemcontents{#1}%
                   4175:   \setbox0 = \hbox{\itemcontents}%
                   4176:   %
                   4177:   % @itemize with no arg is equivalent to @itemize @bullet.
                   4178:   \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
                   4179:   %
                   4180:   \let\item=\itemizeitem
                   4181: }
                   4182: 
                   4183: % Definition of @item while inside @itemize and @enumerate.
                   4184: %
                   4185: \def\itemizeitem{%
                   4186:   \advance\itemno by 1  % for enumerations
                   4187:   {\let\par=\endgraf \smallbreak}% reasonable place to break
                   4188:   {%
                   4189:    % If the document has an @itemize directly after a section title, a
                   4190:    % \nobreak will be last on the list, and \sectionheading will have
                   4191:    % done a \vskip-\parskip.  In that case, we don't want to zero
                   4192:    % parskip, or the item text will crash with the heading.  On the
                   4193:    % other hand, when there is normal text preceding the item (as there
                   4194:    % usually is), we do want to zero parskip, or there would be too much
                   4195:    % space.  In that case, we won't have a \nobreak before.  At least
                   4196:    % that's the theory.
                   4197:    \ifnum\lastpenalty<10000 \parskip=0in \fi
                   4198:    \noindent
                   4199:    \hbox to 0pt{\hss \itemcontents \kern\itemmargin}%
                   4200:    %
                   4201:    \ifinner\else
                   4202:      \vadjust{\penalty 1200}% not good to break after first line of item.
                   4203:    \fi
                   4204:    % We can be in inner vertical mode in a footnote, although an
                   4205:    % @itemize looks awful there.
                   4206:   }%
                   4207:   \flushcr
                   4208: }
                   4209: 
                   4210: % \splitoff TOKENS\endmark defines \first to be the first token in
                   4211: % TOKENS, and \rest to be the remainder.
                   4212: %
                   4213: \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
                   4214: 
                   4215: % Allow an optional argument of an uppercase letter, lowercase letter,
                   4216: % or number, to specify the first label in the enumerated list.  No
                   4217: % argument is the same as `1'.
                   4218: %
                   4219: \envparseargdef\enumerate{\enumeratey #1  \endenumeratey}
                   4220: \def\enumeratey #1 #2\endenumeratey{%
                   4221:   % If we were given no argument, pretend we were given `1'.
                   4222:   \def\thearg{#1}%
                   4223:   \ifx\thearg\empty \def\thearg{1}\fi
                   4224:   %
                   4225:   % Detect if the argument is a single token.  If so, it might be a
                   4226:   % letter.  Otherwise, the only valid thing it can be is a number.
                   4227:   % (We will always have one token, because of the test we just made.
                   4228:   % This is a good thing, since \splitoff doesn't work given nothing at
                   4229:   % all -- the first parameter is undelimited.)
                   4230:   \expandafter\splitoff\thearg\endmark
                   4231:   \ifx\rest\empty
                   4232:     % Only one token in the argument.  It could still be anything.
                   4233:     % A ``lowercase letter'' is one whose \lccode is nonzero.
                   4234:     % An ``uppercase letter'' is one whose \lccode is both nonzero, and
                   4235:     %   not equal to itself.
                   4236:     % Otherwise, we assume it's a number.
                   4237:     %
                   4238:     % We need the \relax at the end of the \ifnum lines to stop TeX from
                   4239:     % continuing to look for a <number>.
                   4240:     %
                   4241:     \ifnum\lccode\expandafter`\thearg=0\relax
                   4242:       \numericenumerate % a number (we hope)
                   4243:     \else
                   4244:       % It's a letter.
                   4245:       \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
                   4246:         \lowercaseenumerate % lowercase letter
                   4247:       \else
                   4248:         \uppercaseenumerate % uppercase letter
                   4249:       \fi
                   4250:     \fi
                   4251:   \else
                   4252:     % Multiple tokens in the argument.  We hope it's a number.
                   4253:     \numericenumerate
                   4254:   \fi
                   4255: }
                   4256: 
                   4257: % An @enumerate whose labels are integers.  The starting integer is
                   4258: % given in \thearg.
                   4259: %
                   4260: \def\numericenumerate{%
                   4261:   \itemno = \thearg
                   4262:   \startenumeration{\the\itemno}%
                   4263: }
                   4264: 
                   4265: % The starting (lowercase) letter is in \thearg.
                   4266: \def\lowercaseenumerate{%
                   4267:   \itemno = \expandafter`\thearg
                   4268:   \startenumeration{%
                   4269:     % Be sure we're not beyond the end of the alphabet.
                   4270:     \ifnum\itemno=0
                   4271:       \errmessage{No more lowercase letters in @enumerate; get a bigger
                   4272:                   alphabet}%
                   4273:     \fi
                   4274:     \char\lccode\itemno
                   4275:   }%
                   4276: }
                   4277: 
                   4278: % The starting (uppercase) letter is in \thearg.
                   4279: \def\uppercaseenumerate{%
                   4280:   \itemno = \expandafter`\thearg
                   4281:   \startenumeration{%
                   4282:     % Be sure we're not beyond the end of the alphabet.
                   4283:     \ifnum\itemno=0
                   4284:       \errmessage{No more uppercase letters in @enumerate; get a bigger
                   4285:                   alphabet}
                   4286:     \fi
                   4287:     \char\uccode\itemno
                   4288:   }%
                   4289: }
                   4290: 
                   4291: % Call \doitemize, adding a period to the first argument and supplying the
                   4292: % common last two arguments.  Also subtract one from the initial value in
                   4293: % \itemno, since @item increments \itemno.
                   4294: %
                   4295: \def\startenumeration#1{%
                   4296:   \advance\itemno by -1
                   4297:   \doitemize{#1.}\flushcr
                   4298: }
                   4299: 
                   4300: 
                   4301: % @multitable macros
                   4302: 
                   4303: % Macros used to set up halign preamble:
                   4304: %
                   4305: \let\endsetuptable\relax
                   4306: \def\xendsetuptable{\endsetuptable}
                   4307: \let\columnfractions\relax
                   4308: \def\xcolumnfractions{\columnfractions}
                   4309: \newif\ifsetpercent
                   4310: 
                   4311: % #1 is the @columnfraction, usually a decimal number like .5, but might
                   4312: % be just 1.  We just use it, whatever it is.
                   4313: %
                   4314: \def\pickupwholefraction#1 {%
                   4315:   \global\advance\colcount by 1
                   4316:   \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}%
                   4317:   \setuptable
                   4318: }
                   4319: 
                   4320: \newcount\colcount
                   4321: \def\setuptable#1{%
                   4322:   \def\firstarg{#1}%
                   4323:   \ifx\firstarg\xendsetuptable
                   4324:     \let\go = \relax
                   4325:   \else
                   4326:     \ifx\firstarg\xcolumnfractions
                   4327:       \global\setpercenttrue
                   4328:     \else
                   4329:       \ifsetpercent
                   4330:          \let\go\pickupwholefraction
                   4331:       \else
                   4332:          \global\advance\colcount by 1
                   4333:          \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a
                   4334:                    % separator; typically that is always in the input, anyway.
                   4335:          \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
                   4336:       \fi
                   4337:     \fi
                   4338:     \ifx\go\pickupwholefraction
                   4339:       % Put the argument back for the \pickupwholefraction call, so
                   4340:       % we'll always have a period there to be parsed.
                   4341:       \def\go{\pickupwholefraction#1}%
                   4342:     \else
                   4343:       \let\go = \setuptable
                   4344:     \fi%
                   4345:   \fi
                   4346:   \go
                   4347: }
                   4348: 
                   4349: % @headitem starts a heading row, which we typeset in bold.  Assignments
                   4350: % have to be global since we are inside the implicit group of an
                   4351: % alignment entry.  \everycr below resets \everytab so we don't have to
                   4352: % undo it ourselves.
                   4353: \def\headitemfont{\b}% for people to use in the template row; not changeable
                   4354: \def\headitem{%
1.2     ! snw      4355:   \crcr % must appear first
1.1       snw      4356:   \gdef\headitemcrhook{\nobreak}% attempt to avoid page break after headings
                   4357:   \global\everytab={\bf}% can't use \headitemfont since the parsing differs
                   4358:   \the\everytab % for the first item
                   4359: }%
                   4360: %
                   4361: % default for tables with no headings.
                   4362: \let\headitemcrhook=\relax
                   4363: %
                   4364: \def\tab{\checkenv\multitable &\the\everytab}%
                   4365: 
                   4366: \newtoks\everytab  % insert after every tab.
                   4367: %
                   4368: \envdef\multitable{%
                   4369:   \vskip\parskip
                   4370:   \startsavinginserts
                   4371:   %
                   4372:   % @item within a multitable starts a normal row.
                   4373:   % We use \def instead of \let so that if one of the multitable entries
                   4374:   % contains an @itemize, we don't choke on the \item (seen as \crcr aka
                   4375:   % \endtemplate) expanding \doitemize.
                   4376:   \def\item{\crcr}%
                   4377:   %
                   4378:   \tolerance=9500
                   4379:   \hbadness=9500
                   4380:   \parskip=0pt
                   4381:   \parindent=6pt
                   4382:   \overfullrule=0pt
                   4383:   \global\colcount=0
                   4384:   %
                   4385:   \everycr = {%
                   4386:     \noalign{%
                   4387:       \global\everytab={}% Reset from possible headitem.
                   4388:       \global\colcount=0 % Reset the column counter.
                   4389:       %
                   4390:       % Check for saved footnotes, etc.:
                   4391:       \checkinserts
                   4392:       %
                   4393:       % Perhaps a \nobreak, then reset:
                   4394:       \headitemcrhook
                   4395:       \global\let\headitemcrhook=\relax
                   4396:     }%
                   4397:   }%
                   4398:   %
                   4399:   \parsearg\domultitable
                   4400: }
                   4401: \def\domultitable#1{%
                   4402:   % To parse everything between @multitable and @item:
                   4403:   \setuptable#1 \endsetuptable
                   4404:   %
                   4405:   % This preamble sets up a generic column definition, which will
                   4406:   % be used as many times as user calls for columns.
                   4407:   % \vtop will set a single line and will also let text wrap and
                   4408:   % continue for many paragraphs if desired.
                   4409:   \halign\bgroup &%
                   4410:     \global\advance\colcount by 1
                   4411:     \strut
                   4412:     \vtop{%
                   4413:       \advance\hsize by -1\leftskip
                   4414:       % Find the correct column width
                   4415:       \hsize=\expandafter\csname col\the\colcount\endcsname
                   4416:       %
1.2     ! snw      4417:       \advance\rightskip by -1\rightskip % Zero leaving only any stretch
1.1       snw      4418:       \ifnum\colcount=1
                   4419:         \advance\hsize by\leftskip % Add indent of surrounding text
                   4420:       \else
                   4421:         % In order to keep entries from bumping into each other.
                   4422:         \leftskip=12pt
                   4423:         \ifsetpercent \else
                   4424:           % If a template has been used
                   4425:           \advance\hsize by \leftskip
                   4426:         \fi
                   4427:       \fi
                   4428:       \noindent\ignorespaces##\unskip\strut
                   4429:     }\cr
                   4430: }
                   4431: \def\Emultitable{%
                   4432:   \crcr
                   4433:   \egroup % end the \halign
                   4434:   \global\setpercentfalse
                   4435: }
                   4436: 
                   4437: 
                   4438: \message{conditionals,}
                   4439: 
1.2     ! snw      4440: % @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotlatex, @ifnotplaintext,
1.1       snw      4441: % @ifnotxml always succeed.  They currently do nothing; we don't
                   4442: % attempt to check whether the conditionals are properly nested.  But we
                   4443: % have to remember that they are conditionals, so that @end doesn't
                   4444: % attempt to close an environment group.
                   4445: %
                   4446: \def\makecond#1{%
                   4447:   \expandafter\let\csname #1\endcsname = \relax
                   4448:   \expandafter\let\csname iscond.#1\endcsname = 1
                   4449: }
                   4450: \makecond{iftex}
                   4451: \makecond{ifnotdocbook}
                   4452: \makecond{ifnothtml}
                   4453: \makecond{ifnotinfo}
1.2     ! snw      4454: \makecond{ifnotlatex}
1.1       snw      4455: \makecond{ifnotplaintext}
                   4456: \makecond{ifnotxml}
                   4457: 
                   4458: % Ignore @ignore, @ifhtml, @ifinfo, and the like.
                   4459: %
                   4460: \def\direntry{\doignore{direntry}}
                   4461: \def\documentdescription{\doignore{documentdescription}}
                   4462: \def\docbook{\doignore{docbook}}
                   4463: \def\html{\doignore{html}}
                   4464: \def\ifdocbook{\doignore{ifdocbook}}
                   4465: \def\ifhtml{\doignore{ifhtml}}
                   4466: \def\ifinfo{\doignore{ifinfo}}
1.2     ! snw      4467: \def\iflatex{\doignore{iflatex}}
1.1       snw      4468: \def\ifnottex{\doignore{ifnottex}}
                   4469: \def\ifplaintext{\doignore{ifplaintext}}
                   4470: \def\ifxml{\doignore{ifxml}}
                   4471: \def\ignore{\doignore{ignore}}
1.2     ! snw      4472: \def\latex{\doignore{latex}}
1.1       snw      4473: \def\menu{\doignore{menu}}
                   4474: \def\xml{\doignore{xml}}
                   4475: 
                   4476: % Ignore text until a line `@end #1', keeping track of nested conditionals.
                   4477: %
                   4478: % A count to remember the depth of nesting.
                   4479: \newcount\doignorecount
                   4480: 
                   4481: \def\doignore#1{\begingroup
                   4482:   % Scan in ``verbatim'' mode:
                   4483:   \obeylines
                   4484:   \catcode`\@ = \other
                   4485:   \catcode`\{ = \other
                   4486:   \catcode`\} = \other
                   4487:   %
                   4488:   % Make sure that spaces turn into tokens that match what \doignoretext wants.
                   4489:   \spaceisspace
                   4490:   %
                   4491:   % Count number of #1's that we've seen.
                   4492:   \doignorecount = 0
                   4493:   %
                   4494:   % Swallow text until we reach the matching `@end #1'.
                   4495:   \dodoignore{#1}%
                   4496: }
                   4497: 
                   4498: { \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source.
                   4499:   \obeylines %
                   4500:   %
                   4501:   \gdef\dodoignore#1{%
                   4502:     % #1 contains the command name as a string, e.g., `ifinfo'.
                   4503:     %
                   4504:     % Define a command to find the next `@end #1'.
                   4505:     \long\def\doignoretext##1^^M@end #1{%
                   4506:       \doignoretextyyy##1^^M@#1\_STOP_}%
                   4507:     %
                   4508:     % And this command to find another #1 command, at the beginning of a
                   4509:     % line.  (Otherwise, we would consider a line `@c @ifset', for
                   4510:     % example, to count as an @ifset for nesting.)
                   4511:     \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}%
                   4512:     %
                   4513:     % And now expand that command.
                   4514:     \doignoretext ^^M%
                   4515:   }%
                   4516: }
                   4517: 
                   4518: \def\doignoreyyy#1{%
                   4519:   \def\temp{#1}%
                   4520:   \ifx\temp\empty                      % Nothing found.
                   4521:     \let\next\doignoretextzzz
                   4522:   \else                                        % Found a nested condition, ...
                   4523:     \advance\doignorecount by 1
                   4524:     \let\next\doignoretextyyy          % ..., look for another.
                   4525:     % If we're here, #1 ends with ^^M\ifinfo (for example).
                   4526:   \fi
                   4527:   \next #1% the token \_STOP_ is present just after this macro.
                   4528: }
                   4529: 
                   4530: % We have to swallow the remaining "\_STOP_".
                   4531: %
                   4532: \def\doignoretextzzz#1{%
                   4533:   \ifnum\doignorecount = 0     % We have just found the outermost @end.
                   4534:     \let\next\enddoignore
                   4535:   \else                                % Still inside a nested condition.
                   4536:     \advance\doignorecount by -1
                   4537:     \let\next\doignoretext      % Look for the next @end.
                   4538:   \fi
                   4539:   \next
                   4540: }
                   4541: 
                   4542: % Finish off ignored text.
                   4543: { \obeylines%
                   4544:   % Ignore anything after the last `@end #1'; this matters in verbatim
                   4545:   % environments, where otherwise the newline after an ignored conditional
                   4546:   % would result in a blank line in the output.
                   4547:   \gdef\enddoignore#1^^M{\endgroup\ignorespaces}%
                   4548: }
                   4549: 
                   4550: 
                   4551: % @set VAR sets the variable VAR to an empty value.
                   4552: % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
                   4553: %
                   4554: % Since we want to separate VAR from REST-OF-LINE (which might be
                   4555: % empty), we can't just use \parsearg; we have to insert a space of our
                   4556: % own to delimit the rest of the line, and then take it out again if we
                   4557: % didn't need it.
                   4558: % We rely on the fact that \parsearg sets \catcode`\ =10.
                   4559: %
                   4560: \parseargdef\set{\setyyy#1 \endsetyyy}
                   4561: \def\setyyy#1 #2\endsetyyy{%
                   4562:   {%
                   4563:     \makevalueexpandable
                   4564:     \def\temp{#2}%
                   4565:     \edef\next{\gdef\makecsname{SET#1}}%
                   4566:     \ifx\temp\empty
                   4567:       \next{}%
                   4568:     \else
                   4569:       \setzzz#2\endsetzzz
                   4570:     \fi
                   4571:   }%
                   4572: }
                   4573: % Remove the trailing space \setxxx inserted.
                   4574: \def\setzzz#1 \endsetzzz{\next{#1}}
                   4575: 
                   4576: % @clear VAR clears (i.e., unsets) the variable VAR.
                   4577: %
                   4578: \parseargdef\clear{%
                   4579:   {%
                   4580:     \makevalueexpandable
                   4581:     \global\expandafter\let\csname SET#1\endcsname=\relax
                   4582:   }%
                   4583: }
                   4584: 
                   4585: % @value{foo} gets the text saved in variable foo.
                   4586: \def\value{\begingroup\makevalueexpandable\valuexxx}
                   4587: \def\valuexxx#1{\expandablevalue{#1}\endgroup}
                   4588: {
                   4589:   \catcode`\-=\active \catcode`\_=\active
                   4590:   %
                   4591:   \gdef\makevalueexpandable{%
                   4592:     \let\value = \expandablevalue
                   4593:     % We don't want these characters active, ...
                   4594:     \catcode`\-=\other \catcode`\_=\other
                   4595:     % ..., but we might end up with active ones in the argument if
                   4596:     % we're called from @code, as @code{@value{foo-bar_}}, though.
                   4597:     % So \let them to their normal equivalents.
                   4598:     \let-\normaldash \let_\normalunderscore
                   4599:   }
                   4600: }
                   4601: 
                   4602: \def\expandablevalue#1{%
                   4603:   \expandafter\ifx\csname SET#1\endcsname\relax
                   4604:     {[No value for ``#1'']}%
                   4605:     \message{Variable `#1', used in @value, is not set.}%
                   4606:   \else
                   4607:     \csname SET#1\endcsname
                   4608:   \fi
                   4609: }
                   4610: 
                   4611: % Like \expandablevalue, but completely expandable (the \message in the
                   4612: % definition above operates at the execution level of TeX).  Used when
                   4613: % writing to auxiliary files, due to the expansion that \write does.
                   4614: % If flag is undefined, pass through an unexpanded @value command: maybe it
                   4615: % will be set by the time it is read back in.
                   4616: %
                   4617: % NB flag names containing - or _ may not work here.
                   4618: \def\dummyvalue#1{%
                   4619:   \expandafter\ifx\csname SET#1\endcsname\relax
                   4620:     \string\value{#1}%
                   4621:   \else
                   4622:     \csname SET#1\endcsname
                   4623:   \fi
                   4624: }
                   4625: 
                   4626: % Used for @value's in index entries to form the sort key: expand the @value
                   4627: % if possible, otherwise sort late.
                   4628: \def\indexnofontsvalue#1{%
                   4629:   \expandafter\ifx\csname SET#1\endcsname\relax
                   4630:     ZZZZZZZ%
                   4631:   \else
                   4632:     \csname SET#1\endcsname
                   4633:   \fi
                   4634: }
                   4635: 
                   4636: % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
                   4637: % with @set.
                   4638: %
                   4639: % To get the special treatment we need for `@end ifset,' we call
                   4640: % \makecond and then redefine.
                   4641: %
                   4642: \makecond{ifset}
                   4643: \def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}}
                   4644: \def\doifset#1#2{%
                   4645:   {%
                   4646:     \makevalueexpandable
                   4647:     \let\next=\empty
                   4648:     \expandafter\ifx\csname SET#2\endcsname\relax
                   4649:       #1% If not set, redefine \next.
                   4650:     \fi
                   4651:     \expandafter
                   4652:   }\next
                   4653: }
                   4654: \def\ifsetfail{\doignore{ifset}}
                   4655: 
                   4656: % @ifclear VAR ... @end executes the `...' iff VAR has never been
                   4657: % defined with @set, or has been undefined with @clear.
                   4658: %
                   4659: % The `\else' inside the `\doifset' parameter is a trick to reuse the
                   4660: % above code: if the variable is not set, do nothing, if it is set,
                   4661: % then redefine \next to \ifclearfail.
                   4662: %
                   4663: \makecond{ifclear}
                   4664: \def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}}
                   4665: \def\ifclearfail{\doignore{ifclear}}
                   4666: 
                   4667: % @ifcommandisdefined CMD ... @end executes the `...' if CMD (written
                   4668: % without the @) is in fact defined.  We can only feasibly check at the
                   4669: % TeX level, so something like `mathcode' is going to considered
                   4670: % defined even though it is not a Texinfo command.
                   4671: %
                   4672: \makecond{ifcommanddefined}
                   4673: \def\ifcommanddefined{\parsearg{\doifcmddefined{\let\next=\ifcmddefinedfail}}}
                   4674: %
                   4675: \def\doifcmddefined#1#2{{%
                   4676:     \makevalueexpandable
                   4677:     \let\next=\empty
                   4678:     \expandafter\ifx\csname #2\endcsname\relax
                   4679:       #1% If not defined, \let\next as above.
                   4680:     \fi
                   4681:     \expandafter
                   4682:   }\next
                   4683: }
                   4684: \def\ifcmddefinedfail{\doignore{ifcommanddefined}}
                   4685: 
                   4686: % @ifcommandnotdefined CMD ... handled similar to @ifclear above.
                   4687: \makecond{ifcommandnotdefined}
                   4688: \def\ifcommandnotdefined{%
                   4689:   \parsearg{\doifcmddefined{\else \let\next=\ifcmdnotdefinedfail}}}
                   4690: \def\ifcmdnotdefinedfail{\doignore{ifcommandnotdefined}}
                   4691: 
                   4692: % Set the `txicommandconditionals' variable, so documents have a way to
                   4693: % test if the @ifcommand...defined conditionals are available.
                   4694: \set txicommandconditionals
                   4695: 
                   4696: % @dircategory CATEGORY  -- specify a category of the dir file
                   4697: % which this file should belong to.  Ignore this in TeX.
                   4698: \let\dircategory=\comment
                   4699: 
                   4700: % @defininfoenclose.
                   4701: \let\definfoenclose=\comment
                   4702: 
                   4703: 
                   4704: \message{indexing,}
                   4705: % Index generation facilities
                   4706: 
                   4707: % Define \newwrite to be identical to plain tex's \newwrite
                   4708: % except not \outer, so it can be used within macros and \if's.
                   4709: \edef\newwrite{\makecsname{ptexnewwrite}}
                   4710: 
1.2     ! snw      4711: % \newindex {IX} defines an index named IX.
1.1       snw      4712: % It automatically defines \IXindex such that
                   4713: % \IXindex ...rest of line... puts an entry in the index IX.
                   4714: % It also defines \IXindfile to be the number of the output channel for
                   4715: % the file that accumulates this index.  The file's extension is IX.
                   4716: %
                   4717: \def\newindex#1{%
                   4718:   \expandafter\chardef\csname#1indfile\endcsname=0
                   4719:   \expandafter\xdef\csname#1index\endcsname{%     % Define @#1index
                   4720:     \noexpand\doindex{#1}}
                   4721: }
                   4722: 
                   4723: % @defindex foo  ==  \newindex{foo}
                   4724: %
                   4725: \def\defindex{\parsearg\newindex}
                   4726: 
                   4727: % Define @defcodeindex, like @defindex except put all entries in @code.
                   4728: %
                   4729: \def\defcodeindex{\parsearg\newcodeindex}
                   4730: %
                   4731: \def\newcodeindex#1{%
                   4732:   \expandafter\chardef\csname#1indfile\endcsname=0
                   4733:   \expandafter\xdef\csname#1index\endcsname{%
                   4734:     \noexpand\docodeindex{#1}}%
                   4735: }
                   4736: 
                   4737: % The default indices:
                   4738: \newindex{cp}%      concepts,
                   4739: \newcodeindex{fn}%  functions,
                   4740: \newcodeindex{vr}%  variables,
                   4741: \newcodeindex{tp}%  types,
                   4742: \newcodeindex{ky}%  keys
                   4743: \newcodeindex{pg}%  and programs.
                   4744: 
                   4745: 
                   4746: % @synindex foo bar    makes index foo feed into index bar.
                   4747: % Do this instead of @defindex foo if you don't want it as a separate index.
                   4748: %
                   4749: % @syncodeindex foo bar   similar, but put all entries made for index foo
                   4750: % inside @code.
                   4751: %
                   4752: \def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
                   4753: \def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}
                   4754: 
                   4755: % #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
                   4756: % #3 the target index (bar).
                   4757: \def\dosynindex#1#2#3{%
                   4758:   \requireopenindexfile{#3}%
                   4759:   % redefine \fooindfile:
                   4760:   \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
                   4761:   \expandafter\let\csname#2indfile\endcsname=\temp
                   4762:   % redefine \fooindex:
                   4763:   \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
                   4764: }
                   4765: 
                   4766: % Define \doindex, the driver for all index macros.
                   4767: % Argument #1 is generated by the calling \fooindex macro,
                   4768: % and it is the two-letter name of the index.
                   4769: 
                   4770: \def\doindex#1{\edef\indexname{#1}\parsearg\doindexxxx}
                   4771: \def\doindexxxx #1{\doind{\indexname}{#1}}
                   4772: 
                   4773: % like the previous two, but they put @code around the argument.
                   4774: \def\docodeindex#1{\edef\indexname{#1}\parsearg\docodeindexxxx}
                   4775: \def\docodeindexxxx #1{\docind{\indexname}{#1}}
                   4776: 
                   4777: 
                   4778: % \definedummyword defines \#1 as \string\#1\space, thus effectively
                   4779: % preventing its expansion.  This is used only for control words,
                   4780: % not control letters, because the \space would be incorrect for
                   4781: % control characters, but is needed to separate the control word
                   4782: % from whatever follows.
                   4783: %
                   4784: % These can be used both for control words that take an argument and
                   4785: % those that do not.  If it is followed by {arg} in the input, then
                   4786: % that will dutifully get written to the index (or wherever).
                   4787: %
                   4788: % For control letters, we have \definedummyletter, which omits the
                   4789: % space.
                   4790: %
                   4791: \def\definedummyword  #1{\def#1{\string#1\space}}%
                   4792: \def\definedummyletter#1{\def#1{\string#1}}%
                   4793: 
1.2     ! snw      4794: % Used for the aux, toc and index files to prevent expansion of Texinfo
        !          4795: % commands.  Most of the commands are controlled through the
        !          4796: % \ifdummies conditional.
1.1       snw      4797: %
1.2     ! snw      4798: \def\atdummies{%
        !          4799:   \dummiestrue
1.1       snw      4800:   %
1.2     ! snw      4801:   \definedummyletter\@%
        !          4802:   \definedummyletter\ %
        !          4803:   \definedummyletter\{%
        !          4804:   \definedummyletter\}%
        !          4805:   \definedummyletter\&%
1.1       snw      4806:   %
                   4807:   \definedummyletter\_%
                   4808:   \definedummyletter\-%
                   4809:   %
                   4810:   \definedummyword\subentry
                   4811:   %
                   4812:   % We want to disable all macros so that they are not expanded by \write.
1.2     ! snw      4813:   \let\commondummyword\definedummyword
1.1       snw      4814:   \macrolist
                   4815:   \let\value\dummyvalue
                   4816:   %
1.2     ! snw      4817:   \turnoffactive
1.1       snw      4818: }
                   4819: 
1.2     ! snw      4820: \newif\ifdummies
        !          4821: \newif\ifindexnofonts
        !          4822: 
        !          4823: \def\commondummyletter#1{%
        !          4824:   \expandafter\let\csname\string#1:impl\endcsname#1%
        !          4825:   \edef#1{%
        !          4826:     \noexpand\ifindexnofonts
        !          4827:       % empty expansion
        !          4828:     \noexpand\else
        !          4829:       \noexpand\ifdummies\string#1%
        !          4830:       \noexpand\else
        !          4831:         \noexpand\jumptwofi % dispose of the \fi
        !          4832:         \expandafter\noexpand\csname\string#1:impl\endcsname
        !          4833:       \noexpand\fi
        !          4834:     \noexpand\fi}%
        !          4835: }
        !          4836: 
        !          4837: \def\commondummyaccent#1{%
        !          4838:   \expandafter\let\csname\string#1:impl\endcsname#1%
        !          4839:   \edef#1{%
        !          4840:     \noexpand\ifindexnofonts
        !          4841:       \noexpand\expandafter % dispose of \else ... \fi
        !          4842:       \noexpand\asis
        !          4843:     \noexpand\else
        !          4844:       \noexpand\ifdummies\string#1%
        !          4845:       \noexpand\else
        !          4846:         \noexpand\jumptwofi % dispose of the \fi
        !          4847:         \expandafter\noexpand\csname\string#1:impl\endcsname
        !          4848:       \noexpand\fi
        !          4849:     \noexpand\fi}%
        !          4850: }
        !          4851: 
        !          4852: % Like \commondummyaccent but add a \space at the end of the dummy expansion
        !          4853: % #2 is the expansion used for \indexnofonts.  #2 is always followed by
        !          4854: % \asis to remove a pair of following braces.
        !          4855: \def\commondummyword#1#2{%
        !          4856:   \expandafter\let\csname\string#1:impl\endcsname#1%
        !          4857:   \expandafter\def\csname\string#1:ixnf\endcsname{#2\asis}%
        !          4858:   \edef#1{%
        !          4859:     \noexpand\ifindexnofonts
        !          4860:       \noexpand\expandafter % dispose of \else ... \fi
        !          4861:       \expandafter\noexpand\csname\string#1:ixnf\endcsname
        !          4862:     \noexpand\else
        !          4863:       \noexpand\ifdummies\string#1\space
        !          4864:       \noexpand\else
        !          4865:         \noexpand\jumptwofi % dispose of the \fi \fi
        !          4866:         \expandafter\noexpand\csname\string#1:impl\endcsname
        !          4867:       \noexpand\fi
        !          4868:     \noexpand\fi}%
        !          4869: }
        !          4870: \def\jumptwofi#1\fi\fi{\fi\fi#1}
        !          4871: 
        !          4872: % For \atdummies and \indexnofonts.  \atdummies sets
        !          4873: % \dummiestrue and \indexnofonts sets \indexnofontstrue.
        !          4874: \def\definedummies{
        !          4875:   % @-sign is always an escape character when reading auxiliary files
        !          4876:   \escapechar = `\@
        !          4877:   %
1.1       snw      4878:   \commondummyletter\!%
                   4879:   \commondummyaccent\"%
                   4880:   \commondummyaccent\'%
                   4881:   \commondummyletter\*%
                   4882:   \commondummyaccent\,%
                   4883:   \commondummyletter\.%
                   4884:   \commondummyletter\/%
                   4885:   \commondummyletter\:%
                   4886:   \commondummyaccent\=%
                   4887:   \commondummyletter\?%
                   4888:   \commondummyaccent\^%
                   4889:   \commondummyaccent\`%
                   4890:   \commondummyaccent\~%
1.2     ! snw      4891:   %
        !          4892:   % Control letters and accents.
        !          4893:   \commondummyword\u          {}%
        !          4894:   \commondummyword\v          {}%
        !          4895:   \commondummyword\H          {}%
        !          4896:   \commondummyword\dotaccent  {}%
        !          4897:   \commondummyword\ogonek     {}%
        !          4898:   \commondummyword\ringaccent {}%
        !          4899:   \commondummyword\tieaccent  {}%
        !          4900:   \commondummyword\ubaraccent {}%
        !          4901:   \commondummyword\udotaccent {}%
        !          4902:   \commondummyword\dotless    {}%
1.1       snw      4903:   %
                   4904:   % Texinfo font commands.
1.2     ! snw      4905:   \commondummyword\b          {}%
        !          4906:   \commondummyword\i          {}%
        !          4907:   \commondummyword\r          {}%
        !          4908:   \commondummyword\sansserif  {}%
        !          4909:   \commondummyword\sc         {}%
        !          4910:   \commondummyword\slanted    {}%
        !          4911:   \commondummyword\t          {}%
1.1       snw      4912:   %
                   4913:   % Commands that take arguments.
1.2     ! snw      4914:   \commondummyword\abbr       {}%
        !          4915:   \commondummyword\acronym    {}%
        !          4916:   \commondummyword\anchor     {}%
        !          4917:   \commondummyword\cite       {}%
        !          4918:   \commondummyword\code       {}%
        !          4919:   \commondummyword\command    {}%
        !          4920:   \commondummyword\dfn        {}%
        !          4921:   \commondummyword\dmn        {}%
        !          4922:   \commondummyword\email      {}%
        !          4923:   \commondummyword\emph       {}%
        !          4924:   \commondummyword\env        {}%
        !          4925:   \commondummyword\file       {}%
        !          4926:   \commondummyword\image      {}%
        !          4927:   \commondummyword\indicateurl{}%
        !          4928:   \commondummyword\inforef    {}%
        !          4929:   \commondummyword\kbd        {}%
        !          4930:   \commondummyword\key        {}%
        !          4931:   \commondummyword\link       {}%
        !          4932:   \commondummyword\math       {}%
        !          4933:   \commondummyword\option     {}%
        !          4934:   \commondummyword\pxref      {}%
        !          4935:   \commondummyword\ref        {}%
        !          4936:   \commondummyword\samp       {}%
        !          4937:   \commondummyword\strong     {}%
        !          4938:   \commondummyword\tie        {}%
        !          4939:   \commondummyword\U          {}%
        !          4940:   \commondummyword\uref       {}%
        !          4941:   \commondummyword\url        {}%
        !          4942:   \commondummyword\var        {}%
        !          4943:   \commondummyword\verb       {}%
        !          4944:   \commondummyword\w          {}%
        !          4945:   \commondummyword\xref       {}%
        !          4946:   %
        !          4947:   \commondummyword\AA               {AA}%
        !          4948:   \commondummyword\AE               {AE}%
        !          4949:   \commondummyword\DH               {DZZ}%
        !          4950:   \commondummyword\L                {L}%
        !          4951:   \commondummyword\O                {O}%
        !          4952:   \commondummyword\OE               {OE}%
        !          4953:   \commondummyword\TH               {TH}%
        !          4954:   \commondummyword\aa               {aa}%
        !          4955:   \commondummyword\ae               {ae}%
        !          4956:   \commondummyword\dh               {dzz}%
        !          4957:   \commondummyword\exclamdown       {!}%
        !          4958:   \commondummyword\l                {l}%
        !          4959:   \commondummyword\o                {o}%
        !          4960:   \commondummyword\oe               {oe}%
        !          4961:   \commondummyword\ordf             {a}%
        !          4962:   \commondummyword\ordm             {o}%
        !          4963:   \commondummyword\questiondown     {?}%
        !          4964:   \commondummyword\ss               {ss}%
        !          4965:   \commondummyword\th               {th}%
        !          4966:   %
        !          4967:   \commondummyword\LaTeX            {LaTeX}%
        !          4968:   \commondummyword\TeX              {TeX}%
        !          4969:   %
        !          4970:   % Assorted special characters.
        !          4971:   \commondummyword\ampchar          {\normalamp}%
        !          4972:   \commondummyword\atchar           {\@}%
        !          4973:   \commondummyword\arrow            {->}%
        !          4974:   \commondummyword\backslashchar    {\realbackslash}%
        !          4975:   \commondummyword\bullet           {bullet}%
        !          4976:   \commondummyword\comma            {,}%
        !          4977:   \commondummyword\copyright        {copyright}%
        !          4978:   \commondummyword\dots             {...}%
        !          4979:   \commondummyword\enddots          {...}%
        !          4980:   \commondummyword\entrybreak       {}%
        !          4981:   \commondummyword\equiv            {===}%
        !          4982:   \commondummyword\error            {error}%
        !          4983:   \commondummyword\euro             {euro}%
        !          4984:   \commondummyword\expansion        {==>}%
        !          4985:   \commondummyword\geq              {>=}%
        !          4986:   \commondummyword\guillemetleft    {<<}%
        !          4987:   \commondummyword\guillemetright   {>>}%
        !          4988:   \commondummyword\guilsinglleft    {<}%
        !          4989:   \commondummyword\guilsinglright   {>}%
        !          4990:   \commondummyword\lbracechar       {\{}%
        !          4991:   \commondummyword\leq              {<=}%
        !          4992:   \commondummyword\mathopsup        {sup}%
        !          4993:   \commondummyword\minus            {-}%
        !          4994:   \commondummyword\pounds           {pounds}%
        !          4995:   \commondummyword\point            {.}%
        !          4996:   \commondummyword\print            {-|}%
        !          4997:   \commondummyword\quotedblbase     {"}%
        !          4998:   \commondummyword\quotedblleft     {"}%
        !          4999:   \commondummyword\quotedblright    {"}%
        !          5000:   \commondummyword\quoteleft        {`}%
        !          5001:   \commondummyword\quoteright       {'}%
        !          5002:   \commondummyword\quotesinglbase   {,}%
        !          5003:   \commondummyword\rbracechar       {\}}%
        !          5004:   \commondummyword\registeredsymbol {R}%
        !          5005:   \commondummyword\result           {=>}%
        !          5006:   \commondummyword\sub              {}%
        !          5007:   \commondummyword\sup              {}%
        !          5008:   \commondummyword\textdegree       {o}%
1.1       snw      5009: }
                   5010: 
                   5011: \let\indexlbrace\relax
                   5012: \let\indexrbrace\relax
                   5013: \let\indexatchar\relax
                   5014: \let\indexbackslash\relax
                   5015: 
                   5016: {\catcode`\@=0
                   5017: \catcode`\\=13
                   5018:   @gdef@backslashdisappear{@def\{}}
                   5019: }
                   5020: 
                   5021: {
                   5022: \catcode`\<=13
                   5023: \catcode`\-=13
                   5024: \catcode`\`=13
                   5025:   \gdef\indexnonalnumdisappear{%
1.2     ! snw      5026:     \ifflagclear{txiindexlquoteignore}{}{%
1.1       snw      5027:       % @set txiindexlquoteignore makes us ignore left quotes in the sort term.
                   5028:       % (Introduced for FSFS 2nd ed.)
                   5029:       \let`=\empty
1.2     ! snw      5030:     }%
1.1       snw      5031:     %
1.2     ! snw      5032:     \ifflagclear{txiindexbackslashignore}{}{%
1.1       snw      5033:       \backslashdisappear
1.2     ! snw      5034:     }%
        !          5035:     \ifflagclear{txiindexhyphenignore}{}{%
1.1       snw      5036:       \def-{}%
1.2     ! snw      5037:     }%
        !          5038:     \ifflagclear{txiindexlessthanignore}{}{%
1.1       snw      5039:       \def<{}%
1.2     ! snw      5040:     }%
        !          5041:     \ifflagclear{txiindexatsignignore}{}{%
1.1       snw      5042:       \def\@{}%
1.2     ! snw      5043:     }%
1.1       snw      5044:   }
                   5045: 
                   5046:   \gdef\indexnonalnumreappear{%
                   5047:     \let-\normaldash
                   5048:     \let<\normalless
                   5049:   }
                   5050: }
                   5051: 
                   5052: 
                   5053: % \indexnofonts is used when outputting the strings to sort the index
                   5054: % by, and when constructing control sequence names.  It eliminates all
                   5055: % control sequences and just writes whatever the best ASCII sort string
                   5056: % would be for a given command (usually its argument).
                   5057: %
                   5058: \def\indexnofonts{%
1.2     ! snw      5059:   \indexnofontstrue
1.1       snw      5060:   %
                   5061:   \def\ { }%
                   5062:   \def\@{@}%
                   5063:   \def\_{\normalunderscore}%
                   5064:   \def\-{}% @- shouldn't affect sorting
                   5065:   %
                   5066:   \uccode`\1=`\{ \uppercase{\def\{{1}}%
                   5067:   \uccode`\1=`\} \uppercase{\def\}{1}}%
                   5068:   \let\lbracechar\{%
                   5069:   \let\rbracechar\}%
                   5070:   %
                   5071:   %
                   5072:   % We need to get rid of all macros, leaving only the arguments (if present).
                   5073:   % Of course this is not nearly correct, but it is the best we can do for now.
                   5074:   %
                   5075:   % Since macro invocations are followed by braces, we can just redefine them
                   5076:   % to take a single TeX argument.  The case of a macro invocation that
                   5077:   % goes to end-of-line is not handled.
                   5078:   %
1.2     ! snw      5079:   \def\commondummyword##1{\let##1\asis}%
1.1       snw      5080:   \macrolist
                   5081:   \let\value\indexnofontsvalue
                   5082: }
                   5083: 
                   5084: 
                   5085: 
                   5086: 
                   5087: % #1 is the index name, #2 is the entry text.
                   5088: \def\doind#1#2{%
                   5089:   \iflinks
                   5090:   {%
                   5091:     %
                   5092:     \requireopenindexfile{#1}%
                   5093:     \edef\writeto{\csname#1indfile\endcsname}%
                   5094:     %
                   5095:     \def\indextext{#2}%
                   5096:     \safewhatsit\doindwrite
                   5097:   }%
                   5098:   \fi
                   5099: }
                   5100: 
                   5101: % Same as \doind, but for code indices
                   5102: \def\docind#1#2{%
                   5103:   \iflinks
                   5104:   {%
                   5105:     %
                   5106:     \requireopenindexfile{#1}%
                   5107:     \edef\writeto{\csname#1indfile\endcsname}%
                   5108:     %
                   5109:     \def\indextext{#2}%
                   5110:     \safewhatsit\docindwrite
                   5111:   }%
                   5112:   \fi
                   5113: }
                   5114: 
                   5115: % Check if an index file has been opened, and if not, open it.
                   5116: \def\requireopenindexfile#1{%
                   5117: \ifnum\csname #1indfile\endcsname=0
                   5118:   \expandafter\newwrite \csname#1indfile\endcsname
                   5119:   \edef\suffix{#1}%
                   5120:   % A .fls suffix would conflict with the file extension for the output
                   5121:   % of -recorder, so use .f1s instead.
                   5122:   \ifx\suffix\indexisfl\def\suffix{f1}\fi
                   5123:   % Open the file
                   5124:   \immediate\openout\csname#1indfile\endcsname \jobname.\suffix
                   5125:   % Using \immediate above here prevents an object entering into the current
                   5126:   % box, which could confound checks such as those in \safewhatsit for
                   5127:   % preceding skips.
                   5128:   \typeout{Writing index file \jobname.\suffix}%
                   5129: \fi}
                   5130: \def\indexisfl{fl}
                   5131: 
                   5132: % Definition for writing index entry sort key.
                   5133: {
                   5134: \catcode`\-=13
                   5135: \gdef\indexwritesortas{%
                   5136:   \begingroup
                   5137:   \indexnonalnumreappear
                   5138:   \indexwritesortasxxx}
                   5139: \gdef\indexwritesortasxxx#1{%
                   5140:   \xdef\indexsortkey{#1}\endgroup}
                   5141: }
                   5142: 
                   5143: \def\indexwriteseealso#1{
                   5144:   \gdef\pagenumbertext{\string\seealso{#1}}%
                   5145: }
                   5146: \def\indexwriteseeentry#1{
                   5147:   \gdef\pagenumbertext{\string\seeentry{#1}}%
                   5148: }
                   5149: 
                   5150: % The default definitions
                   5151: \def\sortas#1{}%
                   5152: \def\seealso#1{\i{\putwordSeeAlso}\ #1}% for sorted index file only
                   5153: \def\putwordSeeAlso{See also}
                   5154: \def\seeentry#1{\i{\putwordSee}\ #1}% for sorted index file only
                   5155: 
                   5156: 
                   5157: % Given index entry text like "aaa @subentry bbb @sortas{ZZZ}":
                   5158: %   * Set \bracedtext to "{aaa}{bbb}"
                   5159: %   * Set \fullindexsortkey to "aaa @subentry ZZZ"
                   5160: %   * If @seealso occurs, set \pagenumbertext
                   5161: %
                   5162: \def\splitindexentry#1{%
                   5163:   \gdef\fullindexsortkey{}%
                   5164:   \xdef\bracedtext{}%
                   5165:   \def\sep{}%
                   5166:   \def\seealso##1{}%
                   5167:   \def\seeentry##1{}%
                   5168:   \expandafter\doindexsegment#1\subentry\finish\subentry
                   5169: }
                   5170: 
                   5171: % append the results from the next segment
                   5172: \def\doindexsegment#1\subentry{%
                   5173:   \def\segment{#1}%
                   5174:   \ifx\segment\isfinish
                   5175:   \else
                   5176:     %
                   5177:     % Fully expand the segment, throwing away any @sortas directives, and
                   5178:     % trim spaces.
                   5179:     \edef\trimmed{\segment}%
                   5180:     \edef\trimmed{\expandafter\eatspaces\expandafter{\trimmed}}%
                   5181:     \ifincodeindex
                   5182:       \edef\trimmed{\noexpand\code{\trimmed}}%
                   5183:     \fi
                   5184:     %
                   5185:     \xdef\bracedtext{\bracedtext{\trimmed}}%
                   5186:     %
                   5187:     % Get the string to sort by.  Process the segment with all
                   5188:     % font commands turned off.
                   5189:     \bgroup
                   5190:       \let\sortas\indexwritesortas
                   5191:       \let\seealso\indexwriteseealso
                   5192:       \let\seeentry\indexwriteseeentry
                   5193:       \indexnofonts
                   5194:       % The braces around the commands are recognized by texindex.
                   5195:       \def\lbracechar{{\string\indexlbrace}}%
                   5196:       \def\rbracechar{{\string\indexrbrace}}%
                   5197:       \let\{=\lbracechar
                   5198:       \let\}=\rbracechar
                   5199:       \def\@{{\string\indexatchar}}%
                   5200:       \def\atchar##1{\@}%
                   5201:       \def\backslashchar{{\string\indexbackslash}}%
                   5202:       \uccode`\~=`\\ \uppercase{\let~\backslashchar}%
                   5203:       %
                   5204:       \let\indexsortkey\empty
                   5205:       \global\let\pagenumbertext\empty
                   5206:       % Execute the segment and throw away the typeset output.  This executes
                   5207:       % any @sortas or @seealso commands in this segment.
                   5208:       \setbox\dummybox = \hbox{\segment}%
                   5209:       \ifx\indexsortkey\empty{%
                   5210:         \indexnonalnumdisappear
                   5211:         \xdef\trimmed{\segment}%
                   5212:         \xdef\trimmed{\expandafter\eatspaces\expandafter{\trimmed}}%
                   5213:         \xdef\indexsortkey{\trimmed}%
1.2     ! snw      5214:         \ifx\indexsortkey\empty
        !          5215:           \message{Empty index sort key near line \the\inputlineno}%
        !          5216:           \xdef\indexsortkey{ }%
        !          5217:         \fi
1.1       snw      5218:       }\fi
                   5219:       %
                   5220:       % Append to \fullindexsortkey.
                   5221:       \edef\tmp{\gdef\noexpand\fullindexsortkey{%
                   5222:                   \fullindexsortkey\sep\indexsortkey}}%
                   5223:       \tmp
                   5224:     \egroup
                   5225:     \def\sep{\subentry}%
                   5226:     %
                   5227:     \expandafter\doindexsegment
                   5228:   \fi
                   5229: }
                   5230: \def\isfinish{\finish}%
                   5231: \newbox\dummybox % used above
                   5232: 
                   5233: \let\subentry\relax
                   5234: 
                   5235: % Use \ instead of @ in index files.  To support old texi2dvi and texindex.
                   5236: % This works without changing the escape character used in the toc or aux
                   5237: % files because the index entries are fully expanded here, and \string uses
                   5238: % the current value of \escapechar.
                   5239: \def\escapeisbackslash{\escapechar=`\\}
                   5240: 
1.2     ! snw      5241: % Uncomment to use \ in index files by default.  Old texi2dvi (before 2019)
        !          5242: % didn't support @ as the escape character (as it checked for "\entry" in
        !          5243: % the files, and not "@entry").
        !          5244: %   In the future we can remove this flag and simplify the code for
        !          5245: % index files and backslashes, once the support is no longer likely to be
        !          5246: % useful.
1.1       snw      5247: %
1.2     ! snw      5248: % \set txiindexescapeisbackslash
1.1       snw      5249: 
                   5250: % Write the entry in \indextext to the index file.
                   5251: %
                   5252: 
                   5253: \newif\ifincodeindex
                   5254: \def\doindwrite{\incodeindexfalse\doindwritex}
                   5255: \def\docindwrite{\incodeindextrue\doindwritex}
                   5256: 
                   5257: \def\doindwritex{%
                   5258:   \maybemarginindex
                   5259:   %
                   5260:   \atdummies
                   5261:   %
1.2     ! snw      5262:   \ifflagclear{txiindexescapeisbackslash}{}{\escapeisbackslash}%
1.1       snw      5263:   %
                   5264:   % For texindex which always views { and } as separators.
                   5265:   \def\{{\lbracechar{}}%
                   5266:   \def\}{\rbracechar{}}%
                   5267:   \uccode`\~=`\\ \uppercase{\def~{\backslashchar{}}}%
                   5268:   %
                   5269:   % Split the entry into primary entry and any subentries, and get the index
                   5270:   % sort key.
                   5271:   \splitindexentry\indextext
                   5272:   %
                   5273:   % Set up the complete index entry, with both the sort key and
                   5274:   % the original text, including any font commands.  We write
                   5275:   % three arguments to \entry to the .?? file (four in the
                   5276:   % subentry case), texindex reduces to two when writing the .??s
                   5277:   % sorted result.
                   5278:   %
                   5279:   \edef\temp{%
                   5280:     \write\writeto{%
                   5281:       \string\entry{\fullindexsortkey}%
                   5282:         {\ifx\pagenumbertext\empty\noexpand\folio\else\pagenumbertext\fi}%
                   5283:         \bracedtext}%
                   5284:   }%
                   5285:   \temp
                   5286: }
                   5287: 
                   5288: % Put the index entry in the margin if desired (undocumented).
                   5289: \def\maybemarginindex{%
                   5290:   \ifx\SETmarginindex\relax\else
                   5291:     \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \relax\indextext}}%
                   5292:   \fi
                   5293: }
                   5294: \let\SETmarginindex=\relax
                   5295: 
                   5296: 
                   5297: % Take care of unwanted page breaks/skips around a whatsit:
                   5298: %
                   5299: % If a skip is the last thing on the list now, preserve it
                   5300: % by backing up by \lastskip, doing the \write, then inserting
                   5301: % the skip again.  Otherwise, the whatsit generated by the
                   5302: % \write or \pdfdest will make \lastskip zero.  The result is that
                   5303: % sequences like this:
                   5304: % @end defun
                   5305: % @tindex whatever
                   5306: % @defun ...
                   5307: % will have extra space inserted, because the \medbreak in the
                   5308: % start of the @defun won't see the skip inserted by the @end of
                   5309: % the previous defun.
                   5310: %
                   5311: % But don't do any of this if we're not in vertical mode.  We
                   5312: % don't want to do a \vskip and prematurely end a paragraph.
                   5313: %
                   5314: % Avoid page breaks due to these extra skips, too.
                   5315: %
                   5316: % But wait, there is a catch there:
                   5317: % We'll have to check whether \lastskip is zero skip.  \ifdim is not
                   5318: % sufficient for this purpose, as it ignores stretch and shrink parts
                   5319: % of the skip.  The only way seems to be to check the textual
                   5320: % representation of the skip.
                   5321: %
                   5322: % The following is almost like \def\zeroskipmacro{0.0pt} except that
                   5323: % the ``p'' and ``t'' characters have catcode \other, not 11 (letter).
                   5324: %
                   5325: \edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname}
                   5326: %
                   5327: \newskip\whatsitskip
                   5328: \newcount\whatsitpenalty
                   5329: %
                   5330: % ..., ready, GO:
                   5331: %
                   5332: \def\safewhatsit#1{\ifhmode
                   5333:   #1%
                   5334:  \else
                   5335:   % \lastskip and \lastpenalty cannot both be nonzero simultaneously.
                   5336:   \whatsitskip = \lastskip
                   5337:   \edef\lastskipmacro{\the\lastskip}%
                   5338:   \whatsitpenalty = \lastpenalty
                   5339:   %
                   5340:   % If \lastskip is nonzero, that means the last item was a
                   5341:   % skip.  And since a skip is discardable, that means this
                   5342:   % -\whatsitskip glue we're inserting is preceded by a
                   5343:   % non-discardable item, therefore it is not a potential
                   5344:   % breakpoint, therefore no \nobreak needed.
                   5345:   \ifx\lastskipmacro\zeroskipmacro
                   5346:   \else
                   5347:     \vskip-\whatsitskip
                   5348:   \fi
                   5349:   %
                   5350:   #1%
                   5351:   %
                   5352:   \ifx\lastskipmacro\zeroskipmacro
                   5353:     % If \lastskip was zero, perhaps the last item was a penalty, and
                   5354:     % perhaps it was >=10000, e.g., a \nobreak.  In that case, we want
                   5355:     % to re-insert the same penalty (values >10000 are used for various
                   5356:     % signals); since we just inserted a non-discardable item, any
                   5357:     % following glue (such as a \parskip) would be a breakpoint.  For example:
                   5358:     %   @deffn deffn-whatever
                   5359:     %   @vindex index-whatever
                   5360:     %   Description.
                   5361:     % would allow a break between the index-whatever whatsit
                   5362:     % and the "Description." paragraph.
                   5363:     \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi
                   5364:   \else
                   5365:     % On the other hand, if we had a nonzero \lastskip,
                   5366:     % this make-up glue would be preceded by a non-discardable item
                   5367:     % (the whatsit from the \write), so we must insert a \nobreak.
                   5368:     \nobreak\vskip\whatsitskip
                   5369:   \fi
                   5370: \fi}
                   5371: 
                   5372: % The index entry written in the file actually looks like
                   5373: %  \entry {sortstring}{page}{topic}
                   5374: % or
                   5375: %  \entry {sortstring}{page}{topic}{subtopic}
                   5376: % The texindex program reads in these files and writes files
                   5377: % containing these kinds of lines:
                   5378: %  \initial {c}
                   5379: %     before the first topic whose initial is c
                   5380: %  \entry {topic}{pagelist}
                   5381: %     for a topic that is used without subtopics
                   5382: %  \primary {topic}
                   5383: %  \entry {topic}{}
                   5384: %     for the beginning of a topic that is used with subtopics
                   5385: %  \secondary {subtopic}{pagelist}
                   5386: %     for each subtopic.
                   5387: %  \secondary {subtopic}{}
                   5388: %     for a subtopic with sub-subtopics
                   5389: %  \tertiary {subtopic}{subsubtopic}{pagelist}
                   5390: %     for each sub-subtopic.
                   5391: 
                   5392: % Define the user-accessible indexing commands
                   5393: % @findex, @vindex, @kindex, @cindex.
                   5394: 
                   5395: \def\findex {\fnindex}
                   5396: \def\kindex {\kyindex}
                   5397: \def\cindex {\cpindex}
                   5398: \def\vindex {\vrindex}
                   5399: \def\tindex {\tpindex}
                   5400: \def\pindex {\pgindex}
                   5401: 
                   5402: % Define the macros used in formatting output of the sorted index material.
                   5403: 
                   5404: % @printindex causes a particular index (the ??s file) to get printed.
                   5405: % It does not print any chapter heading (usually an @unnumbered).
                   5406: %
                   5407: \parseargdef\printindex{\begingroup
                   5408:   \dobreak \chapheadingskip{10000}%
                   5409:   %
                   5410:   \smallfonts \rm
                   5411:   \tolerance = 9500
                   5412:   \plainfrenchspacing
                   5413:   \everypar = {}% don't want the \kern\-parindent from indentation suppression.
                   5414:   %
                   5415:   % See comment in \requireopenindexfile.
                   5416:   \def\indexname{#1}\ifx\indexname\indexisfl\def\indexname{f1}\fi
                   5417:   %
                   5418:   % See if the index file exists and is nonempty.
                   5419:   \openin 1 \jobname.\indexname s
                   5420:   \ifeof 1
                   5421:     % \enddoublecolumns gets confused if there is no text in the index,
                   5422:     % and it loses the chapter title and the aux file entries for the
                   5423:     % index.  The easiest way to prevent this problem is to make sure
                   5424:     % there is some text.
                   5425:     \putwordIndexNonexistent
                   5426:     \typeout{No file \jobname.\indexname s.}%
                   5427:   \else
                   5428:     % If the index file exists but is empty, then \openin leaves \ifeof
                   5429:     % false.  We have to make TeX try to read something from the file, so
                   5430:     % it can discover if there is anything in it.
                   5431:     \read 1 to \thisline
                   5432:     \ifeof 1
                   5433:       \putwordIndexIsEmpty
                   5434:     \else
                   5435:       \expandafter\printindexzz\thisline\relax\relax\finish%
                   5436:     \fi
                   5437:   \fi
                   5438:   \closein 1
                   5439: \endgroup}
                   5440: 
                   5441: % If the index file starts with a backslash, forgo reading the index
                   5442: % file altogether.  If somebody upgrades texinfo.tex they may still have
                   5443: % old index files using \ as the escape character.  Reading this would
                   5444: % at best lead to typesetting garbage, at worst a TeX syntax error.
                   5445: \def\printindexzz#1#2\finish{%
1.2     ! snw      5446:   \ifflagclear{txiindexescapeisbackslash}{%
1.1       snw      5447:     \uccode`\~=`\\ \uppercase{\if\noexpand~}\noexpand#1
1.2     ! snw      5448:       \ifflagclear{txiskipindexfileswithbackslash}{%
1.1       snw      5449: \errmessage{%
                   5450: ERROR: A sorted index file in an obsolete format was skipped.
                   5451: To fix this problem, please upgrade your version of 'texi2dvi'
                   5452: or 'texi2pdf' to that at <https://ftp.gnu.org/gnu/texinfo>.
                   5453: If you are using an old version of 'texindex' (part of the Texinfo
                   5454: distribution), you may also need to upgrade to a newer version (at least 6.0).
                   5455: You may be able to typeset the index if you run
                   5456: 'texindex \jobname.\indexname' yourself.
                   5457: You could also try setting the 'txiindexescapeisbackslash' flag by
                   5458: running a command like
                   5459: 'texi2dvi -t "@set txiindexescapeisbackslash" \jobname.texi'.  If you do
                   5460: this, Texinfo will try to use index files in the old format.
                   5461: If you continue to have problems, deleting the index files and starting again
                   5462: might help (with 'rm \jobname.?? \jobname.??s')%
                   5463: }%
1.2     ! snw      5464:       }{%
1.1       snw      5465:         (Skipped sorted index file in obsolete format)
1.2     ! snw      5466:       }%
1.1       snw      5467:     \else
                   5468:       \begindoublecolumns
                   5469:       \input \jobname.\indexname s
                   5470:       \enddoublecolumns
                   5471:     \fi
1.2     ! snw      5472:   }{%
1.1       snw      5473:     \begindoublecolumns
                   5474:     \catcode`\\=0\relax
                   5475:     %
                   5476:     % Make @ an escape character to give macros a chance to work.  This
                   5477:     % should work because we (hopefully) don't otherwise use @ in index files.
                   5478:     %\catcode`\@=12\relax
                   5479:     \catcode`\@=0\relax
                   5480:     \input \jobname.\indexname s
                   5481:     \enddoublecolumns
1.2     ! snw      5482:   }%
1.1       snw      5483: }
                   5484: 
                   5485: % These macros are used by the sorted index file itself.
                   5486: % Change them to control the appearance of the index.
                   5487: 
                   5488: {\catcode`\/=13 \catcode`\-=13 \catcode`\^=13 \catcode`\~=13 \catcode`\_=13
                   5489: \catcode`\|=13 \catcode`\<=13 \catcode`\>=13 \catcode`\+=13 \catcode`\"=13
                   5490: \catcode`\$=3
                   5491: \gdef\initialglyphs{%
                   5492:   % special control sequences used in the index sort key
                   5493:   \let\indexlbrace\{%
                   5494:   \let\indexrbrace\}%
                   5495:   \let\indexatchar\@%
                   5496:   \def\indexbackslash{\math{\backslash}}%
                   5497:   %
                   5498:   % Some changes for non-alphabetic characters.  Using the glyphs from the
                   5499:   % math fonts looks more consistent than the typewriter font used elsewhere
                   5500:   % for these characters.
                   5501:   \uccode`\~=`\\ \uppercase{\def~{\math{\backslash}}}
                   5502:   %
                   5503:   % In case @\ is used for backslash
                   5504:   \uppercase{\let\\=~}
                   5505:   % Can't get bold backslash so don't use bold forward slash
                   5506:   \catcode`\/=13
                   5507:   \def/{{\secrmnotbold \normalslash}}%
                   5508:   \def-{{\normaldash\normaldash}}% en dash `--'
                   5509:   \def^{{\chapbf \normalcaret}}%
                   5510:   \def~{{\chapbf \normaltilde}}%
                   5511:   \def\_{%
                   5512:      \leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }%
                   5513:   \def|{$\vert$}%
                   5514:   \def<{$\less$}%
                   5515:   \def>{$\gtr$}%
                   5516:   \def+{$\normalplus$}%
                   5517: }}
                   5518: 
                   5519: \def\initial{%
                   5520:   \bgroup
                   5521:   \initialglyphs
                   5522:   \initialx
                   5523: }
                   5524: 
                   5525: \def\initialx#1{%
                   5526:   % Remove any glue we may have, we'll be inserting our own.
                   5527:   \removelastskip
                   5528:   %
                   5529:   % We like breaks before the index initials, so insert a bonus.
                   5530:   % The glue before the bonus allows a little bit of space at the
                   5531:   % bottom of a column to reduce an increase in inter-line spacing.
                   5532:   \nobreak
                   5533:   \vskip 0pt plus 5\baselineskip
                   5534:   \penalty -300
                   5535:   \vskip 0pt plus -5\baselineskip
                   5536:   %
                   5537:   % Typeset the initial.  Making this add up to a whole number of
                   5538:   % baselineskips increases the chance of the dots lining up from column
                   5539:   % to column.  It still won't often be perfect, because of the stretch
                   5540:   % we need before each entry, but it's better.
                   5541:   %
                   5542:   % No shrink because it confuses \balancecolumns.
                   5543:   \vskip 1.67\baselineskip plus 1\baselineskip
                   5544:   \leftline{\secfonts \kern-0.05em \secbf #1}%
                   5545:   % \secfonts is inside the argument of \leftline so that the change of
                   5546:   % \baselineskip will not affect any glue inserted before the vbox that
                   5547:   % \leftline creates.
                   5548:   % Do our best not to break after the initial.
                   5549:   \nobreak
                   5550:   \vskip .33\baselineskip plus .1\baselineskip
                   5551:   \egroup % \initialglyphs
                   5552: }
                   5553: 
                   5554: \newdimen\entryrightmargin
                   5555: \entryrightmargin=0pt
                   5556: 
1.2     ! snw      5557: % amount to indent subsequent lines in an entry when it spans more than
        !          5558: % one line.
        !          5559: \newdimen\entrycontskip
        !          5560: \entrycontskip=1em
        !          5561: 
        !          5562: % for PDF output, whether to make the text of the entry a link to the page
        !          5563: % number.  set for @contents and @shortcontents where there is only one
        !          5564: % page number.
        !          5565: \newif\iflinkentrytext
        !          5566: 
1.1       snw      5567: % \entry typesets a paragraph consisting of the text (#1), dot leaders, and
                   5568: % then page number (#2) flushed to the right margin.  It is used for index
                   5569: % and table of contents entries.  The paragraph is indented by \leftskip.
                   5570: %
                   5571: \def\entry{%
                   5572:   \begingroup
                   5573:     %
                   5574:     % Start a new paragraph if necessary, so our assignments below can't
                   5575:     % affect previous text.
                   5576:     \par
                   5577:     %
                   5578:     % No extra space above this paragraph.
                   5579:     \parskip = 0in
                   5580:     %
                   5581:     % When reading the text of entry, convert explicit line breaks
                   5582:     % from @* into spaces.  The user might give these in long section
                   5583:     % titles, for instance.
                   5584:     \def\*{\unskip\space\ignorespaces}%
                   5585:     \def\entrybreak{\hfil\break}% An undocumented command
                   5586:     %
                   5587:     % Swallow the left brace of the text (first parameter):
                   5588:     \afterassignment\doentry
                   5589:     \let\temp =
                   5590: }
                   5591: \def\entrybreak{\unskip\space\ignorespaces}%
                   5592: \def\doentry{%
1.2     ! snw      5593:     % Save the text of the entry in \boxA
1.1       snw      5594:     \global\setbox\boxA=\hbox\bgroup
                   5595:     \bgroup % Instead of the swallowed brace.
                   5596:       \noindent
                   5597:       \aftergroup\finishentry
                   5598:       % And now comes the text of the entry.
                   5599:       % Not absorbing as a macro argument reduces the chance of problems
                   5600:       % with catcodes occurring.
                   5601: }
                   5602: {\catcode`\@=11
1.2     ! snw      5603: % #1 is the page number
1.1       snw      5604: \gdef\finishentry#1{%
1.2     ! snw      5605:     \egroup % end \boxA
1.1       snw      5606:     \dimen@ = \wd\boxA % Length of text of entry
1.2     ! snw      5607:     % add any leaders and page number to \boxA.
1.1       snw      5608:     \global\setbox\boxA=\hbox\bgroup
1.2     ! snw      5609:       \ifpdforxetex
        !          5610:         \iflinkentrytext
        !          5611:           \pdflinkpage{#1}{\unhbox\boxA}%
        !          5612:         \else
        !          5613:           \unhbox\boxA
        !          5614:         \fi
        !          5615:       \else
        !          5616:         \unhbox\boxA
        !          5617:       \fi
1.1       snw      5618:       %
                   5619:       % Get the width of the page numbers, and only use
                   5620:       % leaders if they are present.
                   5621:       \global\setbox\boxB = \hbox{#1}%
                   5622:       \ifdim\wd\boxB = 0pt
                   5623:         \null\nobreak\hfill\ %
                   5624:       \else
                   5625:         %
                   5626:         \null\nobreak\indexdotfill % Have leaders before the page number.
                   5627:         %
                   5628:         \ifpdforxetex
                   5629:           \pdfgettoks#1.%
                   5630:           \hskip\skip\thinshrinkable\the\toksA
                   5631:         \else
                   5632:           \hskip\skip\thinshrinkable #1%
                   5633:         \fi
                   5634:       \fi
                   5635:     \egroup % end \boxA
1.2     ! snw      5636:     %
        !          5637:     % now output
1.1       snw      5638:     \ifdim\wd\boxB = 0pt
                   5639:       \noindent\unhbox\boxA\par
                   5640:       \nobreak
                   5641:     \else\bgroup
                   5642:       % We want the text of the entries to be aligned to the left, and the
                   5643:       % page numbers to be aligned to the right.
                   5644:       %
                   5645:       \parindent = 0pt
                   5646:       \advance\leftskip by 0pt plus 1fil
                   5647:       \advance\leftskip by 0pt plus -1fill
                   5648:       \rightskip = 0pt plus -1fil
                   5649:       \advance\rightskip by 0pt plus 1fill
                   5650:       % Cause last line, which could consist of page numbers on their own
                   5651:       % if the list of page numbers is long, to be aligned to the right.
                   5652:       \parfillskip=0pt plus -1fill
                   5653:       %
                   5654:       \advance\rightskip by \entryrightmargin
                   5655:       %
                   5656:       \dimen@ii = \hsize
                   5657:       \advance\dimen@ii by -1\leftskip
                   5658:       \advance\dimen@ii by -1\entryrightmargin
                   5659:       \ifdim\wd\boxA > \dimen@ii % If the entry doesn't fit in one line
                   5660:       \ifdim\dimen@ > 0.8\dimen@ii   % due to long index text
                   5661:         \advance\leftskip by 0pt plus 1fill % ragged right
                   5662:         %
                   5663:         % Indent all lines but the first one.
1.2     ! snw      5664:         \advance\leftskip by \entrycontskip
        !          5665:         \advance\parindent by -\entrycontskip
1.1       snw      5666:       \fi\fi
                   5667:       \indent % start paragraph
                   5668:       \unhbox\boxA
                   5669:       %
                   5670:       % Do not prefer a separate line ending with a hyphen to fewer lines.
                   5671:       \finalhyphendemerits = 0
                   5672:       %
                   5673:       % Word spacing - no stretch
                   5674:       \spaceskip=\fontdimen2\font minus \fontdimen4\font
                   5675:       %
                   5676:       \linepenalty=1000  % Discourage line breaks.
                   5677:       \hyphenpenalty=5000  % Discourage hyphenation.
                   5678:       %
                   5679:       \par % format the paragraph
                   5680:     \egroup % The \vbox
                   5681:     \fi
                   5682:   \endgroup
                   5683: }}
                   5684: 
                   5685: \newskip\thinshrinkable
                   5686: \skip\thinshrinkable=.15em minus .15em
                   5687: 
1.2     ! snw      5688: % Like plain.tex's \dotfill, except uses up at least 0.5 em.
1.1       snw      5689: % The filll stretch here overpowers both the fil and fill stretch to push
                   5690: % the page number to the right.
                   5691: \def\indexdotfill{\cleaders
1.2     ! snw      5692:   \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 0.5em plus 1filll}
1.1       snw      5693: 
                   5694: \def\primary #1{\line{#1\hfil}}
                   5695: 
                   5696: \def\secondary{\indententry{0.5cm}}
                   5697: \def\tertiary{\indententry{1cm}}
                   5698: 
                   5699: \def\indententry#1#2#3{%
                   5700:   \bgroup
                   5701:   \leftskip=#1
                   5702:   \entry{#2}{#3}%
                   5703:   \egroup
                   5704: }
                   5705: 
                   5706: % Define two-column mode, which we use to typeset indexes.
                   5707: % Adapted from the TeXbook, page 416, which is to say,
                   5708: % the manmac.tex format used to print the TeXbook itself.
                   5709: \catcode`\@=11  % private names
                   5710: 
                   5711: \newbox\partialpage
                   5712: \newdimen\doublecolumnhsize
                   5713: 
                   5714: \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
                   5715:   % If not much space left on page, start a new page.
                   5716:   \ifdim\pagetotal>0.8\vsize\vfill\eject\fi
                   5717:   %
                   5718:   % Grab any single-column material above us.
                   5719:   \output = {%
                   5720:     \savetopmark
                   5721:     %
                   5722:     \global\setbox\partialpage = \vbox{%
                   5723:       % Unvbox the main output page.
                   5724:       \unvbox\PAGE
                   5725:       \kern-\topskip \kern\baselineskip
                   5726:     }%
                   5727:   }%
                   5728:   \eject % run that output routine to set \partialpage
                   5729:   %
                   5730:   % Use the double-column output routine for subsequent pages.
                   5731:   \output = {\doublecolumnout}%
                   5732:   %
                   5733:   % Change the page size parameters.  We could do this once outside this
                   5734:   % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
                   5735:   % format, but then we repeat the same computation.  Repeating a couple
                   5736:   % of assignments once per index is clearly meaningless for the
                   5737:   % execution time, so we may as well do it in one place.
                   5738:   %
                   5739:   % First we halve the line length, less a little for the gutter between
                   5740:   % the columns.  We compute the gutter based on the line length, so it
                   5741:   % changes automatically with the paper format.  The magic constant
                   5742:   % below is chosen so that the gutter has the same value (well, +-<1pt)
                   5743:   % as it did when we hard-coded it.
                   5744:   %
1.2     ! snw      5745:   % We put the result in a separate register, \doublecolumnhsize, so we
1.1       snw      5746:   % can restore it in \pagesofar, after \hsize itself has (potentially)
                   5747:   % been clobbered.
                   5748:   %
                   5749:   \doublecolumnhsize = \hsize
                   5750:     \advance\doublecolumnhsize by -.04154\hsize
                   5751:     \divide\doublecolumnhsize by 2
                   5752:   \hsize = \doublecolumnhsize
                   5753:   %
                   5754:   % Get the available space for the double columns -- the normal
                   5755:   % (undoubled) page height minus any material left over from the
                   5756:   % previous page.
                   5757:   \advance\vsize by -\ht\partialpage
                   5758:   \vsize = 2\vsize
                   5759:   %
                   5760:   % For the benefit of balancing columns
                   5761:   \advance\baselineskip by 0pt plus 0.5pt
                   5762: }
                   5763: 
                   5764: % The double-column output routine for all double-column pages except
                   5765: % the last, which is done by \balancecolumns.
                   5766: %
                   5767: \def\doublecolumnout{%
                   5768:   %
                   5769:   \savetopmark
                   5770:   \splittopskip=\topskip \splitmaxdepth=\maxdepth
                   5771:   \dimen@ = \vsize
                   5772:   \divide\dimen@ by 2
                   5773:   %
                   5774:   % box0 will be the left-hand column, box2 the right.
                   5775:   \setbox0=\vsplit\PAGE to\dimen@ \setbox2=\vsplit\PAGE to\dimen@
                   5776:   \global\advance\vsize by 2\ht\partialpage
                   5777:   \onepageout\pagesofar % empty except for the first time we are called
                   5778:   \unvbox\PAGE
                   5779:   \penalty\outputpenalty
                   5780: }
                   5781: %
                   5782: % Re-output the contents of the output page -- any previous material,
                   5783: % followed by the two boxes we just split, in box0 and box2.
                   5784: \def\pagesofar{%
                   5785:   \unvbox\partialpage
                   5786:   %
                   5787:   \hsize = \doublecolumnhsize
                   5788:   \wd0=\hsize \wd2=\hsize
                   5789:   \hbox to\txipagewidth{\box0\hfil\box2}%
                   5790: }
                   5791: 
                   5792: 
                   5793: % Finished with double columns.
                   5794: \def\enddoublecolumns{%
                   5795:   % The following penalty ensures that the page builder is exercised
                   5796:   % _before_ we change the output routine.  This is necessary in the
                   5797:   % following situation:
                   5798:   %
                   5799:   % The last section of the index consists only of a single entry.
                   5800:   % Before this section, \pagetotal is less than \pagegoal, so no
                   5801:   % break occurs before the last section starts.  However, the last
                   5802:   % section, consisting of \initial and the single \entry, does not
                   5803:   % fit on the page and has to be broken off.  Without the following
                   5804:   % penalty the page builder will not be exercised until \eject
                   5805:   % below, and by that time we'll already have changed the output
                   5806:   % routine to the \balancecolumns version, so the next-to-last
                   5807:   % double-column page will be processed with \balancecolumns, which
                   5808:   % is wrong:  The two columns will go to the main vertical list, with
                   5809:   % the broken-off section in the recent contributions.  As soon as
                   5810:   % the output routine finishes, TeX starts reconsidering the page
                   5811:   % break.  The two columns and the broken-off section both fit on the
                   5812:   % page, because the two columns now take up only half of the page
                   5813:   % goal.  When TeX sees \eject from below which follows the final
                   5814:   % section, it invokes the new output routine that we've set after
                   5815:   % \balancecolumns below; \onepageout will try to fit the two columns
                   5816:   % and the final section into the vbox of \txipageheight (see
                   5817:   % \pagebody), causing an overfull box.
                   5818:   %
                   5819:   % Note that glue won't work here, because glue does not exercise the
                   5820:   % page builder, unlike penalties (see The TeXbook, pp. 280-281).
                   5821:   \penalty0
                   5822:   %
                   5823:   \output = {%
                   5824:     % Split the last of the double-column material.
                   5825:     \savetopmark
                   5826:     \balancecolumns
                   5827:   }%
                   5828:   \eject % call the \output just set
                   5829:   \ifdim\pagetotal=0pt
                   5830:     % Having called \balancecolumns once, we do not
                   5831:     % want to call it again.  Therefore, reset \output to its normal
                   5832:     % definition right away.
                   5833:     \global\output=\expandafter{\the\defaultoutput}
                   5834:     %
                   5835:     \endgroup % started in \begindoublecolumns
                   5836:     % Leave the double-column material on the current page, no automatic
                   5837:     % page break.
                   5838:     \box\balancedcolumns
                   5839:     %
                   5840:     % \pagegoal was set to the doubled \vsize above, since we restarted
                   5841:     % the current page.  We're now back to normal single-column
                   5842:     % typesetting, so reset \pagegoal to the normal \vsize.
                   5843:     \global\vsize = \txipageheight %
                   5844:     \pagegoal = \txipageheight %
                   5845:   \else
                   5846:     % We had some left-over material.  This might happen when \doublecolumnout
                   5847:     % is called in \balancecolumns.  Try again.
                   5848:     \expandafter\enddoublecolumns
                   5849:   \fi
                   5850: }
                   5851: \newbox\balancedcolumns
                   5852: \setbox\balancedcolumns=\vbox{shouldnt see this}%
                   5853: %
                   5854: % Only called for the last of the double column material.  \doublecolumnout
                   5855: % does the others.
                   5856: \def\balancecolumns{%
                   5857:   \setbox0 = \vbox{\unvbox\PAGE}% like \box255 but more efficient, see p.120.
                   5858:   \dimen@ = \ht0
                   5859:   \ifdim\dimen@<7\baselineskip
                   5860:     % Don't split a short final column in two.
                   5861:     \setbox2=\vbox{}%
                   5862:     \global\setbox\balancedcolumns=\vbox{\pagesofar}%
                   5863:   \else
                   5864:     % double the leading vertical space
                   5865:     \advance\dimen@ by \topskip
                   5866:     \advance\dimen@ by-\baselineskip
                   5867:     \divide\dimen@ by 2 % target to split to
                   5868:     \dimen@ii = \dimen@
                   5869:     \splittopskip = \topskip
                   5870:     % Loop until left column is at least as high as the right column.
                   5871:     {%
                   5872:       \vbadness = 10000
                   5873:       \loop
                   5874:         \global\setbox3 = \copy0
                   5875:         \global\setbox1 = \vsplit3 to \dimen@
                   5876:       \ifdim\ht1<\ht3
                   5877:         \global\advance\dimen@ by 1pt
                   5878:       \repeat
                   5879:     }%
                   5880:     % Now the left column is in box 1, and the right column in box 3.
                   5881:     %
                   5882:     % Check whether the left column has come out higher than the page itself.
                   5883:     % (Note that we have doubled \vsize for the double columns, so
                   5884:     % the actual height of the page is 0.5\vsize).
                   5885:     \ifdim2\ht1>\vsize
                   5886:       % It appears that we have been called upon to balance too much material.
                   5887:       % Output some of it with \doublecolumnout, leaving the rest on the page.
                   5888:       \setbox\PAGE=\box0
                   5889:       \doublecolumnout
                   5890:     \else
                   5891:       % Compare the heights of the two columns.
                   5892:       \ifdim4\ht1>5\ht3
                   5893:         % Column heights are too different, so don't make their bottoms
                   5894:         % flush with each other.
                   5895:         \setbox2=\vbox to \ht1 {\unvbox3\vfill}%
                   5896:         \setbox0=\vbox to \ht1 {\unvbox1\vfill}%
                   5897:       \else
                   5898:         % Make column bottoms flush with each other.
                   5899:         \setbox2=\vbox to\ht1{\unvbox3\unskip}%
                   5900:         \setbox0=\vbox to\ht1{\unvbox1\unskip}%
                   5901:       \fi
                   5902:       \global\setbox\balancedcolumns=\vbox{\pagesofar}%
                   5903:     \fi
                   5904:   \fi
                   5905:   %
                   5906: }
                   5907: \catcode`\@ = \other
                   5908: 
                   5909: 
                   5910: \message{sectioning,}
                   5911: % Chapters, sections, etc.
                   5912: 
                   5913: % Let's start with @part.
1.2     ! snw      5914: \parseargdef\part{\partzzz{#1}}
1.1       snw      5915: \def\partzzz#1{%
                   5916:   \chapoddpage
                   5917:   \null
                   5918:   \vskip.3\vsize  % move it down on the page a bit
                   5919:   \begingroup
                   5920:     \noindent \titlefonts\rm #1\par % the text
                   5921:     \let\lastnode=\empty      % no node to associate with
                   5922:     \writetocentry{part}{#1}{}% but put it in the toc
                   5923:     \headingsoff              % no headline or footline on the part page
                   5924:     % This outputs a mark at the end of the page that clears \thischapter
                   5925:     % and \thissection, as is done in \startcontents.
                   5926:     \let\pchapsepmacro\relax
                   5927:     \chapmacro{}{Yomitfromtoc}{}%
                   5928:     \chapoddpage
                   5929:   \endgroup
                   5930: }
                   5931: 
                   5932: % \unnumberedno is an oxymoron.  But we count the unnumbered
                   5933: % sections so that we can refer to them unambiguously in the pdf
                   5934: % outlines by their "section number".  We avoid collisions with chapter
                   5935: % numbers by starting them at 10000.  (If a document ever has 10000
                   5936: % chapters, we're in trouble anyway, I'm sure.)
                   5937: \newcount\unnumberedno \unnumberedno = 10000
                   5938: \newcount\chapno
                   5939: \newcount\secno        \secno=0
                   5940: \newcount\subsecno     \subsecno=0
                   5941: \newcount\subsubsecno  \subsubsecno=0
                   5942: 
                   5943: % This counter is funny since it counts through charcodes of letters A, B, ...
                   5944: \newcount\appendixno  \appendixno = `\@
                   5945: %
                   5946: % \def\appendixletter{\char\the\appendixno}
                   5947: % We do the following ugly conditional instead of the above simple
                   5948: % construct for the sake of pdftex, which needs the actual
                   5949: % letter in the expansion, not just typeset.
                   5950: %
                   5951: \def\appendixletter{%
                   5952:   \ifnum\appendixno=`A A%
                   5953:   \else\ifnum\appendixno=`B B%
                   5954:   \else\ifnum\appendixno=`C C%
                   5955:   \else\ifnum\appendixno=`D D%
                   5956:   \else\ifnum\appendixno=`E E%
                   5957:   \else\ifnum\appendixno=`F F%
                   5958:   \else\ifnum\appendixno=`G G%
                   5959:   \else\ifnum\appendixno=`H H%
                   5960:   \else\ifnum\appendixno=`I I%
                   5961:   \else\ifnum\appendixno=`J J%
                   5962:   \else\ifnum\appendixno=`K K%
                   5963:   \else\ifnum\appendixno=`L L%
                   5964:   \else\ifnum\appendixno=`M M%
                   5965:   \else\ifnum\appendixno=`N N%
                   5966:   \else\ifnum\appendixno=`O O%
                   5967:   \else\ifnum\appendixno=`P P%
                   5968:   \else\ifnum\appendixno=`Q Q%
                   5969:   \else\ifnum\appendixno=`R R%
                   5970:   \else\ifnum\appendixno=`S S%
                   5971:   \else\ifnum\appendixno=`T T%
                   5972:   \else\ifnum\appendixno=`U U%
                   5973:   \else\ifnum\appendixno=`V V%
                   5974:   \else\ifnum\appendixno=`W W%
                   5975:   \else\ifnum\appendixno=`X X%
                   5976:   \else\ifnum\appendixno=`Y Y%
                   5977:   \else\ifnum\appendixno=`Z Z%
                   5978:   % The \the is necessary, despite appearances, because \appendixletter is
                   5979:   % expanded while writing the .toc file.  \char\appendixno is not
                   5980:   % expandable, thus it is written literally, thus all appendixes come out
                   5981:   % with the same letter (or @) in the toc without it.
                   5982:   \else\char\the\appendixno
                   5983:   \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
                   5984:   \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
                   5985: 
                   5986: % Each @chapter defines these (using marks) as the number+name, number
                   5987: % and name of the chapter.  Page headings and footings can use
                   5988: % these.  @section does likewise.
                   5989: \def\thischapter{}
                   5990: \def\thischapternum{}
                   5991: \def\thischaptername{}
                   5992: \def\thissection{}
                   5993: \def\thissectionnum{}
                   5994: \def\thissectionname{}
                   5995: 
                   5996: \newcount\absseclevel % used to calculate proper heading level
                   5997: \newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count
                   5998: 
                   5999: % @raisesections: treat @section as chapter, @subsection as section, etc.
                   6000: \def\raisesections{\global\advance\secbase by -1}
                   6001: 
                   6002: % @lowersections: treat @chapter as section, @section as subsection, etc.
                   6003: \def\lowersections{\global\advance\secbase by 1}
                   6004: 
                   6005: % we only have subsub.
                   6006: \chardef\maxseclevel = 3
                   6007: %
                   6008: % A numbered section within an unnumbered changes to unnumbered too.
                   6009: % To achieve this, remember the "biggest" unnum. sec. we are currently in:
                   6010: \chardef\unnlevel = \maxseclevel
                   6011: %
                   6012: % Trace whether the current chapter is an appendix or not:
                   6013: % \chapheadtype is "N" or "A", unnumbered chapters are ignored.
                   6014: \def\chapheadtype{N}
                   6015: 
                   6016: % Choose a heading macro
                   6017: % #1 is heading type
                   6018: % #2 is heading level
                   6019: % #3 is text for heading
                   6020: \def\genhead#1#2#3{%
                   6021:   % Compute the abs. sec. level:
                   6022:   \absseclevel=#2
                   6023:   \advance\absseclevel by \secbase
                   6024:   % Make sure \absseclevel doesn't fall outside the range:
                   6025:   \ifnum \absseclevel < 0
                   6026:     \absseclevel = 0
                   6027:   \else
                   6028:     \ifnum \absseclevel > 3
                   6029:       \absseclevel = 3
                   6030:     \fi
                   6031:   \fi
                   6032:   % The heading type:
                   6033:   \def\headtype{#1}%
                   6034:   \if \headtype U%
                   6035:     \ifnum \absseclevel < \unnlevel
                   6036:       \chardef\unnlevel = \absseclevel
                   6037:     \fi
                   6038:   \else
                   6039:     % Check for appendix sections:
                   6040:     \ifnum \absseclevel = 0
                   6041:       \edef\chapheadtype{\headtype}%
                   6042:     \else
                   6043:       \if \headtype A\if \chapheadtype N%
                   6044:        \errmessage{@appendix... within a non-appendix chapter}%
                   6045:       \fi\fi
                   6046:     \fi
                   6047:     % Check for numbered within unnumbered:
                   6048:     \ifnum \absseclevel > \unnlevel
                   6049:       \def\headtype{U}%
                   6050:     \else
                   6051:       \chardef\unnlevel = 3
                   6052:     \fi
                   6053:   \fi
                   6054:   % Now print the heading:
                   6055:   \if \headtype U%
                   6056:     \ifcase\absseclevel
                   6057:        \unnumberedzzz{#3}%
                   6058:     \or \unnumberedseczzz{#3}%
                   6059:     \or \unnumberedsubseczzz{#3}%
                   6060:     \or \unnumberedsubsubseczzz{#3}%
                   6061:     \fi
                   6062:   \else
                   6063:     \if \headtype A%
                   6064:       \ifcase\absseclevel
                   6065:          \appendixzzz{#3}%
                   6066:       \or \appendixsectionzzz{#3}%
                   6067:       \or \appendixsubseczzz{#3}%
                   6068:       \or \appendixsubsubseczzz{#3}%
                   6069:       \fi
                   6070:     \else
                   6071:       \ifcase\absseclevel
                   6072:          \chapterzzz{#3}%
                   6073:       \or \seczzz{#3}%
                   6074:       \or \numberedsubseczzz{#3}%
                   6075:       \or \numberedsubsubseczzz{#3}%
                   6076:       \fi
                   6077:     \fi
                   6078:   \fi
                   6079:   \suppressfirstparagraphindent
                   6080: }
                   6081: 
                   6082: % an interface:
                   6083: \def\numhead{\genhead N}
                   6084: \def\apphead{\genhead A}
                   6085: \def\unnmhead{\genhead U}
                   6086: 
                   6087: % @chapter, @appendix, @unnumbered.  Increment top-level counter, reset
                   6088: % all lower-level sectioning counters to zero.
                   6089: %
                   6090: % Also set \chaplevelprefix, which we prepend to @float sequence numbers
                   6091: % (e.g., figures), q.v.  By default (before any chapter), that is empty.
                   6092: \let\chaplevelprefix = \empty
                   6093: %
                   6094: \outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz
                   6095: \def\chapterzzz#1{%
                   6096:   % section resetting is \global in case the chapter is in a group, such
                   6097:   % as an @include file.
                   6098:   \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
                   6099:     \global\advance\chapno by 1
                   6100:   %
                   6101:   % Used for \float.
                   6102:   \gdef\chaplevelprefix{\the\chapno.}%
                   6103:   \resetallfloatnos
                   6104:   %
                   6105:   % \putwordChapter can contain complex things in translations.
                   6106:   \toks0=\expandafter{\putwordChapter}%
                   6107:   \message{\the\toks0 \space \the\chapno}%
                   6108:   %
                   6109:   % Write the actual heading.
                   6110:   \chapmacro{#1}{Ynumbered}{\the\chapno}%
                   6111:   %
                   6112:   % So @section and the like are numbered underneath this chapter.
                   6113:   \global\let\section = \numberedsec
                   6114:   \global\let\subsection = \numberedsubsec
                   6115:   \global\let\subsubsection = \numberedsubsubsec
                   6116: }
                   6117: 
                   6118: \outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz
                   6119: %
                   6120: \def\appendixzzz#1{%
                   6121:   \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
                   6122:     \global\advance\appendixno by 1
                   6123:   \gdef\chaplevelprefix{\appendixletter.}%
                   6124:   \resetallfloatnos
                   6125:   %
                   6126:   % \putwordAppendix can contain complex things in translations.
                   6127:   \toks0=\expandafter{\putwordAppendix}%
                   6128:   \message{\the\toks0 \space \appendixletter}%
                   6129:   %
                   6130:   \chapmacro{#1}{Yappendix}{\appendixletter}%
                   6131:   %
                   6132:   \global\let\section = \appendixsec
                   6133:   \global\let\subsection = \appendixsubsec
                   6134:   \global\let\subsubsection = \appendixsubsubsec
                   6135: }
                   6136: 
                   6137: % normally unnmhead0 calls unnumberedzzz:
                   6138: \outer\parseargdef\unnumbered{\unnmhead0{#1}}
                   6139: \def\unnumberedzzz#1{%
1.2     ! snw      6140:   \global\advance\unnumberedno by 1
1.1       snw      6141:   %
                   6142:   % Since an unnumbered has no number, no prefix for figures.
                   6143:   \global\let\chaplevelprefix = \empty
                   6144:   \resetallfloatnos
                   6145:   %
                   6146:   % This used to be simply \message{#1}, but TeX fully expands the
                   6147:   % argument to \message.  Therefore, if #1 contained @-commands, TeX
                   6148:   % expanded them.  For example, in `@unnumbered The @cite{Book}', TeX
                   6149:   % expanded @cite (which turns out to cause errors because \cite is meant
                   6150:   % to be executed, not expanded).
                   6151:   %
                   6152:   % Anyway, we don't want the fully-expanded definition of @cite to appear
                   6153:   % as a result of the \message, we just want `@cite' itself.  We use
                   6154:   % \the<toks register> to achieve this: TeX expands \the<toks> only once,
                   6155:   % simply yielding the contents of <toks register>.  (We also do this for
                   6156:   % the toc entries.)
                   6157:   \toks0 = {#1}%
                   6158:   \message{(\the\toks0)}%
                   6159:   %
                   6160:   \chapmacro{#1}{Ynothing}{\the\unnumberedno}%
                   6161:   %
                   6162:   \global\let\section = \unnumberedsec
                   6163:   \global\let\subsection = \unnumberedsubsec
                   6164:   \global\let\subsubsection = \unnumberedsubsubsec
                   6165: }
                   6166: 
                   6167: % @centerchap is like @unnumbered, but the heading is centered.
                   6168: \outer\parseargdef\centerchap{%
                   6169:   \let\centerparametersmaybe = \centerparameters
                   6170:   \unnmhead0{#1}%
                   6171:   \let\centerparametersmaybe = \relax
                   6172: }
                   6173: 
                   6174: % @top is like @unnumbered.
                   6175: \let\top\unnumbered
                   6176: 
                   6177: % Sections.
                   6178: %
                   6179: \outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz
                   6180: \def\seczzz#1{%
                   6181:   \global\subsecno=0 \global\subsubsecno=0  \global\advance\secno by 1
                   6182:   \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}%
                   6183: }
                   6184: 
                   6185: % normally calls appendixsectionzzz:
                   6186: \outer\parseargdef\appendixsection{\apphead1{#1}}
                   6187: \def\appendixsectionzzz#1{%
                   6188:   \global\subsecno=0 \global\subsubsecno=0  \global\advance\secno by 1
                   6189:   \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}%
                   6190: }
                   6191: \let\appendixsec\appendixsection
                   6192: 
                   6193: % normally calls unnumberedseczzz:
                   6194: \outer\parseargdef\unnumberedsec{\unnmhead1{#1}}
                   6195: \def\unnumberedseczzz#1{%
1.2     ! snw      6196:   \global\advance\unnumberedno by 1
        !          6197:   \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno}%
1.1       snw      6198: }
                   6199: 
                   6200: % Subsections.
                   6201: %
                   6202: % normally calls numberedsubseczzz:
                   6203: \outer\parseargdef\numberedsubsec{\numhead2{#1}}
                   6204: \def\numberedsubseczzz#1{%
                   6205:   \global\subsubsecno=0  \global\advance\subsecno by 1
                   6206:   \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}%
                   6207: }
                   6208: 
                   6209: % normally calls appendixsubseczzz:
                   6210: \outer\parseargdef\appendixsubsec{\apphead2{#1}}
                   6211: \def\appendixsubseczzz#1{%
                   6212:   \global\subsubsecno=0  \global\advance\subsecno by 1
                   6213:   \sectionheading{#1}{subsec}{Yappendix}%
                   6214:                  {\appendixletter.\the\secno.\the\subsecno}%
                   6215: }
                   6216: 
                   6217: % normally calls unnumberedsubseczzz:
                   6218: \outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}}
                   6219: \def\unnumberedsubseczzz#1{%
1.2     ! snw      6220:   \global\advance\unnumberedno by 1
        !          6221:   \sectionheading{#1}{subsec}{Ynothing}{\the\unnumberedno}%
1.1       snw      6222: }
                   6223: 
                   6224: % Subsubsections.
                   6225: %
                   6226: % normally numberedsubsubseczzz:
                   6227: \outer\parseargdef\numberedsubsubsec{\numhead3{#1}}
                   6228: \def\numberedsubsubseczzz#1{%
                   6229:   \global\advance\subsubsecno by 1
                   6230:   \sectionheading{#1}{subsubsec}{Ynumbered}%
                   6231:                  {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}%
                   6232: }
                   6233: 
                   6234: % normally appendixsubsubseczzz:
                   6235: \outer\parseargdef\appendixsubsubsec{\apphead3{#1}}
                   6236: \def\appendixsubsubseczzz#1{%
                   6237:   \global\advance\subsubsecno by 1
                   6238:   \sectionheading{#1}{subsubsec}{Yappendix}%
                   6239:                  {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}%
                   6240: }
                   6241: 
                   6242: % normally unnumberedsubsubseczzz:
                   6243: \outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}}
                   6244: \def\unnumberedsubsubseczzz#1{%
1.2     ! snw      6245:   \global\advance\unnumberedno by 1
        !          6246:   \sectionheading{#1}{subsubsec}{Ynothing}{\the\unnumberedno}%
1.1       snw      6247: }
                   6248: 
                   6249: % These macros control what the section commands do, according
                   6250: % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
                   6251: % Define them by default for a numbered chapter.
                   6252: \let\section = \numberedsec
                   6253: \let\subsection = \numberedsubsec
                   6254: \let\subsubsection = \numberedsubsubsec
                   6255: 
                   6256: % Define @majorheading, @heading and @subheading
                   6257: 
                   6258: \def\majorheading{%
                   6259:   {\advance\chapheadingskip by 10pt \chapbreak }%
                   6260:   \parsearg\chapheadingzzz
                   6261: }
                   6262: 
                   6263: \def\chapheading{\chapbreak \parsearg\chapheadingzzz}
                   6264: \def\chapheadingzzz#1{%
                   6265:   \vbox{\chapfonts \raggedtitlesettings #1\par}%
                   6266:   \nobreak\bigskip \nobreak
                   6267:   \suppressfirstparagraphindent
                   6268: }
                   6269: 
                   6270: % @heading, @subheading, @subsubheading.
                   6271: \parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{}
                   6272:   \suppressfirstparagraphindent}
                   6273: \parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{}
                   6274:   \suppressfirstparagraphindent}
                   6275: \parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{}
                   6276:   \suppressfirstparagraphindent}
                   6277: 
                   6278: % These macros generate a chapter, section, etc. heading only
                   6279: % (including whitespace, linebreaking, etc. around it),
                   6280: % given all the information in convenient, parsed form.
                   6281: 
                   6282: % Args are the skip and penalty (usually negative)
                   6283: \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
                   6284: 
                   6285: % Parameter controlling skip before chapter headings (if needed)
                   6286: \newskip\chapheadingskip
                   6287: 
                   6288: % Define plain chapter starts, and page on/off switching for it.
                   6289: \def\chapbreak{\dobreak \chapheadingskip {-4000}}
                   6290: 
                   6291: % Start a new page
                   6292: \def\chappager{\par\vfill\supereject}
                   6293: 
                   6294: % \chapoddpage - start on an odd page for a new chapter
                   6295: % Because \domark is called before \chapoddpage, the filler page will
                   6296: % get the headings for the next chapter, which is wrong.  But we don't
                   6297: % care -- we just disable all headings on the filler page.
                   6298: \def\chapoddpage{%
                   6299:   \chappager
                   6300:   \ifodd\pageno \else
                   6301:     \begingroup
                   6302:       \headingsoff
                   6303:       \null
                   6304:       \chappager
                   6305:     \endgroup
                   6306:   \fi
                   6307: }
                   6308: 
1.2     ! snw      6309: \parseargdef\setchapternewpage{\csname CHAPPAG#1\endcsname\HEADINGSon}
1.1       snw      6310: 
                   6311: \def\CHAPPAGoff{%
                   6312: \global\let\contentsalignmacro = \chappager
                   6313: \global\let\pchapsepmacro=\chapbreak
                   6314: \global\def\HEADINGSon{\HEADINGSsinglechapoff}}
                   6315: 
                   6316: \def\CHAPPAGon{%
                   6317: \global\let\contentsalignmacro = \chappager
                   6318: \global\let\pchapsepmacro=\chappager
                   6319: \global\def\HEADINGSon{\HEADINGSsingle}}
                   6320: 
                   6321: \def\CHAPPAGodd{%
                   6322: \global\let\contentsalignmacro = \chapoddpage
                   6323: \global\let\pchapsepmacro=\chapoddpage
                   6324: \global\def\HEADINGSon{\HEADINGSdouble}}
                   6325: 
1.2     ! snw      6326: \setchapternewpage on
1.1       snw      6327: 
                   6328: % \chapmacro - Chapter opening.
                   6329: %
                   6330: % #1 is the text, #2 is the section type (Ynumbered, Ynothing,
                   6331: % Yappendix, Yomitfromtoc), #3 the chapter number.
                   6332: % Not used for @heading series.
                   6333: %
                   6334: % To test against our argument.
                   6335: \def\Ynothingkeyword{Ynothing}
                   6336: \def\Yappendixkeyword{Yappendix}
                   6337: \def\Yomitfromtockeyword{Yomitfromtoc}
                   6338: %
1.2     ! snw      6339: %
        !          6340: % Definitions for @thischapter. These can be overridden in translation
        !          6341: % files.
        !          6342: \def\thischapterAppendix{%
        !          6343:   \putwordAppendix{} \thischapternum: \thischaptername}
        !          6344: 
        !          6345: \def\thischapterChapter{%
        !          6346:   \putwordChapter{} \thischapternum: \thischaptername}
        !          6347: %
        !          6348: %
1.1       snw      6349: \def\chapmacro#1#2#3{%
                   6350:   \expandafter\ifx\thisenv\titlepage\else
                   6351:     \checkenv{}% chapters, etc., should not start inside an environment.
                   6352:   \fi
                   6353:   % Insert the first mark before the heading break (see notes for \domark).
                   6354:   \let\prevchapterdefs=\currentchapterdefs
                   6355:   \let\prevsectiondefs=\currentsectiondefs
                   6356:   \gdef\currentsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}%
                   6357:                         \gdef\thissection{}}%
                   6358:   %
                   6359:   \def\temptype{#2}%
                   6360:   \ifx\temptype\Ynothingkeyword
                   6361:     \gdef\currentchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
                   6362:                           \gdef\thischapter{\thischaptername}}%
                   6363:   \else\ifx\temptype\Yomitfromtockeyword
                   6364:     \gdef\currentchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
                   6365:                           \gdef\thischapter{}}%
                   6366:   \else\ifx\temptype\Yappendixkeyword
                   6367:     \toks0={#1}%
                   6368:     \xdef\currentchapterdefs{%
                   6369:       \gdef\noexpand\thischaptername{\the\toks0}%
                   6370:       \gdef\noexpand\thischapternum{\appendixletter}%
1.2     ! snw      6371:       \let\noexpand\thischapter\noexpand\thischapterAppendix
1.1       snw      6372:     }%
                   6373:   \else
                   6374:     \toks0={#1}%
                   6375:     \xdef\currentchapterdefs{%
                   6376:       \gdef\noexpand\thischaptername{\the\toks0}%
                   6377:       \gdef\noexpand\thischapternum{\the\chapno}%
1.2     ! snw      6378:       \let\noexpand\thischapter\noexpand\thischapterChapter
1.1       snw      6379:     }%
                   6380:   \fi\fi\fi
                   6381:   %
                   6382:   % Output the mark.  Pass it through \safewhatsit, to take care of
                   6383:   % the preceding space.
                   6384:   \safewhatsit\domark
                   6385:   %
                   6386:   % Insert the chapter heading break.
                   6387:   \pchapsepmacro
                   6388:   %
                   6389:   % Now the second mark, after the heading break.  No break points
                   6390:   % between here and the heading.
                   6391:   \let\prevchapterdefs=\currentchapterdefs
                   6392:   \let\prevsectiondefs=\currentsectiondefs
                   6393:   \domark
                   6394:   %
                   6395:   {%
                   6396:     \chapfonts \rm
                   6397:     \let\footnote=\errfootnoteheading % give better error message
                   6398:     %
                   6399:     % Have to define \currentsection before calling \donoderef, because the
                   6400:     % xref code eventually uses it.  On the other hand, it has to be called
                   6401:     % after \pchapsepmacro, or the headline will change too soon.
                   6402:     \gdef\currentsection{#1}%
                   6403:     %
                   6404:     % Only insert the separating space if we have a chapter/appendix
                   6405:     % number, and don't print the unnumbered ``number''.
                   6406:     \ifx\temptype\Ynothingkeyword
                   6407:       \setbox0 = \hbox{}%
                   6408:       \def\toctype{unnchap}%
                   6409:     \else\ifx\temptype\Yomitfromtockeyword
                   6410:       \setbox0 = \hbox{}% contents like unnumbered, but no toc entry
                   6411:       \def\toctype{omit}%
                   6412:     \else\ifx\temptype\Yappendixkeyword
                   6413:       \setbox0 = \hbox{\putwordAppendix{} #3\enspace}%
                   6414:       \def\toctype{app}%
                   6415:     \else
                   6416:       \setbox0 = \hbox{#3\enspace}%
                   6417:       \def\toctype{numchap}%
                   6418:     \fi\fi\fi
                   6419:     %
                   6420:     % Write the toc entry for this chapter.  Must come before the
                   6421:     % \donoderef, because we include the current node name in the toc
                   6422:     % entry, and \donoderef resets it to empty.
                   6423:     \writetocentry{\toctype}{#1}{#3}%
                   6424:     %
                   6425:     % For pdftex, we have to write out the node definition (aka, make
                   6426:     % the pdfdest) after any page break, but before the actual text has
                   6427:     % been typeset.  If the destination for the pdf outline is after the
                   6428:     % text, then jumping from the outline may wind up with the text not
                   6429:     % being visible, for instance under high magnification.
                   6430:     \donoderef{#2}%
                   6431:     %
                   6432:     % Typeset the actual heading.
                   6433:     \nobreak % Avoid page breaks at the interline glue.
                   6434:     \vbox{\raggedtitlesettings \hangindent=\wd0 \centerparametersmaybe
                   6435:           \unhbox0 #1\par}%
                   6436:   }%
                   6437:   \nobreak\bigskip % no page break after a chapter title
                   6438:   \nobreak
                   6439: }
                   6440: 
                   6441: % @centerchap -- centered and unnumbered.
                   6442: \let\centerparametersmaybe = \relax
                   6443: \def\centerparameters{%
                   6444:   \advance\rightskip by 3\rightskip
                   6445:   \leftskip = \rightskip
                   6446:   \parfillskip = 0pt
                   6447: }
                   6448: 
                   6449: 
                   6450: % Section titles.  These macros combine the section number parts and
                   6451: % call the generic \sectionheading to do the printing.
                   6452: %
                   6453: \newskip\secheadingskip
                   6454: \def\secheadingbreak{\dobreak \secheadingskip{-1000}}
                   6455: 
                   6456: % Subsection titles.
                   6457: \newskip\subsecheadingskip
                   6458: \def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}}
                   6459: 
                   6460: % Subsubsection titles.
                   6461: \def\subsubsecheadingskip{\subsecheadingskip}
                   6462: \def\subsubsecheadingbreak{\subsecheadingbreak}
                   6463: 
1.2     ! snw      6464: % Definition for @thissection. This can be overridden in translation
        !          6465: % files.
        !          6466: \def\thissectionDef{%
        !          6467:   \putwordSection{} \thissectionnum: \thissectionname}
        !          6468: %
        !          6469: 
1.1       snw      6470: 
                   6471: % Print any size, any type, section title.
                   6472: %
                   6473: % #1 is the text of the title,
                   6474: % #2 is the section level (sec/subsec/subsubsec),
                   6475: % #3 is the section type (Ynumbered, Ynothing, Yappendix, Yomitfromtoc),
                   6476: % #4 is the section number.
                   6477: %
                   6478: \def\seckeyword{sec}
                   6479: %
                   6480: \def\sectionheading#1#2#3#4{%
                   6481:   {%
                   6482:     \def\sectionlevel{#2}%
                   6483:     \def\temptype{#3}%
                   6484:     %
                   6485:     % It is ok for the @heading series commands to appear inside an
                   6486:     % environment (it's been historically allowed, though the logic is
                   6487:     % dubious), but not the others.
                   6488:     \ifx\temptype\Yomitfromtockeyword\else
                   6489:       \checkenv{}% non-@*heading should not be in an environment.
                   6490:     \fi
                   6491:     \let\footnote=\errfootnoteheading
                   6492:     %
                   6493:     % Switch to the right set of fonts.
                   6494:     \csname #2fonts\endcsname \rm
                   6495:     %
                   6496:     % Insert first mark before the heading break (see notes for \domark).
                   6497:     \let\prevsectiondefs=\currentsectiondefs
                   6498:     \ifx\temptype\Ynothingkeyword
                   6499:       \ifx\sectionlevel\seckeyword
                   6500:         \gdef\currentsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}%
                   6501:                               \gdef\thissection{\thissectionname}}%
                   6502:       \fi
                   6503:     \else\ifx\temptype\Yomitfromtockeyword
                   6504:       % Don't redefine \thissection.
                   6505:     \else\ifx\temptype\Yappendixkeyword
                   6506:       \ifx\sectionlevel\seckeyword
                   6507:         \toks0={#1}%
                   6508:         \xdef\currentsectiondefs{%
                   6509:           \gdef\noexpand\thissectionname{\the\toks0}%
                   6510:           \gdef\noexpand\thissectionnum{#4}%
1.2     ! snw      6511:           \let\noexpand\thissection\noexpand\thissectionDef
1.1       snw      6512:         }%
                   6513:       \fi
                   6514:     \else
                   6515:       \ifx\sectionlevel\seckeyword
                   6516:         \toks0={#1}%
                   6517:         \xdef\currentsectiondefs{%
                   6518:           \gdef\noexpand\thissectionname{\the\toks0}%
                   6519:           \gdef\noexpand\thissectionnum{#4}%
1.2     ! snw      6520:           \let\noexpand\thissection\noexpand\thissectionDef
1.1       snw      6521:         }%
                   6522:       \fi
                   6523:     \fi\fi\fi
                   6524:     %
                   6525:     % Go into vertical mode.  Usually we'll already be there, but we
                   6526:     % don't want the following whatsit to end up in a preceding paragraph
                   6527:     % if the document didn't happen to have a blank line.
                   6528:     \par
                   6529:     %
                   6530:     % Output the mark.  Pass it through \safewhatsit, to take care of
                   6531:     % the preceding space.
                   6532:     \safewhatsit\domark
                   6533:     %
                   6534:     % Insert space above the heading.
                   6535:     \csname #2headingbreak\endcsname
                   6536:     %
                   6537:     % Now the second mark, after the heading break.  No break points
                   6538:     % between here and the heading.
                   6539:     \global\let\prevsectiondefs=\currentsectiondefs
                   6540:     \domark
                   6541:     %
                   6542:     % Only insert the space after the number if we have a section number.
                   6543:     \ifx\temptype\Ynothingkeyword
                   6544:       \setbox0 = \hbox{}%
                   6545:       \def\toctype{unn}%
                   6546:       \gdef\currentsection{#1}%
                   6547:     \else\ifx\temptype\Yomitfromtockeyword
                   6548:       % for @headings -- no section number, don't include in toc,
                   6549:       % and don't redefine \currentsection.
                   6550:       \setbox0 = \hbox{}%
                   6551:       \def\toctype{omit}%
                   6552:       \let\sectionlevel=\empty
                   6553:     \else\ifx\temptype\Yappendixkeyword
                   6554:       \setbox0 = \hbox{#4\enspace}%
                   6555:       \def\toctype{app}%
                   6556:       \gdef\currentsection{#1}%
                   6557:     \else
                   6558:       \setbox0 = \hbox{#4\enspace}%
                   6559:       \def\toctype{num}%
                   6560:       \gdef\currentsection{#1}%
                   6561:     \fi\fi\fi
                   6562:     %
                   6563:     % Write the toc entry (before \donoderef).  See comments in \chapmacro.
                   6564:     \writetocentry{\toctype\sectionlevel}{#1}{#4}%
                   6565:     %
                   6566:     % Write the node reference (= pdf destination for pdftex).
                   6567:     % Again, see comments in \chapmacro.
                   6568:     \donoderef{#3}%
                   6569:     %
                   6570:     % Interline glue will be inserted when the vbox is completed.
                   6571:     % That glue will be a valid breakpoint for the page, since it'll be
                   6572:     % preceded by a whatsit (usually from the \donoderef, or from the
                   6573:     % \writetocentry if there was no node).  We don't want to allow that
                   6574:     % break, since then the whatsits could end up on page n while the
                   6575:     % section is on page n+1, thus toc/etc. are wrong.  Debian bug 276000.
                   6576:     \nobreak
                   6577:     %
                   6578:     % Output the actual section heading.
                   6579:     \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright
                   6580:           \hangindent=\wd0  % zero if no section number
                   6581:           \unhbox0 #1}%
                   6582:   }%
                   6583:   % Add extra space after the heading -- half of whatever came above it.
                   6584:   % Don't allow stretch, though.
                   6585:   \kern .5 \csname #2headingskip\endcsname
                   6586:   %
                   6587:   % Do not let the kern be a potential breakpoint, as it would be if it
                   6588:   % was followed by glue.
                   6589:   \nobreak
                   6590:   %
                   6591:   % We'll almost certainly start a paragraph next, so don't let that
                   6592:   % glue accumulate.  (Not a breakpoint because it's preceded by a
                   6593:   % discardable item.)  However, when a paragraph is not started next
                   6594:   % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out
                   6595:   % or the negative glue will cause weirdly wrong output, typically
                   6596:   % obscuring the section heading with something else.
                   6597:   \vskip-\parskip
                   6598:   %
                   6599:   % This is so the last item on the main vertical list is a known
                   6600:   % \penalty > 10000, so \startdefun, etc., can recognize the situation
                   6601:   % and do the needful.
                   6602:   \penalty 10001
                   6603: }
                   6604: 
                   6605: 
                   6606: \message{toc,}
                   6607: % Table of contents.
                   6608: \newwrite\tocfile
                   6609: 
                   6610: % Write an entry to the toc file, opening it if necessary.
                   6611: % Called from @chapter, etc.
                   6612: %
                   6613: % Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno}
                   6614: % We append the current node name (if any) and page number as additional
                   6615: % arguments for the \{chap,sec,...}entry macros which will eventually
                   6616: % read this.  The node name is used in the pdf outlines as the
                   6617: % destination to jump to.
                   6618: %
                   6619: % We open the .toc file for writing here instead of at @setfilename (or
                   6620: % any other fixed time) so that @contents can be anywhere in the document.
                   6621: % But if #1 is `omit', then we don't do anything.  This is used for the
                   6622: % table of contents chapter openings themselves.
                   6623: %
                   6624: \newif\iftocfileopened
                   6625: \def\omitkeyword{omit}%
                   6626: %
                   6627: \def\writetocentry#1#2#3{%
                   6628:   \edef\writetoctype{#1}%
                   6629:   \ifx\writetoctype\omitkeyword \else
                   6630:     \iftocfileopened\else
                   6631:       \immediate\openout\tocfile = \jobname.toc
                   6632:       \global\tocfileopenedtrue
                   6633:     \fi
                   6634:     %
                   6635:     \iflinks
                   6636:       {\atdummies
                   6637:        \edef\temp{%
                   6638:          \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}%
                   6639:        \temp
                   6640:       }%
                   6641:     \fi
                   6642:   \fi
                   6643:   %
                   6644:   % Tell \shipout to create a pdf destination on each page, if we're
                   6645:   % writing pdf.  These are used in the table of contents.  We can't
                   6646:   % just write one on every page because the title pages are numbered
                   6647:   % 1 and 2 (the page numbers aren't printed), and so are the first
                   6648:   % two pages of the document.  Thus, we'd have two destinations named
                   6649:   % `1', and two named `2'.
                   6650:   \ifpdforxetex
                   6651:     \global\pdfmakepagedesttrue
                   6652:   \fi
                   6653: }
                   6654: 
                   6655: 
                   6656: % These characters do not print properly in the Computer Modern roman
                   6657: % fonts, so we must take special care.  This is more or less redundant
                   6658: % with the Texinfo input format setup at the end of this file.
                   6659: %
                   6660: \def\activecatcodes{%
                   6661:   \catcode`\"=\active
                   6662:   \catcode`\$=\active
                   6663:   \catcode`\<=\active
                   6664:   \catcode`\>=\active
                   6665:   \catcode`\\=\active
                   6666:   \catcode`\^=\active
                   6667:   \catcode`\_=\active
                   6668:   \catcode`\|=\active
                   6669:   \catcode`\~=\active
                   6670: }
                   6671: 
                   6672: 
                   6673: % Read the toc file, which is essentially Texinfo input.
                   6674: \def\readtocfile{%
                   6675:   \setupdatafile
                   6676:   \activecatcodes
                   6677:   \input \tocreadfilename
                   6678: }
                   6679: 
1.2     ! snw      6680: % process toc file to find the maximum width of the section numbers for
        !          6681: % each chapter
        !          6682: \def\findsecnowidths{%
        !          6683:   \begingroup
        !          6684:   \setupdatafile
        !          6685:   \activecatcodes
        !          6686:   \secentryfonts
        !          6687:   % Redefinitions
        !          6688:   \def\numchapentry##1##2##3##4{%
        !          6689:     \def\curchapname{secnowidth-##2}%
        !          6690:     \curchapmax=0pt
        !          6691:   }%
        !          6692:   \let\appentry\numchapentry
        !          6693:   %
        !          6694:   \def\numsecentry##1##2##3##4{%
        !          6695:     \def\cursecname{secnowidth-##2}%
        !          6696:     \cursecmax=0pt
        !          6697:     %
        !          6698:     \setbox0=\hbox{##2}%
        !          6699:     \ifdim\wd0>\curchapmax
        !          6700:       \curchapmax=\wd0
        !          6701:       \expandafter\xdef\csname\curchapname\endcsname{\the\wd0}%
        !          6702:     \fi
        !          6703:   }%
        !          6704:   \let\appsecentry\numsecentry
        !          6705:   %
        !          6706:   \def\numsubsecentry##1##2##3##4{%
        !          6707:     \def\curssecname{secnowidth-##2}%
        !          6708:     \curssecmax=0pt
        !          6709:     %
        !          6710:     \setbox0=\hbox{##2}%
        !          6711:     \ifdim\wd0>\cursecmax
        !          6712:       \cursecmax=\wd0
        !          6713:       \expandafter\xdef\csname\cursecname\endcsname{\the\wd0}%
        !          6714:     \fi
        !          6715:   }%
        !          6716:   \let\appsubsecentry\numsubsecentry
        !          6717:   %
        !          6718:   \def\numsubsubsecentry##1##2##3##4{%
        !          6719:     \setbox0=\hbox{##2}%
        !          6720:     \ifdim\wd0>\curssecmax
        !          6721:       \curssecmax=\wd0
        !          6722:       \expandafter\xdef\csname\curssecname\endcsname{\the\wd0}%
        !          6723:     \fi
        !          6724:   }%
        !          6725:   \let\appsubsubsecentry\numsubsubsecentry
        !          6726:   %
        !          6727:   % Discard any output by outputting to dummy vbox, in case the toc file
        !          6728:   % contains macros that we have not redefined above.
        !          6729:   \setbox\dummybox\vbox\bgroup
        !          6730:     \input \tocreadfilename\relax
        !          6731:   \egroup
        !          6732:   \endgroup
        !          6733: }
        !          6734: \newdimen\curchapmax
        !          6735: \newdimen\cursecmax
        !          6736: \newdimen\curssecmax
        !          6737: 
        !          6738: 
        !          6739: % set #1 to the maximum section width for #2
        !          6740: \def\retrievesecnowidth#1#2{%
        !          6741:   \expandafter\let\expandafter\savedsecnowidth \csname secnowidth-#2\endcsname
        !          6742:   \ifx\savedsecnowidth\relax
        !          6743:     #1=0pt
        !          6744:   \else
        !          6745:     #1=\savedsecnowidth
        !          6746:   \fi
        !          6747: }
        !          6748: \newdimen\secnowidthchap
        !          6749: \secnowidthchap=0pt
        !          6750: \newdimen\secnowidthsec
        !          6751: \secnowidthsec=0pt
        !          6752: \newdimen\secnowidthssec
        !          6753: \secnowidthssec=0pt
        !          6754: 
        !          6755: 
1.1       snw      6756: \newskip\contentsrightmargin \contentsrightmargin=1in
                   6757: \newcount\savepageno
                   6758: \newcount\lastnegativepageno \lastnegativepageno = -1
                   6759: 
                   6760: % Prepare to read what we've written to \tocfile.
                   6761: %
                   6762: \def\startcontents#1{%
                   6763:   % If @setchapternewpage on, and @headings double, the contents should
                   6764:   % start on an odd page, unlike chapters.
                   6765:   \contentsalignmacro
                   6766:   \immediate\closeout\tocfile
                   6767:   %
                   6768:   % Don't need to put `Contents' or `Short Contents' in the headline.
                   6769:   % It is abundantly clear what they are.
                   6770:   \chapmacro{#1}{Yomitfromtoc}{}%
                   6771:   %
                   6772:   \savepageno = \pageno
                   6773:   \begingroup                  % Set up to handle contents files properly.
                   6774:     \raggedbottom              % Worry more about breakpoints than the bottom.
                   6775:     \entryrightmargin=\contentsrightmargin % Don't use the full line length.
                   6776:     %
                   6777:     % Roman numerals for page numbers.
                   6778:     \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
                   6779:     \def\thistitle{}% no title in double-sided headings
                   6780:     % Record where the Roman numerals started.
                   6781:     \ifnum\romancount=0 \global\romancount=\pagecount \fi
1.2     ! snw      6782:     \linkentrytexttrue
1.1       snw      6783: }
                   6784: 
1.2     ! snw      6785: % \raggedbottom in plain.tex hardcodes \topskip so override it
        !          6786: \catcode`\@=11
        !          6787: \def\raggedbottom{\advance\topskip by 0pt plus60pt \r@ggedbottomtrue}
        !          6788: \catcode`\@=\other
        !          6789: 
1.1       snw      6790: % redefined for the two-volume lispref.  We always output on
                   6791: % \jobname.toc even if this is redefined.
                   6792: %
                   6793: \def\tocreadfilename{\jobname.toc}
                   6794: 
                   6795: % Normal (long) toc.
                   6796: %
                   6797: \def\contents{%
                   6798:   \startcontents{\putwordTOC}%
                   6799:     \openin 1 \tocreadfilename\space
                   6800:     \ifeof 1 \else
1.2     ! snw      6801:       \findsecnowidths
1.1       snw      6802:       \readtocfile
                   6803:     \fi
                   6804:     \vfill \eject
                   6805:     \contentsalignmacro % in case @setchapternewpage odd is in effect
                   6806:     \ifeof 1 \else
                   6807:       \pdfmakeoutlines
                   6808:     \fi
                   6809:     \closein 1
                   6810:   \endgroup
                   6811:   \contentsendroman
                   6812: }
                   6813: 
                   6814: % And just the chapters.
                   6815: \def\summarycontents{%
                   6816:   \startcontents{\putwordShortTOC}%
                   6817:     %
                   6818:     \let\partentry = \shortpartentry
                   6819:     \let\numchapentry = \shortchapentry
                   6820:     \let\appentry = \shortchapentry
                   6821:     \let\unnchapentry = \shortunnchapentry
                   6822:     % We want a true roman here for the page numbers.
                   6823:     \secfonts
                   6824:     \let\rm=\shortcontrm \let\bf=\shortcontbf
                   6825:     \let\sl=\shortcontsl \let\tt=\shortconttt
                   6826:     \rm
                   6827:     \hyphenpenalty = 10000
                   6828:     \advance\baselineskip by 1pt % Open it up a little.
1.2     ! snw      6829:     \extrasecnoskip=0.4pt
1.1       snw      6830:     \def\numsecentry##1##2##3##4{}
                   6831:     \let\appsecentry = \numsecentry
                   6832:     \let\unnsecentry = \numsecentry
                   6833:     \let\numsubsecentry = \numsecentry
                   6834:     \let\appsubsecentry = \numsecentry
                   6835:     \let\unnsubsecentry = \numsecentry
                   6836:     \let\numsubsubsecentry = \numsecentry
                   6837:     \let\appsubsubsecentry = \numsecentry
                   6838:     \let\unnsubsubsecentry = \numsecentry
                   6839:     \openin 1 \tocreadfilename\space
                   6840:     \ifeof 1 \else
                   6841:       \readtocfile
                   6842:     \fi
                   6843:     \closein 1
                   6844:     \vfill \eject
                   6845:     \contentsalignmacro % in case @setchapternewpage odd is in effect
                   6846:   \endgroup
                   6847:   \contentsendroman
                   6848: }
                   6849: \let\shortcontents = \summarycontents
                   6850: 
                   6851: % Get ready to use Arabic numerals again
                   6852: \def\contentsendroman{%
                   6853:   \lastnegativepageno = \pageno
1.2     ! snw      6854:   \global\pageno=1
        !          6855:   \contentsendcount = \pagecount
1.1       snw      6856: }
                   6857: 
                   6858: % Typeset the label for a chapter or appendix for the short contents.
                   6859: % The arg is, e.g., `A' for an appendix, or `3' for a chapter.
                   6860: %
                   6861: \def\shortchaplabel#1{%
                   6862:   % This space should be enough, since a single number is .5em, and the
                   6863:   % widest letter (M) is 1em, at least in the Computer Modern fonts.
                   6864:   % But use \hss just in case.
                   6865:   %
                   6866:   % We'd like to right-justify chapter numbers, but that looks strange
                   6867:   % with appendix letters.  And right-justifying numbers and
                   6868:   % left-justifying letters looks strange when there is less than 10
                   6869:   % chapters.  Have to read the whole toc once to know how many chapters
                   6870:   % there are before deciding ...
                   6871:   \hbox to 1em{#1\hss}%
                   6872: }
                   6873: 
1.2     ! snw      6874: % These macros generate individual entries in the table of contents,
        !          6875: % and are read in from the *.toc file.
        !          6876: %
        !          6877: % The arguments are like:
        !          6878: % \def\numchapentry#1#2#3#4
        !          6879: %   #1 - the chapter or section name.
        !          6880: %   #2 - section number
        !          6881: %   #3 - level of section (e.g "chap", "sec")
        !          6882: %   #4 - page number
1.1       snw      6883: 
                   6884: % Parts, in the main contents.  Replace the part number, which doesn't
                   6885: % exist, with an empty box.  Let's hope all the numbers have the same width.
                   6886: % Also ignore the page number, which is conventionally not printed.
                   6887: \def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}}
                   6888: \def\partentry#1#2#3#4{%
                   6889:   % Add stretch and a bonus for breaking the page before the part heading.
                   6890:   % This reduces the chance of the page being broken immediately after the
                   6891:   % part heading, before a following chapter heading.
                   6892:   \vskip 0pt plus 5\baselineskip
                   6893:   \penalty-300
                   6894:   \vskip 0pt plus -5\baselineskip
1.2     ! snw      6895:   \dochapentry{#1}{\numeralbox}{}%
1.1       snw      6896: }
                   6897: %
                   6898: % Parts, in the short toc.
                   6899: \def\shortpartentry#1#2#3#4{%
                   6900:   \penalty-300
                   6901:   \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip
                   6902:   \shortchapentry{{\bf #1}}{\numeralbox}{}{}%
                   6903: }
                   6904: 
                   6905: % Chapters, in the main contents.
1.2     ! snw      6906: \def\numchapentry#1#2#3#4{%
        !          6907:   \retrievesecnowidth\secnowidthchap{#2}%
        !          6908:   \dochapentry{#1}{#2}{#4}%
        !          6909: }
1.1       snw      6910: 
                   6911: % Chapters, in the short toc.
                   6912: \def\shortchapentry#1#2#3#4{%
1.2     ! snw      6913:   \tocentry{#1}{\shortchaplabel{#2}}{#4}%
1.1       snw      6914: }
                   6915: 
                   6916: % Appendices, in the main contents.
                   6917: % Need the word Appendix, and a fixed-size box.
                   6918: %
                   6919: \def\appendixbox#1{%
                   6920:   % We use M since it's probably the widest letter.
                   6921:   \setbox0 = \hbox{\putwordAppendix{} M}%
                   6922:   \hbox to \wd0{\putwordAppendix{} #1\hss}}
                   6923: %
1.2     ! snw      6924: \def\appentry#1#2#3#4{%
        !          6925:   \retrievesecnowidth\secnowidthchap{#2}%
        !          6926:   \dochapentry{\appendixbox{#2}\hskip.7em#1}{}{#4}%
        !          6927: }
1.1       snw      6928: 
                   6929: % Unnumbered chapters.
1.2     ! snw      6930: \def\unnchapentry#1#2#3#4{\dochapentry{#1}{}{#4}}
        !          6931: \def\shortunnchapentry#1#2#3#4{\tocentry{#1}{}{#4}}
1.1       snw      6932: 
                   6933: % Sections.
1.2     ! snw      6934: \def\numsecentry#1#2#3#4{\dosecentry{#1}{#2}{#4}}
        !          6935: 
        !          6936: \def\numsecentry#1#2#3#4{%
        !          6937:   \retrievesecnowidth\secnowidthsec{#2}%
        !          6938:   \dosecentry{#1}{#2}{#4}%
        !          6939: }
1.1       snw      6940: \let\appsecentry=\numsecentry
1.2     ! snw      6941: \def\unnsecentry#1#2#3#4{%
        !          6942:   \retrievesecnowidth\secnowidthsec{#2}%
        !          6943:   \dosecentry{#1}{}{#4}%
        !          6944: }
1.1       snw      6945: 
                   6946: % Subsections.
1.2     ! snw      6947: \def\numsubsecentry#1#2#3#4{%
        !          6948:   \retrievesecnowidth\secnowidthssec{#2}%
        !          6949:   \dosubsecentry{#1}{#2}{#4}%
        !          6950: }
1.1       snw      6951: \let\appsubsecentry=\numsubsecentry
1.2     ! snw      6952: \def\unnsubsecentry#1#2#3#4{%
        !          6953:   \retrievesecnowidth\secnowidthssec{#2}%
        !          6954:   \dosubsecentry{#1}{}{#4}%
        !          6955: }
1.1       snw      6956: 
                   6957: % And subsubsections.
1.2     ! snw      6958: \def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#2}{#4}}
1.1       snw      6959: \let\appsubsubsecentry=\numsubsubsecentry
1.2     ! snw      6960: \def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{}{#4}}
1.1       snw      6961: 
                   6962: % This parameter controls the indentation of the various levels.
                   6963: % Same as \defaultparindent.
                   6964: \newdimen\tocindent \tocindent = 15pt
                   6965: 
1.2     ! snw      6966: % Now for the actual typesetting. In all these, #1 is the text, #2 is
        !          6967: % a section number if present, and #3 is the page number.
1.1       snw      6968: %
                   6969: % If the toc has to be broken over pages, we want it to be at chapters
                   6970: % if at all possible; hence the \penalty.
1.2     ! snw      6971: \def\dochapentry#1#2#3{%
1.1       snw      6972:    \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
                   6973:    \begingroup
                   6974:      % Move the page numbers slightly to the right
                   6975:      \advance\entryrightmargin by -0.05em
                   6976:      \chapentryfonts
1.2     ! snw      6977:      \extrasecnoskip=0.4em % separate chapter number more
        !          6978:      \tocentry{#1}{#2}{#3}%
1.1       snw      6979:    \endgroup
                   6980:    \nobreak\vskip .25\baselineskip plus.1\baselineskip
                   6981: }
                   6982: 
1.2     ! snw      6983: \def\dosecentry#1#2#3{\begingroup
        !          6984:   \secnowidth=\secnowidthchap
1.1       snw      6985:   \secentryfonts \leftskip=\tocindent
1.2     ! snw      6986:   \tocentry{#1}{#2}{#3}%
1.1       snw      6987: \endgroup}
                   6988: 
1.2     ! snw      6989: \def\dosubsecentry#1#2#3{\begingroup
        !          6990:   \secnowidth=\secnowidthsec
1.1       snw      6991:   \subsecentryfonts \leftskip=2\tocindent
1.2     ! snw      6992:   \tocentry{#1}{#2}{#3}%
1.1       snw      6993: \endgroup}
                   6994: 
1.2     ! snw      6995: \def\dosubsubsecentry#1#2#3{\begingroup
        !          6996:   \secnowidth=\secnowidthssec
1.1       snw      6997:   \subsubsecentryfonts \leftskip=3\tocindent
1.2     ! snw      6998:   \tocentry{#1}{#2}{#3}%
1.1       snw      6999: \endgroup}
                   7000: 
1.2     ! snw      7001: % Used for the maximum width of a section number so we can align
        !          7002: % section titles.
        !          7003: \newdimen\secnowidth
        !          7004: \secnowidth=0pt
        !          7005: \newdimen\extrasecnoskip
        !          7006: \extrasecnoskip=0pt
        !          7007: 
        !          7008: % \tocentry{TITLE}{SEC NO}{PAGE}
        !          7009: %
        !          7010: \def\tocentry#1#2#3{%
        !          7011:   \def\secno{#2}%
        !          7012:   \ifx\empty\secno
        !          7013:     \entry{#1}{#3}%
        !          7014:   \else
        !          7015:     \ifdim 0pt=\secnowidth
        !          7016:       \setbox0=\hbox{#2\hskip\labelspace\hskip\extrasecnoskip}%
        !          7017:     \else
        !          7018:       \advance\secnowidth by \labelspace
        !          7019:       \advance\secnowidth by \extrasecnoskip
        !          7020:       \setbox0=\hbox to \secnowidth{%
        !          7021:         #2\hskip\labelspace\hskip\extrasecnoskip\hfill}%
        !          7022:     \fi
        !          7023:     \entrycontskip=\wd0
        !          7024:     \entry{\box0 #1}{#3}%
        !          7025:   \fi
        !          7026: }
        !          7027: \newdimen\labelspace
        !          7028: \labelspace=0.6em
1.1       snw      7029: 
                   7030: \def\chapentryfonts{\secfonts \rm}
                   7031: \def\secentryfonts{\textfonts}
                   7032: \def\subsecentryfonts{\textfonts}
                   7033: \def\subsubsecentryfonts{\textfonts}
                   7034: 
                   7035: 
                   7036: \message{environments,}
                   7037: % @foo ... @end foo.
                   7038: 
                   7039: % @tex ... @end tex    escapes into raw TeX temporarily.
                   7040: % One exception: @ is still an escape character, so that @end tex works.
                   7041: % But \@ or @@ will get a plain @ character.
                   7042: 
                   7043: \envdef\tex{%
                   7044:   \setregularquotes
                   7045:   \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
                   7046:   \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
                   7047:   \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
                   7048:   \catcode `\%=14
                   7049:   \catcode `\+=\other
                   7050:   \catcode `\"=\other
                   7051:   \catcode `\|=\other
                   7052:   \catcode `\<=\other
                   7053:   \catcode `\>=\other
                   7054:   \catcode `\`=\other
                   7055:   \catcode `\'=\other
                   7056:   %
                   7057:   % ' is active in math mode (mathcode"8000).  So reset it, and all our
                   7058:   % other math active characters (just in case), to plain's definitions.
                   7059:   \mathactive
                   7060:   %
                   7061:   % Inverse of the list at the beginning of the file.
                   7062:   \let\b=\ptexb
                   7063:   \let\bullet=\ptexbullet
                   7064:   \let\c=\ptexc
                   7065:   \let\,=\ptexcomma
                   7066:   \let\.=\ptexdot
                   7067:   \let\dots=\ptexdots
                   7068:   \let\equiv=\ptexequiv
                   7069:   \let\!=\ptexexclam
                   7070:   \let\i=\ptexi
                   7071:   \let\indent=\ptexindent
                   7072:   \let\noindent=\ptexnoindent
                   7073:   \let\{=\ptexlbrace
                   7074:   \let\+=\tabalign
                   7075:   \let\}=\ptexrbrace
                   7076:   \let\/=\ptexslash
                   7077:   \let\sp=\ptexsp
                   7078:   \let\*=\ptexstar
                   7079:   %\let\sup=\ptexsup % do not redefine, we want @sup to work in math mode
                   7080:   \let\t=\ptext
                   7081:   \expandafter \let\csname top\endcsname=\ptextop  % we've made it outer
                   7082:   \let\frenchspacing=\plainfrenchspacing
                   7083:   %
                   7084:   \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
                   7085:   \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
                   7086:   \def\@{@}%
                   7087: }
                   7088: % There is no need to define \Etex.
                   7089: 
                   7090: % Define @lisp ... @end lisp.
                   7091: % @lisp environment forms a group so it can rebind things,
                   7092: % including the definition of @end lisp (which normally is erroneous).
                   7093: 
                   7094: % Amount to narrow the margins by for @lisp.
                   7095: \newskip\lispnarrowing \lispnarrowing=0.4in
                   7096: 
                   7097: % This is the definition that ^^M gets inside @lisp, @example, and other
                   7098: % such environments.  \null is better than a space, since it doesn't
                   7099: % have any width.
                   7100: \def\lisppar{\null\endgraf}
                   7101: 
                   7102: % This space is always present above and below environments.
                   7103: \newskip\envskipamount \envskipamount = 0pt
                   7104: 
                   7105: % Make spacing and below environment symmetrical.  We use \parskip here
                   7106: % to help in doing that, since in @example-like environments \parskip
                   7107: % is reset to zero; thus the \afterenvbreak inserts no space -- but the
                   7108: % start of the next paragraph will insert \parskip.
                   7109: %
                   7110: \def\aboveenvbreak{{%
                   7111:   % =10000 instead of <10000 because of a special case in \itemzzz and
                   7112:   % \sectionheading, q.v.
                   7113:   \ifnum \lastpenalty=10000 \else
                   7114:     \advance\envskipamount by \parskip
                   7115:     \endgraf
                   7116:     \ifdim\lastskip<\envskipamount
                   7117:       \removelastskip
                   7118:       \ifnum\lastpenalty<10000
                   7119:         % Penalize breaking before the environment, because preceding text
                   7120:         % often leads into it.
                   7121:         \penalty100
                   7122:       \fi
                   7123:       \vskip\envskipamount
                   7124:     \fi
                   7125:   \fi
                   7126: }}
                   7127: 
                   7128: \def\afterenvbreak{{%
                   7129:   % =10000 instead of <10000 because of a special case in \itemzzz and
                   7130:   % \sectionheading, q.v.
                   7131:   \ifnum \lastpenalty=10000 \else
                   7132:     \advance\envskipamount by \parskip
                   7133:     \endgraf
                   7134:     \ifdim\lastskip<\envskipamount
                   7135:       \removelastskip
                   7136:       % it's not a good place to break if the last penalty was \nobreak
                   7137:       % or better ...
                   7138:       \ifnum\lastpenalty<10000 \penalty-50 \fi
                   7139:       \vskip\envskipamount
                   7140:     \fi
                   7141:   \fi
                   7142: }}
                   7143: 
                   7144: % \nonarrowing is a flag.  If "set", @lisp etc don't narrow margins; it will
                   7145: % also clear it, so that its embedded environments do the narrowing again.
                   7146: \let\nonarrowing=\relax
                   7147: 
                   7148: % @cartouche ... @end cartouche: draw rectangle w/rounded corners around
                   7149: % environment contents.
                   7150: 
                   7151: %
                   7152: \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
                   7153: \def\ctr{{\hskip 6pt\circle\char'010}}
                   7154: \def\cbl{{\circle\char'012\hskip -6pt}}
                   7155: \def\cbr{{\hskip 6pt\circle\char'011}}
                   7156: \def\carttop{\hbox to \cartouter{\hskip\lskip
                   7157:         \ctl\leaders\hrule height\circthick\hfil\ctr
                   7158:         \hskip\rskip}}
                   7159: \def\cartbot{\hbox to \cartouter{\hskip\lskip
                   7160:         \cbl\leaders\hrule height\circthick\hfil\cbr
                   7161:         \hskip\rskip}}
                   7162: %
                   7163: \newskip\lskip\newskip\rskip
                   7164: 
                   7165: % only require the font if @cartouche is actually used
                   7166: \def\cartouchefontdefs{%
                   7167:   \font\circle=lcircle10\relax
                   7168:   \circthick=\fontdimen8\circle
                   7169: }
                   7170: \newdimen\circthick
                   7171: \newdimen\cartouter\newdimen\cartinner
                   7172: \newskip\normbskip\newskip\normpskip\newskip\normlskip
                   7173: 
1.2     ! snw      7174: \envparseargdef\cartouche{%
1.1       snw      7175:   \cartouchefontdefs
                   7176:   \ifhmode\par\fi  % can't be in the midst of a paragraph.
                   7177:   \startsavinginserts
                   7178:   \lskip=\leftskip \rskip=\rightskip
                   7179:   \leftskip=0pt\rightskip=0pt % we want these *outside*.
1.2     ! snw      7180:   %
        !          7181:   % Set paragraph width for text inside cartouche.  There are
        !          7182:   % left and right margins of 3pt each plus two vrules 0.4pt each.
1.1       snw      7183:   \cartinner=\hsize \advance\cartinner by-\lskip
                   7184:   \advance\cartinner by-\rskip
1.2     ! snw      7185:   \advance\cartinner by -6.8pt
        !          7186:   %
        !          7187:   % For drawing top and bottom of cartouche.  Each corner char
        !          7188:   % adds 6pt and we take off the width of a rule to line up with the
        !          7189:   % right boundary perfectly.
1.1       snw      7190:   \cartouter=\hsize
1.2     ! snw      7191:   \advance\cartouter by 11.6pt
        !          7192:   %
1.1       snw      7193:   \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
                   7194:   %
                   7195:   % If this cartouche directly follows a sectioning command, we need the
                   7196:   % \parskip glue (backspaced over by default) or the cartouche can
                   7197:   % collide with the section heading.
                   7198:   \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi
                   7199:   %
1.2     ! snw      7200:   \setbox\groupbox=\vtop\bgroup
1.1       snw      7201:       \baselineskip=0pt\parskip=0pt\lineskip=0pt
                   7202:       \carttop
                   7203:       \hbox\bgroup
1.2     ! snw      7204:           \hskip\lskip
        !          7205:           \vrule\kern3pt
        !          7206:           \vbox\bgroup
        !          7207:               \hsize=\cartinner
        !          7208:               \baselineskip=\normbskip
        !          7209:               \lineskip=\normlskip
        !          7210:               \parskip=\normpskip
        !          7211:               \def\arg{#1}%
        !          7212:               \ifx\arg\empty\else
        !          7213:                 \centerV{\hfil \bf #1 \hfil}%
        !          7214:               \fi
        !          7215:               \kern3pt
        !          7216:               \vskip -\parskip
1.1       snw      7217: }
                   7218: \def\Ecartouche{%
                   7219:               \ifhmode\par\fi
                   7220:              \kern3pt
                   7221:          \egroup
                   7222:          \kern3pt\vrule
                   7223:          \hskip\rskip
                   7224:       \egroup
                   7225:       \cartbot
                   7226:   \egroup
                   7227:   \addgroupbox
                   7228:   \checkinserts
                   7229: }
                   7230: 
                   7231: 
                   7232: % This macro is called at the beginning of all the @example variants,
                   7233: % inside a group.
                   7234: \newdimen\nonfillparindent
                   7235: \def\nonfillstart{%
                   7236:   \aboveenvbreak
                   7237:   \ifdim\hfuzz < 12pt \hfuzz = 12pt \fi % Don't be fussy
                   7238:   \sepspaces % Make spaces be word-separators rather than space tokens.
                   7239:   \let\par = \lisppar % don't ignore blank lines
                   7240:   \obeylines % each line of input is a line of output
                   7241:   \parskip = 0pt
                   7242:   % Turn off paragraph indentation but redefine \indent to emulate
                   7243:   % the normal \indent.
                   7244:   \nonfillparindent=\parindent
                   7245:   \parindent = 0pt
                   7246:   \let\indent\nonfillindent
                   7247:   %
                   7248:   \emergencystretch = 0pt % don't try to avoid overfull boxes
                   7249:   \ifx\nonarrowing\relax
                   7250:     \advance \leftskip by \lispnarrowing
                   7251:     \exdentamount=\lispnarrowing
                   7252:   \else
                   7253:     \let\nonarrowing = \relax
                   7254:   \fi
                   7255:   \let\exdent=\nofillexdent
                   7256: }
                   7257: 
                   7258: \begingroup
                   7259: \obeyspaces
                   7260: % We want to swallow spaces (but not other tokens) after the fake
                   7261: % @indent in our nonfill-environments, where spaces are normally
                   7262: % active and set to @tie, resulting in them not being ignored after
                   7263: % @indent.
                   7264: \gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}%
                   7265: \gdef\nonfillindentcheck{%
                   7266: \ifx\temp %
                   7267: \expandafter\nonfillindentgobble%
                   7268: \else%
                   7269: \leavevmode\nonfillindentbox%
                   7270: \fi%
                   7271: }%
                   7272: \endgroup
                   7273: \def\nonfillindentgobble#1{\nonfillindent}
                   7274: \def\nonfillindentbox{\hbox to \nonfillparindent{\hss}}
                   7275: 
                   7276: % If you want all examples etc. small: @set dispenvsize small.
                   7277: % If you want even small examples the full size: @set dispenvsize nosmall.
                   7278: % This affects the following displayed environments:
                   7279: %    @example, @display, @format, @lisp, @verbatim
                   7280: %
                   7281: \def\smallword{small}
                   7282: \def\nosmallword{nosmall}
                   7283: \let\SETdispenvsize\relax
                   7284: \def\setnormaldispenv{%
                   7285:   \ifx\SETdispenvsize\smallword
                   7286:     % end paragraph for sake of leading, in case document has no blank
                   7287:     % line.  This is redundant with what happens in \aboveenvbreak, but
                   7288:     % we need to do it before changing the fonts, and it's inconvenient
                   7289:     % to change the fonts afterward.
                   7290:     \ifnum \lastpenalty=10000 \else \endgraf \fi
                   7291:     \smallexamplefonts \rm
                   7292:   \fi
                   7293: }
                   7294: \def\setsmalldispenv{%
                   7295:   \ifx\SETdispenvsize\nosmallword
                   7296:   \else
                   7297:     \ifnum \lastpenalty=10000 \else \endgraf \fi
                   7298:     \smallexamplefonts \rm
                   7299:   \fi
                   7300: }
                   7301: 
                   7302: % We often define two environments, @foo and @smallfoo.
                   7303: % Let's do it in one command.  #1 is the env name, #2 the definition.
                   7304: \def\makedispenvdef#1#2{%
                   7305:   \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}%
                   7306:   \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}%
                   7307:   \expandafter\let\csname E#1\endcsname \afterenvbreak
                   7308:   \expandafter\let\csname Esmall#1\endcsname \afterenvbreak
                   7309: }
                   7310: 
                   7311: % Define two environment synonyms (#1 and #2) for an environment.
                   7312: \def\maketwodispenvdef#1#2#3{%
                   7313:   \makedispenvdef{#1}{#3}%
                   7314:   \makedispenvdef{#2}{#3}%
                   7315: }
                   7316: %
                   7317: % @lisp: indented, narrowed, typewriter font;
                   7318: % @example: same as @lisp.
                   7319: %
                   7320: % @smallexample and @smalllisp: use smaller fonts.
                   7321: % Originally contributed by Pavel@xerox.
                   7322: %
                   7323: \maketwodispenvdef{lisp}{example}{%
                   7324:   \nonfillstart
                   7325:   \tt\setcodequotes
                   7326:   \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
                   7327:   \parsearg\gobble
                   7328: }
                   7329: % @display/@smalldisplay: same as @lisp except keep current font.
                   7330: %
                   7331: \makedispenvdef{display}{%
                   7332:   \nonfillstart
                   7333:   \gobble
                   7334: }
                   7335: 
                   7336: % @format/@smallformat: same as @display except don't narrow margins.
                   7337: %
                   7338: \makedispenvdef{format}{%
                   7339:   \let\nonarrowing = t%
                   7340:   \nonfillstart
                   7341:   \gobble
                   7342: }
                   7343: 
                   7344: % @flushleft: same as @format, but doesn't obey \SETdispenvsize.
                   7345: \envdef\flushleft{%
                   7346:   \let\nonarrowing = t%
                   7347:   \nonfillstart
                   7348:   \gobble
                   7349: }
                   7350: \let\Eflushleft = \afterenvbreak
                   7351: 
                   7352: % @flushright.
                   7353: %
                   7354: \envdef\flushright{%
                   7355:   \let\nonarrowing = t%
                   7356:   \nonfillstart
                   7357:   \advance\leftskip by 0pt plus 1fill\relax
                   7358:   \gobble
                   7359: }
                   7360: \let\Eflushright = \afterenvbreak
                   7361: 
                   7362: 
                   7363: % @raggedright does more-or-less normal line breaking but no right
                   7364: % justification.  From plain.tex.
                   7365: \envdef\raggedright{%
                   7366:   \rightskip0pt plus2.4em \spaceskip.3333em \xspaceskip.5em\relax
                   7367: }
                   7368: \let\Eraggedright\par
                   7369: 
                   7370: 
                   7371: % @quotation does normal linebreaking (hence we can't use \nonfillstart)
                   7372: % and narrows the margins.  We keep \parskip nonzero in general, since
                   7373: % we're doing normal filling.  So, when using \aboveenvbreak and
                   7374: % \afterenvbreak, temporarily make \parskip 0.
                   7375: %
                   7376: \makedispenvdef{quotation}{\quotationstart}
                   7377: %
                   7378: \def\quotationstart{%
                   7379:   \indentedblockstart % same as \indentedblock, but increase right margin too.
                   7380:   \ifx\nonarrowing\relax
                   7381:     \advance\rightskip by \lispnarrowing
                   7382:   \fi
                   7383:   \parsearg\quotationlabel
                   7384: }
                   7385: 
                   7386: % We have retained a nonzero parskip for the environment, since we're
                   7387: % doing normal filling.
                   7388: %
                   7389: \def\Equotation{%
                   7390:   \par
                   7391:   \ifx\quotationauthor\thisisundefined\else
                   7392:     % indent a bit.
                   7393:     \leftline{\kern 2\leftskip \sl ---\quotationauthor}%
                   7394:   \fi
                   7395:   {\parskip=0pt \afterenvbreak}%
                   7396: }
                   7397: \def\Esmallquotation{\Equotation}
                   7398: 
                   7399: % If we're given an argument, typeset it in bold with a colon after.
                   7400: \def\quotationlabel#1{%
                   7401:   \def\temp{#1}%
                   7402:   \ifx\temp\empty \else
                   7403:     {\bf #1: }%
                   7404:   \fi
                   7405: }
                   7406: 
                   7407: % @indentedblock is like @quotation, but indents only on the left and
                   7408: % has no optional argument.
                   7409: %
                   7410: \makedispenvdef{indentedblock}{\indentedblockstart}
                   7411: %
                   7412: \def\indentedblockstart{%
                   7413:   {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
                   7414:   \parindent=0pt
                   7415:   %
                   7416:   % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
                   7417:   \ifx\nonarrowing\relax
                   7418:     \advance\leftskip by \lispnarrowing
                   7419:     \exdentamount = \lispnarrowing
                   7420:   \else
                   7421:     \let\nonarrowing = \relax
                   7422:   \fi
                   7423: }
                   7424: 
                   7425: % Keep a nonzero parskip for the environment, since we're doing normal filling.
                   7426: %
                   7427: \def\Eindentedblock{%
                   7428:   \par
                   7429:   {\parskip=0pt \afterenvbreak}%
                   7430: }
                   7431: \def\Esmallindentedblock{\Eindentedblock}
                   7432: 
                   7433: 
                   7434: % LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
                   7435: % If we want to allow any <char> as delimiter,
                   7436: % we need the curly braces so that makeinfo sees the @verb command, eg:
                   7437: % `@verbx...x' would look like the '@verbx' command.  --janneke@gnu.org
                   7438: %
                   7439: % [Knuth]: Donald Ervin Knuth, 1996.  The TeXbook.
                   7440: %
                   7441: % [Knuth] p.344; only we need to do the other characters Texinfo sets
                   7442: % active too.  Otherwise, they get lost as the first character on a
                   7443: % verbatim line.
                   7444: \def\dospecials{%
                   7445:   \do\ \do\\\do\{\do\}\do\$\do\&%
                   7446:   \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~%
                   7447:   \do\<\do\>\do\|\do\@\do+\do\"%
                   7448:   % Don't do the quotes -- if we do, @set txicodequoteundirected and
                   7449:   % @set txicodequotebacktick will not have effect on @verb and
                   7450:   % @verbatim, and ?` and !` ligatures won't get disabled.
                   7451:   %\do\`\do\'%
                   7452: }
                   7453: %
                   7454: % [Knuth] p. 380
                   7455: \def\uncatcodespecials{%
                   7456:   \def\do##1{\catcode`##1=\other}\dospecials}
                   7457: %
                   7458: % Setup for the @verb command.
                   7459: %
                   7460: % Eight spaces for a tab
                   7461: \begingroup
                   7462:   \catcode`\^^I=\active
                   7463:   \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
                   7464: \endgroup
                   7465: %
                   7466: \def\setupverb{%
1.2     ! snw      7467:   \tt
1.1       snw      7468:   \def\par{\leavevmode\endgraf}%
1.2     ! snw      7469:   \parindent = 0pt
1.1       snw      7470:   \setcodequotes
                   7471:   \tabeightspaces
                   7472:   % Respect line breaks,
                   7473:   % print special symbols as themselves, and
                   7474:   % make each space count
                   7475:   % must do in this order:
                   7476:   \obeylines \uncatcodespecials \sepspaces
                   7477: }
                   7478: 
                   7479: % Setup for the @verbatim environment
                   7480: %
                   7481: % Real tab expansion.
                   7482: \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
                   7483: %
                   7484: % We typeset each line of the verbatim in an \hbox, so we can handle
                   7485: % tabs.
                   7486: \newbox\verbbox
                   7487: \def\starttabbox{\setbox\verbbox=\hbox\bgroup}
                   7488: %
                   7489: \begingroup
                   7490:   \catcode`\^^I=\active
                   7491:   \gdef\tabexpand{%
                   7492:     \catcode`\^^I=\active
                   7493:     \def^^I{\leavevmode\egroup
                   7494:       \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab
                   7495:       \divide\dimen\verbbox by\tabw
                   7496:       \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw
                   7497:       \advance\dimen\verbbox by\tabw  % advance to next multiple of \tabw
                   7498:       \wd\verbbox=\dimen\verbbox
                   7499:       \leavevmode\box\verbbox \starttabbox
                   7500:     }%
                   7501:   }
                   7502: \endgroup
                   7503: 
                   7504: % start the verbatim environment.
                   7505: \def\setupverbatim{%
                   7506:   \let\nonarrowing = t%
                   7507:   \nonfillstart
                   7508:   \tt % easiest (and conventionally used) font for verbatim
                   7509:   \def\par{\egroup\leavevmode\box\verbbox\endgraf\starttabbox}%
                   7510:   \tabexpand
                   7511:   \setcodequotes
                   7512:   % Respect line breaks,
                   7513:   % print special symbols as themselves, and
                   7514:   % make each space count.
                   7515:   % Must do in this order:
                   7516:   \obeylines \uncatcodespecials \sepspaces
                   7517: }
                   7518: 
                   7519: % Do the @verb magic: verbatim text is quoted by unique
                   7520: % delimiter characters.  Before first delimiter expect a
                   7521: % right brace, after last delimiter expect closing brace:
                   7522: %
                   7523: %    \def\doverb'{'<char>#1<char>'}'{#1}
                   7524: %
                   7525: % [Knuth] p. 382; only eat outer {}
                   7526: \begingroup
                   7527:   \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other
                   7528:   \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
                   7529: \endgroup
                   7530: %
                   7531: \def\verb{\begingroup\setupverb\doverb}
                   7532: %
                   7533: %
                   7534: % Do the @verbatim magic: define the macro \doverbatim so that
                   7535: % the (first) argument ends when '@end verbatim' is reached, ie:
                   7536: %
                   7537: %     \def\doverbatim#1@end verbatim{#1}
                   7538: %
                   7539: % For Texinfo it's a lot easier than for LaTeX,
                   7540: % because texinfo's \verbatim doesn't stop at '\end{verbatim}':
                   7541: % we need not redefine '\', '{' and '}'.
                   7542: %
                   7543: % Inspired by LaTeX's verbatim command set [latex.ltx]
                   7544: %
                   7545: \begingroup
                   7546:   \catcode`\ =\active
                   7547:   \obeylines %
                   7548:   % ignore everything up to the first ^^M, that's the newline at the end
                   7549:   % of the @verbatim input line itself.  Otherwise we get an extra blank
                   7550:   % line in the output.
                   7551:   \xdef\doverbatim#1^^M#2@end verbatim{%
                   7552:     \starttabbox#2\egroup\noexpand\end\gobble verbatim}%
                   7553:   % We really want {...\end verbatim} in the body of the macro, but
                   7554:   % without the active space; thus we have to use \xdef and \gobble.
                   7555:   % The \egroup ends the \verbbox started at the end of the last line in
                   7556:   % the block.
                   7557: \endgroup
                   7558: %
                   7559: \envdef\verbatim{%
                   7560:     \setnormaldispenv\setupverbatim\doverbatim
                   7561: }
                   7562: \let\Everbatim = \afterenvbreak
                   7563: 
                   7564: 
                   7565: % @verbatiminclude FILE - insert text of file in verbatim environment.
                   7566: %
                   7567: \def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude}
                   7568: %
                   7569: \def\doverbatiminclude#1{%
                   7570:   {%
                   7571:     \makevalueexpandable
                   7572:     \setupverbatim
                   7573:     {%
                   7574:       \indexnofonts       % Allow `@@' and other weird things in file names.
                   7575:       \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}%
                   7576:       \edef\tmp{\noexpand\input #1 }
                   7577:       \expandafter
                   7578:     }\expandafter\starttabbox\tmp\egroup
                   7579:     \afterenvbreak
                   7580:   }%
                   7581: }
                   7582: 
                   7583: % @copying ... @end copying.
                   7584: % Save the text away for @insertcopying later.
                   7585: %
                   7586: % We save the uninterpreted tokens, rather than creating a box.
                   7587: % Saving the text in a box would be much easier, but then all the
                   7588: % typesetting commands (@smallbook, font changes, etc.) have to be done
                   7589: % beforehand -- and a) we want @copying to be done first in the source
                   7590: % file; b) letting users define the frontmatter in as flexible order as
                   7591: % possible is desirable.
                   7592: %
1.2     ! snw      7593: \def\copying{\checkenv{}\begingroup\macrobodyctxt\docopying}
        !          7594: {\catcode`\ =\other
        !          7595: \gdef\docopying#1@end copying{\endgroup\def\copyingtext{#1}}
        !          7596: }
        !          7597: 
1.1       snw      7598: \def\insertcopying{%
                   7599:   \begingroup
                   7600:     \parindent = 0pt  % paragraph indentation looks wrong on title page
                   7601:     \scanexp\copyingtext
                   7602:   \endgroup
                   7603: }
                   7604: 
                   7605: 
                   7606: \message{defuns,}
                   7607: % @defun etc.
                   7608: 
                   7609: \newskip\defbodyindent \defbodyindent=.4in
                   7610: \newskip\defargsindent \defargsindent=50pt
                   7611: \newskip\deflastargmargin \deflastargmargin=18pt
                   7612: \newcount\defunpenalty
                   7613: 
                   7614: % Start the processing of @deffn:
                   7615: \def\startdefun{%
                   7616:   \ifnum\lastpenalty<10000
                   7617:     \medbreak
                   7618:     \defunpenalty=10003 % Will keep this @deffn together with the
                   7619:                         % following @def command, see below.
                   7620:   \else
                   7621:     % If there are two @def commands in a row, we'll have a \nobreak,
                   7622:     % which is there to keep the function description together with its
                   7623:     % header.  But if there's nothing but headers, we need to allow a
                   7624:     % break somewhere.  Check specifically for penalty 10002, inserted
                   7625:     % by \printdefunline, instead of 10000, since the sectioning
                   7626:     % commands also insert a nobreak penalty, and we don't want to allow
                   7627:     % a break between a section heading and a defun.
                   7628:     %
                   7629:     % As a further refinement, we avoid "club" headers by signalling
                   7630:     % with penalty of 10003 after the very first @deffn in the
                   7631:     % sequence (see above), and penalty of 10002 after any following
                   7632:     % @def command.
                   7633:     \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi
                   7634:     %
                   7635:     % Similarly, after a section heading, do not allow a break.
                   7636:     % But do insert the glue.
                   7637:     \medskip  % preceded by discardable penalty, so not a breakpoint
                   7638:   \fi
                   7639:   %
                   7640:   \parindent=0in
                   7641:   \advance\leftskip by \defbodyindent
                   7642:   \exdentamount=\defbodyindent
                   7643: }
                   7644: 
1.2     ! snw      7645: % Called as \printdefunline \deffooheader{text}
1.1       snw      7646: %
                   7647: \def\printdefunline#1#2{%
                   7648:   \begingroup
1.2     ! snw      7649:     \plainfrenchspacing
        !          7650:     % call \deffooheader:
1.1       snw      7651:     #1#2 \endheader
                   7652:     % common ending:
                   7653:     \interlinepenalty = 10000
                   7654:     \advance\rightskip by 0pt plus 1fil\relax
                   7655:     \endgraf
                   7656:     \nobreak\vskip -\parskip
1.2     ! snw      7657:     \penalty\defunpenalty  % signal to \startdefun and \deffoox
1.1       snw      7658:     % Some of the @defun-type tags do not enable magic parentheses,
                   7659:     % rendering the following check redundant.  But we don't optimize.
                   7660:     \checkparencounts
                   7661:   \endgroup
                   7662: }
                   7663: 
                   7664: \def\Edefun{\endgraf\medbreak}
                   7665: 
1.2     ! snw      7666: % @defblock, @defline do not automatically create index entries
        !          7667: \envdef\defblock{%
        !          7668:   \startdefun
        !          7669: }
        !          7670: \let\Edefblock\Edefun
        !          7671: 
        !          7672: \def\defline{%
        !          7673:   \doingtypefnfalse
        !          7674:   \parseargusing\activeparens{\printdefunline\deflineheader}%
        !          7675: }
        !          7676: \def\deflineheader#1 #2 #3\endheader{%
        !          7677:   \printdefname{#1}{}{#2}\magicamp\defunargs{#3\unskip}%
        !          7678: }
        !          7679: 
        !          7680: \def\deftypeline{%
        !          7681:   \doingtypefntrue
        !          7682:   \parseargusing\activeparens{\printdefunline\deftypelineheader}%
        !          7683: }
        !          7684: \def\deftypelineheader#1 #2 #3 #4\endheader{%
        !          7685:   \printdefname{#1}{#2}{#3}\magicamp\defunargs{#4\unskip}%
        !          7686: }
        !          7687: 
        !          7688: % \makedefun{deffoo} (\deffooheader parameters) { (\deffooheader expansion) }
1.1       snw      7689: %
1.2     ! snw      7690: % Define \deffoo, \deffoox  \Edeffoo and \deffooheader.
1.1       snw      7691: \def\makedefun#1{%
                   7692:   \expandafter\let\csname E#1\endcsname = \Edefun
                   7693:   \edef\temp{\noexpand\domakedefun
                   7694:     \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}%
                   7695:   \temp
                   7696: }
                   7697: \def\domakedefun#1#2#3{%
                   7698:   \envdef#1{%
                   7699:     \startdefun
                   7700:     \doingtypefnfalse    % distinguish typed functions from all else
                   7701:     \parseargusing\activeparens{\printdefunline#3}%
                   7702:   }%
1.2     ! snw      7703:   \def#2{%
        !          7704:     % First, check whether we are in the right environment:
        !          7705:     \checkenv#1%
        !          7706:     %
        !          7707:     % As in \startdefun, allow line break if we have multiple x headers
        !          7708:     % in a row.  It's not a great place, though.
        !          7709:     \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi
        !          7710:     %
        !          7711:     \doingtypefnfalse    % distinguish typed functions from all else
        !          7712:     \parseargusing\activeparens{\printdefunline#3}%
        !          7713:   }%
        !          7714:   \def#3% definition of \deffooheader follows
1.1       snw      7715: }
                   7716: 
                   7717: \newif\ifdoingtypefn       % doing typed function?
                   7718: \newif\ifrettypeownline    % typeset return type on its own line?
                   7719: 
                   7720: % @deftypefnnewline on|off says whether the return type of typed functions
                   7721: % are printed on their own line.  This affects @deftypefn, @deftypefun,
                   7722: % @deftypeop, and @deftypemethod.
                   7723: %
                   7724: \parseargdef\deftypefnnewline{%
                   7725:   \def\temp{#1}%
                   7726:   \ifx\temp\onword
                   7727:     \expandafter\let\csname SETtxideftypefnnl\endcsname
                   7728:       = \empty
                   7729:   \else\ifx\temp\offword
                   7730:     \expandafter\let\csname SETtxideftypefnnl\endcsname
                   7731:       = \relax
                   7732:   \else
                   7733:     \errhelp = \EMsimple
                   7734:     \errmessage{Unknown @txideftypefnnl value `\temp',
                   7735:                 must be on|off}%
                   7736:   \fi\fi
                   7737: }
                   7738: 
                   7739: % Untyped functions:
                   7740: 
                   7741: % @deffn category name args
1.2     ! snw      7742: \makedefun{deffn}#1 #2 #3\endheader{%
        !          7743:   \doind{fn}{\code{#2}}%
        !          7744:   \printdefname{#1}{}{#2}\magicamp\defunargs{#3\unskip}%
        !          7745: }
1.1       snw      7746: 
1.2     ! snw      7747: % @defop category class name args
        !          7748: \makedefun{defop}#1 {\defopheaderx{#1\ \putwordon}}
        !          7749: \def\defopheaderx#1#2 #3 #4\endheader{%
        !          7750:   \doind{fn}{\code{#3}\space\putwordon\ \code{#2}}%
        !          7751:   \printdefname{#1\ \code{#2}}{}{#3}\magicamp\defunargs{#4\unskip}%
1.1       snw      7752: }
                   7753: 
                   7754: % Typed functions:
                   7755: 
                   7756: % @deftypefn category type name args
1.2     ! snw      7757: \makedefun{deftypefn}#1 #2 #3 #4\endheader{%
        !          7758:   \doind{fn}{\code{#3}}%
        !          7759:   \doingtypefntrue
        !          7760:   \printdefname{#1}{#2}{#3}\defunargs{#4\unskip}%
        !          7761: }
1.1       snw      7762: 
                   7763: % @deftypeop category class type name args
1.2     ! snw      7764: \makedefun{deftypeop}#1 {\deftypeopheaderx{#1\ \putwordon}}
        !          7765: \def\deftypeopheaderx#1#2 #3 #4 #5\endheader{%
        !          7766:   \doind{fn}{\code{#4}\space\putwordon\ \code{#1\ \code{#2}}}%
1.1       snw      7767:   \doingtypefntrue
1.2     ! snw      7768:   \printdefname{#1\ \code{#2}}{#3}{#4}\defunargs{#5\unskip}%
1.1       snw      7769: }
                   7770: 
                   7771: % Typed variables:
                   7772: 
                   7773: % @deftypevr category type var args
1.2     ! snw      7774: \makedefun{deftypevr}#1 #2 #3 #4\endheader{%
        !          7775:   \doind{vr}{\code{#3}}%
        !          7776:   \printdefname{#1}{#2}{#3}\defunargs{#4\unskip}%
        !          7777: }
1.1       snw      7778: 
                   7779: % @deftypecv category class type var args
1.2     ! snw      7780: \makedefun{deftypecv}#1 {\deftypecvheaderx{#1\ \putwordof}}
        !          7781: \def\deftypecvheaderx#1#2 #3 #4 #5\endheader{%
        !          7782:   \doind{vr}{\code{#4}\space\putwordof\ \code{#2}}%
        !          7783:   \printdefname{#1\ \code{#2}}{#3}{#4}\defunargs{#5\unskip}%
1.1       snw      7784: }
                   7785: 
                   7786: % Untyped variables:
                   7787: 
                   7788: % @defvr category var args
                   7789: \makedefun{defvr}#1 {\deftypevrheader{#1} {} }
                   7790: 
                   7791: % @defcv category class var args
1.2     ! snw      7792: \makedefun{defcv}#1 {\defcvheaderx{#1\ \putwordof}}
        !          7793: \def\defcvheaderx#1#2 {\deftypecvheaderx{#1}#2 {} }
1.1       snw      7794: 
                   7795: % Types:
                   7796: 
                   7797: % @deftp category name args
                   7798: \makedefun{deftp}#1 #2 #3\endheader{%
                   7799:   \doind{tp}{\code{#2}}%
1.2     ! snw      7800:   \printdefname{#1}{}{#2}\defunargs{#3\unskip}%
1.1       snw      7801: }
                   7802: 
                   7803: % Remaining @defun-like shortcuts:
                   7804: \makedefun{defun}{\deffnheader{\putwordDeffunc} }
                   7805: \makedefun{defmac}{\deffnheader{\putwordDefmac} }
                   7806: \makedefun{defspec}{\deffnheader{\putwordDefspec} }
                   7807: \makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} }
                   7808: \makedefun{defvar}{\defvrheader{\putwordDefvar} }
                   7809: \makedefun{defopt}{\defvrheader{\putwordDefopt} }
                   7810: \makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} }
1.2     ! snw      7811: \makedefun{defmethod}{\defopheaderx\putwordMethodon}
        !          7812: \makedefun{deftypemethod}{\deftypeopheaderx\putwordMethodon}
        !          7813: \makedefun{defivar}{\defcvheaderx\putwordInstanceVariableof}
        !          7814: \makedefun{deftypeivar}{\deftypecvheaderx\putwordInstanceVariableof}
1.1       snw      7815: 
1.2     ! snw      7816: % \printdefname, which formats the name of the @def (not the args).
1.1       snw      7817: % #1 is the category, such as "Function".
                   7818: % #2 is the return type, if any.
                   7819: % #3 is the function name.
                   7820: %
                   7821: % We are followed by (but not passed) the arguments, if any.
                   7822: %
1.2     ! snw      7823: \def\printdefname#1#2#3{%
1.1       snw      7824:   \par
                   7825:   % Get the values of \leftskip and \rightskip as they were outside the @def...
                   7826:   \advance\leftskip by -\defbodyindent
                   7827:   %
                   7828:   % Determine if we are typesetting the return type of a typed function
                   7829:   % on a line by itself.
                   7830:   \rettypeownlinefalse
                   7831:   \ifdoingtypefn  % doing a typed function specifically?
                   7832:     % then check user option for putting return type on its own line:
1.2     ! snw      7833:     \ifflagclear{txideftypefnnl}{}{\rettypeownlinetrue}%
1.1       snw      7834:   \fi
                   7835:   %
                   7836:   % How we'll format the category name.  Putting it in brackets helps
                   7837:   % distinguish it from the body text that may end up on the next line
                   7838:   % just below it.
                   7839:   \def\temp{#1}%
                   7840:   \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi}
                   7841:   %
                   7842:   % Figure out line sizes for the paragraph shape.  We'll always have at
                   7843:   % least two.
                   7844:   \tempnum = 2
                   7845:   %
                   7846:   % The first line needs space for \box0; but if \rightskip is nonzero,
                   7847:   % we need only space for the part of \box0 which exceeds it:
                   7848:   \dimen0=\hsize  \advance\dimen0 by -\wd0  \advance\dimen0 by \rightskip
                   7849:   %
                   7850:   % If doing a return type on its own line, we'll have another line.
                   7851:   \ifrettypeownline
                   7852:     \advance\tempnum by 1
                   7853:     \def\maybeshapeline{0in \hsize}%
                   7854:   \else
                   7855:     \def\maybeshapeline{}%
                   7856:   \fi
                   7857:   %
                   7858:   % The continuations:
                   7859:   \dimen2=\hsize  \advance\dimen2 by -\defargsindent
                   7860:   %
                   7861:   % The final paragraph shape:
                   7862:   \parshape \tempnum  0in \dimen0  \maybeshapeline  \defargsindent \dimen2
                   7863:   %
                   7864:   % Put the category name at the right margin.
                   7865:   \noindent
                   7866:   \hbox to 0pt{%
                   7867:     \hfil\box0 \kern-\hsize
                   7868:     % \hsize has to be shortened this way:
                   7869:     \kern\leftskip
                   7870:     % Intentionally do not respect \rightskip, since we need the space.
                   7871:   }%
                   7872:   %
                   7873:   % Allow all lines to be underfull without complaint:
                   7874:   \tolerance=10000 \hbadness=10000
                   7875:   \exdentamount=\defbodyindent
                   7876:   {%
1.2     ! snw      7877:     \def\^^M{}% for line continuation
        !          7878:     %
1.1       snw      7879:     % defun fonts. We use typewriter by default (used to be bold) because:
                   7880:     % . we're printing identifiers, they should be in tt in principle.
                   7881:     % . in languages with many accents, such as Czech or French, it's
                   7882:     %   common to leave accents off identifiers.  The result looks ok in
                   7883:     %   tt, but exceedingly strange in rm.
                   7884:     % . we don't want -- and --- to be treated as ligatures.
                   7885:     % . this still does not fix the ?` and !` ligatures, but so far no
                   7886:     %   one has made identifiers using them :).
                   7887:     \df \tt
                   7888:     \def\temp{#2}% text of the return type
                   7889:     \ifx\temp\empty\else
                   7890:       \tclose{\temp}% typeset the return type
                   7891:       \ifrettypeownline
                   7892:         % put return type on its own line; prohibit line break following:
                   7893:         \hfil\vadjust{\nobreak}\break
                   7894:       \else
                   7895:         \space  % type on same line, so just followed by a space
                   7896:       \fi
                   7897:     \fi           % no return type
                   7898:     #3% output function name
                   7899:   }%
1.2     ! snw      7900:   \ifflagclear{txidefnamenospace}{%
        !          7901:     {\rm\enskip}% hskip 0.5 em of \rmfont
        !          7902:   }{}%
1.1       snw      7903:   %
                   7904:   \boldbrax
                   7905:   % arguments will be output next, if any.
                   7906: }
                   7907: 
1.2     ! snw      7908: % Print arguments.  Use slanted for @def*, typewriter for @deftype*.
1.1       snw      7909: \def\defunargs#1{%
1.2     ! snw      7910:   \bgroup
        !          7911:     \def\^^M{}% for line continuation
        !          7912:     \df \ifdoingtypefn \tt \else \sl \fi
        !          7913:     \ifflagclear{txicodevaristt}{}%
        !          7914:        {\def\var##1{{\setregularquotes \ttsl ##1}}}%
        !          7915:     #1%
        !          7916:   \egroup
1.1       snw      7917: }
                   7918: 
                   7919: % We want ()&[] to print specially on the defun line.
                   7920: %
                   7921: \def\activeparens{%
                   7922:   \catcode`\(=\active \catcode`\)=\active
                   7923:   \catcode`\[=\active \catcode`\]=\active
                   7924:   \catcode`\&=\active
                   7925: }
                   7926: 
                   7927: % Make control sequences which act like normal parenthesis chars.
                   7928: \let\lparen = ( \let\rparen = )
                   7929: 
                   7930: % Be sure that we always have a definition for `(', etc.  For example,
                   7931: % if the fn name has parens in it, \boldbrax will not be in effect yet,
                   7932: % so TeX would otherwise complain about undefined control sequence.
                   7933: {
                   7934:   \activeparens
1.2     ! snw      7935:   \gdef\defcharsdefault{%
        !          7936:     \let(=\lparen \let)=\rparen
        !          7937:     \let[=\lbrack \let]=\rbrack
        !          7938:     \let& = \&%
        !          7939:   }
        !          7940:   \globaldefs=1 \defcharsdefault
1.1       snw      7941: 
                   7942:   \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
                   7943:   \gdef\magicamp{\let&=\amprm}
                   7944: }
                   7945: \let\ampchar\&
                   7946: 
                   7947: \newcount\parencount
                   7948: 
                   7949: % If we encounter &foo, then turn on ()-hacking afterwards
                   7950: \newif\ifampseen
1.2     ! snw      7951: \def\amprm#1 {\ampseentrue{\rm\&#1 }}
1.1       snw      7952: 
                   7953: \def\parenfont{%
                   7954:   \ifampseen
                   7955:     % At the first level, print parens in roman,
                   7956:     % otherwise use the default font.
                   7957:     \ifnum \parencount=1 \rm \fi
                   7958:   \else
                   7959:     % The \sf parens (in \boldbrax) actually are a little bolder than
                   7960:     % the contained text.  This is especially needed for [ and ] .
                   7961:     \sf
                   7962:   \fi
                   7963: }
                   7964: \def\infirstlevel#1{%
                   7965:   \ifampseen
                   7966:     \ifnum\parencount=1
                   7967:       #1%
                   7968:     \fi
                   7969:   \fi
                   7970: }
                   7971: \def\bfafterword#1 {#1 \bf}
                   7972: 
                   7973: \def\opnr{%
                   7974:   \global\advance\parencount by 1
                   7975:   {\parenfont(}%
                   7976:   \infirstlevel \bfafterword
                   7977: }
                   7978: \def\clnr{%
                   7979:   {\parenfont)}%
                   7980:   \infirstlevel \sl
                   7981:   \global\advance\parencount by -1
                   7982: }
                   7983: 
                   7984: \newcount\brackcount
                   7985: \def\lbrb{%
                   7986:   \global\advance\brackcount by 1
                   7987:   {\bf[}%
                   7988: }
                   7989: \def\rbrb{%
                   7990:   {\bf]}%
                   7991:   \global\advance\brackcount by -1
                   7992: }
                   7993: 
                   7994: \def\checkparencounts{%
                   7995:   \ifnum\parencount=0 \else \badparencount \fi
                   7996:   \ifnum\brackcount=0 \else \badbrackcount \fi
                   7997: }
                   7998: % these should not use \errmessage; the glibc manual, at least, actually
                   7999: % has such constructs (when documenting function pointers).
                   8000: \def\badparencount{%
                   8001:   \message{Warning: unbalanced parentheses in @def...}%
                   8002:   \global\parencount=0
                   8003: }
                   8004: \def\badbrackcount{%
                   8005:   \message{Warning: unbalanced square brackets in @def...}%
                   8006:   \global\brackcount=0
                   8007: }
                   8008: 
                   8009: 
                   8010: \message{macros,}
                   8011: % @macro.
                   8012: 
                   8013: % To do this right we need a feature of e-TeX, \scantokens,
                   8014: % which we arrange to emulate with a temporary file in ordinary TeX.
                   8015: \ifx\eTeXversion\thisisundefined
                   8016:   \newwrite\macscribble
                   8017:   \def\scantokens#1{%
                   8018:     \toks0={#1}%
                   8019:     \immediate\openout\macscribble=\jobname.tmp
                   8020:     \immediate\write\macscribble{\the\toks0}%
                   8021:     \immediate\closeout\macscribble
                   8022:     \input \jobname.tmp
                   8023:   }
                   8024: \fi
                   8025: 
                   8026: \let\E=\expandafter
                   8027: 
                   8028: % Used at the time of macro expansion.
                   8029: % Argument is macro body with arguments substituted
                   8030: \def\scanmacro#1{%
                   8031:   \newlinechar`\^^M
                   8032:   % expand the expansion of \eatleadingcr twice to maybe remove a leading
                   8033:   % newline (and \else and \fi tokens), then call \eatspaces on the result.
                   8034:   \def\xeatspaces##1{%
                   8035:     \E\E\E\E\E\E\E\eatspaces\E\E\E\E\E\E\E{\eatleadingcr##1%
                   8036:   }}%
                   8037:   \def\xempty##1{}%
                   8038:   %
                   8039:   % Process the macro body under the current catcode regime.
                   8040:   \scantokens{#1@comment}%
                   8041:   %
                   8042:   % The \comment is to remove the \newlinechar added by \scantokens, and
                   8043:   % can be noticed by \parsearg.  Note \c isn't used because this means cedilla
                   8044:   % in math mode.
                   8045: }
                   8046: 
                   8047: % Used for copying and captions
                   8048: \def\scanexp#1{%
                   8049:   \expandafter\scanmacro\expandafter{#1}%
                   8050: }
                   8051: 
                   8052: \newcount\paramno   % Count of parameters
                   8053: \newtoks\macname    % Macro name
                   8054: \newif\ifrecursive  % Is it recursive?
                   8055: 
                   8056: % List of all defined macros in the form
                   8057: %    \commondummyword\macro1\commondummyword\macro2...
                   8058: % Currently is also contains all @aliases; the list can be split
                   8059: % if there is a need.
                   8060: \def\macrolist{}
                   8061: 
                   8062: % Add the macro to \macrolist
                   8063: \def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname}
                   8064: \def\addtomacrolistxxx#1{%
                   8065:      \toks0 = \expandafter{\macrolist\commondummyword#1}%
                   8066:      \xdef\macrolist{\the\toks0}%
                   8067: }
                   8068: 
                   8069: % Utility routines.
                   8070: % This does \let #1 = #2, with \csnames; that is,
                   8071: %   \let \csname#1\endcsname = \csname#2\endcsname
                   8072: % (except of course we have to play expansion games).
                   8073: %
                   8074: \def\cslet#1#2{%
                   8075:   \expandafter\let
                   8076:   \csname#1\expandafter\endcsname
                   8077:   \csname#2\endcsname
                   8078: }
                   8079: 
                   8080: % Trim leading and trailing spaces off a string.
                   8081: % Concepts from aro-bend problem 15 (see CTAN).
                   8082: {\catcode`\@=11
                   8083: \gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
                   8084: \gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
                   8085: \gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
                   8086: \def\unbrace#1{#1}
                   8087: \unbrace{\gdef\trim@@@ #1 } #2@{#1}
                   8088: }
                   8089: 
                   8090: {\catcode`\^^M=\other%
                   8091: \gdef\eatleadingcr#1{\if\noexpand#1\noexpand^^M\else\E#1\fi}}%
                   8092: % Warning: this won't work for a delimited argument
                   8093: % or for an empty argument
                   8094: 
                   8095: % Trim a single trailing ^^M off a string.
                   8096: {\catcode`\^^M=\other \catcode`\Q=3%
                   8097: \gdef\eatcr #1{\eatcra #1Q^^MQ}%
                   8098: \gdef\eatcra#1^^MQ{\eatcrb#1Q}%
                   8099: \gdef\eatcrb#1Q#2Q{#1}%
                   8100: }
                   8101: 
                   8102: % Macro bodies are absorbed as an argument in a context where
                   8103: % all characters are catcode 10, 11 or 12, except \ which is active
                   8104: % (as in normal texinfo). It is necessary to change the definition of \
                   8105: % to recognize macro arguments; this is the job of \mbodybackslash.
                   8106: %
                   8107: % Non-ASCII encodings make 8-bit characters active, so un-activate
                   8108: % them to avoid their expansion.  Must do this non-globally, to
                   8109: % confine the change to the current group.
                   8110: %
                   8111: % It's necessary to have hard CRs when the macro is executed. This is
                   8112: % done by making ^^M (\endlinechar) catcode 12 when reading the macro
                   8113: % body, and then making it the \newlinechar in \scanmacro.
                   8114: %
                   8115: \def\scanctxt{% used as subroutine
                   8116:   \catcode`\"=\other
                   8117:   \catcode`\+=\other
                   8118:   \catcode`\<=\other
                   8119:   \catcode`\>=\other
                   8120:   \catcode`\^=\other
                   8121:   \catcode`\_=\other
                   8122:   \catcode`\|=\other
                   8123:   \catcode`\~=\other
                   8124:   \catcode`\@=\other
                   8125:   \catcode`\^^M=\other
1.2     ! snw      8126:   \catcode`\\=\active
        !          8127:   \passthroughcharstrue
1.1       snw      8128: }
                   8129: 
1.2     ! snw      8130: \def\macrobodyctxt{% used for @macro definitions and @copying
1.1       snw      8131:   \scanctxt
                   8132:   \catcode`\ =\other
                   8133:   \catcode`\{=\other
                   8134:   \catcode`\}=\other
                   8135: }
                   8136: 
                   8137: % Used when scanning braced macro arguments.  Note, however, that catcode
                   8138: % changes here are ineffectual if the macro invocation was nested inside
                   8139: % an argument to another Texinfo command.
                   8140: \def\macroargctxt{%
                   8141:   \scanctxt
                   8142:   \catcode`\ =\active
                   8143: }
                   8144: 
                   8145: \def\macrolineargctxt{% used for whole-line arguments without braces
                   8146:   \scanctxt
                   8147:   \catcode`\{=\other
                   8148:   \catcode`\}=\other
                   8149: }
                   8150: 
                   8151: % \mbodybackslash is the definition of \ in @macro bodies.
                   8152: % It maps \foo\ => \csname macarg.foo\endcsname => #N
                   8153: % where N is the macro parameter number.
                   8154: % We define \csname macarg.\endcsname to be \realbackslash, so
                   8155: % \\ in macro replacement text gets you a backslash.
                   8156: %
                   8157: {\catcode`@=0 @catcode`@\=@active
                   8158:  @gdef@usembodybackslash{@let\=@mbodybackslash}
                   8159:  @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
                   8160: }
                   8161: \expandafter\def\csname macarg.\endcsname{\realbackslash}
                   8162: 
                   8163: \def\margbackslash#1{\char`\#1 }
                   8164: 
                   8165: \def\macro{\recursivefalse\parsearg\macroxxx}
                   8166: \def\rmacro{\recursivetrue\parsearg\macroxxx}
                   8167: 
                   8168: \def\macroxxx#1{%
                   8169:   \getargs{#1}% now \macname is the macname and \argl the arglist
                   8170:   \ifx\argl\empty       % no arguments
                   8171:      \paramno=0\relax
                   8172:   \else
                   8173:      \expandafter\parsemargdef \argl;%
                   8174:      \if\paramno>256\relax
                   8175:        \ifx\eTeXversion\thisisundefined
                   8176:          \errhelp = \EMsimple
                   8177:          \errmessage{You need eTeX to compile a file with macros with more than 256 arguments}
                   8178:        \fi
                   8179:      \fi
                   8180:   \fi
                   8181:   \if1\csname ismacro.\the\macname\endcsname
                   8182:      \message{Warning: redefining \the\macname}%
                   8183:   \else
                   8184:      \expandafter\ifx\csname \the\macname\endcsname \relax
                   8185:      \else \errmessage{Macro name \the\macname\space already defined}\fi
                   8186:      \global\cslet{macsave.\the\macname}{\the\macname}%
                   8187:      \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
                   8188:      \addtomacrolist{\the\macname}%
                   8189:   \fi
1.2     ! snw      8190:   \begingroup \macrobodyctxt \usembodybackslash
1.1       snw      8191:   \ifrecursive \expandafter\parsermacbody
                   8192:   \else \expandafter\parsemacbody
                   8193:   \fi}
                   8194: 
                   8195: \parseargdef\unmacro{%
                   8196:   \if1\csname ismacro.#1\endcsname
                   8197:     \global\cslet{#1}{macsave.#1}%
                   8198:     \global\expandafter\let \csname ismacro.#1\endcsname=0%
                   8199:     % Remove the macro name from \macrolist:
                   8200:     \begingroup
                   8201:       \expandafter\let\csname#1\endcsname \relax
                   8202:       \let\commondummyword\unmacrodo
                   8203:       \xdef\macrolist{\macrolist}%
                   8204:     \endgroup
                   8205:   \fi
                   8206: }
                   8207: 
                   8208: % Called by \do from \dounmacro on each macro.  The idea is to omit any
                   8209: % macro definitions that have been changed to \relax.
                   8210: %
                   8211: \def\unmacrodo#1{%
                   8212:   \ifx #1\relax
                   8213:     % remove this
                   8214:   \else
                   8215:     \noexpand\commondummyword \noexpand#1%
                   8216:   \fi
                   8217: }
                   8218: 
                   8219: % \getargs -- Parse the arguments to a @macro line.  Set \macname to
                   8220: % the name of the macro, and \argl to the braced argument list.
                   8221: \def\getargs#1{\getargsxxx#1{}}
                   8222: \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
                   8223: \def\getmacname#1 #2\relax{\macname={#1}}
                   8224: \def\getmacargs#1{\def\argl{#1}}
                   8225: % This made use of the feature that if the last token of a
                   8226: % <parameter list> is #, then the preceding argument is delimited by
                   8227: % an opening brace, and that opening brace is not consumed.
                   8228: 
                   8229: % Parse the optional {params} list to @macro or @rmacro.
                   8230: % Set \paramno to the number of arguments,
                   8231: % and \paramlist to a parameter text for the macro (e.g. #1,#2,#3 for a
                   8232: % three-param macro.)  Define \macarg.BLAH for each BLAH in the params
                   8233: % list to some hook where the argument is to be expanded.  If there are
                   8234: % less than 10 arguments that hook is to be replaced by ##N where N
                   8235: % is the position in that list, that is to say the macro arguments are to be
                   8236: % defined `a la TeX in the macro body.
                   8237: %
                   8238: % That gets used by \mbodybackslash (above).
                   8239: %
                   8240: % If there are 10 or more arguments, a different technique is used: see
                   8241: % \parsemmanyargdef.
                   8242: %
                   8243: \def\parsemargdef#1;{%
                   8244:   \paramno=0\def\paramlist{}%
                   8245:   \let\hash\relax
                   8246:   % \hash is redefined to `#' later to get it into definitions
                   8247:   \let\xeatspaces\relax
                   8248:   \let\xempty\relax
                   8249:   \parsemargdefxxx#1,;,%
                   8250:   \ifnum\paramno<10\relax\else
                   8251:     \paramno0\relax
                   8252:     \parsemmanyargdef@@#1,;,% 10 or more arguments
                   8253:   \fi
                   8254: }
                   8255: \def\parsemargdefxxx#1,{%
                   8256:   \if#1;\let\next=\relax
                   8257:   \else \let\next=\parsemargdefxxx
                   8258:     \advance\paramno by 1
                   8259:     \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
                   8260:         {\xeatspaces{\hash\the\paramno\noexpand\xempty{}}}%
                   8261:     \edef\paramlist{\paramlist\hash\the\paramno,}%
                   8262:   \fi\next}
                   8263: % the \xempty{} is to give \eatleadingcr an argument in the case of an
                   8264: % empty macro argument.
                   8265: 
                   8266: % \parsemacbody, \parsermacbody
                   8267: %
                   8268: % Read recursive and nonrecursive macro bodies. (They're different since
                   8269: % rec and nonrec macros end differently.)
                   8270: %
1.2     ! snw      8271: % We are in \macrobodyctxt, and the \xdef causes backslashes in the macro
1.1       snw      8272: % body to be transformed.
1.2     ! snw      8273: % Set \macrobody to the body of the macro, and call \macrodef.
1.1       snw      8274: %
                   8275: {\catcode`\ =\other\long\gdef\parsemacbody#1@end macro{%
1.2     ! snw      8276: \xdef\macrobody{\eatcr{#1}}\endgroup\macrodef}}%
1.1       snw      8277: {\catcode`\ =\other\long\gdef\parsermacbody#1@end rmacro{%
1.2     ! snw      8278: \xdef\macrobody{\eatcr{#1}}\endgroup\macrodef}}%
1.1       snw      8279: 
                   8280: % Make @ a letter, so that we can make private-to-Texinfo macro names.
                   8281: \edef\texiatcatcode{\the\catcode`\@}
                   8282: \catcode `@=11\relax
                   8283: 
                   8284: %%%%%%%%%%%%%% Code for > 10 arguments only   %%%%%%%%%%%%%%%%%%
                   8285: 
                   8286: % If there are 10 or more arguments, a different technique is used, where the
                   8287: % hook remains in the body, and when macro is to be expanded the body is
                   8288: % processed again to replace the arguments.
                   8289: %
                   8290: % In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the
                   8291: % argument N value and then \edef the body (nothing else will expand because of
                   8292: % the catcode regime under which the body was input).
                   8293: %
                   8294: % If you compile with TeX (not eTeX), and you have macros with 10 or more
                   8295: % arguments, no macro can have more than 256 arguments (else error).
                   8296: %
                   8297: % In case that there are 10 or more arguments we parse again the arguments
                   8298: % list to set new definitions for the \macarg.BLAH macros corresponding to
                   8299: % each BLAH argument. It was anyhow needed to parse already once this list
                   8300: % in order to count the arguments, and as macros with at most 9 arguments
                   8301: % are by far more frequent than macro with 10 or more arguments, defining
                   8302: % twice the \macarg.BLAH macros does not cost too much processing power.
                   8303: \def\parsemmanyargdef@@#1,{%
                   8304:   \if#1;\let\next=\relax
                   8305:   \else
                   8306:     \let\next=\parsemmanyargdef@@
                   8307:     \edef\tempb{\eatspaces{#1}}%
                   8308:     \expandafter\def\expandafter\tempa
                   8309:        \expandafter{\csname macarg.\tempb\endcsname}%
                   8310:     % Note that we need some extra \noexpand\noexpand, this is because we
                   8311:     % don't want \the  to be expanded in the \parsermacbody  as it uses an
                   8312:     % \xdef .
                   8313:     \expandafter\edef\tempa
                   8314:       {\noexpand\noexpand\noexpand\the\toks\the\paramno}%
                   8315:     \advance\paramno by 1\relax
                   8316:   \fi\next}
                   8317: 
                   8318: 
                   8319: \let\endargs@\relax
                   8320: \let\nil@\relax
                   8321: \def\nilm@{\nil@}%
                   8322: \long\def\nillm@{\nil@}%
                   8323: 
                   8324: % This macro is expanded during the Texinfo macro expansion, not during its
                   8325: % definition.  It gets all the arguments' values and assigns them to macros
                   8326: % macarg.ARGNAME
                   8327: %
                   8328: % #1 is the macro name
                   8329: % #2 is the list of argument names
                   8330: % #3 is the list of argument values
                   8331: \def\getargvals@#1#2#3{%
                   8332:   \def\macargdeflist@{}%
                   8333:   \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion.
                   8334:   \def\paramlist{#2,\nil@}%
                   8335:   \def\macroname{#1}%
                   8336:   \begingroup
                   8337:   \macroargctxt
                   8338:   \def\argvaluelist{#3,\nil@}%
                   8339:   \def\@tempa{#3}%
                   8340:   \ifx\@tempa\empty
                   8341:     \setemptyargvalues@
                   8342:   \else
                   8343:     \getargvals@@
                   8344:   \fi
                   8345: }
                   8346: \def\getargvals@@{%
                   8347:   \ifx\paramlist\nilm@
                   8348:       % Some sanity check needed here that \argvaluelist is also empty.
                   8349:       \ifx\argvaluelist\nillm@
                   8350:       \else
                   8351:         \errhelp = \EMsimple
                   8352:         \errmessage{Too many arguments in macro `\macroname'!}%
                   8353:       \fi
                   8354:       \let\next\macargexpandinbody@
                   8355:   \else
                   8356:     \ifx\argvaluelist\nillm@
                   8357:        % No more arguments values passed to macro.  Set remaining named-arg
                   8358:        % macros to empty.
                   8359:        \let\next\setemptyargvalues@
                   8360:     \else
                   8361:       % pop current arg name into \@tempb
                   8362:       \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}%
                   8363:       \expandafter\@tempa\expandafter{\paramlist}%
                   8364:        % pop current argument value into \@tempc
                   8365:       \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}%
                   8366:       \expandafter\@tempa\expandafter{\argvaluelist}%
                   8367:        % Here \@tempb is the current arg name and \@tempc is the current arg value.
                   8368:        % First place the new argument macro definition into \@tempd
                   8369:        \expandafter\macname\expandafter{\@tempc}%
                   8370:        \expandafter\let\csname macarg.\@tempb\endcsname\relax
                   8371:        \expandafter\def\expandafter\@tempe\expandafter{%
                   8372:          \csname macarg.\@tempb\endcsname}%
                   8373:        \edef\@tempd{\long\def\@tempe{\the\macname}}%
                   8374:        \push@\@tempd\macargdeflist@
                   8375:        \let\next\getargvals@@
                   8376:     \fi
                   8377:   \fi
                   8378:   \next
                   8379: }
                   8380: 
                   8381: \def\push@#1#2{%
                   8382:   \expandafter\expandafter\expandafter\def
                   8383:   \expandafter\expandafter\expandafter#2%
                   8384:   \expandafter\expandafter\expandafter{%
                   8385:   \expandafter#1#2}%
                   8386: }
                   8387: 
                   8388: % Replace arguments by their values in the macro body, and place the result
                   8389: % in macro \@tempa.
                   8390: %
                   8391: \def\macvalstoargs@{%
                   8392:   %  To do this we use the property that token registers that are \the'ed
                   8393:   % within an \edef  expand only once. So we are going to place all argument
                   8394:   % values into respective token registers.
                   8395:   %
                   8396:   % First we save the token context, and initialize argument numbering.
                   8397:   \begingroup
                   8398:     \paramno0\relax
                   8399:     % Then, for each argument number #N, we place the corresponding argument
                   8400:     % value into a new token list register \toks#N
                   8401:     \expandafter\putargsintokens@\saveparamlist@,;,%
                   8402:     % Then, we expand the body so that argument are replaced by their
                   8403:     % values. The trick for values not to be expanded themselves is that they
                   8404:     % are within tokens and that tokens expand only once in an \edef .
                   8405:     \edef\@tempc{\csname mac.\macroname .body\endcsname}%
                   8406:     % Now we restore the token stack pointer to free the token list registers
                   8407:     % which we have used, but we make sure that expanded body is saved after
                   8408:     % group.
                   8409:     \expandafter
                   8410:   \endgroup
                   8411:   \expandafter\def\expandafter\@tempa\expandafter{\@tempc}%
                   8412:   }
                   8413: 
                   8414: % Define the named-macro outside of this group and then close this group.
                   8415: %
                   8416: \def\macargexpandinbody@{%
                   8417:   \expandafter
                   8418:   \endgroup
                   8419:   \macargdeflist@
                   8420:   % First the replace in body the macro arguments by their values, the result
                   8421:   % is in \@tempa .
                   8422:   \macvalstoargs@
                   8423:   % Then we point at the \norecurse or \gobble (for recursive) macro value
                   8424:   % with \@tempb .
                   8425:   \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname
                   8426:   % Depending on whether it is recursive or not, we need some tailing
                   8427:   % \egroup .
                   8428:   \ifx\@tempb\gobble
                   8429:      \let\@tempc\relax
                   8430:   \else
                   8431:      \let\@tempc\egroup
                   8432:   \fi
                   8433:   % And now we do the real job:
                   8434:   \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}%
                   8435:   \@tempd
                   8436: }
                   8437: 
                   8438: \def\putargsintokens@#1,{%
                   8439:   \if#1;\let\next\relax
                   8440:   \else
                   8441:     \let\next\putargsintokens@
                   8442:     % First we allocate the new token list register, and give it a temporary
                   8443:     % alias \@tempb .
                   8444:     \toksdef\@tempb\the\paramno
                   8445:     % Then we place the argument value into that token list register.
                   8446:     \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname
                   8447:     \expandafter\@tempb\expandafter{\@tempa}%
                   8448:     \advance\paramno by 1\relax
                   8449:   \fi
                   8450:   \next
                   8451: }
                   8452: 
                   8453: % Trailing missing arguments are set to empty.
                   8454: %
                   8455: \def\setemptyargvalues@{%
                   8456:   \ifx\paramlist\nilm@
                   8457:     \let\next\macargexpandinbody@
                   8458:   \else
                   8459:     \expandafter\setemptyargvaluesparser@\paramlist\endargs@
                   8460:     \let\next\setemptyargvalues@
                   8461:   \fi
                   8462:   \next
                   8463: }
                   8464: 
                   8465: \def\setemptyargvaluesparser@#1,#2\endargs@{%
                   8466:   \expandafter\def\expandafter\@tempa\expandafter{%
                   8467:     \expandafter\def\csname macarg.#1\endcsname{}}%
                   8468:   \push@\@tempa\macargdeflist@
                   8469:   \def\paramlist{#2}%
                   8470: }
                   8471: 
                   8472: % #1 is the element target macro
                   8473: % #2 is the list macro
                   8474: % #3,#4\endargs@ is the list value
                   8475: \def\pop@#1#2#3,#4\endargs@{%
                   8476:    \def#1{#3}%
                   8477:    \def#2{#4}%
                   8478: }
                   8479: \long\def\longpop@#1#2#3,#4\endargs@{%
                   8480:    \long\def#1{#3}%
                   8481:    \long\def#2{#4}%
                   8482: }
                   8483: 
                   8484: 
                   8485: %%%%%%%%%%%%%% End of code for > 10 arguments %%%%%%%%%%%%%%%%%%
                   8486: 
                   8487: 
                   8488: % This defines a Texinfo @macro or @rmacro, called by \parsemacbody.
                   8489: %    \macrobody has the body of the macro in it, with placeholders for
                   8490: % its parameters, looking like "\xeatspaces{\hash 1}".
                   8491: %    \paramno is the number of parameters
                   8492: %    \paramlist is a TeX parameter text, e.g. "#1,#2,#3,"
                   8493: % There are four cases: macros of zero, one, up to nine, and many arguments.
                   8494: % \xdef is used so that macro definitions will survive the file
                   8495: % they're defined in: @include reads the file inside a group.
                   8496: %
1.2     ! snw      8497: \def\macrodef{%
1.1       snw      8498:   \let\hash=##% convert placeholders to macro parameter chars
                   8499:   \ifnum\paramno=1
1.2     ! snw      8500:     \long\def\xeatspaces##1{##1}%
        !          8501:     % We don't use \xeatspaces for single-argument macros, because we
        !          8502:     % want to keep ends of lines.  This definition removes \xeatspaces
        !          8503:     % when \macrobody is expanded below.
        !          8504:   \else
        !          8505:     \def\xeatspaces{\string\xeatspaces}%
        !          8506:     % This expands \xeatspaces as a sequence of character tokens, which
        !          8507:     % stops \scantokens inserting an extra space after the control sequence.
1.1       snw      8508:   \fi
                   8509:   \ifcase\paramno
                   8510:   % 0
                   8511:     \expandafter\xdef\csname\the\macname\endcsname{%
1.2     ! snw      8512:       \begingroup
1.1       snw      8513:         \noexpand\spaceisspace
                   8514:         \noexpand\endlineisspace
                   8515:         \noexpand\expandafter % skip any whitespace after the macro name.
                   8516:         \expandafter\noexpand\csname\the\macname @@@\endcsname}%
                   8517:     \expandafter\xdef\csname\the\macname @@@\endcsname{%
1.2     ! snw      8518:       \endgroup
1.1       snw      8519:       \noexpand\scanmacro{\macrobody}}%
                   8520:   \or % 1
                   8521:     \expandafter\xdef\csname\the\macname\endcsname{%
1.2     ! snw      8522:        \begingroup
1.1       snw      8523:        \noexpand\braceorline
                   8524:        \expandafter\noexpand\csname\the\macname @@@\endcsname}%
                   8525:     \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
1.2     ! snw      8526:       \endgroup
1.1       snw      8527:       \noexpand\scanmacro{\macrobody}%
                   8528:       }%
                   8529:   \else % at most 9
                   8530:     \ifnum\paramno<10\relax
                   8531:       % @MACNAME sets the context for reading the macro argument
                   8532:       % @MACNAME@@ gets the argument, processes backslashes and appends a
                   8533:       % comma.
                   8534:       % @MACNAME@@@ removes braces surrounding the argument list.
                   8535:       % @MACNAME@@@@ scans the macro body with arguments substituted.
                   8536:       \expandafter\xdef\csname\the\macname\endcsname{%
1.2     ! snw      8537:         \begingroup
1.1       snw      8538:         \noexpand\expandafter  % This \expandafter skip any spaces after the
                   8539:         \noexpand\macroargctxt % macro before we change the catcode of space.
                   8540:         \noexpand\expandafter
                   8541:         \expandafter\noexpand\csname\the\macname @@\endcsname}%
                   8542:       \expandafter\xdef\csname\the\macname @@\endcsname##1{%
                   8543:           \noexpand\passargtomacro
                   8544:           \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}%
                   8545:       \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
                   8546:           \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}%
                   8547:       \expandafter\expandafter
                   8548:       \expandafter\xdef
                   8549:       \expandafter\expandafter
                   8550:         \csname\the\macname @@@@\endcsname\paramlist{%
1.2     ! snw      8551:           \endgroup\noexpand\scanmacro{\macrobody}}%
1.1       snw      8552:     \else % 10 or more:
                   8553:       \expandafter\xdef\csname\the\macname\endcsname{%
                   8554:         \noexpand\getargvals@{\the\macname}{\argl}%
                   8555:       }%
                   8556:       \global\expandafter\let\csname mac.\the\macname .body\endcsname\macrobody
                   8557:       \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble
                   8558:     \fi
                   8559:   \fi}
                   8560: 
                   8561: \catcode `\@\texiatcatcode\relax % end private-to-Texinfo catcodes
                   8562: 
                   8563: \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
                   8564: 
                   8565: 
                   8566: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                   8567: %
                   8568: {\catcode`\@=0 \catcode`\\=13  % We need to manipulate \ so use @ as escape
                   8569: @catcode`@_=11  % private names
                   8570: @catcode`@!=11  % used as argument separator
                   8571: 
                   8572: % \passargtomacro#1#2 -
                   8573: % Call #1 with a list of tokens #2, with any doubled backslashes in #2
                   8574: % compressed to one.
                   8575: %
                   8576: % This implementation works by expansion, and not execution (so we cannot use
                   8577: % \def or similar).  This reduces the risk of this failing in contexts where
                   8578: % complete expansion is done with no execution (for example, in writing out to
                   8579: % an auxiliary file for an index entry).
                   8580: %
                   8581: % State is kept in the input stream: the argument passed to
                   8582: % @look_ahead, @gobble_and_check_finish and @add_segment is
                   8583: %
                   8584: % THE_MACRO ARG_RESULT ! {PENDING_BS} NEXT_TOKEN  (... rest of input)
                   8585: %
                   8586: % where:
                   8587: % THE_MACRO - name of the macro we want to call
                   8588: % ARG_RESULT - argument list we build to pass to that macro
                   8589: % PENDING_BS - either a backslash or nothing
                   8590: % NEXT_TOKEN - used to look ahead in the input stream to see what's coming next
                   8591: 
                   8592: @gdef@passargtomacro#1#2{%
                   8593:   @add_segment #1!{}@relax#2\@_finish\%
                   8594: }
                   8595: @gdef@_finish{@_finishx} @global@let@_finishx@relax
                   8596: 
                   8597: % #1 - THE_MACRO ARG_RESULT
                   8598: % #2 - PENDING_BS
                   8599: % #3 - NEXT_TOKEN
                   8600: % #4 used to look ahead
                   8601: %
                   8602: % If the next token is not a backslash, process the rest of the argument;
                   8603: % otherwise, remove the next token.
                   8604: @gdef@look_ahead#1!#2#3#4{%
                   8605:   @ifx#4\%
                   8606:    @expandafter@gobble_and_check_finish
                   8607:   @else
                   8608:    @expandafter@add_segment
                   8609:   @fi#1!{#2}#4#4%
                   8610: }
                   8611: 
                   8612: % #1 - THE_MACRO ARG_RESULT
                   8613: % #2 - PENDING_BS
                   8614: % #3 - NEXT_TOKEN
                   8615: % #4 should be a backslash, which is gobbled.
                   8616: % #5 looks ahead
                   8617: %
                   8618: % Double backslash found.  Add a single backslash, and look ahead.
                   8619: @gdef@gobble_and_check_finish#1!#2#3#4#5{%
                   8620:   @add_segment#1\!{}#5#5%
                   8621: }
                   8622: 
                   8623: @gdef@is_fi{@fi}
                   8624: 
                   8625: % #1 - THE_MACRO ARG_RESULT
                   8626: % #2 - PENDING_BS
                   8627: % #3 - NEXT_TOKEN
                   8628: % #4 is input stream until next backslash
                   8629: %
                   8630: % Input stream is either at the start of the argument, or just after a
                   8631: % backslash sequence, either a lone backslash, or a doubled backslash.
                   8632: % NEXT_TOKEN contains the first token in the input stream: if it is \finish,
                   8633: % finish; otherwise, append to ARG_RESULT the segment of the argument up until
                   8634: % the next backslash.  PENDING_BACKSLASH contains a backslash to represent
                   8635: % a backslash just before the start of the input stream that has not been
                   8636: % added to ARG_RESULT.
                   8637: @gdef@add_segment#1!#2#3#4\{%
                   8638: @ifx#3@_finish
                   8639:   @call_the_macro#1!%
                   8640: @else
                   8641:   % append the pending backslash to the result, followed by the next segment
                   8642:   @expandafter@is_fi@look_ahead#1#2#4!{\}@fi
                   8643:   % this @fi is discarded by @look_ahead.
                   8644:   % we can't get rid of it with \expandafter because we don't know how
                   8645:   % long #4 is.
                   8646: }
                   8647: 
                   8648: % #1 - THE_MACRO
                   8649: % #2 - ARG_RESULT
                   8650: % #3 discards the res of the conditional in @add_segment, and @is_fi ends the
                   8651: % conditional.
                   8652: @gdef@call_the_macro#1#2!#3@fi{@is_fi #1{#2}}
                   8653: 
                   8654: }
                   8655: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                   8656: 
                   8657: % \braceorline MAC is used for a one-argument macro MAC.  It checks
                   8658: % whether the next non-whitespace character is a {.  It sets the context
                   8659: % for reading the argument (slightly different in the two cases).  Then,
                   8660: % to read the argument, in the whole-line case, it then calls the regular
                   8661: % \parsearg MAC; in the lbrace case, it calls \passargtomacro MAC.
                   8662: %
                   8663: \def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx}
                   8664: \def\braceorlinexxx{%
                   8665:   \ifx\nchar\bgroup
                   8666:     \macroargctxt
                   8667:     \expandafter\passargtomacro
                   8668:   \else
                   8669:     \macrolineargctxt\expandafter\parsearg
                   8670:   \fi \macnamexxx}
                   8671: 
                   8672: 
1.2     ! snw      8673: % @linemacro
        !          8674: 
        !          8675: \parseargdef\linemacro{%
        !          8676:   \getargs{#1}% now \macname is the macname and \argl the arglist
        !          8677:   \ifx\argl\empty
        !          8678:     \paramno=0
        !          8679:     \let\hash\relax
        !          8680:     \def\paramlist{\hash 1\endlinemacro}%
        !          8681:   \else
        !          8682:     \expandafter\linegetparamlist\argl;%
        !          8683:   \fi
        !          8684:   \begingroup \macrobodyctxt \usembodybackslash
        !          8685:   \parselinemacrobody
        !          8686: }
        !          8687: 
        !          8688: % Build up \paramlist which will be used as the parameter text for the macro.
        !          8689: % At the end it will be like "#1 #2 #3\endlinemacro".
        !          8690: \def\linegetparamlist#1;{%
        !          8691:   \paramno=0\def\paramlist{}%
        !          8692:   \let\hash\relax
        !          8693:   \linegetparamlistxxx#1,;,%
        !          8694: }
        !          8695: \def\linegetparamlistxxx#1,{%
        !          8696:   \if#1;\let\next=\linegetparamlistxxxx
        !          8697:   \else \let\next=\linegetparamlistxxx
        !          8698:     \advance\paramno by 1
        !          8699:     \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
        !          8700:         {\hash\the\paramno}%
        !          8701:     \edef\paramlist{\paramlist\hash\the\paramno\space}%
        !          8702:   \fi\next}
        !          8703: \def\linegetparamlistxxxx{%
        !          8704:   \expandafter\fixparamlist\paramlist\fixparamlist
        !          8705: }
        !          8706: % Replace final space token
        !          8707: \def\fixparamlist#1 \fixparamlist{%
        !          8708:   \def\paramlist{#1\endlinemacro}%
        !          8709: }
        !          8710: 
        !          8711: % Read the body of the macro, replacing backslash-surrounded variables
        !          8712: %
        !          8713: {\catcode`\ =\other\long\gdef\parselinemacrobody#1@end linemacro{%
        !          8714: \xdef\macrobody{#1}%
        !          8715: \endgroup
        !          8716: \linemacrodef
        !          8717: }}
        !          8718: 
        !          8719: % Make the definition
        !          8720: \def\linemacrodef{%
        !          8721:   \let\hash=##%
        !          8722:   \expandafter\xdef\csname\the\macname\endcsname{%
        !          8723:     \bgroup
        !          8724:     \noexpand\parsearg
        !          8725:     \expandafter\noexpand\csname\the\macname @@\endcsname
        !          8726:   }
        !          8727:   \expandafter\xdef\csname\the\macname @@\endcsname##1{%
        !          8728:     \egroup
        !          8729:     \expandafter\noexpand
        !          8730:     \csname\the\macname @@@\endcsname##1\noexpand\endlinemacro
        !          8731:   }
        !          8732:   \expandafter\expandafter
        !          8733:   \expandafter\xdef
        !          8734:   \expandafter\expandafter\csname\the\macname @@@\endcsname\paramlist{%
        !          8735:     \newlinechar=13 % split \macrobody into lines
        !          8736:     \noexpand\scantokens{\macrobody}%
        !          8737:   }
        !          8738: }
        !          8739: 
        !          8740: 
        !          8741: 
1.1       snw      8742: % @alias.
                   8743: % We need some trickery to remove the optional spaces around the equal
                   8744: % sign.  Make them active and then expand them all to nothing.
                   8745: %
                   8746: \def\alias{\parseargusing\obeyspaces\aliasxxx}
                   8747: \def\aliasxxx #1{\aliasyyy#1\relax}
                   8748: \def\aliasyyy #1=#2\relax{%
                   8749:   {%
                   8750:     \expandafter\let\obeyedspace=\empty
                   8751:     \addtomacrolist{#1}%
                   8752:     \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}%
                   8753:   }%
                   8754:   \next
                   8755: }
                   8756: 
                   8757: 
                   8758: \message{cross references,}
                   8759: 
                   8760: \newwrite\auxfile
                   8761: \newif\ifhavexrefs    % True if xref values are known.
                   8762: \newif\ifwarnedxrefs  % True if we warned once that they aren't known.
                   8763: 
                   8764: % @inforef is relatively simple.
                   8765: \def\inforef #1{\inforefzzz #1,,,,**}
                   8766: \def\inforefzzz #1,#2,#3,#4**{%
                   8767:   \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
                   8768:   node \samp{\ignorespaces#1{}}}
                   8769: 
                   8770: % @node's only job in TeX is to define \lastnode, which is used in
                   8771: % cross-references.  The @node line might or might not have commas, and
                   8772: % might or might not have spaces before the first comma, like:
                   8773: % @node foo , bar , ...
                   8774: % We don't want such trailing spaces in the node name.
                   8775: %
                   8776: \parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse}
                   8777: %
                   8778: % also remove a trailing comma, in case of something like this:
                   8779: % @node Help-Cross,  ,  , Cross-refs
                   8780: \def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse}
                   8781: \def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}\omittopnode}
                   8782: 
                   8783: % Used so that the @top node doesn't have to be wrapped in an @ifnottex
                   8784: % conditional.
                   8785: % \doignore goes to more effort to skip nested conditionals but we don't need
                   8786: % that here.
                   8787: \def\omittopnode{%
                   8788:    \ifx\lastnode\wordTop
                   8789:    \expandafter\ignorenode\fi
                   8790: }
                   8791: \def\wordTop{Top}
                   8792: 
1.2     ! snw      8793: % Until the next @node, @part or @bye command, divert output to a box that
        !          8794: % is not output.
        !          8795: \def\ignorenode{\setbox\dummybox\vbox\bgroup
        !          8796: \def\part{\egroup\part}%
        !          8797: \def\node{\egroup\node}%
1.1       snw      8798: \ignorenodebye
                   8799: }
                   8800: 
                   8801: {\let\bye\relax
                   8802: \gdef\ignorenodebye{\let\bye\ignorenodebyedef}
                   8803: \gdef\ignorenodebyedef{\egroup(`Top' node ignored)\bye}}
                   8804: % The redefinition of \bye here is because it is declared \outer
                   8805: 
                   8806: \let\lastnode=\empty
                   8807: 
                   8808: % Write a cross-reference definition for the current node.  #1 is the
                   8809: % type (Ynumbered, Yappendix, Ynothing).
                   8810: %
                   8811: \def\donoderef#1{%
                   8812:   \ifx\lastnode\empty\else
                   8813:     \setref{\lastnode}{#1}%
                   8814:     \global\let\lastnode=\empty
                   8815:   \fi
                   8816: }
                   8817: 
1.2     ! snw      8818: % @nodedescription, @nodedescriptionblock - do nothing for TeX
        !          8819: \parseargdef\nodedescription{}
        !          8820: \def\nodedescriptionblock{\doignore{nodedescriptionblock}}
        !          8821: 
        !          8822: 
1.1       snw      8823: % @anchor{NAME} -- define xref target at arbitrary point.
                   8824: %
                   8825: \newcount\savesfregister
                   8826: %
                   8827: \def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
                   8828: \def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
                   8829: \def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
                   8830: 
                   8831: % \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
                   8832: % anchor), which consists of three parts:
                   8833: % 1) NAME-title - the current sectioning name taken from \currentsection,
                   8834: %                 or the anchor name.
                   8835: % 2) NAME-snt   - section number and type, passed as the SNT arg, or
                   8836: %                 empty for anchors.
                   8837: % 3) NAME-pg    - the page number.
                   8838: %
                   8839: % This is called from \donoderef, \anchor, and \dofloat.  In the case of
                   8840: % floats, there is an additional part, which is not written here:
                   8841: % 4) NAME-lof   - the text as it should appear in a @listoffloats.
                   8842: %
                   8843: \def\setref#1#2{%
                   8844:   \pdfmkdest{#1}%
                   8845:   \iflinks
                   8846:     {%
                   8847:       \requireauxfile
                   8848:       \atdummies  % preserve commands, but don't expand them
                   8849:       % match definition in \xrdef, \refx, \xrefX.
                   8850:       \def\value##1{##1}%
                   8851:       \edef\writexrdef##1##2{%
                   8852:        \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef
                   8853:          ##1}{##2}}% these are parameters of \writexrdef
                   8854:       }%
                   8855:       \toks0 = \expandafter{\currentsection}%
                   8856:       \immediate \writexrdef{title}{\the\toks0 }%
                   8857:       \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
                   8858:       \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout
                   8859:     }%
                   8860:   \fi
                   8861: }
                   8862: 
                   8863: % @xrefautosectiontitle on|off says whether @section(ing) names are used
                   8864: % automatically in xrefs, if the third arg is not explicitly specified.
                   8865: % This was provided as a "secret" @set xref-automatic-section-title
                   8866: % variable, now it's official.
                   8867: %
                   8868: \parseargdef\xrefautomaticsectiontitle{%
                   8869:   \def\temp{#1}%
                   8870:   \ifx\temp\onword
                   8871:     \expandafter\let\csname SETxref-automatic-section-title\endcsname
                   8872:       = \empty
                   8873:   \else\ifx\temp\offword
                   8874:     \expandafter\let\csname SETxref-automatic-section-title\endcsname
                   8875:       = \relax
                   8876:   \else
                   8877:     \errhelp = \EMsimple
                   8878:     \errmessage{Unknown @xrefautomaticsectiontitle value `\temp',
                   8879:                 must be on|off}%
                   8880:   \fi\fi
                   8881: }
                   8882: 
                   8883: %
                   8884: % @xref, @pxref, and @ref generate cross-references.  For \xrefX, #1 is
                   8885: % the node name, #2 the name of the Info cross-reference, #3 the printed
                   8886: % node name, #4 the name of the Info file, #5 the name of the printed
                   8887: % manual.  All but the node name can be omitted.
                   8888: %
                   8889: \def\pxref{\putwordsee{} \xrefXX}
                   8890: \def\xref{\putwordSee{} \xrefXX}
                   8891: \def\ref{\xrefXX}
                   8892: 
                   8893: \def\xrefXX#1{\def\xrefXXarg{#1}\futurelet\tokenafterxref\xrefXXX}
                   8894: \def\xrefXXX{\expandafter\xrefX\expandafter[\xrefXXarg,,,,,,,]}
                   8895: %
                   8896: \newbox\toprefbox
                   8897: \newbox\printedrefnamebox
                   8898: \newbox\infofilenamebox
                   8899: \newbox\printedmanualbox
                   8900: %
                   8901: \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
                   8902:   \unsepspaces
                   8903:   %
1.2     ! snw      8904:   \getprintedrefname{#1}{#3}{#5}%
1.1       snw      8905:   \def\infofilename{\ignorespaces #4}%
                   8906:   \setbox\infofilenamebox = \hbox{\infofilename\unskip}%
                   8907:   %
1.2     ! snw      8908:   \startxreflink{#1}{#4}%
1.1       snw      8909:   {%
                   8910:     % Have to otherify everything special to allow the \csname to
                   8911:     % include an _ in the xref name, etc.
                   8912:     \indexnofonts
                   8913:     \turnoffactive
                   8914:     \def\value##1{##1}%
                   8915:     \expandafter\global\expandafter\let\expandafter\Xthisreftitle
                   8916:       \csname XR#1-title\endcsname
                   8917:   }%
                   8918:   %
                   8919:   % Float references are printed completely differently: "Figure 1.2"
                   8920:   % instead of "[somenode], p.3".  \iffloat distinguishes them by
                   8921:   % \Xthisreftitle being set to a magic string.
                   8922:   \iffloat\Xthisreftitle
                   8923:     % If the user specified the print name (third arg) to the ref,
                   8924:     % print it instead of our usual "Figure 1.2".
                   8925:     \ifdim\wd\printedrefnamebox = 0pt
                   8926:       \refx{#1-snt}%
                   8927:     \else
                   8928:       \printedrefname
                   8929:     \fi
                   8930:     %
                   8931:     % If the user also gave the printed manual name (fifth arg), append
                   8932:     % "in MANUALNAME".
                   8933:     \ifdim \wd\printedmanualbox > 0pt
                   8934:       \space \putwordin{} \cite{\printedmanual}%
                   8935:     \fi
                   8936:   \else
                   8937:     % node/anchor (non-float) references.
                   8938:     %
                   8939:     % If we use \unhbox to print the node names, TeX does not insert
                   8940:     % empty discretionaries after hyphens, which means that it will not
                   8941:     % find a line break at a hyphen in a node names.  Since some manuals
                   8942:     % are best written with fairly long node names, containing hyphens,
                   8943:     % this is a loss.  Therefore, we give the text of the node name
                   8944:     % again, so it is as if TeX is seeing it for the first time.
                   8945:     %
                   8946:     \ifdim \wd\printedmanualbox > 0pt
                   8947:       % Cross-manual reference with a printed manual name.
                   8948:       %
                   8949:       \crossmanualxref{\cite{\printedmanual\unskip}}%
                   8950:     %
                   8951:     \else\ifdim \wd\infofilenamebox > 0pt
                   8952:       % Cross-manual reference with only an info filename (arg 4), no
                   8953:       % printed manual name (arg 5).  This is essentially the same as
                   8954:       % the case above; we output the filename, since we have nothing else.
                   8955:       %
                   8956:       \crossmanualxref{\code{\infofilename\unskip}}%
                   8957:     %
                   8958:     \else
                   8959:       % Reference within this manual.
                   8960:       %
                   8961:       % Only output a following space if the -snt ref is nonempty, as the ref
                   8962:       % will be empty for @unnumbered and @anchor.
                   8963:       \setbox2 = \hbox{\ignorespaces \refx{#1-snt}}%
                   8964:       \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
                   8965:       %
                   8966:       % output the `[mynode]' via the macro below so it can be overridden.
                   8967:       \xrefprintnodename\printedrefname
                   8968:       %
1.2     ! snw      8969:       \ifflagclear{txiomitxrefpg}{%
        !          8970:         % We always want a comma
        !          8971:         ,%
1.1       snw      8972:         % output the `page 3'.
1.2     ! snw      8973:         \turnoffactive \putpageref{#1}%
1.1       snw      8974:         % Add a , if xref followed by a space
                   8975:         \if\space\noexpand\tokenafterxref ,%
                   8976:         \else\ifx\     \tokenafterxref ,% @TAB
                   8977:         \else\ifx\*\tokenafterxref ,%   @*
                   8978:         \else\ifx\ \tokenafterxref ,%   @SPACE
                   8979:         \else\ifx\
                   8980:                   \tokenafterxref ,%    @NL
                   8981:         \else\ifx\tie\tokenafterxref ,% @tie
                   8982:         \fi\fi\fi\fi\fi\fi
1.2     ! snw      8983:       }{}%
1.1       snw      8984:     \fi\fi
                   8985:   \fi
                   8986:   \endlink
                   8987: \endgroup}
                   8988: 
1.2     ! snw      8989: % \getprintedrefname{NODE}{LABEL}{MANUAL}
        !          8990: % - set \printedrefname and \printedmanual
        !          8991: %
        !          8992: \def\getprintedrefname#1#2#3{%
        !          8993:   % Get args without leading/trailing spaces.
        !          8994:   \def\printedrefname{\ignorespaces #2}%
        !          8995:   \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}%
        !          8996:   %
        !          8997:   \def\printedmanual{\ignorespaces #3}%
        !          8998:   \setbox\printedmanualbox  = \hbox{\printedmanual\unskip}%
        !          8999:   %
        !          9000:   % If the printed reference name (arg #2) was not explicitly given in
        !          9001:   % the @xref, figure out what we want to use.
        !          9002:   \ifdim \wd\printedrefnamebox = 0pt
        !          9003:     % No printed node name was explicitly given.
        !          9004:     \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax
        !          9005:       % Not auto section-title: use node name inside the square brackets.
        !          9006:       \def\printedrefname{\ignorespaces #1}%
        !          9007:     \else
        !          9008:       % Auto section-title: use chapter/section title inside
        !          9009:       % the square brackets if we have it.
        !          9010:       \ifdim \wd\printedmanualbox > 0pt
        !          9011:         % It is in another manual, so we don't have it; use node name.
        !          9012:         \def\printedrefname{\ignorespaces #1}%
        !          9013:       \else
        !          9014:         \ifhavexrefs
        !          9015:           % We (should) know the real title if we have the xref values.
        !          9016:           \def\printedrefname{\refx{#1-title}}%
        !          9017:         \else
        !          9018:           % Otherwise just copy the Info node name.
        !          9019:           \def\printedrefname{\ignorespaces #1}%
        !          9020:         \fi%
        !          9021:       \fi
        !          9022:     \fi
        !          9023:   \fi
        !          9024: }
        !          9025: 
        !          9026: % \startxreflink{NODE}{FILE} - start link in pdf output.
        !          9027: \def\startxreflink#1#2{%
        !          9028:   \ifpdforxetex
        !          9029:     % For pdfTeX and LuaTeX
        !          9030:     {\indexnofonts
        !          9031:      \makevalueexpandable
        !          9032:      \turnoffactive
        !          9033:      % This expands tokens, so do it after making catcode changes, so _
        !          9034:      % etc. don't get their TeX definitions.  This ignores all spaces in
        !          9035:      % #2, including (wrongly) those in the middle of the filename.
        !          9036:      \getfilename{#2}%
        !          9037:      %
        !          9038:      % This (wrongly) does not take account of leading or trailing
        !          9039:      % spaces in #1, which should be ignored.
        !          9040:      \setpdfdestname{#1}%
        !          9041:      %
        !          9042:      \ifx\pdfdestname\empty
        !          9043:        \def\pdfdestname{Top}% no empty targets
        !          9044:      \fi
        !          9045:      %
        !          9046:      \leavevmode
        !          9047:      \ifpdf
        !          9048:        \startlink attr{/Border [0 0 0]}%
        !          9049:        \ifnum\filenamelength>0
        !          9050:          goto file{\the\filename.pdf} name{\pdfdestname}%
        !          9051:        \else
        !          9052:          goto name{\pdfmkpgn{\pdfdestname}}%
        !          9053:        \fi
        !          9054:      \else % XeTeX
        !          9055:        \ifnum\filenamelength>0
        !          9056:          % With default settings,
        !          9057:          % XeTeX (xdvipdfmx) replaces link destination names with integers.
        !          9058:          % In this case, the replaced destination names of
        !          9059:          % remote PDFs are no longer known.  In order to avoid a replacement,
        !          9060:          % you can use xdvipdfmx's command line option `-C 0x0010'.
        !          9061:          % If you use XeTeX 0.99996+ (TeX Live 2016+),
        !          9062:          % this command line option is no longer necessary
        !          9063:          % because we can use the `dvipdfmx:config' special.
        !          9064:          \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A
        !          9065:            << /S /GoToR /F (\the\filename.pdf) /D (\pdfdestname) >> >>}%
        !          9066:        \else
        !          9067:          \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A
        !          9068:            << /S /GoTo /D (\pdfdestname) >> >>}%
        !          9069:        \fi
        !          9070:      \fi
        !          9071:     }%
        !          9072:     \setcolor{\linkcolor}%
        !          9073:   \fi
        !          9074: }
        !          9075: 
        !          9076: % can be overridden in translation files
        !          9077: \def\putpageref#1{%
        !          9078:   \space\putwordpage\tie\refx{#1-pg}}
        !          9079: 
1.1       snw      9080: % Output a cross-manual xref to #1.  Used just above (twice).
                   9081: %
                   9082: % Only include the text "Section ``foo'' in" if the foo is neither
                   9083: % missing or Top.  Thus, @xref{,,,foo,The Foo Manual} outputs simply
                   9084: % "see The Foo Manual", the idea being to refer to the whole manual.
                   9085: %
                   9086: % But, this being TeX, we can't easily compare our node name against the
                   9087: % string "Top" while ignoring the possible spaces before and after in
                   9088: % the input.  By adding the arbitrary 7sp below, we make it much less
                   9089: % likely that a real node name would have the same width as "Top" (e.g.,
                   9090: % in a monospaced font).  Hopefully it will never happen in practice.
                   9091: %
                   9092: % For the same basic reason, we retypeset the "Top" at every
                   9093: % reference, since the current font is indeterminate.
                   9094: %
                   9095: \def\crossmanualxref#1{%
                   9096:   \setbox\toprefbox = \hbox{Top\kern7sp}%
                   9097:   \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}%
                   9098:   \ifdim \wd2 > 7sp  % nonempty?
                   9099:     \ifdim \wd2 = \wd\toprefbox \else  % same as Top?
                   9100:       \putwordSection{} ``\printedrefname'' \putwordin{}\space
                   9101:     \fi
                   9102:   \fi
                   9103:   #1%
                   9104: }
                   9105: 
                   9106: % This macro is called from \xrefX for the `[nodename]' part of xref
                   9107: % output.  It's a separate macro only so it can be changed more easily,
                   9108: % since square brackets don't work well in some documents.  Particularly
                   9109: % one that Bob is working on :).
                   9110: %
                   9111: \def\xrefprintnodename#1{[#1]}
                   9112: 
1.2     ! snw      9113: % @link{NODENAME, LABEL, MANUAL} - create a "plain" link, with no
        !          9114: % page number.  Not useful if printed on paper.
        !          9115: %
        !          9116: \def\link#1{\linkX[#1,,,]}
        !          9117: \def\linkX[#1,#2,#3,#4]{%
        !          9118:   \begingroup
        !          9119:   \unsepspaces
        !          9120:   \getprintedrefname{#1}{#2}{#3}%
        !          9121:   \startxreflink{#1}{#3}%
        !          9122:   \printedrefname
        !          9123:   \endlink
        !          9124:   \endgroup
        !          9125: }
        !          9126: 
        !          9127: 
1.1       snw      9128: % Things referred to by \setref.
                   9129: %
                   9130: \def\Ynothing{}
                   9131: \def\Yomitfromtoc{}
                   9132: \def\Ynumbered{%
                   9133:   \ifnum\secno=0
                   9134:     \putwordChapter@tie \the\chapno
                   9135:   \else \ifnum\subsecno=0
                   9136:     \putwordSection@tie \the\chapno.\the\secno
                   9137:   \else \ifnum\subsubsecno=0
                   9138:     \putwordSection@tie \the\chapno.\the\secno.\the\subsecno
                   9139:   \else
                   9140:     \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno
                   9141:   \fi\fi\fi
                   9142: }
                   9143: \def\Yappendix{%
                   9144:   \ifnum\secno=0
                   9145:      \putwordAppendix@tie @char\the\appendixno{}%
                   9146:   \else \ifnum\subsecno=0
                   9147:      \putwordSection@tie @char\the\appendixno.\the\secno
                   9148:   \else \ifnum\subsubsecno=0
                   9149:     \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno
                   9150:   \else
                   9151:     \putwordSection@tie
                   9152:       @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno
                   9153:   \fi\fi\fi
                   9154: }
                   9155: 
                   9156: % \refx{NAME} - reference a cross-reference string named NAME.
                   9157: \def\refx#1{%
                   9158:   \requireauxfile
                   9159:   {%
                   9160:     \indexnofonts
                   9161:     \turnoffactive
                   9162:     \def\value##1{##1}%
                   9163:     \expandafter\global\expandafter\let\expandafter\thisrefX
                   9164:       \csname XR#1\endcsname
                   9165:   }%
                   9166:   \ifx\thisrefX\relax
                   9167:     % If not defined, say something at least.
                   9168:     \angleleft un\-de\-fined\angleright
                   9169:     \iflinks
                   9170:       \ifhavexrefs
                   9171:         {\toks0 = {#1}% avoid expansion of possibly-complex value
                   9172:          \message{\linenumber Undefined cross reference `\the\toks0'.}}%
                   9173:       \else
                   9174:         \ifwarnedxrefs\else
                   9175:           \global\warnedxrefstrue
                   9176:           \message{Cross reference values unknown; you must run TeX again.}%
                   9177:         \fi
                   9178:       \fi
                   9179:     \fi
                   9180:   \else
                   9181:     % It's defined, so just use it.
                   9182:     \thisrefX
                   9183:   \fi
                   9184: }
                   9185: 
                   9186: % This is the macro invoked by entries in the aux file.  Define a control
                   9187: % sequence for a cross-reference target (we prepend XR to the control sequence
                   9188: % name to avoid collisions).  The value is the page number.  If this is a float
                   9189: % type, we have more work to do.
                   9190: %
                   9191: \def\xrdef#1#2{%
                   9192:   {% Expand the node or anchor name to remove control sequences.
                   9193:    % \turnoffactive stops 8-bit characters being changed to commands
                   9194:    % like @'e.  \refx does the same to retrieve the value in the definition.
                   9195:     \indexnofonts
                   9196:     \turnoffactive
                   9197:     \def\value##1{##1}%
                   9198:     \xdef\safexrefname{#1}%
                   9199:   }%
                   9200:   %
                   9201:   \bgroup
                   9202:     \expandafter\gdef\csname XR\safexrefname\endcsname{#2}%
                   9203:   \egroup
                   9204:   % We put the \gdef inside a group to avoid the definitions building up on
                   9205:   % TeX's save stack, which can cause it to run out of space for aux files with
                   9206:   % thousands of lines.  \gdef doesn't use the save stack, but \csname does
                   9207:   % when it defines an unknown control sequence as \relax.
                   9208:   %
                   9209:   % Was that xref control sequence that we just defined for a float?
                   9210:   \expandafter\iffloat\csname XR\safexrefname\endcsname
                   9211:     % it was a float, and we have the (safe) float type in \iffloattype.
                   9212:     \expandafter\let\expandafter\floatlist
                   9213:       \csname floatlist\iffloattype\endcsname
                   9214:     %
                   9215:     % Is this the first time we've seen this float type?
                   9216:     \expandafter\ifx\floatlist\relax
                   9217:       \toks0 = {\do}% yes, so just \do
                   9218:     \else
                   9219:       % had it before, so preserve previous elements in list.
                   9220:       \toks0 = \expandafter{\floatlist\do}%
                   9221:     \fi
                   9222:     %
                   9223:     % Remember this xref in the control sequence \floatlistFLOATTYPE,
                   9224:     % for later use in \listoffloats.
                   9225:     \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0
                   9226:       {\safexrefname}}%
                   9227:   \fi
                   9228: }
                   9229: 
                   9230: % If working on a large document in chapters, it is convenient to
                   9231: % be able to disable indexing, cross-referencing, and contents, for test runs.
                   9232: % This is done with @novalidate at the beginning of the file.
                   9233: %
                   9234: \newif\iflinks \linkstrue % by default we want the aux files.
                   9235: \let\novalidate = \linksfalse
                   9236: 
                   9237: % Used when writing to the aux file, or when using data from it.
                   9238: \def\requireauxfile{%
                   9239:   \iflinks
                   9240:     \tryauxfile
                   9241:     % Open the new aux file.  TeX will close it automatically at exit.
                   9242:     \immediate\openout\auxfile=\jobname.aux
                   9243:   \fi
                   9244:   \global\let\requireauxfile=\relax   % Only do this once.
                   9245: }
                   9246: 
                   9247: % Read the last existing aux file, if any.  No error if none exists.
                   9248: %
                   9249: \def\tryauxfile{%
                   9250:   \openin 1 \jobname.aux
                   9251:   \ifeof 1 \else
                   9252:     \readdatafile{aux}%
                   9253:     \global\havexrefstrue
                   9254:   \fi
                   9255:   \closein 1
                   9256: }
                   9257: 
                   9258: \def\setupdatafile{%
                   9259:   \catcode`\^^@=\other
                   9260:   \catcode`\^^A=\other
                   9261:   \catcode`\^^B=\other
                   9262:   \catcode`\^^C=\other
                   9263:   \catcode`\^^D=\other
                   9264:   \catcode`\^^E=\other
                   9265:   \catcode`\^^F=\other
                   9266:   \catcode`\^^G=\other
                   9267:   \catcode`\^^H=\other
                   9268:   \catcode`\^^K=\other
                   9269:   \catcode`\^^L=\other
                   9270:   \catcode`\^^N=\other
                   9271:   \catcode`\^^P=\other
                   9272:   \catcode`\^^Q=\other
                   9273:   \catcode`\^^R=\other
                   9274:   \catcode`\^^S=\other
                   9275:   \catcode`\^^T=\other
                   9276:   \catcode`\^^U=\other
                   9277:   \catcode`\^^V=\other
                   9278:   \catcode`\^^W=\other
                   9279:   \catcode`\^^X=\other
                   9280:   \catcode`\^^Z=\other
                   9281:   \catcode`\^^[=\other
                   9282:   \catcode`\^^\=\other
                   9283:   \catcode`\^^]=\other
                   9284:   \catcode`\^^^=\other
                   9285:   \catcode`\^^_=\other
                   9286:   \catcode`\^=\other
                   9287:   %
                   9288:   % Special characters.  Should be turned off anyway, but...
                   9289:   \catcode`\~=\other
                   9290:   \catcode`\[=\other
                   9291:   \catcode`\]=\other
                   9292:   \catcode`\"=\other
                   9293:   \catcode`\_=\active
                   9294:   \catcode`\|=\active
                   9295:   \catcode`\<=\active
                   9296:   \catcode`\>=\active
                   9297:   \catcode`\$=\other
                   9298:   \catcode`\#=\other
                   9299:   \catcode`\&=\other
                   9300:   \catcode`\%=\other
                   9301:   \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
                   9302:   %
                   9303:   \catcode`\\=\active
                   9304:   %
                   9305:   % @ is our escape character in .aux files, and we need braces.
                   9306:   \catcode`\{=1
                   9307:   \catcode`\}=2
                   9308:   \catcode`\@=0
                   9309: }
                   9310: 
                   9311: \def\readdatafile#1{%
                   9312: \begingroup
                   9313:   \setupdatafile
                   9314:   \input\jobname.#1
                   9315: \endgroup}
                   9316: 
                   9317: 
                   9318: \message{insertions,}
                   9319: % including footnotes.
                   9320: 
                   9321: \newcount \footnoteno
                   9322: 
                   9323: % The trailing space in the following definition for supereject is
                   9324: % vital for proper filling; pages come out unaligned when you do a
                   9325: % pagealignmacro call if that space before the closing brace is
                   9326: % removed. (Generally, numeric constants should always be followed by a
                   9327: % space to prevent strange expansion errors.)
                   9328: \def\supereject{\par\penalty -20000\footnoteno =0 }
                   9329: 
                   9330: % @footnotestyle is meaningful for Info output only.
                   9331: \let\footnotestyle=\comment
                   9332: 
                   9333: {\catcode `\@=11
                   9334: %
                   9335: % Auto-number footnotes.  Otherwise like plain.
                   9336: \gdef\footnote{%
                   9337:   \global\advance\footnoteno by \@ne
                   9338:   \edef\thisfootno{$^{\the\footnoteno}$}%
                   9339:   %
                   9340:   % In case the footnote comes at the end of a sentence, preserve the
                   9341:   % extra spacing after we do the footnote number.
                   9342:   \let\@sf\empty
                   9343:   \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi
                   9344:   %
                   9345:   % Remove inadvertent blank space before typesetting the footnote number.
                   9346:   \unskip
                   9347:   \thisfootno\@sf
                   9348:   \dofootnote
                   9349: }%
                   9350: 
                   9351: % Don't bother with the trickery in plain.tex to not require the
                   9352: % footnote text as a parameter.  Our footnotes don't need to be so general.
                   9353: %
                   9354: % Oh yes, they do; otherwise, @ifset (and anything else that uses
                   9355: % \parseargline) fails inside footnotes because the tokens are fixed when
                   9356: % the footnote is read.  --karl, 16nov96.
                   9357: %
                   9358: \gdef\dofootnote{%
                   9359:   \insert\footins\bgroup
                   9360:   %
                   9361:   % Nested footnotes are not supported in TeX, that would take a lot
                   9362:   % more work.  (\startsavinginserts does not suffice.)
                   9363:   \let\footnote=\errfootnotenest
                   9364:   %
                   9365:   % We want to typeset this text as a normal paragraph, even if the
                   9366:   % footnote reference occurs in (for example) a display environment.
                   9367:   % So reset some parameters.
                   9368:   \hsize=\txipagewidth
                   9369:   \interlinepenalty\interfootnotelinepenalty
                   9370:   \splittopskip\ht\strutbox % top baseline for broken footnotes
                   9371:   \splitmaxdepth\dp\strutbox
                   9372:   \floatingpenalty\@MM
                   9373:   \leftskip\z@skip
                   9374:   \rightskip\z@skip
                   9375:   \spaceskip\z@skip
                   9376:   \xspaceskip\z@skip
                   9377:   \parindent\defaultparindent
                   9378:   %
                   9379:   \smallfonts \rm
                   9380:   %
                   9381:   % Because we use hanging indentation in footnotes, a @noindent appears
                   9382:   % to exdent this text, so make it be a no-op.  makeinfo does not use
                   9383:   % hanging indentation so @noindent can still be needed within footnote
                   9384:   % text after an @example or the like (not that this is good style).
                   9385:   \let\noindent = \relax
                   9386:   %
                   9387:   % Hang the footnote text off the number.  Use \everypar in case the
                   9388:   % footnote extends for more than one paragraph.
                   9389:   \everypar = {\hang}%
                   9390:   \textindent{\thisfootno}%
                   9391:   %
                   9392:   % Don't crash into the line above the footnote text.  Since this
                   9393:   % expands into a box, it must come within the paragraph, lest it
                   9394:   % provide a place where TeX can split the footnote.
                   9395:   \footstrut
                   9396:   %
                   9397:   % Invoke rest of plain TeX footnote routine.
                   9398:   \futurelet\next\fo@t
                   9399: }
                   9400: }%end \catcode `\@=11
                   9401: 
                   9402: \def\errfootnotenest{%
                   9403:   \errhelp=\EMsimple
                   9404:   \errmessage{Nested footnotes not supported in texinfo.tex,
                   9405:     even though they work in makeinfo; sorry}
                   9406: }
                   9407: 
                   9408: \def\errfootnoteheading{%
                   9409:   \errhelp=\EMsimple
                   9410:   \errmessage{Footnotes in chapters, sections, etc., are not supported}
                   9411: }
                   9412: 
                   9413: % In case a @footnote appears in a vbox, save the footnote text and create
                   9414: % the real \insert just after the vbox finished.  Otherwise, the insertion
                   9415: % would be lost.
                   9416: % Similarly, if a @footnote appears inside an alignment, save the footnote
                   9417: % text to a box and make the \insert when a row of the table is finished.
                   9418: % And the same can be done for other insert classes.  --kasal, 16nov03.
                   9419: %
                   9420: % Replace the \insert primitive by a cheating macro.
                   9421: % Deeper inside, just make sure that the saved insertions are not spilled
                   9422: % out prematurely.
                   9423: %
                   9424: \def\startsavinginserts{%
                   9425:   \ifx \insert\ptexinsert
                   9426:     \let\insert\saveinsert
                   9427:   \else
                   9428:     \let\checkinserts\relax
                   9429:   \fi
                   9430: }
                   9431: 
                   9432: % This \insert replacement works for both \insert\footins{foo} and
                   9433: % \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}.
                   9434: %
                   9435: \def\saveinsert#1{%
                   9436:   \edef\next{\noexpand\savetobox \makeSAVEname#1}%
                   9437:   \afterassignment\next
                   9438:   % swallow the left brace
                   9439:   \let\temp =
                   9440: }
                   9441: \def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}}
                   9442: \def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1}
                   9443: 
                   9444: \def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi}
                   9445: 
                   9446: \def\placesaveins#1{%
                   9447:   \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname
                   9448:     {\box#1}%
                   9449: }
                   9450: 
                   9451: % eat @SAVE -- beware, all of them have catcode \other:
                   9452: {
                   9453:   \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials  %  ;-)
                   9454:   \gdef\gobblesave @SAVE{}
                   9455: }
                   9456: 
                   9457: % initialization:
                   9458: \def\newsaveins #1{%
                   9459:   \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}%
                   9460:   \next
                   9461: }
                   9462: \def\newsaveinsX #1{%
                   9463:   \csname newbox\endcsname #1%
                   9464:   \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts
                   9465:     \checksaveins #1}%
                   9466: }
                   9467: 
                   9468: % initialize:
                   9469: \let\checkinserts\empty
                   9470: \newsaveins\footins
                   9471: \newsaveins\margin
                   9472: 
                   9473: 
                   9474: % @image.  We use the macros from epsf.tex to support this.
                   9475: % If epsf.tex is not installed and @image is used, we complain.
                   9476: %
                   9477: % Check for and read epsf.tex up front.  If we read it only at @image
                   9478: % time, we might be inside a group, and then its definitions would get
                   9479: % undone and the next image would fail.
                   9480: \openin 1 = epsf.tex
                   9481: \ifeof 1 \else
                   9482:   % Do not bother showing banner with epsf.tex v2.7k (available in
                   9483:   % doc/epsf.tex and on ctan).
                   9484:   \def\epsfannounce{\toks0 = }%
                   9485:   \input epsf.tex
                   9486: \fi
                   9487: \closein 1
                   9488: %
                   9489: % We will only complain once about lack of epsf.tex.
                   9490: \newif\ifwarnednoepsf
                   9491: \newhelp\noepsfhelp{epsf.tex must be installed for images to
                   9492:   work.  It is also included in the Texinfo distribution, or you can get
                   9493:   it from https://ctan.org/texarchive/macros/texinfo/texinfo/doc/epsf.tex.}
                   9494: %
                   9495: \def\image#1{%
                   9496:   \ifx\epsfbox\thisisundefined
                   9497:     \ifwarnednoepsf \else
                   9498:       \errhelp = \noepsfhelp
                   9499:       \errmessage{epsf.tex not found, images will be ignored}%
                   9500:       \global\warnednoepsftrue
                   9501:     \fi
                   9502:   \else
                   9503:     \imagexxx #1,,,,,\finish
                   9504:   \fi
                   9505: }
1.2     ! snw      9506: 
        !          9507: % Approximate height of a line in the standard text font.
        !          9508: \newdimen\capheight
        !          9509: \setbox0=\vbox{\tenrm H}
        !          9510: \capheight=\ht0
        !          9511: 
1.1       snw      9512: %
                   9513: % Arguments to @image:
                   9514: % #1 is (mandatory) image filename; we tack on .eps extension.
                   9515: % #2 is (optional) width, #3 is (optional) height.
                   9516: % #4 is (ignored optional) html alt text.
                   9517: % #5 is (ignored optional) extension.
                   9518: % #6 is just the usual extra ignored arg for parsing stuff.
                   9519: \newif\ifimagevmode
                   9520: \def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
                   9521:   \catcode`\^^M = 5     % in case we're inside an example
                   9522:   \normalturnoffactive  % allow _ et al. in names
                   9523:   \makevalueexpandable
                   9524:   \ifvmode
                   9525:     \imagevmodetrue
1.2     ! snw      9526:     \medskip
1.1       snw      9527:     % Usually we'll have text after the image which will insert
                   9528:     % \parskip glue, so insert it here too to equalize the space
                   9529:     % above and below.
1.2     ! snw      9530:     \vskip\parskip
        !          9531:     %
        !          9532:     % Place image in a \vtop for a top page margin that is (close to) correct,
        !          9533:     % as \topskip glue is relative to the first baseline.
        !          9534:     \vtop\bgroup \kern -\capheight \vskip-\parskip
1.1       snw      9535:   \fi
                   9536:   %
1.2     ! snw      9537:   \ifx\centersub\centerV
        !          9538:     % For @center @image, enter vertical mode and add vertical space
        !          9539:     % Enter an extra \parskip because @center doesn't add space itself.
        !          9540:     \vbox\bgroup\vskip\parskip\medskip\vskip\parskip
        !          9541:   \else
        !          9542:     % Enter horizontal mode so that indentation from an enclosing
        !          9543:     %  environment such as @quotation is respected.
        !          9544:     % However, if we're at the top level, we don't want the
        !          9545:     %  normal paragraph indentation.
        !          9546:     \imageindent
        !          9547:   \fi
1.1       snw      9548:   %
                   9549:   % Output the image.
                   9550:   \ifpdf
                   9551:     % For pdfTeX and LuaTeX <= 0.80
                   9552:     \dopdfimage{#1}{#2}{#3}%
                   9553:   \else
                   9554:     \ifx\XeTeXrevision\thisisundefined
                   9555:       % For epsf.tex
                   9556:       % \epsfbox itself resets \epsf?size at each figure.
                   9557:       \setbox0 = \hbox{\ignorespaces #2}%
                   9558:         \ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
                   9559:       \setbox0 = \hbox{\ignorespaces #3}%
                   9560:         \ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
                   9561:       \epsfbox{#1.eps}%
                   9562:     \else
                   9563:       % For XeTeX
                   9564:       \doxeteximage{#1}{#2}{#3}%
                   9565:     \fi
                   9566:   \fi
                   9567:   %
                   9568:   \ifimagevmode
1.2     ! snw      9569:     \egroup
1.1       snw      9570:     \medskip  % space after a standalone image
                   9571:   \fi
1.2     ! snw      9572:   \ifx\centersub\centerV % @center @image
        !          9573:     \medskip
        !          9574:     \egroup % close \vbox
        !          9575:   \fi
1.1       snw      9576: \endgroup}
                   9577: 
                   9578: 
                   9579: % @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables,
                   9580: % etc.  We don't actually implement floating yet, we always include the
                   9581: % float "here".  But it seemed the best name for the future.
                   9582: %
                   9583: \envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish}
                   9584: 
                   9585: % There may be a space before second and/or third parameter; delete it.
                   9586: \def\eatcommaspace#1, {#1,}
                   9587: 
                   9588: % #1 is the optional FLOATTYPE, the text label for this float, typically
                   9589: % "Figure", "Table", "Example", etc.  Can't contain commas.  If omitted,
                   9590: % this float will not be numbered and cannot be referred to.
                   9591: %
                   9592: % #2 is the optional xref label.  Also must be present for the float to
                   9593: % be referable.
                   9594: %
                   9595: % #3 is the optional positioning argument; for now, it is ignored.  It
                   9596: % will somehow specify the positions allowed to float to (here, top, bottom).
                   9597: %
                   9598: % We keep a separate counter for each FLOATTYPE, which we reset at each
                   9599: % chapter-level command.
                   9600: \let\resetallfloatnos=\empty
                   9601: %
                   9602: \def\dofloat#1,#2,#3,#4\finish{%
                   9603:   \let\thiscaption=\empty
                   9604:   \let\thisshortcaption=\empty
                   9605:   %
                   9606:   % don't lose footnotes inside @float.
                   9607:   %
                   9608:   % BEWARE: when the floats start float, we have to issue warning whenever an
                   9609:   % insert appears inside a float which could possibly float. --kasal, 26may04
                   9610:   %
                   9611:   \startsavinginserts
                   9612:   %
                   9613:   % We can't be used inside a paragraph.
                   9614:   \par
                   9615:   %
                   9616:   \vtop\bgroup
                   9617:     \def\floattype{#1}%
                   9618:     \def\floatlabel{#2}%
                   9619:     \def\floatloc{#3}% we do nothing with this yet.
                   9620:     %
                   9621:     \ifx\floattype\empty
                   9622:       \let\safefloattype=\empty
                   9623:     \else
                   9624:       {%
                   9625:         % the floattype might have accents or other special characters,
                   9626:         % but we need to use it in a control sequence name.
                   9627:         \indexnofonts
                   9628:         \turnoffactive
                   9629:         \xdef\safefloattype{\floattype}%
                   9630:       }%
                   9631:     \fi
                   9632:     %
                   9633:     % If label is given but no type, we handle that as the empty type.
                   9634:     \ifx\floatlabel\empty \else
                   9635:       % We want each FLOATTYPE to be numbered separately (Figure 1,
                   9636:       % Table 1, Figure 2, ...).  (And if no label, no number.)
                   9637:       %
                   9638:       \expandafter\getfloatno\csname\safefloattype floatno\endcsname
                   9639:       \global\advance\floatno by 1
                   9640:       %
                   9641:       {%
                   9642:         % This magic value for \currentsection is output by \setref as the
                   9643:         % XREFLABEL-title value.  \xrefX uses it to distinguish float
                   9644:         % labels (which have a completely different output format) from
                   9645:         % node and anchor labels.  And \xrdef uses it to construct the
                   9646:         % lists of floats.
                   9647:         %
                   9648:         \edef\currentsection{\floatmagic=\safefloattype}%
                   9649:         \setref{\floatlabel}{Yfloat}%
                   9650:       }%
                   9651:     \fi
                   9652:     %
                   9653:     % start with \parskip glue, I guess.
                   9654:     \vskip\parskip
                   9655:     %
                   9656:     % Don't suppress indentation if a float happens to start a section.
                   9657:     \restorefirstparagraphindent
                   9658: }
                   9659: 
                   9660: % we have these possibilities:
                   9661: % @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap
                   9662: % @float Foo,lbl & no caption:    Foo 1.1
                   9663: % @float Foo & @caption{Cap}:     Foo: Cap
                   9664: % @float Foo & no caption:        Foo
                   9665: % @float ,lbl & Caption{Cap}:     1.1: Cap
                   9666: % @float ,lbl & no caption:       1.1
                   9667: % @float & @caption{Cap}:         Cap
                   9668: % @float & no caption:
                   9669: %
                   9670: \def\Efloat{%
                   9671:     \let\floatident = \empty
                   9672:     %
                   9673:     % In all cases, if we have a float type, it comes first.
                   9674:     \ifx\floattype\empty \else \def\floatident{\floattype}\fi
                   9675:     %
                   9676:     % If we have an xref label, the number comes next.
                   9677:     \ifx\floatlabel\empty \else
                   9678:       \ifx\floattype\empty \else % if also had float type, need tie first.
                   9679:         \appendtomacro\floatident{\tie}%
                   9680:       \fi
                   9681:       % the number.
                   9682:       \appendtomacro\floatident{\chaplevelprefix\the\floatno}%
                   9683:     \fi
                   9684:     %
                   9685:     % Start the printed caption with what we've constructed in
                   9686:     % \floatident, but keep it separate; we need \floatident again.
                   9687:     \let\captionline = \floatident
                   9688:     %
                   9689:     \ifx\thiscaption\empty \else
                   9690:       \ifx\floatident\empty \else
                   9691:         \appendtomacro\captionline{: }% had ident, so need a colon between
                   9692:       \fi
                   9693:       %
                   9694:       % caption text.
                   9695:       \appendtomacro\captionline{\scanexp\thiscaption}%
                   9696:     \fi
                   9697:     %
                   9698:     % If we have anything to print, print it, with space before.
                   9699:     % Eventually this needs to become an \insert.
                   9700:     \ifx\captionline\empty \else
                   9701:       \vskip.5\parskip
                   9702:       \captionline
                   9703:       %
                   9704:       % Space below caption.
                   9705:       \vskip\parskip
                   9706:     \fi
                   9707:     %
                   9708:     % If have an xref label, write the list of floats info.  Do this
                   9709:     % after the caption, to avoid chance of it being a breakpoint.
                   9710:     \ifx\floatlabel\empty \else
                   9711:       % Write the text that goes in the lof to the aux file as
                   9712:       % \floatlabel-lof.  Besides \floatident, we include the short
                   9713:       % caption if specified, else the full caption if specified, else nothing.
                   9714:       {%
                   9715:         \requireauxfile
                   9716:         \atdummies
                   9717:         %
                   9718:         \ifx\thisshortcaption\empty
                   9719:           \def\gtemp{\thiscaption}%
                   9720:         \else
                   9721:           \def\gtemp{\thisshortcaption}%
                   9722:         \fi
                   9723:         \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident
                   9724:           \ifx\gtemp\empty \else : \gtemp \fi}}%
                   9725:       }%
                   9726:     \fi
                   9727:   \egroup  % end of \vtop
                   9728:   %
                   9729:   \checkinserts
                   9730: }
                   9731: 
                   9732: % Append the tokens #2 to the definition of macro #1, not expanding either.
                   9733: %
                   9734: \def\appendtomacro#1#2{%
                   9735:   \expandafter\def\expandafter#1\expandafter{#1#2}%
                   9736: }
                   9737: 
                   9738: % @caption, @shortcaption
                   9739: %
                   9740: \def\caption{\docaption\thiscaption}
                   9741: \def\shortcaption{\docaption\thisshortcaption}
1.2     ! snw      9742: \def\docaption{\checkenv\float \bgroup\scanctxt\docaptionz}
        !          9743: \def\docaptionz#1#2{\egroup \def#1{#2}}
1.1       snw      9744: 
                   9745: % The parameter is the control sequence identifying the counter we are
                   9746: % going to use.  Create it if it doesn't exist and assign it to \floatno.
                   9747: \def\getfloatno#1{%
                   9748:   \ifx#1\relax
                   9749:       % Haven't seen this figure type before.
                   9750:       \csname newcount\endcsname #1%
                   9751:       %
                   9752:       % Remember to reset this floatno at the next chap.
                   9753:       \expandafter\gdef\expandafter\resetallfloatnos
                   9754:         \expandafter{\resetallfloatnos #1=0 }%
                   9755:   \fi
                   9756:   \let\floatno#1%
                   9757: }
                   9758: 
                   9759: % \setref calls this to get the XREFLABEL-snt value.  We want an @xref
                   9760: % to the FLOATLABEL to expand to "Figure 3.1".  We call \setref when we
                   9761: % first read the @float command.
                   9762: %
                   9763: \def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}%
                   9764: 
                   9765: % Magic string used for the XREFLABEL-title value, so \xrefX can
                   9766: % distinguish floats from other xref types.
                   9767: \def\floatmagic{!!float!!}
                   9768: 
                   9769: % #1 is the control sequence we are passed; we expand into a conditional
                   9770: % which is true if #1 represents a float ref.  That is, the magic
                   9771: % \currentsection value which we \setref above.
                   9772: %
                   9773: \def\iffloat#1{\expandafter\doiffloat#1==\finish}
                   9774: %
                   9775: % #1 is (maybe) the \floatmagic string.  If so, #2 will be the
                   9776: % (safe) float type for this float.  We set \iffloattype to #2.
                   9777: %
                   9778: \def\doiffloat#1=#2=#3\finish{%
                   9779:   \def\temp{#1}%
                   9780:   \def\iffloattype{#2}%
                   9781:   \ifx\temp\floatmagic
                   9782: }
                   9783: 
                   9784: % @listoffloats FLOATTYPE - print a list of floats like a table of contents.
                   9785: %
                   9786: \parseargdef\listoffloats{%
                   9787:   \def\floattype{#1}% floattype
                   9788:   {%
                   9789:     % the floattype might have accents or other special characters,
                   9790:     % but we need to use it in a control sequence name.
                   9791:     \indexnofonts
                   9792:     \turnoffactive
                   9793:     \xdef\safefloattype{\floattype}%
                   9794:   }%
                   9795:   %
                   9796:   % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE.
                   9797:   \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax
                   9798:     \ifhavexrefs
                   9799:       % if the user said @listoffloats foo but never @float foo.
                   9800:       \message{\linenumber No `\safefloattype' floats to list.}%
                   9801:     \fi
                   9802:   \else
                   9803:     \begingroup
                   9804:       \leftskip=\tocindent  % indent these entries like a toc
                   9805:       \let\do=\listoffloatsdo
                   9806:       \csname floatlist\safefloattype\endcsname
                   9807:     \endgroup
                   9808:   \fi
                   9809: }
                   9810: 
                   9811: % This is called on each entry in a list of floats.  We're passed the
                   9812: % xref label, in the form LABEL-title, which is how we save it in the
                   9813: % aux file.  We strip off the -title and look up \XRLABEL-lof, which
                   9814: % has the text we're supposed to typeset here.
                   9815: %
                   9816: % Figures without xref labels will not be included in the list (since
                   9817: % they won't appear in the aux file).
                   9818: %
                   9819: \def\listoffloatsdo#1{\listoffloatsdoentry#1\finish}
                   9820: \def\listoffloatsdoentry#1-title\finish{{%
                   9821:   % Can't fully expand XR#1-lof because it can contain anything.  Just
                   9822:   % pass the control sequence.  On the other hand, XR#1-pg is just the
                   9823:   % page number, and we want to fully expand that so we can get a link
                   9824:   % in pdf output.
                   9825:   \toksA = \expandafter{\csname XR#1-lof\endcsname}%
                   9826:   %
                   9827:   % use the same \entry macro we use to generate the TOC and index.
                   9828:   \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}%
                   9829:   \writeentry
                   9830: }}
                   9831: 
                   9832: 
                   9833: \message{localization,}
                   9834: 
                   9835: % For single-language documents, @documentlanguage is usually given very
                   9836: % early, just after @documentencoding.  Single argument is the language
                   9837: % (de) or locale (de_DE) abbreviation.
                   9838: %
                   9839: {
                   9840:   \catcode`\_ = \active
                   9841:   \globaldefs=1
                   9842: \parseargdef\documentlanguage{%
                   9843:   \tex % read txi-??.tex file in plain TeX.
                   9844:     % Read the file by the name they passed if it exists.
                   9845:     \let_ = \normalunderscore  % normal _ character for filename test
                   9846:     \openin 1 txi-#1.tex
                   9847:     \ifeof 1
                   9848:       \documentlanguagetrywithoutunderscore #1_\finish
                   9849:     \else
                   9850:       \globaldefs = 1  % everything in the txi-LL files needs to persist
                   9851:       \input txi-#1.tex
                   9852:     \fi
                   9853:     \closein 1
                   9854:   \endgroup % end raw TeX
                   9855: }
                   9856: %
                   9857: % If they passed de_DE, and txi-de_DE.tex doesn't exist,
                   9858: % try txi-de.tex.
                   9859: %
                   9860: \gdef\documentlanguagetrywithoutunderscore#1_#2\finish{%
                   9861:   \openin 1 txi-#1.tex
                   9862:   \ifeof 1
                   9863:     \errhelp = \nolanghelp
                   9864:     \errmessage{Cannot read language file txi-#1.tex}%
                   9865:   \else
                   9866:     \globaldefs = 1  % everything in the txi-LL files needs to persist
                   9867:     \input txi-#1.tex
                   9868:   \fi
                   9869:   \closein 1
                   9870: }
                   9871: }% end of special _ catcode
                   9872: %
                   9873: \newhelp\nolanghelp{The given language definition file cannot be found or
                   9874: is empty.  Maybe you need to install it?  Putting it in the current
                   9875: directory should work if nowhere else does.}
                   9876: 
                   9877: % This macro is called from txi-??.tex files; the first argument is the
                   9878: % \language name to set (without the "\lang@" prefix), the second and
                   9879: % third args are \{left,right}hyphenmin.
                   9880: %
                   9881: % The language names to pass are determined when the format is built.
                   9882: % See the etex.log file created at that time, e.g.,
                   9883: % /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log.
                   9884: %
                   9885: % With TeX Live 2008, etex now includes hyphenation patterns for all
                   9886: % available languages.  This means we can support hyphenation in
                   9887: % Texinfo, at least to some extent.  (This still doesn't solve the
                   9888: % accented characters problem.)
                   9889: %
                   9890: \catcode`@=11
                   9891: \def\txisetlanguage#1#2#3{%
                   9892:   % do not set the language if the name is undefined in the current TeX.
                   9893:   \expandafter\ifx\csname lang@#1\endcsname \relax
                   9894:     \message{no patterns for #1}%
                   9895:   \else
                   9896:     \global\language = \csname lang@#1\endcsname
                   9897:   \fi
                   9898:   % but there is no harm in adjusting the hyphenmin values regardless.
                   9899:   \global\lefthyphenmin = #2\relax
                   9900:   \global\righthyphenmin = #3\relax
                   9901: }
                   9902: 
                   9903: % XeTeX and LuaTeX can handle Unicode natively.
                   9904: % Their default I/O uses UTF-8 sequences instead of a byte-wise operation.
                   9905: % Other TeX engines' I/O (pdfTeX, etc.) is byte-wise.
                   9906: %
                   9907: \newif\iftxinativeunicodecapable
                   9908: \newif\iftxiusebytewiseio
                   9909: 
                   9910: \ifx\XeTeXrevision\thisisundefined
                   9911:   \ifx\luatexversion\thisisundefined
                   9912:     \txinativeunicodecapablefalse
                   9913:     \txiusebytewiseiotrue
                   9914:   \else
                   9915:     \txinativeunicodecapabletrue
                   9916:     \txiusebytewiseiofalse
                   9917:   \fi
                   9918: \else
                   9919:   \txinativeunicodecapabletrue
                   9920:   \txiusebytewiseiofalse
                   9921: \fi
                   9922: 
                   9923: % Set I/O by bytes instead of UTF-8 sequence for XeTeX and LuaTex
                   9924: % for non-UTF-8 (byte-wise) encodings.
                   9925: %
                   9926: \def\setbytewiseio{%
                   9927:   \ifx\XeTeXrevision\thisisundefined
                   9928:   \else
                   9929:     \XeTeXdefaultencoding "bytes"  % For subsequent files to be read
                   9930:     \XeTeXinputencoding "bytes"  % For document root file
                   9931:     % Unfortunately, there seems to be no corresponding XeTeX command for
                   9932:     % output encoding.  This is a problem for auxiliary index and TOC files.
                   9933:     % The only solution would be perhaps to write out @U{...} sequences in
                   9934:     % place of non-ASCII characters.
                   9935:   \fi
                   9936: 
                   9937:   \ifx\luatexversion\thisisundefined
                   9938:   \else
                   9939:     \directlua{
                   9940:     local utf8_char, byte, gsub = unicode.utf8.char, string.byte, string.gsub
                   9941:     local function convert_char (char)
                   9942:       return utf8_char(byte(char))
                   9943:     end
                   9944: 
                   9945:     local function convert_line (line)
                   9946:       return gsub(line, ".", convert_char)
                   9947:     end
                   9948: 
                   9949:     callback.register("process_input_buffer", convert_line)
                   9950: 
                   9951:     local function convert_line_out (line)
                   9952:       local line_out = ""
                   9953:       for c in string.utfvalues(line) do
                   9954:          line_out = line_out .. string.char(c)
                   9955:       end
                   9956:       return line_out
                   9957:     end
                   9958: 
                   9959:     callback.register("process_output_buffer", convert_line_out)
                   9960:     }
                   9961:   \fi
                   9962: 
                   9963:   \txiusebytewiseiotrue
                   9964: }
                   9965: 
                   9966: 
                   9967: % Helpers for encodings.
                   9968: % Set the catcode of characters 128 through 255 to the specified number.
                   9969: %
                   9970: \def\setnonasciicharscatcode#1{%
                   9971:    \count255=128
                   9972:    \loop\ifnum\count255<256
                   9973:       \global\catcode\count255=#1\relax
                   9974:       \advance\count255 by 1
                   9975:    \repeat
                   9976: }
                   9977: 
                   9978: \def\setnonasciicharscatcodenonglobal#1{%
                   9979:    \count255=128
                   9980:    \loop\ifnum\count255<256
                   9981:       \catcode\count255=#1\relax
                   9982:       \advance\count255 by 1
                   9983:    \repeat
                   9984: }
                   9985: 
                   9986: % @documentencoding sets the definition of non-ASCII characters
                   9987: % according to the specified encoding.
                   9988: %
                   9989: \def\documentencoding{\parseargusing\filenamecatcodes\documentencodingzzz}
                   9990: \def\documentencodingzzz#1{%
                   9991:   %
                   9992:   % Encoding being declared for the document.
                   9993:   \def\declaredencoding{\csname #1.enc\endcsname}%
                   9994:   %
                   9995:   % Supported encodings: names converted to tokens in order to be able
                   9996:   % to compare them with \ifx.
                   9997:   \def\ascii{\csname US-ASCII.enc\endcsname}%
                   9998:   \def\latnine{\csname ISO-8859-15.enc\endcsname}%
                   9999:   \def\latone{\csname ISO-8859-1.enc\endcsname}%
                   10000:   \def\lattwo{\csname ISO-8859-2.enc\endcsname}%
                   10001:   \def\utfeight{\csname UTF-8.enc\endcsname}%
                   10002:   %
                   10003:   \ifx \declaredencoding \ascii
                   10004:      \asciichardefs
                   10005:   %
                   10006:   \else \ifx \declaredencoding \lattwo
                   10007:      \iftxinativeunicodecapable
                   10008:        \setbytewiseio
                   10009:      \fi
                   10010:      \setnonasciicharscatcode\active
                   10011:      \lattwochardefs
                   10012:   %
                   10013:   \else \ifx \declaredencoding \latone
                   10014:      \iftxinativeunicodecapable
                   10015:        \setbytewiseio
                   10016:      \fi
                   10017:      \setnonasciicharscatcode\active
                   10018:      \latonechardefs
                   10019:   %
                   10020:   \else \ifx \declaredencoding \latnine
                   10021:      \iftxinativeunicodecapable
                   10022:        \setbytewiseio
                   10023:      \fi
                   10024:      \setnonasciicharscatcode\active
                   10025:      \latninechardefs
                   10026:   %
                   10027:   \else \ifx \declaredencoding \utfeight
                   10028:      \iftxinativeunicodecapable
                   10029:        % For native Unicode handling (XeTeX and LuaTeX)
                   10030:        \nativeunicodechardefs
                   10031:      \else
1.2     ! snw      10032:        % For treating UTF-8 as byte sequences (TeX, eTeX and pdfTeX).
        !          10033:        % Since we already invoke \utfeightchardefs at the top level,
        !          10034:        % making non-ascii chars active is sufficient.
1.1       snw      10035:        \setnonasciicharscatcode\active
                   10036:      \fi
                   10037:   %
                   10038:   \else
                   10039:     \message{Ignoring unknown document encoding: #1.}%
                   10040:   %
                   10041:   \fi % utfeight
                   10042:   \fi % latnine
                   10043:   \fi % latone
                   10044:   \fi % lattwo
                   10045:   \fi % ascii
                   10046:   %
                   10047:   \ifx\XeTeXrevision\thisisundefined
                   10048:   \else
                   10049:     \ifx \declaredencoding \utfeight
                   10050:     \else
                   10051:       \ifx \declaredencoding \ascii
                   10052:       \else
                   10053:         \message{Warning: XeTeX with non-UTF-8 encodings cannot handle %
                   10054:         non-ASCII characters in auxiliary files.}%
                   10055:       \fi
                   10056:     \fi
                   10057:   \fi
                   10058: }
                   10059: 
                   10060: % A message to be logged when using a character that isn't available
                   10061: % the default font encoding (OT1).
                   10062: %
                   10063: \def\missingcharmsg#1{\message{Character missing, sorry: #1.}}
                   10064: 
                   10065: % Take account of \c (plain) vs. \, (Texinfo) difference.
                   10066: \def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi}
                   10067: 
                   10068: \def\gdefchar#1#2{%
                   10069: \gdef#1{%
                   10070:    \ifpassthroughchars
                   10071:      \string#1%
                   10072:    \else
                   10073:      #2%
                   10074:    \fi
                   10075: }}
                   10076: 
1.2     ! snw      10077: \begingroup
        !          10078: 
        !          10079: % Make non-ASCII characters active for defining the character definition
        !          10080: % macros.
        !          10081: \setnonasciicharscatcode\active
        !          10082: 
1.1       snw      10083: % Latin1 (ISO-8859-1) character definitions.
1.2     ! snw      10084: \gdef\latonechardefs{%
1.1       snw      10085:   \gdefchar^^a0{\tie}
                   10086:   \gdefchar^^a1{\exclamdown}
                   10087:   \gdefchar^^a2{{\tcfont \char162}} % cent
                   10088:   \gdefchar^^a3{\pounds{}}
                   10089:   \gdefchar^^a4{{\tcfont \char164}} % currency
                   10090:   \gdefchar^^a5{{\tcfont \char165}} % yen
                   10091:   \gdefchar^^a6{{\tcfont \char166}} % broken bar
                   10092:   \gdefchar^^a7{\S}
                   10093:   \gdefchar^^a8{\"{}}
                   10094:   \gdefchar^^a9{\copyright{}}
                   10095:   \gdefchar^^aa{\ordf}
                   10096:   \gdefchar^^ab{\guillemetleft{}}
                   10097:   \gdefchar^^ac{\ensuremath\lnot}
                   10098:   \gdefchar^^ad{\-}
                   10099:   \gdefchar^^ae{\registeredsymbol{}}
                   10100:   \gdefchar^^af{\={}}
                   10101:   %
                   10102:   \gdefchar^^b0{\textdegree}
                   10103:   \gdefchar^^b1{$\pm$}
                   10104:   \gdefchar^^b2{$^2$}
                   10105:   \gdefchar^^b3{$^3$}
                   10106:   \gdefchar^^b4{\'{}}
                   10107:   \gdefchar^^b5{$\mu$}
                   10108:   \gdefchar^^b6{\P}
                   10109:   \gdefchar^^b7{\ensuremath\cdot}
                   10110:   \gdefchar^^b8{\cedilla\ }
                   10111:   \gdefchar^^b9{$^1$}
                   10112:   \gdefchar^^ba{\ordm}
                   10113:   \gdefchar^^bb{\guillemetright{}}
                   10114:   \gdefchar^^bc{$1\over4$}
                   10115:   \gdefchar^^bd{$1\over2$}
                   10116:   \gdefchar^^be{$3\over4$}
                   10117:   \gdefchar^^bf{\questiondown}
                   10118:   %
                   10119:   \gdefchar^^c0{\`A}
                   10120:   \gdefchar^^c1{\'A}
                   10121:   \gdefchar^^c2{\^A}
                   10122:   \gdefchar^^c3{\~A}
                   10123:   \gdefchar^^c4{\"A}
                   10124:   \gdefchar^^c5{\ringaccent A}
                   10125:   \gdefchar^^c6{\AE}
                   10126:   \gdefchar^^c7{\cedilla C}
                   10127:   \gdefchar^^c8{\`E}
                   10128:   \gdefchar^^c9{\'E}
                   10129:   \gdefchar^^ca{\^E}
                   10130:   \gdefchar^^cb{\"E}
                   10131:   \gdefchar^^cc{\`I}
                   10132:   \gdefchar^^cd{\'I}
                   10133:   \gdefchar^^ce{\^I}
                   10134:   \gdefchar^^cf{\"I}
                   10135:   %
                   10136:   \gdefchar^^d0{\DH}
                   10137:   \gdefchar^^d1{\~N}
                   10138:   \gdefchar^^d2{\`O}
                   10139:   \gdefchar^^d3{\'O}
                   10140:   \gdefchar^^d4{\^O}
                   10141:   \gdefchar^^d5{\~O}
                   10142:   \gdefchar^^d6{\"O}
                   10143:   \gdefchar^^d7{$\times$}
                   10144:   \gdefchar^^d8{\O}
                   10145:   \gdefchar^^d9{\`U}
                   10146:   \gdefchar^^da{\'U}
                   10147:   \gdefchar^^db{\^U}
                   10148:   \gdefchar^^dc{\"U}
                   10149:   \gdefchar^^dd{\'Y}
                   10150:   \gdefchar^^de{\TH}
                   10151:   \gdefchar^^df{\ss}
                   10152:   %
                   10153:   \gdefchar^^e0{\`a}
                   10154:   \gdefchar^^e1{\'a}
                   10155:   \gdefchar^^e2{\^a}
                   10156:   \gdefchar^^e3{\~a}
                   10157:   \gdefchar^^e4{\"a}
                   10158:   \gdefchar^^e5{\ringaccent a}
                   10159:   \gdefchar^^e6{\ae}
                   10160:   \gdefchar^^e7{\cedilla c}
                   10161:   \gdefchar^^e8{\`e}
                   10162:   \gdefchar^^e9{\'e}
                   10163:   \gdefchar^^ea{\^e}
                   10164:   \gdefchar^^eb{\"e}
                   10165:   \gdefchar^^ec{\`{\dotless i}}
                   10166:   \gdefchar^^ed{\'{\dotless i}}
                   10167:   \gdefchar^^ee{\^{\dotless i}}
                   10168:   \gdefchar^^ef{\"{\dotless i}}
                   10169:   %
                   10170:   \gdefchar^^f0{\dh}
                   10171:   \gdefchar^^f1{\~n}
                   10172:   \gdefchar^^f2{\`o}
                   10173:   \gdefchar^^f3{\'o}
                   10174:   \gdefchar^^f4{\^o}
                   10175:   \gdefchar^^f5{\~o}
                   10176:   \gdefchar^^f6{\"o}
                   10177:   \gdefchar^^f7{$\div$}
                   10178:   \gdefchar^^f8{\o}
                   10179:   \gdefchar^^f9{\`u}
                   10180:   \gdefchar^^fa{\'u}
                   10181:   \gdefchar^^fb{\^u}
                   10182:   \gdefchar^^fc{\"u}
                   10183:   \gdefchar^^fd{\'y}
                   10184:   \gdefchar^^fe{\th}
                   10185:   \gdefchar^^ff{\"y}
                   10186: }
                   10187: 
                   10188: % Latin9 (ISO-8859-15) encoding character definitions.
1.2     ! snw      10189: \gdef\latninechardefs{%
1.1       snw      10190:   % Encoding is almost identical to Latin1.
                   10191:   \latonechardefs
                   10192:   %
                   10193:   \gdefchar^^a4{\euro{}}
                   10194:   \gdefchar^^a6{\v S}
                   10195:   \gdefchar^^a8{\v s}
                   10196:   \gdefchar^^b4{\v Z}
                   10197:   \gdefchar^^b8{\v z}
                   10198:   \gdefchar^^bc{\OE}
                   10199:   \gdefchar^^bd{\oe}
                   10200:   \gdefchar^^be{\"Y}
                   10201: }
                   10202: 
                   10203: % Latin2 (ISO-8859-2) character definitions.
1.2     ! snw      10204: \gdef\lattwochardefs{%
1.1       snw      10205:   \gdefchar^^a0{\tie}
                   10206:   \gdefchar^^a1{\ogonek{A}}
                   10207:   \gdefchar^^a2{\u{}}
                   10208:   \gdefchar^^a3{\L}
                   10209:   \gdefchar^^a4{\missingcharmsg{CURRENCY SIGN}}
                   10210:   \gdefchar^^a5{\v L}
                   10211:   \gdefchar^^a6{\'S}
                   10212:   \gdefchar^^a7{\S}
                   10213:   \gdefchar^^a8{\"{}}
                   10214:   \gdefchar^^a9{\v S}
                   10215:   \gdefchar^^aa{\cedilla S}
                   10216:   \gdefchar^^ab{\v T}
                   10217:   \gdefchar^^ac{\'Z}
                   10218:   \gdefchar^^ad{\-}
                   10219:   \gdefchar^^ae{\v Z}
                   10220:   \gdefchar^^af{\dotaccent Z}
                   10221:   %
1.2     ! snw      10222:   \gdefchar^^b0{\textdegree}
1.1       snw      10223:   \gdefchar^^b1{\ogonek{a}}
                   10224:   \gdefchar^^b2{\ogonek{ }}
                   10225:   \gdefchar^^b3{\l}
                   10226:   \gdefchar^^b4{\'{}}
                   10227:   \gdefchar^^b5{\v l}
                   10228:   \gdefchar^^b6{\'s}
                   10229:   \gdefchar^^b7{\v{}}
                   10230:   \gdefchar^^b8{\cedilla\ }
                   10231:   \gdefchar^^b9{\v s}
                   10232:   \gdefchar^^ba{\cedilla s}
                   10233:   \gdefchar^^bb{\v t}
                   10234:   \gdefchar^^bc{\'z}
                   10235:   \gdefchar^^bd{\H{}}
                   10236:   \gdefchar^^be{\v z}
                   10237:   \gdefchar^^bf{\dotaccent z}
                   10238:   %
                   10239:   \gdefchar^^c0{\'R}
                   10240:   \gdefchar^^c1{\'A}
                   10241:   \gdefchar^^c2{\^A}
                   10242:   \gdefchar^^c3{\u A}
                   10243:   \gdefchar^^c4{\"A}
                   10244:   \gdefchar^^c5{\'L}
                   10245:   \gdefchar^^c6{\'C}
                   10246:   \gdefchar^^c7{\cedilla C}
                   10247:   \gdefchar^^c8{\v C}
                   10248:   \gdefchar^^c9{\'E}
                   10249:   \gdefchar^^ca{\ogonek{E}}
                   10250:   \gdefchar^^cb{\"E}
                   10251:   \gdefchar^^cc{\v E}
                   10252:   \gdefchar^^cd{\'I}
                   10253:   \gdefchar^^ce{\^I}
                   10254:   \gdefchar^^cf{\v D}
                   10255:   %
                   10256:   \gdefchar^^d0{\DH}
                   10257:   \gdefchar^^d1{\'N}
                   10258:   \gdefchar^^d2{\v N}
                   10259:   \gdefchar^^d3{\'O}
                   10260:   \gdefchar^^d4{\^O}
                   10261:   \gdefchar^^d5{\H O}
                   10262:   \gdefchar^^d6{\"O}
                   10263:   \gdefchar^^d7{$\times$}
                   10264:   \gdefchar^^d8{\v R}
                   10265:   \gdefchar^^d9{\ringaccent U}
                   10266:   \gdefchar^^da{\'U}
                   10267:   \gdefchar^^db{\H U}
                   10268:   \gdefchar^^dc{\"U}
                   10269:   \gdefchar^^dd{\'Y}
                   10270:   \gdefchar^^de{\cedilla T}
                   10271:   \gdefchar^^df{\ss}
                   10272:   %
                   10273:   \gdefchar^^e0{\'r}
                   10274:   \gdefchar^^e1{\'a}
                   10275:   \gdefchar^^e2{\^a}
                   10276:   \gdefchar^^e3{\u a}
                   10277:   \gdefchar^^e4{\"a}
                   10278:   \gdefchar^^e5{\'l}
                   10279:   \gdefchar^^e6{\'c}
                   10280:   \gdefchar^^e7{\cedilla c}
                   10281:   \gdefchar^^e8{\v c}
                   10282:   \gdefchar^^e9{\'e}
                   10283:   \gdefchar^^ea{\ogonek{e}}
                   10284:   \gdefchar^^eb{\"e}
                   10285:   \gdefchar^^ec{\v e}
                   10286:   \gdefchar^^ed{\'{\dotless{i}}}
                   10287:   \gdefchar^^ee{\^{\dotless{i}}}
                   10288:   \gdefchar^^ef{\v d}
                   10289:   %
                   10290:   \gdefchar^^f0{\dh}
                   10291:   \gdefchar^^f1{\'n}
                   10292:   \gdefchar^^f2{\v n}
                   10293:   \gdefchar^^f3{\'o}
                   10294:   \gdefchar^^f4{\^o}
                   10295:   \gdefchar^^f5{\H o}
                   10296:   \gdefchar^^f6{\"o}
                   10297:   \gdefchar^^f7{$\div$}
                   10298:   \gdefchar^^f8{\v r}
                   10299:   \gdefchar^^f9{\ringaccent u}
                   10300:   \gdefchar^^fa{\'u}
                   10301:   \gdefchar^^fb{\H u}
                   10302:   \gdefchar^^fc{\"u}
                   10303:   \gdefchar^^fd{\'y}
                   10304:   \gdefchar^^fe{\cedilla t}
                   10305:   \gdefchar^^ff{\dotaccent{}}
                   10306: }
                   10307: 
1.2     ! snw      10308: \endgroup % active chars
        !          10309: 
1.1       snw      10310: % UTF-8 character definitions.
                   10311: %
                   10312: % This code to support UTF-8 is based on LaTeX's utf8.def, with some
                   10313: % changes for Texinfo conventions.  It is included here under the GPL by
                   10314: % permission from Frank Mittelbach and the LaTeX team.
                   10315: %
                   10316: \newcount\countUTFx
                   10317: \newcount\countUTFy
                   10318: \newcount\countUTFz
                   10319: 
                   10320: \gdef\UTFviiiTwoOctets#1#2{\expandafter
                   10321:    \UTFviiiDefined\csname u8:#1\string #2\endcsname}
                   10322: %
                   10323: \gdef\UTFviiiThreeOctets#1#2#3{\expandafter
                   10324:    \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname}
                   10325: %
                   10326: \gdef\UTFviiiFourOctets#1#2#3#4{\expandafter
                   10327:    \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname}
                   10328: 
                   10329: \gdef\UTFviiiDefined#1{%
                   10330:   \ifx #1\relax
                   10331:     \message{\linenumber Unicode char \string #1 not defined for Texinfo}%
                   10332:   \else
                   10333:     \expandafter #1%
                   10334:   \fi
                   10335: }
                   10336: 
                   10337: % Give non-ASCII bytes the active definitions for processing UTF-8 sequences
                   10338: \begingroup
                   10339:   \catcode`\~13
                   10340:   \catcode`\$12
                   10341:   \catcode`\"12
                   10342: 
                   10343:   % Loop from \countUTFx to \countUTFy, performing \UTFviiiTmp
                   10344:   % substituting ~ and $ with a character token of that value.
                   10345:   \def\UTFviiiLoop{%
                   10346:     \global\catcode\countUTFx\active
                   10347:     \uccode`\~\countUTFx
                   10348:     \uccode`\$\countUTFx
                   10349:     \uppercase\expandafter{\UTFviiiTmp}%
                   10350:     \advance\countUTFx by 1
                   10351:     \ifnum\countUTFx < \countUTFy
                   10352:       \expandafter\UTFviiiLoop
                   10353:     \fi}
                   10354: 
                   10355:   % For bytes other than the first in a UTF-8 sequence.  Not expected to
                   10356:   % be expanded except when writing to auxiliary files.
                   10357:   \countUTFx = "80
                   10358:   \countUTFy = "C2
                   10359:   \def\UTFviiiTmp{%
                   10360:     \gdef~{%
                   10361:         \ifpassthroughchars $\fi}}%
                   10362:   \UTFviiiLoop
                   10363: 
                   10364:   \countUTFx = "C2
                   10365:   \countUTFy = "E0
                   10366:   \def\UTFviiiTmp{%
                   10367:     \gdef~{%
                   10368:         \ifpassthroughchars $%
                   10369:         \else\expandafter\UTFviiiTwoOctets\expandafter$\fi}}%
                   10370:   \UTFviiiLoop
                   10371: 
                   10372:   \countUTFx = "E0
                   10373:   \countUTFy = "F0
                   10374:   \def\UTFviiiTmp{%
                   10375:     \gdef~{%
                   10376:         \ifpassthroughchars $%
                   10377:         \else\expandafter\UTFviiiThreeOctets\expandafter$\fi}}%
                   10378:   \UTFviiiLoop
                   10379: 
                   10380:   \countUTFx = "F0
                   10381:   \countUTFy = "F4
                   10382:   \def\UTFviiiTmp{%
                   10383:     \gdef~{%
                   10384:         \ifpassthroughchars $%
                   10385:         \else\expandafter\UTFviiiFourOctets\expandafter$\fi
                   10386:         }}%
                   10387:   \UTFviiiLoop
                   10388: \endgroup
                   10389: 
                   10390: \def\globallet{\global\let} % save some \expandafter's below
                   10391: 
                   10392: % @U{xxxx} to produce U+xxxx, if we support it.
                   10393: \def\U#1{%
                   10394:   \expandafter\ifx\csname uni:#1\endcsname \relax
                   10395:     \iftxinativeunicodecapable
                   10396:       % All Unicode characters can be used if native Unicode handling is
                   10397:       % active.  However, if the font does not have the glyph,
                   10398:       % letters are missing.
                   10399:       \begingroup
                   10400:         \uccode`\.="#1\relax
                   10401:         \uppercase{.}
                   10402:       \endgroup
                   10403:     \else
                   10404:       \errhelp = \EMsimple
                   10405:       \errmessage{Unicode character U+#1 not supported, sorry}%
                   10406:     \fi
                   10407:   \else
                   10408:     \csname uni:#1\endcsname
                   10409:   \fi
                   10410: }
                   10411: 
                   10412: % These macros are used here to construct the name of a control
                   10413: % sequence to be defined.
                   10414: \def\UTFviiiTwoOctetsName#1#2{%
                   10415:   \csname u8:#1\string #2\endcsname}%
                   10416: \def\UTFviiiThreeOctetsName#1#2#3{%
                   10417:   \csname u8:#1\string #2\string #3\endcsname}%
                   10418: \def\UTFviiiFourOctetsName#1#2#3#4{%
                   10419:   \csname u8:#1\string #2\string #3\string #4\endcsname}%
                   10420: 
                   10421: % For UTF-8 byte sequences (TeX, e-TeX and pdfTeX),
                   10422: % provide a definition macro to replace a Unicode character;
                   10423: % this gets used by the @U command
                   10424: %
                   10425: \begingroup
                   10426:   \catcode`\"=12
                   10427:   \catcode`\<=12
                   10428:   \catcode`\.=12
                   10429:   \catcode`\,=12
                   10430:   \catcode`\;=12
                   10431:   \catcode`\!=12
                   10432:   \catcode`\~=13
                   10433:   \gdef\DeclareUnicodeCharacterUTFviii#1#2{%
                   10434:     \countUTFz = "#1\relax
                   10435:     \begingroup
                   10436:       \parseXMLCharref
                   10437: 
                   10438:       % Give \u8:... its definition.  The sequence of seven \expandafter's
                   10439:       % expands after the \gdef three times, e.g.
                   10440:       %
                   10441:       % 1.  \UTFviiTwoOctetsName B1 B2
                   10442:       % 2.  \csname u8:B1 \string B2 \endcsname
                   10443:       % 3.  \u8: B1 B2  (a single control sequence token)
                   10444:       %
                   10445:       \expandafter\expandafter
                   10446:       \expandafter\expandafter
                   10447:       \expandafter\expandafter
                   10448:       \expandafter\gdef       \UTFviiiTmp{#2}%
                   10449:       %
                   10450:       \expandafter\ifx\csname uni:#1\endcsname \relax \else
                   10451:        \message{Internal error, already defined: #1}%
                   10452:       \fi
                   10453:       %
                   10454:       % define an additional control sequence for this code point.
                   10455:       \expandafter\globallet\csname uni:#1\endcsname \UTFviiiTmp
                   10456:     \endgroup}
                   10457:   %
                   10458:   % Given the value in \countUTFz as a Unicode code point, set \UTFviiiTmp
                   10459:   % to the corresponding UTF-8 sequence.
                   10460:   \gdef\parseXMLCharref{%
1.2     ! snw      10461:     \ifnum\countUTFz < "20\relax
1.1       snw      10462:       \errhelp = \EMsimple
1.2     ! snw      10463:       \errmessage{Cannot define Unicode char value < 0020}%
1.1       snw      10464:     \else\ifnum\countUTFz < "800\relax
                   10465:       \parseUTFviiiA,%
                   10466:       \parseUTFviiiB C\UTFviiiTwoOctetsName.,%
                   10467:     \else\ifnum\countUTFz < "10000\relax
                   10468:       \parseUTFviiiA;%
                   10469:       \parseUTFviiiA,%
                   10470:       \parseUTFviiiB E\UTFviiiThreeOctetsName.{,;}%
                   10471:     \else
                   10472:       \parseUTFviiiA;%
                   10473:       \parseUTFviiiA,%
                   10474:       \parseUTFviiiA!%
                   10475:       \parseUTFviiiB F\UTFviiiFourOctetsName.{!,;}%
                   10476:     \fi\fi\fi
                   10477:   }
                   10478: 
                   10479:   % Extract a byte from the end of the UTF-8 representation of \countUTFx.
                   10480:   % It must be a non-initial byte in the sequence.
                   10481:   % Change \uccode of #1 for it to be used in \parseUTFviiiB as one
                   10482:   % of the bytes.
                   10483:   \gdef\parseUTFviiiA#1{%
                   10484:     \countUTFx = \countUTFz
                   10485:     \divide\countUTFz by 64
                   10486:     \countUTFy = \countUTFz  % Save to be the future value of \countUTFz.
                   10487:     \multiply\countUTFz by 64
                   10488: 
                   10489:     % \countUTFz is now \countUTFx with the last 5 bits cleared.  Subtract
                   10490:     % in order to get the last five bits.
                   10491:     \advance\countUTFx by -\countUTFz
                   10492: 
                   10493:     % Convert this to the byte in the UTF-8 sequence.
                   10494:     \advance\countUTFx by 128
                   10495:     \uccode `#1\countUTFx
                   10496:     \countUTFz = \countUTFy}
                   10497: 
                   10498:   % Used to put a UTF-8 byte sequence into \UTFviiiTmp
                   10499:   % #1 is the increment for \countUTFz to yield a the first byte of the UTF-8
                   10500:   %    sequence.
                   10501:   % #2 is one of the \UTFviii*OctetsName macros.
                   10502:   % #3 is always a full stop (.)
                   10503:   % #4 is a template for the other bytes in the sequence.  The values for these
                   10504:   %    bytes is substituted in here with \uppercase using the \uccode's.
                   10505:   \gdef\parseUTFviiiB#1#2#3#4{%
                   10506:     \advance\countUTFz by "#10\relax
                   10507:     \uccode `#3\countUTFz
                   10508:     \uppercase{\gdef\UTFviiiTmp{#2#3#4}}}
                   10509: \endgroup
                   10510: 
                   10511: % For native Unicode handling (XeTeX and LuaTeX),
                   10512: % provide a definition macro that sets a catcode to `other' non-globally
                   10513: %
                   10514: \def\DeclareUnicodeCharacterNativeOther#1#2{%
                   10515:   \catcode"#1=\other
                   10516: }
                   10517: 
                   10518: % https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_M
                   10519: % U+0000..U+007F = https://en.wikipedia.org/wiki/Basic_Latin_(Unicode_block)
                   10520: % U+0080..U+00FF = https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)
                   10521: % U+0100..U+017F = https://en.wikipedia.org/wiki/Latin_Extended-A
                   10522: % U+0180..U+024F = https://en.wikipedia.org/wiki/Latin_Extended-B
                   10523: %
                   10524: % Many of our renditions are less than wonderful, and all the missing
                   10525: % characters are available somewhere.  Loading the necessary fonts
                   10526: % awaits user request.  We can't truly support Unicode without
                   10527: % reimplementing everything that's been done in LaTeX for many years,
                   10528: % plus probably using luatex or xetex, and who knows what else.
                   10529: % We won't be doing that here in this simple file.  But we can try to at
                   10530: % least make most of the characters not bomb out.
                   10531: %
                   10532: \def\unicodechardefs{%
1.2     ! snw      10533:   \DeclareUnicodeCharacter{0020}{ } % space
        !          10534:   \DeclareUnicodeCharacter{0021}{\char"21 }% % space to terminate number
        !          10535:   \DeclareUnicodeCharacter{0022}{\char"22 }%
        !          10536:   \DeclareUnicodeCharacter{0023}{\char"23 }%
        !          10537:   \DeclareUnicodeCharacter{0024}{\char"24 }%
        !          10538:   \DeclareUnicodeCharacter{0025}{\char"25 }%
        !          10539:   \DeclareUnicodeCharacter{0026}{\char"26 }%
        !          10540:   \DeclareUnicodeCharacter{0027}{\char"27 }%
        !          10541:   \DeclareUnicodeCharacter{0028}{\char"28 }%
        !          10542:   \DeclareUnicodeCharacter{0029}{\char"29 }%
        !          10543:   \DeclareUnicodeCharacter{002A}{\char"2A }%
        !          10544:   \DeclareUnicodeCharacter{002B}{\char"2B }%
        !          10545:   \DeclareUnicodeCharacter{002C}{\char"2C }%
        !          10546:   \DeclareUnicodeCharacter{002D}{\char"2D }%
        !          10547:   \DeclareUnicodeCharacter{002E}{\char"2E }%
        !          10548:   \DeclareUnicodeCharacter{002F}{\char"2F }%
        !          10549:   \DeclareUnicodeCharacter{0030}{0}%
        !          10550:   \DeclareUnicodeCharacter{0031}{1}%
        !          10551:   \DeclareUnicodeCharacter{0032}{2}%
        !          10552:   \DeclareUnicodeCharacter{0033}{3}%
        !          10553:   \DeclareUnicodeCharacter{0034}{4}%
        !          10554:   \DeclareUnicodeCharacter{0035}{5}%
        !          10555:   \DeclareUnicodeCharacter{0036}{6}%
        !          10556:   \DeclareUnicodeCharacter{0037}{7}%
        !          10557:   \DeclareUnicodeCharacter{0038}{8}%
        !          10558:   \DeclareUnicodeCharacter{0039}{9}%
        !          10559:   \DeclareUnicodeCharacter{003A}{\char"3A }%
        !          10560:   \DeclareUnicodeCharacter{003B}{\char"3B }%
        !          10561:   \DeclareUnicodeCharacter{003C}{\char"3C }%
        !          10562:   \DeclareUnicodeCharacter{003D}{\char"3D }%
        !          10563:   \DeclareUnicodeCharacter{003E}{\char"3E }%
        !          10564:   \DeclareUnicodeCharacter{003F}{\char"3F }%
        !          10565:   \DeclareUnicodeCharacter{0040}{\char"40 }%
        !          10566:   \DeclareUnicodeCharacter{0041}{A}%
        !          10567:   \DeclareUnicodeCharacter{0042}{B}%
        !          10568:   \DeclareUnicodeCharacter{0043}{C}%
        !          10569:   \DeclareUnicodeCharacter{0044}{D}%
        !          10570:   \DeclareUnicodeCharacter{0045}{E}%
        !          10571:   \DeclareUnicodeCharacter{0046}{F}%
        !          10572:   \DeclareUnicodeCharacter{0047}{G}%
        !          10573:   \DeclareUnicodeCharacter{0048}{H}%
        !          10574:   \DeclareUnicodeCharacter{0049}{I}%
        !          10575:   \DeclareUnicodeCharacter{004A}{J}%
        !          10576:   \DeclareUnicodeCharacter{004B}{K}%
        !          10577:   \DeclareUnicodeCharacter{004C}{L}%
        !          10578:   \DeclareUnicodeCharacter{004D}{M}%
        !          10579:   \DeclareUnicodeCharacter{004E}{N}%
        !          10580:   \DeclareUnicodeCharacter{004F}{O}%
        !          10581:   \DeclareUnicodeCharacter{0050}{P}%
        !          10582:   \DeclareUnicodeCharacter{0051}{Q}%
        !          10583:   \DeclareUnicodeCharacter{0052}{R}%
        !          10584:   \DeclareUnicodeCharacter{0053}{S}%
        !          10585:   \DeclareUnicodeCharacter{0054}{T}%
        !          10586:   \DeclareUnicodeCharacter{0055}{U}%
        !          10587:   \DeclareUnicodeCharacter{0056}{V}%
        !          10588:   \DeclareUnicodeCharacter{0057}{W}%
        !          10589:   \DeclareUnicodeCharacter{0058}{X}%
        !          10590:   \DeclareUnicodeCharacter{0059}{Y}%
        !          10591:   \DeclareUnicodeCharacter{005A}{Z}%
        !          10592:   \DeclareUnicodeCharacter{005B}{\char"5B }%
        !          10593:   \DeclareUnicodeCharacter{005C}{\char"5C }%
        !          10594:   \DeclareUnicodeCharacter{005D}{\char"5D }%
        !          10595:   \DeclareUnicodeCharacter{005E}{\char"5E }%
        !          10596:   \DeclareUnicodeCharacter{005F}{\char"5F }%
        !          10597:   \DeclareUnicodeCharacter{0060}{\char"60 }%
        !          10598:   \DeclareUnicodeCharacter{0061}{a}%
        !          10599:   \DeclareUnicodeCharacter{0062}{b}%
        !          10600:   \DeclareUnicodeCharacter{0063}{c}%
        !          10601:   \DeclareUnicodeCharacter{0064}{d}%
        !          10602:   \DeclareUnicodeCharacter{0065}{e}%
        !          10603:   \DeclareUnicodeCharacter{0066}{f}%
        !          10604:   \DeclareUnicodeCharacter{0067}{g}%
        !          10605:   \DeclareUnicodeCharacter{0068}{h}%
        !          10606:   \DeclareUnicodeCharacter{0069}{i}%
        !          10607:   \DeclareUnicodeCharacter{006A}{j}%
        !          10608:   \DeclareUnicodeCharacter{006B}{k}%
        !          10609:   \DeclareUnicodeCharacter{006C}{l}%
        !          10610:   \DeclareUnicodeCharacter{006D}{m}%
        !          10611:   \DeclareUnicodeCharacter{006E}{n}%
        !          10612:   \DeclareUnicodeCharacter{006F}{o}%
        !          10613:   \DeclareUnicodeCharacter{0070}{p}%
        !          10614:   \DeclareUnicodeCharacter{0071}{q}%
        !          10615:   \DeclareUnicodeCharacter{0072}{r}%
        !          10616:   \DeclareUnicodeCharacter{0073}{s}%
        !          10617:   \DeclareUnicodeCharacter{0074}{t}%
        !          10618:   \DeclareUnicodeCharacter{0075}{u}%
        !          10619:   \DeclareUnicodeCharacter{0076}{v}%
        !          10620:   \DeclareUnicodeCharacter{0077}{w}%
        !          10621:   \DeclareUnicodeCharacter{0078}{x}%
        !          10622:   \DeclareUnicodeCharacter{0079}{y}%
        !          10623:   \DeclareUnicodeCharacter{007A}{z}%
        !          10624:   \DeclareUnicodeCharacter{007B}{\char"7B }%
        !          10625:   \DeclareUnicodeCharacter{007C}{\char"7C }%
        !          10626:   \DeclareUnicodeCharacter{007D}{\char"7D }%
        !          10627:   \DeclareUnicodeCharacter{007E}{\char"7E }%
        !          10628:   % \DeclareUnicodeCharacter{007F}{} % DEL
        !          10629:   %
1.1       snw      10630:   \DeclareUnicodeCharacter{00A0}{\tie}%
                   10631:   \DeclareUnicodeCharacter{00A1}{\exclamdown}%
                   10632:   \DeclareUnicodeCharacter{00A2}{{\tcfont \char162}}% 0242=cent
                   10633:   \DeclareUnicodeCharacter{00A3}{\pounds{}}%
                   10634:   \DeclareUnicodeCharacter{00A4}{{\tcfont \char164}}% 0244=currency
                   10635:   \DeclareUnicodeCharacter{00A5}{{\tcfont \char165}}% 0245=yen
                   10636:   \DeclareUnicodeCharacter{00A6}{{\tcfont \char166}}% 0246=brokenbar
                   10637:   \DeclareUnicodeCharacter{00A7}{\S}%
                   10638:   \DeclareUnicodeCharacter{00A8}{\"{ }}%
                   10639:   \DeclareUnicodeCharacter{00A9}{\copyright{}}%
                   10640:   \DeclareUnicodeCharacter{00AA}{\ordf}%
                   10641:   \DeclareUnicodeCharacter{00AB}{\guillemetleft{}}%
                   10642:   \DeclareUnicodeCharacter{00AC}{\ensuremath\lnot}%
                   10643:   \DeclareUnicodeCharacter{00AD}{\-}%
                   10644:   \DeclareUnicodeCharacter{00AE}{\registeredsymbol{}}%
                   10645:   \DeclareUnicodeCharacter{00AF}{\={ }}%
                   10646:   %
1.2     ! snw      10647:   \DeclareUnicodeCharacter{00B0}{\textdegree}%
1.1       snw      10648:   \DeclareUnicodeCharacter{00B1}{\ensuremath\pm}%
                   10649:   \DeclareUnicodeCharacter{00B2}{$^2$}%
                   10650:   \DeclareUnicodeCharacter{00B3}{$^3$}%
                   10651:   \DeclareUnicodeCharacter{00B4}{\'{ }}%
                   10652:   \DeclareUnicodeCharacter{00B5}{$\mu$}%
                   10653:   \DeclareUnicodeCharacter{00B6}{\P}%
                   10654:   \DeclareUnicodeCharacter{00B7}{\ensuremath\cdot}%
                   10655:   \DeclareUnicodeCharacter{00B8}{\cedilla{ }}%
                   10656:   \DeclareUnicodeCharacter{00B9}{$^1$}%
                   10657:   \DeclareUnicodeCharacter{00BA}{\ordm}%
                   10658:   \DeclareUnicodeCharacter{00BB}{\guillemetright{}}%
                   10659:   \DeclareUnicodeCharacter{00BC}{$1\over4$}%
                   10660:   \DeclareUnicodeCharacter{00BD}{$1\over2$}%
                   10661:   \DeclareUnicodeCharacter{00BE}{$3\over4$}%
                   10662:   \DeclareUnicodeCharacter{00BF}{\questiondown}%
                   10663:   %
                   10664:   \DeclareUnicodeCharacter{00C0}{\`A}%
                   10665:   \DeclareUnicodeCharacter{00C1}{\'A}%
                   10666:   \DeclareUnicodeCharacter{00C2}{\^A}%
                   10667:   \DeclareUnicodeCharacter{00C3}{\~A}%
                   10668:   \DeclareUnicodeCharacter{00C4}{\"A}%
                   10669:   \DeclareUnicodeCharacter{00C5}{\AA}%
                   10670:   \DeclareUnicodeCharacter{00C6}{\AE}%
                   10671:   \DeclareUnicodeCharacter{00C7}{\cedilla{C}}%
                   10672:   \DeclareUnicodeCharacter{00C8}{\`E}%
                   10673:   \DeclareUnicodeCharacter{00C9}{\'E}%
                   10674:   \DeclareUnicodeCharacter{00CA}{\^E}%
                   10675:   \DeclareUnicodeCharacter{00CB}{\"E}%
                   10676:   \DeclareUnicodeCharacter{00CC}{\`I}%
                   10677:   \DeclareUnicodeCharacter{00CD}{\'I}%
                   10678:   \DeclareUnicodeCharacter{00CE}{\^I}%
                   10679:   \DeclareUnicodeCharacter{00CF}{\"I}%
                   10680:   %
                   10681:   \DeclareUnicodeCharacter{00D0}{\DH}%
                   10682:   \DeclareUnicodeCharacter{00D1}{\~N}%
                   10683:   \DeclareUnicodeCharacter{00D2}{\`O}%
                   10684:   \DeclareUnicodeCharacter{00D3}{\'O}%
                   10685:   \DeclareUnicodeCharacter{00D4}{\^O}%
                   10686:   \DeclareUnicodeCharacter{00D5}{\~O}%
                   10687:   \DeclareUnicodeCharacter{00D6}{\"O}%
                   10688:   \DeclareUnicodeCharacter{00D7}{\ensuremath\times}%
                   10689:   \DeclareUnicodeCharacter{00D8}{\O}%
                   10690:   \DeclareUnicodeCharacter{00D9}{\`U}%
                   10691:   \DeclareUnicodeCharacter{00DA}{\'U}%
                   10692:   \DeclareUnicodeCharacter{00DB}{\^U}%
                   10693:   \DeclareUnicodeCharacter{00DC}{\"U}%
                   10694:   \DeclareUnicodeCharacter{00DD}{\'Y}%
                   10695:   \DeclareUnicodeCharacter{00DE}{\TH}%
                   10696:   \DeclareUnicodeCharacter{00DF}{\ss}%
                   10697:   %
                   10698:   \DeclareUnicodeCharacter{00E0}{\`a}%
                   10699:   \DeclareUnicodeCharacter{00E1}{\'a}%
                   10700:   \DeclareUnicodeCharacter{00E2}{\^a}%
                   10701:   \DeclareUnicodeCharacter{00E3}{\~a}%
                   10702:   \DeclareUnicodeCharacter{00E4}{\"a}%
                   10703:   \DeclareUnicodeCharacter{00E5}{\aa}%
                   10704:   \DeclareUnicodeCharacter{00E6}{\ae}%
                   10705:   \DeclareUnicodeCharacter{00E7}{\cedilla{c}}%
                   10706:   \DeclareUnicodeCharacter{00E8}{\`e}%
                   10707:   \DeclareUnicodeCharacter{00E9}{\'e}%
                   10708:   \DeclareUnicodeCharacter{00EA}{\^e}%
                   10709:   \DeclareUnicodeCharacter{00EB}{\"e}%
                   10710:   \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}}%
                   10711:   \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}}%
                   10712:   \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}}%
                   10713:   \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}}%
                   10714:   %
                   10715:   \DeclareUnicodeCharacter{00F0}{\dh}%
                   10716:   \DeclareUnicodeCharacter{00F1}{\~n}%
                   10717:   \DeclareUnicodeCharacter{00F2}{\`o}%
                   10718:   \DeclareUnicodeCharacter{00F3}{\'o}%
                   10719:   \DeclareUnicodeCharacter{00F4}{\^o}%
                   10720:   \DeclareUnicodeCharacter{00F5}{\~o}%
                   10721:   \DeclareUnicodeCharacter{00F6}{\"o}%
                   10722:   \DeclareUnicodeCharacter{00F7}{\ensuremath\div}%
                   10723:   \DeclareUnicodeCharacter{00F8}{\o}%
                   10724:   \DeclareUnicodeCharacter{00F9}{\`u}%
                   10725:   \DeclareUnicodeCharacter{00FA}{\'u}%
                   10726:   \DeclareUnicodeCharacter{00FB}{\^u}%
                   10727:   \DeclareUnicodeCharacter{00FC}{\"u}%
                   10728:   \DeclareUnicodeCharacter{00FD}{\'y}%
                   10729:   \DeclareUnicodeCharacter{00FE}{\th}%
                   10730:   \DeclareUnicodeCharacter{00FF}{\"y}%
                   10731:   %
                   10732:   \DeclareUnicodeCharacter{0100}{\=A}%
                   10733:   \DeclareUnicodeCharacter{0101}{\=a}%
                   10734:   \DeclareUnicodeCharacter{0102}{\u{A}}%
                   10735:   \DeclareUnicodeCharacter{0103}{\u{a}}%
                   10736:   \DeclareUnicodeCharacter{0104}{\ogonek{A}}%
                   10737:   \DeclareUnicodeCharacter{0105}{\ogonek{a}}%
                   10738:   \DeclareUnicodeCharacter{0106}{\'C}%
                   10739:   \DeclareUnicodeCharacter{0107}{\'c}%
                   10740:   \DeclareUnicodeCharacter{0108}{\^C}%
                   10741:   \DeclareUnicodeCharacter{0109}{\^c}%
                   10742:   \DeclareUnicodeCharacter{010A}{\dotaccent{C}}%
                   10743:   \DeclareUnicodeCharacter{010B}{\dotaccent{c}}%
                   10744:   \DeclareUnicodeCharacter{010C}{\v{C}}%
                   10745:   \DeclareUnicodeCharacter{010D}{\v{c}}%
                   10746:   \DeclareUnicodeCharacter{010E}{\v{D}}%
                   10747:   \DeclareUnicodeCharacter{010F}{d'}%
                   10748:   %
                   10749:   \DeclareUnicodeCharacter{0110}{\DH}%
                   10750:   \DeclareUnicodeCharacter{0111}{\dh}%
                   10751:   \DeclareUnicodeCharacter{0112}{\=E}%
                   10752:   \DeclareUnicodeCharacter{0113}{\=e}%
                   10753:   \DeclareUnicodeCharacter{0114}{\u{E}}%
                   10754:   \DeclareUnicodeCharacter{0115}{\u{e}}%
                   10755:   \DeclareUnicodeCharacter{0116}{\dotaccent{E}}%
                   10756:   \DeclareUnicodeCharacter{0117}{\dotaccent{e}}%
                   10757:   \DeclareUnicodeCharacter{0118}{\ogonek{E}}%
                   10758:   \DeclareUnicodeCharacter{0119}{\ogonek{e}}%
                   10759:   \DeclareUnicodeCharacter{011A}{\v{E}}%
                   10760:   \DeclareUnicodeCharacter{011B}{\v{e}}%
                   10761:   \DeclareUnicodeCharacter{011C}{\^G}%
                   10762:   \DeclareUnicodeCharacter{011D}{\^g}%
                   10763:   \DeclareUnicodeCharacter{011E}{\u{G}}%
                   10764:   \DeclareUnicodeCharacter{011F}{\u{g}}%
                   10765:   %
                   10766:   \DeclareUnicodeCharacter{0120}{\dotaccent{G}}%
                   10767:   \DeclareUnicodeCharacter{0121}{\dotaccent{g}}%
                   10768:   \DeclareUnicodeCharacter{0122}{\cedilla{G}}%
                   10769:   \DeclareUnicodeCharacter{0123}{\cedilla{g}}%
                   10770:   \DeclareUnicodeCharacter{0124}{\^H}%
                   10771:   \DeclareUnicodeCharacter{0125}{\^h}%
                   10772:   \DeclareUnicodeCharacter{0126}{\missingcharmsg{H WITH STROKE}}%
                   10773:   \DeclareUnicodeCharacter{0127}{\missingcharmsg{h WITH STROKE}}%
                   10774:   \DeclareUnicodeCharacter{0128}{\~I}%
                   10775:   \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}}%
                   10776:   \DeclareUnicodeCharacter{012A}{\=I}%
                   10777:   \DeclareUnicodeCharacter{012B}{\={\dotless{i}}}%
                   10778:   \DeclareUnicodeCharacter{012C}{\u{I}}%
                   10779:   \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}}%
                   10780:   \DeclareUnicodeCharacter{012E}{\ogonek{I}}%
                   10781:   \DeclareUnicodeCharacter{012F}{\ogonek{i}}%
                   10782:   %
                   10783:   \DeclareUnicodeCharacter{0130}{\dotaccent{I}}%
                   10784:   \DeclareUnicodeCharacter{0131}{\dotless{i}}%
                   10785:   \DeclareUnicodeCharacter{0132}{IJ}%
                   10786:   \DeclareUnicodeCharacter{0133}{ij}%
                   10787:   \DeclareUnicodeCharacter{0134}{\^J}%
                   10788:   \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}}%
                   10789:   \DeclareUnicodeCharacter{0136}{\cedilla{K}}%
                   10790:   \DeclareUnicodeCharacter{0137}{\cedilla{k}}%
                   10791:   \DeclareUnicodeCharacter{0138}{\ensuremath\kappa}%
                   10792:   \DeclareUnicodeCharacter{0139}{\'L}%
                   10793:   \DeclareUnicodeCharacter{013A}{\'l}%
                   10794:   \DeclareUnicodeCharacter{013B}{\cedilla{L}}%
                   10795:   \DeclareUnicodeCharacter{013C}{\cedilla{l}}%
                   10796:   \DeclareUnicodeCharacter{013D}{L'}% should kern
                   10797:   \DeclareUnicodeCharacter{013E}{l'}% should kern
                   10798:   \DeclareUnicodeCharacter{013F}{L\U{00B7}}%
                   10799:   %
                   10800:   \DeclareUnicodeCharacter{0140}{l\U{00B7}}%
                   10801:   \DeclareUnicodeCharacter{0141}{\L}%
                   10802:   \DeclareUnicodeCharacter{0142}{\l}%
                   10803:   \DeclareUnicodeCharacter{0143}{\'N}%
                   10804:   \DeclareUnicodeCharacter{0144}{\'n}%
                   10805:   \DeclareUnicodeCharacter{0145}{\cedilla{N}}%
                   10806:   \DeclareUnicodeCharacter{0146}{\cedilla{n}}%
                   10807:   \DeclareUnicodeCharacter{0147}{\v{N}}%
                   10808:   \DeclareUnicodeCharacter{0148}{\v{n}}%
                   10809:   \DeclareUnicodeCharacter{0149}{'n}%
                   10810:   \DeclareUnicodeCharacter{014A}{\missingcharmsg{ENG}}%
                   10811:   \DeclareUnicodeCharacter{014B}{\missingcharmsg{eng}}%
                   10812:   \DeclareUnicodeCharacter{014C}{\=O}%
                   10813:   \DeclareUnicodeCharacter{014D}{\=o}%
                   10814:   \DeclareUnicodeCharacter{014E}{\u{O}}%
                   10815:   \DeclareUnicodeCharacter{014F}{\u{o}}%
                   10816:   %
                   10817:   \DeclareUnicodeCharacter{0150}{\H{O}}%
                   10818:   \DeclareUnicodeCharacter{0151}{\H{o}}%
                   10819:   \DeclareUnicodeCharacter{0152}{\OE}%
                   10820:   \DeclareUnicodeCharacter{0153}{\oe}%
                   10821:   \DeclareUnicodeCharacter{0154}{\'R}%
                   10822:   \DeclareUnicodeCharacter{0155}{\'r}%
                   10823:   \DeclareUnicodeCharacter{0156}{\cedilla{R}}%
                   10824:   \DeclareUnicodeCharacter{0157}{\cedilla{r}}%
                   10825:   \DeclareUnicodeCharacter{0158}{\v{R}}%
                   10826:   \DeclareUnicodeCharacter{0159}{\v{r}}%
                   10827:   \DeclareUnicodeCharacter{015A}{\'S}%
                   10828:   \DeclareUnicodeCharacter{015B}{\'s}%
                   10829:   \DeclareUnicodeCharacter{015C}{\^S}%
                   10830:   \DeclareUnicodeCharacter{015D}{\^s}%
                   10831:   \DeclareUnicodeCharacter{015E}{\cedilla{S}}%
                   10832:   \DeclareUnicodeCharacter{015F}{\cedilla{s}}%
                   10833:   %
                   10834:   \DeclareUnicodeCharacter{0160}{\v{S}}%
                   10835:   \DeclareUnicodeCharacter{0161}{\v{s}}%
                   10836:   \DeclareUnicodeCharacter{0162}{\cedilla{T}}%
                   10837:   \DeclareUnicodeCharacter{0163}{\cedilla{t}}%
                   10838:   \DeclareUnicodeCharacter{0164}{\v{T}}%
                   10839:   \DeclareUnicodeCharacter{0165}{\v{t}}%
                   10840:   \DeclareUnicodeCharacter{0166}{\missingcharmsg{H WITH STROKE}}%
                   10841:   \DeclareUnicodeCharacter{0167}{\missingcharmsg{h WITH STROKE}}%
                   10842:   \DeclareUnicodeCharacter{0168}{\~U}%
                   10843:   \DeclareUnicodeCharacter{0169}{\~u}%
                   10844:   \DeclareUnicodeCharacter{016A}{\=U}%
                   10845:   \DeclareUnicodeCharacter{016B}{\=u}%
                   10846:   \DeclareUnicodeCharacter{016C}{\u{U}}%
                   10847:   \DeclareUnicodeCharacter{016D}{\u{u}}%
                   10848:   \DeclareUnicodeCharacter{016E}{\ringaccent{U}}%
                   10849:   \DeclareUnicodeCharacter{016F}{\ringaccent{u}}%
                   10850:   %
                   10851:   \DeclareUnicodeCharacter{0170}{\H{U}}%
                   10852:   \DeclareUnicodeCharacter{0171}{\H{u}}%
                   10853:   \DeclareUnicodeCharacter{0172}{\ogonek{U}}%
                   10854:   \DeclareUnicodeCharacter{0173}{\ogonek{u}}%
                   10855:   \DeclareUnicodeCharacter{0174}{\^W}%
                   10856:   \DeclareUnicodeCharacter{0175}{\^w}%
                   10857:   \DeclareUnicodeCharacter{0176}{\^Y}%
                   10858:   \DeclareUnicodeCharacter{0177}{\^y}%
                   10859:   \DeclareUnicodeCharacter{0178}{\"Y}%
                   10860:   \DeclareUnicodeCharacter{0179}{\'Z}%
                   10861:   \DeclareUnicodeCharacter{017A}{\'z}%
                   10862:   \DeclareUnicodeCharacter{017B}{\dotaccent{Z}}%
                   10863:   \DeclareUnicodeCharacter{017C}{\dotaccent{z}}%
                   10864:   \DeclareUnicodeCharacter{017D}{\v{Z}}%
                   10865:   \DeclareUnicodeCharacter{017E}{\v{z}}%
                   10866:   \DeclareUnicodeCharacter{017F}{\missingcharmsg{LONG S}}%
                   10867:   %
                   10868:   \DeclareUnicodeCharacter{01C4}{D\v{Z}}%
                   10869:   \DeclareUnicodeCharacter{01C5}{D\v{z}}%
                   10870:   \DeclareUnicodeCharacter{01C6}{d\v{z}}%
                   10871:   \DeclareUnicodeCharacter{01C7}{LJ}%
                   10872:   \DeclareUnicodeCharacter{01C8}{Lj}%
                   10873:   \DeclareUnicodeCharacter{01C9}{lj}%
                   10874:   \DeclareUnicodeCharacter{01CA}{NJ}%
                   10875:   \DeclareUnicodeCharacter{01CB}{Nj}%
                   10876:   \DeclareUnicodeCharacter{01CC}{nj}%
                   10877:   \DeclareUnicodeCharacter{01CD}{\v{A}}%
                   10878:   \DeclareUnicodeCharacter{01CE}{\v{a}}%
                   10879:   \DeclareUnicodeCharacter{01CF}{\v{I}}%
                   10880:   %
                   10881:   \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}}%
                   10882:   \DeclareUnicodeCharacter{01D1}{\v{O}}%
                   10883:   \DeclareUnicodeCharacter{01D2}{\v{o}}%
                   10884:   \DeclareUnicodeCharacter{01D3}{\v{U}}%
                   10885:   \DeclareUnicodeCharacter{01D4}{\v{u}}%
                   10886:   %
                   10887:   \DeclareUnicodeCharacter{01E2}{\={\AE}}%
                   10888:   \DeclareUnicodeCharacter{01E3}{\={\ae}}%
                   10889:   \DeclareUnicodeCharacter{01E6}{\v{G}}%
                   10890:   \DeclareUnicodeCharacter{01E7}{\v{g}}%
                   10891:   \DeclareUnicodeCharacter{01E8}{\v{K}}%
                   10892:   \DeclareUnicodeCharacter{01E9}{\v{k}}%
                   10893:   %
                   10894:   \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}}%
                   10895:   \DeclareUnicodeCharacter{01F1}{DZ}%
                   10896:   \DeclareUnicodeCharacter{01F2}{Dz}%
                   10897:   \DeclareUnicodeCharacter{01F3}{dz}%
                   10898:   \DeclareUnicodeCharacter{01F4}{\'G}%
                   10899:   \DeclareUnicodeCharacter{01F5}{\'g}%
                   10900:   \DeclareUnicodeCharacter{01F8}{\`N}%
                   10901:   \DeclareUnicodeCharacter{01F9}{\`n}%
                   10902:   \DeclareUnicodeCharacter{01FC}{\'{\AE}}%
                   10903:   \DeclareUnicodeCharacter{01FD}{\'{\ae}}%
                   10904:   \DeclareUnicodeCharacter{01FE}{\'{\O}}%
                   10905:   \DeclareUnicodeCharacter{01FF}{\'{\o}}%
                   10906:   %
                   10907:   \DeclareUnicodeCharacter{021E}{\v{H}}%
                   10908:   \DeclareUnicodeCharacter{021F}{\v{h}}%
                   10909:   %
                   10910:   \DeclareUnicodeCharacter{0226}{\dotaccent{A}}%
                   10911:   \DeclareUnicodeCharacter{0227}{\dotaccent{a}}%
                   10912:   \DeclareUnicodeCharacter{0228}{\cedilla{E}}%
                   10913:   \DeclareUnicodeCharacter{0229}{\cedilla{e}}%
                   10914:   \DeclareUnicodeCharacter{022E}{\dotaccent{O}}%
                   10915:   \DeclareUnicodeCharacter{022F}{\dotaccent{o}}%
                   10916:   %
                   10917:   \DeclareUnicodeCharacter{0232}{\=Y}%
                   10918:   \DeclareUnicodeCharacter{0233}{\=y}%
                   10919:   \DeclareUnicodeCharacter{0237}{\dotless{j}}%
                   10920:   %
                   10921:   \DeclareUnicodeCharacter{02BC}{'}%
                   10922:   %
                   10923:   \DeclareUnicodeCharacter{02DB}{\ogonek{ }}%
                   10924:   %
                   10925:   % Greek letters upper case
                   10926:   \DeclareUnicodeCharacter{0391}{{\it A}}%
                   10927:   \DeclareUnicodeCharacter{0392}{{\it B}}%
                   10928:   \DeclareUnicodeCharacter{0393}{\ensuremath{\mit\Gamma}}%
                   10929:   \DeclareUnicodeCharacter{0394}{\ensuremath{\mit\Delta}}%
                   10930:   \DeclareUnicodeCharacter{0395}{{\it E}}%
                   10931:   \DeclareUnicodeCharacter{0396}{{\it Z}}%
                   10932:   \DeclareUnicodeCharacter{0397}{{\it H}}%
                   10933:   \DeclareUnicodeCharacter{0398}{\ensuremath{\mit\Theta}}%
                   10934:   \DeclareUnicodeCharacter{0399}{{\it I}}%
                   10935:   \DeclareUnicodeCharacter{039A}{{\it K}}%
                   10936:   \DeclareUnicodeCharacter{039B}{\ensuremath{\mit\Lambda}}%
                   10937:   \DeclareUnicodeCharacter{039C}{{\it M}}%
                   10938:   \DeclareUnicodeCharacter{039D}{{\it N}}%
                   10939:   \DeclareUnicodeCharacter{039E}{\ensuremath{\mit\Xi}}%
                   10940:   \DeclareUnicodeCharacter{039F}{{\it O}}%
                   10941:   \DeclareUnicodeCharacter{03A0}{\ensuremath{\mit\Pi}}%
                   10942:   \DeclareUnicodeCharacter{03A1}{{\it P}}%
                   10943:   %\DeclareUnicodeCharacter{03A2}{} % none - corresponds to final sigma
                   10944:   \DeclareUnicodeCharacter{03A3}{\ensuremath{\mit\Sigma}}%
                   10945:   \DeclareUnicodeCharacter{03A4}{{\it T}}%
                   10946:   \DeclareUnicodeCharacter{03A5}{\ensuremath{\mit\Upsilon}}%
                   10947:   \DeclareUnicodeCharacter{03A6}{\ensuremath{\mit\Phi}}%
                   10948:   \DeclareUnicodeCharacter{03A7}{{\it X}}%
                   10949:   \DeclareUnicodeCharacter{03A8}{\ensuremath{\mit\Psi}}%
                   10950:   \DeclareUnicodeCharacter{03A9}{\ensuremath{\mit\Omega}}%
                   10951:   %
                   10952:   % Vowels with accents
                   10953:   \DeclareUnicodeCharacter{0390}{\ensuremath{\ddot{\acute\iota}}}%
                   10954:   \DeclareUnicodeCharacter{03AC}{\ensuremath{\acute\alpha}}%
                   10955:   \DeclareUnicodeCharacter{03AD}{\ensuremath{\acute\epsilon}}%
                   10956:   \DeclareUnicodeCharacter{03AE}{\ensuremath{\acute\eta}}%
                   10957:   \DeclareUnicodeCharacter{03AF}{\ensuremath{\acute\iota}}%
                   10958:   \DeclareUnicodeCharacter{03B0}{\ensuremath{\acute{\ddot\upsilon}}}%
                   10959:   %
                   10960:   % Standalone accent
                   10961:   \DeclareUnicodeCharacter{0384}{\ensuremath{\acute{\ }}}%
                   10962:   %
                   10963:   % Greek letters lower case
                   10964:   \DeclareUnicodeCharacter{03B1}{\ensuremath\alpha}%
                   10965:   \DeclareUnicodeCharacter{03B2}{\ensuremath\beta}%
                   10966:   \DeclareUnicodeCharacter{03B3}{\ensuremath\gamma}%
                   10967:   \DeclareUnicodeCharacter{03B4}{\ensuremath\delta}%
                   10968:   \DeclareUnicodeCharacter{03B5}{\ensuremath\epsilon}%
                   10969:   \DeclareUnicodeCharacter{03B6}{\ensuremath\zeta}%
                   10970:   \DeclareUnicodeCharacter{03B7}{\ensuremath\eta}%
                   10971:   \DeclareUnicodeCharacter{03B8}{\ensuremath\theta}%
                   10972:   \DeclareUnicodeCharacter{03B9}{\ensuremath\iota}%
                   10973:   \DeclareUnicodeCharacter{03BA}{\ensuremath\kappa}%
                   10974:   \DeclareUnicodeCharacter{03BB}{\ensuremath\lambda}%
                   10975:   \DeclareUnicodeCharacter{03BC}{\ensuremath\mu}%
                   10976:   \DeclareUnicodeCharacter{03BD}{\ensuremath\nu}%
                   10977:   \DeclareUnicodeCharacter{03BE}{\ensuremath\xi}%
                   10978:   \DeclareUnicodeCharacter{03BF}{{\it o}}% omicron
                   10979:   \DeclareUnicodeCharacter{03C0}{\ensuremath\pi}%
                   10980:   \DeclareUnicodeCharacter{03C1}{\ensuremath\rho}%
                   10981:   \DeclareUnicodeCharacter{03C2}{\ensuremath\varsigma}%
                   10982:   \DeclareUnicodeCharacter{03C3}{\ensuremath\sigma}%
                   10983:   \DeclareUnicodeCharacter{03C4}{\ensuremath\tau}%
                   10984:   \DeclareUnicodeCharacter{03C5}{\ensuremath\upsilon}%
                   10985:   \DeclareUnicodeCharacter{03C6}{\ensuremath\phi}%
                   10986:   \DeclareUnicodeCharacter{03C7}{\ensuremath\chi}%
                   10987:   \DeclareUnicodeCharacter{03C8}{\ensuremath\psi}%
                   10988:   \DeclareUnicodeCharacter{03C9}{\ensuremath\omega}%
                   10989:   %
                   10990:   % More Greek vowels with accents
                   10991:   \DeclareUnicodeCharacter{03CA}{\ensuremath{\ddot\iota}}%
                   10992:   \DeclareUnicodeCharacter{03CB}{\ensuremath{\ddot\upsilon}}%
                   10993:   \DeclareUnicodeCharacter{03CC}{\ensuremath{\acute o}}%
                   10994:   \DeclareUnicodeCharacter{03CD}{\ensuremath{\acute\upsilon}}%
                   10995:   \DeclareUnicodeCharacter{03CE}{\ensuremath{\acute\omega}}%
                   10996:   %
                   10997:   % Variant Greek letters
                   10998:   \DeclareUnicodeCharacter{03D1}{\ensuremath\vartheta}%
                   10999:   \DeclareUnicodeCharacter{03D6}{\ensuremath\varpi}%
                   11000:   \DeclareUnicodeCharacter{03F1}{\ensuremath\varrho}%
                   11001:   %
                   11002:   \DeclareUnicodeCharacter{1E02}{\dotaccent{B}}%
                   11003:   \DeclareUnicodeCharacter{1E03}{\dotaccent{b}}%
                   11004:   \DeclareUnicodeCharacter{1E04}{\udotaccent{B}}%
                   11005:   \DeclareUnicodeCharacter{1E05}{\udotaccent{b}}%
                   11006:   \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}}%
                   11007:   \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}}%
                   11008:   \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}}%
                   11009:   \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}}%
                   11010:   \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}}%
                   11011:   \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}}%
                   11012:   \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}}%
                   11013:   \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}}%
                   11014:   %
                   11015:   \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}}%
                   11016:   \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}}%
                   11017:   %
                   11018:   \DeclareUnicodeCharacter{1E20}{\=G}%
                   11019:   \DeclareUnicodeCharacter{1E21}{\=g}%
                   11020:   \DeclareUnicodeCharacter{1E22}{\dotaccent{H}}%
                   11021:   \DeclareUnicodeCharacter{1E23}{\dotaccent{h}}%
                   11022:   \DeclareUnicodeCharacter{1E24}{\udotaccent{H}}%
                   11023:   \DeclareUnicodeCharacter{1E25}{\udotaccent{h}}%
                   11024:   \DeclareUnicodeCharacter{1E26}{\"H}%
                   11025:   \DeclareUnicodeCharacter{1E27}{\"h}%
                   11026:   %
                   11027:   \DeclareUnicodeCharacter{1E30}{\'K}%
                   11028:   \DeclareUnicodeCharacter{1E31}{\'k}%
                   11029:   \DeclareUnicodeCharacter{1E32}{\udotaccent{K}}%
                   11030:   \DeclareUnicodeCharacter{1E33}{\udotaccent{k}}%
                   11031:   \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}}%
                   11032:   \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}}%
                   11033:   \DeclareUnicodeCharacter{1E36}{\udotaccent{L}}%
                   11034:   \DeclareUnicodeCharacter{1E37}{\udotaccent{l}}%
                   11035:   \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}}%
                   11036:   \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}}%
                   11037:   \DeclareUnicodeCharacter{1E3E}{\'M}%
                   11038:   \DeclareUnicodeCharacter{1E3F}{\'m}%
                   11039:   %
                   11040:   \DeclareUnicodeCharacter{1E40}{\dotaccent{M}}%
                   11041:   \DeclareUnicodeCharacter{1E41}{\dotaccent{m}}%
                   11042:   \DeclareUnicodeCharacter{1E42}{\udotaccent{M}}%
                   11043:   \DeclareUnicodeCharacter{1E43}{\udotaccent{m}}%
                   11044:   \DeclareUnicodeCharacter{1E44}{\dotaccent{N}}%
                   11045:   \DeclareUnicodeCharacter{1E45}{\dotaccent{n}}%
                   11046:   \DeclareUnicodeCharacter{1E46}{\udotaccent{N}}%
                   11047:   \DeclareUnicodeCharacter{1E47}{\udotaccent{n}}%
                   11048:   \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}}%
                   11049:   \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}}%
                   11050:   %
                   11051:   \DeclareUnicodeCharacter{1E54}{\'P}%
                   11052:   \DeclareUnicodeCharacter{1E55}{\'p}%
                   11053:   \DeclareUnicodeCharacter{1E56}{\dotaccent{P}}%
                   11054:   \DeclareUnicodeCharacter{1E57}{\dotaccent{p}}%
                   11055:   \DeclareUnicodeCharacter{1E58}{\dotaccent{R}}%
                   11056:   \DeclareUnicodeCharacter{1E59}{\dotaccent{r}}%
                   11057:   \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}}%
                   11058:   \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}}%
                   11059:   \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}}%
                   11060:   \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}}%
                   11061:   %
                   11062:   \DeclareUnicodeCharacter{1E60}{\dotaccent{S}}%
                   11063:   \DeclareUnicodeCharacter{1E61}{\dotaccent{s}}%
                   11064:   \DeclareUnicodeCharacter{1E62}{\udotaccent{S}}%
                   11065:   \DeclareUnicodeCharacter{1E63}{\udotaccent{s}}%
                   11066:   \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}}%
                   11067:   \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}}%
                   11068:   \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}}%
                   11069:   \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}}%
                   11070:   \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}}%
                   11071:   \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}}%
                   11072:   %
                   11073:   \DeclareUnicodeCharacter{1E7C}{\~V}%
                   11074:   \DeclareUnicodeCharacter{1E7D}{\~v}%
                   11075:   \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}}%
                   11076:   \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}}%
                   11077:   %
                   11078:   \DeclareUnicodeCharacter{1E80}{\`W}%
                   11079:   \DeclareUnicodeCharacter{1E81}{\`w}%
                   11080:   \DeclareUnicodeCharacter{1E82}{\'W}%
                   11081:   \DeclareUnicodeCharacter{1E83}{\'w}%
                   11082:   \DeclareUnicodeCharacter{1E84}{\"W}%
                   11083:   \DeclareUnicodeCharacter{1E85}{\"w}%
                   11084:   \DeclareUnicodeCharacter{1E86}{\dotaccent{W}}%
                   11085:   \DeclareUnicodeCharacter{1E87}{\dotaccent{w}}%
                   11086:   \DeclareUnicodeCharacter{1E88}{\udotaccent{W}}%
                   11087:   \DeclareUnicodeCharacter{1E89}{\udotaccent{w}}%
                   11088:   \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}}%
                   11089:   \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}}%
                   11090:   \DeclareUnicodeCharacter{1E8C}{\"X}%
                   11091:   \DeclareUnicodeCharacter{1E8D}{\"x}%
                   11092:   \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}}%
                   11093:   \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}}%
                   11094:   %
                   11095:   \DeclareUnicodeCharacter{1E90}{\^Z}%
                   11096:   \DeclareUnicodeCharacter{1E91}{\^z}%
                   11097:   \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}}%
                   11098:   \DeclareUnicodeCharacter{1E93}{\udotaccent{z}}%
                   11099:   \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}}%
                   11100:   \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}}%
                   11101:   \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}}%
                   11102:   \DeclareUnicodeCharacter{1E97}{\"t}%
                   11103:   \DeclareUnicodeCharacter{1E98}{\ringaccent{w}}%
                   11104:   \DeclareUnicodeCharacter{1E99}{\ringaccent{y}}%
                   11105:   %
                   11106:   \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}}%
                   11107:   \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}}%
                   11108:   %
                   11109:   \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}}%
                   11110:   \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}}%
                   11111:   \DeclareUnicodeCharacter{1EBC}{\~E}%
                   11112:   \DeclareUnicodeCharacter{1EBD}{\~e}%
                   11113:   %
                   11114:   \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}}%
                   11115:   \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}}%
                   11116:   \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}}%
                   11117:   \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}}%
                   11118:   %
                   11119:   \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}}%
                   11120:   \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}}%
                   11121:   %
                   11122:   \DeclareUnicodeCharacter{1EF2}{\`Y}%
                   11123:   \DeclareUnicodeCharacter{1EF3}{\`y}%
                   11124:   \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}}%
                   11125:   %
                   11126:   \DeclareUnicodeCharacter{1EF8}{\~Y}%
                   11127:   \DeclareUnicodeCharacter{1EF9}{\~y}%
                   11128:   %
1.2     ! snw      11129:   % Exotic spaces
        !          11130:   \DeclareUnicodeCharacter{2007}{\hphantom{0}}%
        !          11131:   %
1.1       snw      11132:   % Punctuation
                   11133:   \DeclareUnicodeCharacter{2013}{--}%
                   11134:   \DeclareUnicodeCharacter{2014}{---}%
                   11135:   \DeclareUnicodeCharacter{2018}{\quoteleft{}}%
                   11136:   \DeclareUnicodeCharacter{2019}{\quoteright{}}%
                   11137:   \DeclareUnicodeCharacter{201A}{\quotesinglbase{}}%
                   11138:   \DeclareUnicodeCharacter{201C}{\quotedblleft{}}%
                   11139:   \DeclareUnicodeCharacter{201D}{\quotedblright{}}%
                   11140:   \DeclareUnicodeCharacter{201E}{\quotedblbase{}}%
                   11141:   \DeclareUnicodeCharacter{2020}{\ensuremath\dagger}%
                   11142:   \DeclareUnicodeCharacter{2021}{\ensuremath\ddagger}%
                   11143:   \DeclareUnicodeCharacter{2022}{\bullet{}}%
                   11144:   \DeclareUnicodeCharacter{202F}{\thinspace}%
                   11145:   \DeclareUnicodeCharacter{2026}{\dots{}}%
                   11146:   \DeclareUnicodeCharacter{2039}{\guilsinglleft{}}%
                   11147:   \DeclareUnicodeCharacter{203A}{\guilsinglright{}}%
                   11148:   %
                   11149:   \DeclareUnicodeCharacter{20AC}{\euro{}}%
                   11150:   %
1.2     ! snw      11151:   \DeclareUnicodeCharacter{2192}{\arrow}%
1.1       snw      11152:   \DeclareUnicodeCharacter{21D2}{\result{}}%
                   11153:   %
                   11154:   % Mathematical symbols
                   11155:   \DeclareUnicodeCharacter{2200}{\ensuremath\forall}%
                   11156:   \DeclareUnicodeCharacter{2203}{\ensuremath\exists}%
                   11157:   \DeclareUnicodeCharacter{2208}{\ensuremath\in}%
                   11158:   \DeclareUnicodeCharacter{2212}{\minus{}}%
                   11159:   \DeclareUnicodeCharacter{2217}{\ast}%
                   11160:   \DeclareUnicodeCharacter{221E}{\ensuremath\infty}%
                   11161:   \DeclareUnicodeCharacter{2225}{\ensuremath\parallel}%
                   11162:   \DeclareUnicodeCharacter{2227}{\ensuremath\wedge}%
                   11163:   \DeclareUnicodeCharacter{2229}{\ensuremath\cap}%
                   11164:   \DeclareUnicodeCharacter{2261}{\equiv{}}%
                   11165:   \DeclareUnicodeCharacter{2264}{\ensuremath\leq}%
                   11166:   \DeclareUnicodeCharacter{2265}{\ensuremath\geq}%
                   11167:   \DeclareUnicodeCharacter{2282}{\ensuremath\subset}%
                   11168:   \DeclareUnicodeCharacter{2287}{\ensuremath\supseteq}%
                   11169:   %
                   11170:   \DeclareUnicodeCharacter{2016}{\ensuremath\Vert}%
                   11171:   \DeclareUnicodeCharacter{2032}{\ensuremath\prime}%
                   11172:   \DeclareUnicodeCharacter{210F}{\ensuremath\hbar}%
                   11173:   \DeclareUnicodeCharacter{2111}{\ensuremath\Im}%
                   11174:   \DeclareUnicodeCharacter{2113}{\ensuremath\ell}%
                   11175:   \DeclareUnicodeCharacter{2118}{\ensuremath\wp}%
                   11176:   \DeclareUnicodeCharacter{211C}{\ensuremath\Re}%
                   11177:   \DeclareUnicodeCharacter{2135}{\ensuremath\aleph}%
                   11178:   \DeclareUnicodeCharacter{2190}{\ensuremath\leftarrow}%
                   11179:   \DeclareUnicodeCharacter{2191}{\ensuremath\uparrow}%
                   11180:   \DeclareUnicodeCharacter{2193}{\ensuremath\downarrow}%
                   11181:   \DeclareUnicodeCharacter{2194}{\ensuremath\leftrightarrow}%
                   11182:   \DeclareUnicodeCharacter{2195}{\ensuremath\updownarrow}%
                   11183:   \DeclareUnicodeCharacter{2196}{\ensuremath\nwarrow}%
                   11184:   \DeclareUnicodeCharacter{2197}{\ensuremath\nearrow}%
                   11185:   \DeclareUnicodeCharacter{2198}{\ensuremath\searrow}%
                   11186:   \DeclareUnicodeCharacter{2199}{\ensuremath\swarrow}%
                   11187:   \DeclareUnicodeCharacter{21A6}{\ensuremath\mapsto}%
                   11188:   \DeclareUnicodeCharacter{21A9}{\ensuremath\hookleftarrow}%
                   11189:   \DeclareUnicodeCharacter{21AA}{\ensuremath\hookrightarrow}%
                   11190:   \DeclareUnicodeCharacter{21BC}{\ensuremath\leftharpoonup}%
                   11191:   \DeclareUnicodeCharacter{21BD}{\ensuremath\leftharpoondown}%
                   11192:   \DeclareUnicodeCharacter{21C0}{\ensuremath\rightharpoonup}%
                   11193:   \DeclareUnicodeCharacter{21C1}{\ensuremath\rightharpoondown}%
                   11194:   \DeclareUnicodeCharacter{21CC}{\ensuremath\rightleftharpoons}%
                   11195:   \DeclareUnicodeCharacter{21D0}{\ensuremath\Leftarrow}%
                   11196:   \DeclareUnicodeCharacter{21D1}{\ensuremath\Uparrow}%
                   11197:   \DeclareUnicodeCharacter{21D3}{\ensuremath\Downarrow}%
                   11198:   \DeclareUnicodeCharacter{21D4}{\ensuremath\Leftrightarrow}%
                   11199:   \DeclareUnicodeCharacter{21D5}{\ensuremath\Updownarrow}%
                   11200:   \DeclareUnicodeCharacter{2202}{\ensuremath\partial}%
                   11201:   \DeclareUnicodeCharacter{2205}{\ensuremath\emptyset}%
                   11202:   \DeclareUnicodeCharacter{2207}{\ensuremath\nabla}%
                   11203:   \DeclareUnicodeCharacter{2209}{\ensuremath\notin}%
                   11204:   \DeclareUnicodeCharacter{220B}{\ensuremath\owns}%
                   11205:   \DeclareUnicodeCharacter{220F}{\ensuremath\prod}%
                   11206:   \DeclareUnicodeCharacter{2210}{\ensuremath\coprod}%
                   11207:   \DeclareUnicodeCharacter{2211}{\ensuremath\sum}%
                   11208:   \DeclareUnicodeCharacter{2213}{\ensuremath\mp}%
                   11209:   \DeclareUnicodeCharacter{2218}{\ensuremath\circ}%
                   11210:   \DeclareUnicodeCharacter{221A}{\ensuremath\surd}%
                   11211:   \DeclareUnicodeCharacter{221D}{\ensuremath\propto}%
                   11212:   \DeclareUnicodeCharacter{2220}{\ensuremath\angle}%
                   11213:   \DeclareUnicodeCharacter{2223}{\ensuremath\mid}%
                   11214:   \DeclareUnicodeCharacter{2228}{\ensuremath\vee}%
                   11215:   \DeclareUnicodeCharacter{222A}{\ensuremath\cup}%
                   11216:   \DeclareUnicodeCharacter{222B}{\ensuremath\smallint}%
                   11217:   \DeclareUnicodeCharacter{222E}{\ensuremath\oint}%
                   11218:   \DeclareUnicodeCharacter{223C}{\ensuremath\sim}%
                   11219:   \DeclareUnicodeCharacter{2240}{\ensuremath\wr}%
                   11220:   \DeclareUnicodeCharacter{2243}{\ensuremath\simeq}%
                   11221:   \DeclareUnicodeCharacter{2245}{\ensuremath\cong}%
                   11222:   \DeclareUnicodeCharacter{2248}{\ensuremath\approx}%
                   11223:   \DeclareUnicodeCharacter{224D}{\ensuremath\asymp}%
                   11224:   \DeclareUnicodeCharacter{2250}{\ensuremath\doteq}%
                   11225:   \DeclareUnicodeCharacter{2260}{\ensuremath\neq}%
                   11226:   \DeclareUnicodeCharacter{226A}{\ensuremath\ll}%
                   11227:   \DeclareUnicodeCharacter{226B}{\ensuremath\gg}%
                   11228:   \DeclareUnicodeCharacter{227A}{\ensuremath\prec}%
                   11229:   \DeclareUnicodeCharacter{227B}{\ensuremath\succ}%
                   11230:   \DeclareUnicodeCharacter{2283}{\ensuremath\supset}%
                   11231:   \DeclareUnicodeCharacter{2286}{\ensuremath\subseteq}%
                   11232:   \DeclareUnicodeCharacter{228E}{\ensuremath\uplus}%
                   11233:   \DeclareUnicodeCharacter{2291}{\ensuremath\sqsubseteq}%
                   11234:   \DeclareUnicodeCharacter{2292}{\ensuremath\sqsupseteq}%
                   11235:   \DeclareUnicodeCharacter{2293}{\ensuremath\sqcap}%
                   11236:   \DeclareUnicodeCharacter{2294}{\ensuremath\sqcup}%
                   11237:   \DeclareUnicodeCharacter{2295}{\ensuremath\oplus}%
                   11238:   \DeclareUnicodeCharacter{2296}{\ensuremath\ominus}%
                   11239:   \DeclareUnicodeCharacter{2297}{\ensuremath\otimes}%
                   11240:   \DeclareUnicodeCharacter{2298}{\ensuremath\oslash}%
                   11241:   \DeclareUnicodeCharacter{2299}{\ensuremath\odot}%
                   11242:   \DeclareUnicodeCharacter{22A2}{\ensuremath\vdash}%
                   11243:   \DeclareUnicodeCharacter{22A3}{\ensuremath\dashv}%
                   11244:   \DeclareUnicodeCharacter{22A4}{\ensuremath\ptextop}%
                   11245:   \DeclareUnicodeCharacter{22A5}{\ensuremath\bot}%
                   11246:   \DeclareUnicodeCharacter{22A8}{\ensuremath\models}%
                   11247:   \DeclareUnicodeCharacter{22C0}{\ensuremath\bigwedge}%
                   11248:   \DeclareUnicodeCharacter{22C1}{\ensuremath\bigvee}%
                   11249:   \DeclareUnicodeCharacter{22C2}{\ensuremath\bigcap}%
                   11250:   \DeclareUnicodeCharacter{22C3}{\ensuremath\bigcup}%
                   11251:   \DeclareUnicodeCharacter{22C4}{\ensuremath\diamond}%
                   11252:   \DeclareUnicodeCharacter{22C5}{\ensuremath\cdot}%
                   11253:   \DeclareUnicodeCharacter{22C6}{\ensuremath\star}%
                   11254:   \DeclareUnicodeCharacter{22C8}{\ensuremath\bowtie}%
                   11255:   \DeclareUnicodeCharacter{2308}{\ensuremath\lceil}%
                   11256:   \DeclareUnicodeCharacter{2309}{\ensuremath\rceil}%
                   11257:   \DeclareUnicodeCharacter{230A}{\ensuremath\lfloor}%
                   11258:   \DeclareUnicodeCharacter{230B}{\ensuremath\rfloor}%
                   11259:   \DeclareUnicodeCharacter{2322}{\ensuremath\frown}%
                   11260:   \DeclareUnicodeCharacter{2323}{\ensuremath\smile}%
                   11261:   %
                   11262:   \DeclareUnicodeCharacter{25B3}{\ensuremath\triangle}%
                   11263:   \DeclareUnicodeCharacter{25B7}{\ensuremath\triangleright}%
                   11264:   \DeclareUnicodeCharacter{25BD}{\ensuremath\bigtriangledown}%
                   11265:   \DeclareUnicodeCharacter{25C1}{\ensuremath\triangleleft}%
                   11266:   \DeclareUnicodeCharacter{25C7}{\ensuremath\diamond}%
                   11267:   \DeclareUnicodeCharacter{2660}{\ensuremath\spadesuit}%
                   11268:   \DeclareUnicodeCharacter{2661}{\ensuremath\heartsuit}%
                   11269:   \DeclareUnicodeCharacter{2662}{\ensuremath\diamondsuit}%
                   11270:   \DeclareUnicodeCharacter{2663}{\ensuremath\clubsuit}%
                   11271:   \DeclareUnicodeCharacter{266D}{\ensuremath\flat}%
                   11272:   \DeclareUnicodeCharacter{266E}{\ensuremath\natural}%
                   11273:   \DeclareUnicodeCharacter{266F}{\ensuremath\sharp}%
                   11274:   \DeclareUnicodeCharacter{26AA}{\ensuremath\bigcirc}%
                   11275:   \DeclareUnicodeCharacter{27B9}{\ensuremath\rangle}%
                   11276:   \DeclareUnicodeCharacter{27C2}{\ensuremath\perp}%
                   11277:   \DeclareUnicodeCharacter{27E8}{\ensuremath\langle}%
                   11278:   \DeclareUnicodeCharacter{27F5}{\ensuremath\longleftarrow}%
                   11279:   \DeclareUnicodeCharacter{27F6}{\ensuremath\longrightarrow}%
                   11280:   \DeclareUnicodeCharacter{27F7}{\ensuremath\longleftrightarrow}%
                   11281:   \DeclareUnicodeCharacter{27FC}{\ensuremath\longmapsto}%
                   11282:   \DeclareUnicodeCharacter{29F5}{\ensuremath\setminus}%
                   11283:   \DeclareUnicodeCharacter{2A00}{\ensuremath\bigodot}%
                   11284:   \DeclareUnicodeCharacter{2A01}{\ensuremath\bigoplus}%
                   11285:   \DeclareUnicodeCharacter{2A02}{\ensuremath\bigotimes}%
                   11286:   \DeclareUnicodeCharacter{2A04}{\ensuremath\biguplus}%
                   11287:   \DeclareUnicodeCharacter{2A06}{\ensuremath\bigsqcup}%
                   11288:   \DeclareUnicodeCharacter{2A3F}{\ensuremath\amalg}%
                   11289:   \DeclareUnicodeCharacter{2AAF}{\ensuremath\preceq}%
                   11290:   \DeclareUnicodeCharacter{2AB0}{\ensuremath\succeq}%
                   11291:   %
                   11292:   \global\mathchardef\checkmark="1370% actually the square root sign
                   11293:   \DeclareUnicodeCharacter{2713}{\ensuremath\checkmark}%
                   11294: }% end of \unicodechardefs
                   11295: 
                   11296: % UTF-8 byte sequence (pdfTeX) definitions (replacing and @U command)
                   11297: % It makes the setting that replace UTF-8 byte sequence.
                   11298: \def\utfeightchardefs{%
                   11299:   \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterUTFviii
                   11300:   \unicodechardefs
                   11301: }
                   11302: 
                   11303: % Whether the active definitions of non-ASCII characters expand to
                   11304: % non-active tokens with the same character code.  This is used to
                   11305: % write characters literally, instead of using active definitions for
                   11306: % printing the correct glyphs.
                   11307: \newif\ifpassthroughchars
                   11308: \passthroughcharsfalse
                   11309: 
                   11310: % For native Unicode handling (XeTeX and LuaTeX),
                   11311: % provide a definition macro to replace/pass-through a Unicode character
                   11312: %
                   11313: \def\DeclareUnicodeCharacterNative#1#2{%
1.2     ! snw      11314:   \ifnum"#1>"7F % only make non-ASCII chars active
        !          11315:     \catcode"#1=\active
        !          11316:     \def\dodeclareunicodecharacternative##1##2##3{%
        !          11317:       \begingroup
        !          11318:         \uccode`\~="##2\relax
        !          11319:         \uppercase{\gdef~}{%
        !          11320:           \ifpassthroughchars
        !          11321:             ##1%
        !          11322:           \else
        !          11323:             ##3%
        !          11324:           \fi
        !          11325:         }
        !          11326:       \endgroup
        !          11327:     }
1.1       snw      11328:     \begingroup
1.2     ! snw      11329:       \uccode`\.="#1\relax
        !          11330:       \uppercase{\def\UTFNativeTmp{.}}%
        !          11331:       \expandafter\dodeclareunicodecharacternative\UTFNativeTmp{#1}{#2}%
1.1       snw      11332:     \endgroup
1.2     ! snw      11333:   \fi
1.1       snw      11334: }
                   11335: 
                   11336: % Native Unicode handling (XeTeX and LuaTeX) character replacing definition.
                   11337: % It activates the setting that replaces Unicode characters.
                   11338: \def\nativeunicodechardefs{%
                   11339:   \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNative
                   11340:   \unicodechardefs
                   11341: }
                   11342: 
                   11343: % For native Unicode handling (XeTeX and LuaTeX),
                   11344: % make the character token expand
                   11345: % to the sequences given in \unicodechardefs for printing.
                   11346: \def\DeclareUnicodeCharacterNativeAtU#1#2{%
                   11347:   \def\UTFAtUTmp{#2}
                   11348:   \expandafter\globallet\csname uni:#1\endcsname \UTFAtUTmp
                   11349: }
                   11350: 
                   11351: % @U command definitions for native Unicode handling (XeTeX and LuaTeX).
                   11352: \def\nativeunicodechardefsatu{%
                   11353:   \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNativeAtU
                   11354:   \unicodechardefs
                   11355: }
                   11356: 
                   11357: % US-ASCII character definitions.
                   11358: \def\asciichardefs{% nothing need be done
                   11359:    \relax
                   11360: }
                   11361: 
1.2     ! snw      11362: % Define all Unicode characters we know about
1.1       snw      11363: \iftxinativeunicodecapable
                   11364:   \nativeunicodechardefsatu
                   11365: \else
                   11366:   \utfeightchardefs
                   11367: \fi
                   11368: 
1.2     ! snw      11369: 
1.1       snw      11370: \message{formatting,}
                   11371: 
                   11372: \newdimen\defaultparindent \defaultparindent = 15pt
                   11373: 
                   11374: \chapheadingskip = 15pt plus 4pt minus 2pt
                   11375: \secheadingskip = 12pt plus 3pt minus 2pt
                   11376: \subsecheadingskip = 9pt plus 2pt minus 2pt
                   11377: 
                   11378: % Prevent underfull vbox error messages.
                   11379: \vbadness = 10000
                   11380: 
                   11381: % Don't be very finicky about underfull hboxes, either.
                   11382: \hbadness = 6666
                   11383: 
                   11384: % Following George Bush, get rid of widows and orphans.
                   11385: \widowpenalty=10000
                   11386: \clubpenalty=10000
                   11387: 
                   11388: % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
                   11389: % using an old version of TeX, don't do anything.  We want the amount of
                   11390: % stretch added to depend on the line length, hence the dependence on
                   11391: % \hsize.  We call this whenever the paper size is set.
                   11392: %
                   11393: \def\setemergencystretch{%
                   11394:   \ifx\emergencystretch\thisisundefined
                   11395:     % Allow us to assign to \emergencystretch anyway.
                   11396:     \def\emergencystretch{\dimen0}%
                   11397:   \else
                   11398:     \emergencystretch = .15\hsize
                   11399:   \fi
                   11400: }
                   11401: 
                   11402: % Parameters in order: 1) textheight; 2) textwidth;
                   11403: % 3) voffset; 4) hoffset; 5) binding offset; 6) topskip;
                   11404: % 7) physical page height; 8) physical page width.
                   11405: %
                   11406: % We also call \setleading{\textleading}, so the caller should define
                   11407: % \textleading.  The caller should also set \parskip.
                   11408: %
                   11409: \def\internalpagesizes#1#2#3#4#5#6#7#8{%
                   11410:   \voffset = #3\relax
                   11411:   \topskip = #6\relax
                   11412:   \splittopskip = \topskip
                   11413:   %
                   11414:   \vsize = #1\relax
                   11415:   \advance\vsize by \topskip
                   11416:   \txipageheight = \vsize
                   11417:   %
                   11418:   \hsize = #2\relax
                   11419:   \txipagewidth = \hsize
                   11420:   %
                   11421:   \normaloffset = #4\relax
                   11422:   \bindingoffset = #5\relax
                   11423:   %
                   11424:   \ifpdf
                   11425:     \pdfpageheight #7\relax
                   11426:     \pdfpagewidth #8\relax
                   11427:     % if we don't reset these, they will remain at "1 true in" of
                   11428:     % whatever layout pdftex was dumped with.
                   11429:     \pdfhorigin = 1 true in
                   11430:     \pdfvorigin = 1 true in
                   11431:   \else
                   11432:     \ifx\XeTeXrevision\thisisundefined
                   11433:       \special{papersize=#8,#7}%
                   11434:     \else
                   11435:       \pdfpageheight #7\relax
                   11436:       \pdfpagewidth #8\relax
                   11437:       % XeTeX does not have \pdfhorigin and \pdfvorigin.
                   11438:     \fi
                   11439:   \fi
                   11440:   %
                   11441:   \setleading{\textleading}
                   11442:   %
                   11443:   \parindent = \defaultparindent
                   11444:   \setemergencystretch
                   11445: }
                   11446: 
                   11447: % @letterpaper (the default).
                   11448: \def\letterpaper{{\globaldefs = 1
                   11449:   \parskip = 3pt plus 2pt minus 1pt
                   11450:   \textleading = 13.2pt
                   11451:   %
                   11452:   % If page is nothing but text, make it come out even.
                   11453:   \internalpagesizes{607.2pt}{6in}% that's 46 lines
                   11454:                     {\voffset}{.25in}%
                   11455:                     {\bindingoffset}{36pt}%
                   11456:                     {11in}{8.5in}%
                   11457: }}
                   11458: 
                   11459: % Use @smallbook to reset parameters for 7x9.25 trim size.
                   11460: \def\smallbook{{\globaldefs = 1
                   11461:   \parskip = 2pt plus 1pt
                   11462:   \textleading = 12pt
                   11463:   %
                   11464:   \internalpagesizes{7.5in}{5in}%
                   11465:                     {-.2in}{0in}%
                   11466:                     {\bindingoffset}{16pt}%
                   11467:                     {9.25in}{7in}%
                   11468:   %
                   11469:   \lispnarrowing = 0.3in
                   11470:   \tolerance = 700
                   11471:   \contentsrightmargin = 0pt
                   11472:   \defbodyindent = .5cm
                   11473: }}
                   11474: 
                   11475: % Use @afourpaper to print on European A4 paper.
                   11476: \def\afourpaper{{\globaldefs = 1
                   11477:   \parskip = 3pt plus 2pt minus 1pt
                   11478:   \textleading = 13.2pt
                   11479:   %
                   11480:   % Double-side printing via postscript on Laserjet 4050
                   11481:   % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm.
                   11482:   % To change the settings for a different printer or situation, adjust
                   11483:   % \normaloffset until the front-side and back-side texts align.  Then
                   11484:   % do the same for \bindingoffset.  You can set these for testing in
                   11485:   % your texinfo source file like this:
                   11486:   % @tex
                   11487:   % \global\normaloffset = -6mm
                   11488:   % \global\bindingoffset = 10mm
                   11489:   % @end tex
                   11490:   \internalpagesizes{673.2pt}{160mm}% that's 51 lines
                   11491:                     {\voffset}{\hoffset}%
                   11492:                     {\bindingoffset}{44pt}%
                   11493:                     {297mm}{210mm}%
                   11494:   %
                   11495:   \tolerance = 700
                   11496:   \contentsrightmargin = 0pt
                   11497:   \defbodyindent = 5mm
                   11498: }}
                   11499: 
                   11500: % Use @afivepaper to print on European A5 paper.
                   11501: % From romildo@urano.iceb.ufop.br, 2 July 2000.
                   11502: % He also recommends making @example and @lisp be small.
                   11503: \def\afivepaper{{\globaldefs = 1
                   11504:   \parskip = 2pt plus 1pt minus 0.1pt
                   11505:   \textleading = 12.5pt
                   11506:   %
                   11507:   \internalpagesizes{160mm}{120mm}%
1.2     ! snw      11508:                     {\voffset}{-11.4mm}%
1.1       snw      11509:                     {\bindingoffset}{8pt}%
                   11510:                     {210mm}{148mm}%
                   11511:   %
                   11512:   \lispnarrowing = 0.2in
                   11513:   \tolerance = 800
                   11514:   \contentsrightmargin = 0pt
                   11515:   \defbodyindent = 2mm
                   11516:   \tableindent = 12mm
                   11517: }}
                   11518: 
                   11519: % A specific text layout, 24x15cm overall, intended for A4 paper.
                   11520: \def\afourlatex{{\globaldefs = 1
                   11521:   \afourpaper
                   11522:   \internalpagesizes{237mm}{150mm}%
                   11523:                     {\voffset}{4.6mm}%
                   11524:                     {\bindingoffset}{7mm}%
                   11525:                     {297mm}{210mm}%
                   11526:   %
                   11527:   % Must explicitly reset to 0 because we call \afourpaper.
                   11528:   \globaldefs = 0
                   11529: }}
                   11530: 
                   11531: % Use @afourwide to print on A4 paper in landscape format.
                   11532: \def\afourwide{{\globaldefs = 1
                   11533:   \afourpaper
                   11534:   \internalpagesizes{241mm}{165mm}%
                   11535:                     {\voffset}{-2.95mm}%
                   11536:                     {\bindingoffset}{7mm}%
                   11537:                     {297mm}{210mm}%
                   11538:   \globaldefs = 0
                   11539: }}
                   11540: 
                   11541: \def\bsixpaper{{\globaldefs = 1
                   11542:   \afourpaper
                   11543:   \internalpagesizes{140mm}{100mm}%
                   11544:                     {-6.35mm}{-12.7mm}%
                   11545:                     {\bindingoffset}{14pt}%
                   11546:                     {176mm}{125mm}%
                   11547:   \let\SETdispenvsize=\smallword
                   11548:   \lispnarrowing = 0.2in
                   11549:   \globaldefs = 0
                   11550: }}
                   11551: 
                   11552: 
                   11553: % @pagesizes TEXTHEIGHT[,TEXTWIDTH]
                   11554: % Perhaps we should allow setting the margins, \topskip, \parskip,
                   11555: % and/or leading, also. Or perhaps we should compute them somehow.
                   11556: %
                   11557: \parseargdef\pagesizes{\pagesizesyyy #1,,\finish}
                   11558: \def\pagesizesyyy#1,#2,#3\finish{{%
                   11559:   \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
                   11560:   \globaldefs = 1
                   11561:   %
                   11562:   \parskip = 3pt plus 2pt minus 1pt
                   11563:   \setleading{\textleading}%
                   11564:   %
                   11565:   \dimen0 = #1\relax
                   11566:   \advance\dimen0 by 2.5in % default 1in margin above heading line
                   11567:                            % and 1.5in to include heading, footing and
                   11568:                            % bottom margin
                   11569:   %
                   11570:   \dimen2 = \hsize
                   11571:   \advance\dimen2 by 2in % default to 1 inch margin on each side
                   11572:   %
                   11573:   \internalpagesizes{#1}{\hsize}%
                   11574:                     {\voffset}{\normaloffset}%
                   11575:                     {\bindingoffset}{44pt}%
                   11576:                     {\dimen0}{\dimen2}%
                   11577: }}
                   11578: 
                   11579: % Set default to letter.
                   11580: %
                   11581: \letterpaper
                   11582: 
                   11583: % Default value of \hfuzz, for suppressing warnings about overfull hboxes.
                   11584: \hfuzz = 1pt
                   11585: 
                   11586: 
1.2     ! snw      11587: \message{microtype,}
        !          11588: 
        !          11589: % protrusion, from Thanh's protcode.tex.
        !          11590: \def\mtsetprotcode#1{%
        !          11591:   \rpcode#1`\!=200  \rpcode#1`\,=700  \rpcode#1`\-=700  \rpcode#1`\.=700
        !          11592:   \rpcode#1`\;=500  \rpcode#1`\:=500  \rpcode#1`\?=200
        !          11593:   \rpcode#1`\'=700
        !          11594:   \rpcode#1 34=500  % ''
        !          11595:   \rpcode#1 123=300 % --
        !          11596:   \rpcode#1 124=200 % ---
        !          11597:   \rpcode#1`\)=50   \rpcode#1`\A=50   \rpcode#1`\F=50   \rpcode#1`\K=50
        !          11598:   \rpcode#1`\L=50   \rpcode#1`\T=50   \rpcode#1`\V=50   \rpcode#1`\W=50
        !          11599:   \rpcode#1`\X=50   \rpcode#1`\Y=50   \rpcode#1`\k=50   \rpcode#1`\r=50
        !          11600:   \rpcode#1`\t=50   \rpcode#1`\v=50   \rpcode#1`\w=50   \rpcode#1`\x=50
        !          11601:   \rpcode#1`\y=50
        !          11602:   %
        !          11603:   \lpcode#1`\`=700
        !          11604:   \lpcode#1 92=500  % ``
        !          11605:   \lpcode#1`\(=50   \lpcode#1`\A=50   \lpcode#1`\J=50   \lpcode#1`\T=50
        !          11606:   \lpcode#1`\V=50   \lpcode#1`\W=50   \lpcode#1`\X=50   \lpcode#1`\Y=50
        !          11607:   \lpcode#1`\v=50   \lpcode#1`\w=50   \lpcode#1`\x=50   \lpcode#1`\y=0
        !          11608:   %
        !          11609:   \mtadjustprotcode#1\relax
        !          11610: }
        !          11611: 
        !          11612: \newcount\countC
        !          11613: \def\mtadjustprotcode#1{%
        !          11614:   \countC=0
        !          11615:   \loop
        !          11616:     \ifcase\lpcode#1\countC\else
        !          11617:       \mtadjustcp\lpcode#1\countC
        !          11618:     \fi
        !          11619:     \ifcase\rpcode#1\countC\else
        !          11620:       \mtadjustcp\rpcode#1\countC
        !          11621:     \fi
        !          11622:     \advance\countC 1
        !          11623:   \ifnum\countC < 256 \repeat
        !          11624: }
        !          11625: 
        !          11626: \newcount\countB
        !          11627: \def\mtadjustcp#1#2#3{%
        !          11628:   \setbox\boxA=\hbox{%
        !          11629:     \ifx#2\font\else#2\fi
        !          11630:     \char#3}%
        !          11631:   \countB=\wd\boxA
        !          11632:   \multiply\countB #1#2#3\relax
        !          11633:   \divide\countB \fontdimen6 #2\relax
        !          11634:   #1#2#3=\countB\relax
        !          11635: }
        !          11636: 
        !          11637: \ifx\XeTeXrevision\thisisundefined
        !          11638:   \ifx\luatexversion\thisisundefined
        !          11639:     \ifpdf % pdfTeX
        !          11640:       \mtsetprotcode\textrm
        !          11641:       \def\mtfontexpand#1{\pdffontexpand#1 20 20 1 autoexpand\relax}
        !          11642:     \else % TeX
        !          11643:       \def\mtfontexpand#1{}
        !          11644:     \fi
        !          11645:   \else % LuaTeX
        !          11646:     \mtsetprotcode\textrm
        !          11647:     \def\mtfontexpand#1{\expandglyphsinfont#1 20 20 1\relax}
        !          11648:   \fi
        !          11649: \else % XeTeX
        !          11650:   \mtsetprotcode\textrm
        !          11651:   \def\mtfontexpand#1{}
        !          11652: \fi
        !          11653: 
        !          11654: 
        !          11655: \newif\ifmicrotype
        !          11656: 
        !          11657: \def\microtypeON{%
        !          11658:   \microtypetrue
        !          11659:   %
        !          11660:   \ifx\XeTeXrevision\thisisundefined
        !          11661:     \ifx\luatexversion\thisisundefined
        !          11662:       \ifpdf % pdfTeX
        !          11663:         \pdfadjustspacing=2
        !          11664:         \pdfprotrudechars=2
        !          11665:       \fi
        !          11666:     \else % LuaTeX
        !          11667:       \adjustspacing=2
        !          11668:       \protrudechars=2
        !          11669:     \fi
        !          11670:   \else % XeTeX
        !          11671:     \XeTeXprotrudechars=2
        !          11672:   \fi
        !          11673:   %
        !          11674:   \mtfontexpand\textrm
        !          11675:   \mtfontexpand\textsl
        !          11676:   \mtfontexpand\textbf
        !          11677: }
        !          11678: 
        !          11679: \def\microtypeOFF{%
        !          11680:   \microtypefalse
        !          11681:   %
        !          11682:   \ifx\XeTeXrevision\thisisundefined
        !          11683:     \ifx\luatexversion\thisisundefined
        !          11684:       \ifpdf % pdfTeX
        !          11685:         \pdfadjustspacing=0
        !          11686:         \pdfprotrudechars=0
        !          11687:       \fi
        !          11688:     \else % LuaTeX
        !          11689:       \adjustspacing=0
        !          11690:       \protrudechars=0
        !          11691:     \fi
        !          11692:   \else % XeTeX
        !          11693:     \XeTeXprotrudechars=0
        !          11694:   \fi
        !          11695: }
        !          11696: 
        !          11697: \microtypeOFF
        !          11698: 
        !          11699: \parseargdef\microtype{%
        !          11700:   \def\txiarg{#1}%
        !          11701:   \ifx\txiarg\onword
        !          11702:     \microtypeON
        !          11703:   \else\ifx\txiarg\offword
        !          11704:     \microtypeOFF
        !          11705:   \else
        !          11706:     \errhelp = \EMsimple
        !          11707:     \errmessage{Unknown @microtype option `\txiarg', must be on|off}%
        !          11708:   \fi\fi
        !          11709: }
        !          11710: 
        !          11711: 
1.1       snw      11712: \message{and turning on texinfo input format.}
                   11713: 
1.2     ! snw      11714: % Make UTF-8 the default encoding.
        !          11715: \documentencodingzzz{UTF-8}
        !          11716: 
1.1       snw      11717: \def^^L{\par} % remove \outer, so ^L can appear in an @comment
1.2     ! snw      11718: \catcode`\^^K = 10 % treat vertical tab as whitespace
1.1       snw      11719: 
                   11720: % DEL is a comment character, in case @c does not suffice.
                   11721: \catcode`\^^? = 14
                   11722: 
                   11723: % Define macros to output various characters with catcode for normal text.
                   11724: \catcode`\"=\other \def\normaldoublequote{"}
                   11725: \catcode`\$=\other \def\normaldollar{$}%$ font-lock fix
                   11726: \catcode`\+=\other \def\normalplus{+}
                   11727: \catcode`\<=\other \def\normalless{<}
                   11728: \catcode`\>=\other \def\normalgreater{>}
                   11729: \catcode`\^=\other \def\normalcaret{^}
                   11730: \catcode`\_=\other \def\normalunderscore{_}
                   11731: \catcode`\|=\other \def\normalverticalbar{|}
                   11732: \catcode`\~=\other \def\normaltilde{~}
                   11733: 
                   11734: % Set catcodes for Texinfo file
                   11735: 
                   11736: % Active characters for printing the wanted glyph.
                   11737: % Most of these we simply print from the \tt font, but for some, we can
                   11738: % use math or other variants that look better in normal text.
                   11739: %
                   11740: \catcode`\"=\active
                   11741: \def\activedoublequote{{\tt\char34}}
                   11742: \let"=\activedoublequote
                   11743: \catcode`\~=\active \def\activetilde{{\tt\char126}} \let~ = \activetilde
                   11744: \chardef\hatchar=`\^
                   11745: \catcode`\^=\active \def\activehat{{\tt \hatchar}} \let^ = \activehat
                   11746: 
                   11747: \catcode`\_=\active
                   11748: \def_{\ifusingtt\normalunderscore\_}
                   11749: \def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }
                   11750: \let\realunder=_
                   11751: 
                   11752: \catcode`\|=\active \def|{{\tt\char124}}
                   11753: 
                   11754: \chardef \less=`\<
                   11755: \catcode`\<=\active \def\activeless{{\tt \less}}\let< = \activeless
                   11756: \chardef \gtr=`\>
                   11757: \catcode`\>=\active \def\activegtr{{\tt \gtr}}\let> = \activegtr
                   11758: \catcode`\+=\active \def+{{\tt \char 43}}
                   11759: \catcode`\$=\active \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
                   11760: \catcode`\-=\active \let-=\normaldash
                   11761: 
                   11762: 
                   11763: % used for headline/footline in the output routine, in case the page
                   11764: % breaks in the middle of an @tex block.
                   11765: \def\texinfochars{%
                   11766:   \let< = \activeless
                   11767:   \let> = \activegtr
                   11768:   \let~ = \activetilde
                   11769:   \let^ = \activehat
                   11770:   \setregularquotes
                   11771:   \let\b = \strong
                   11772:   \let\i = \smartitalic
                   11773:   % in principle, all other definitions in \tex have to be undone too.
                   11774: }
                   11775: 
                   11776: % Used sometimes to turn off (effectively) the active characters even after
                   11777: % parsing them.
                   11778: \def\turnoffactive{%
1.2     ! snw      11779:   \passthroughcharstrue
        !          11780:   \let-=\normaldash
        !          11781:   \let"=\normaldoublequote
        !          11782:   \let$=\normaldollar %$ font-lock fix
        !          11783:   \let+=\normalplus
        !          11784:   \let<=\normalless
        !          11785:   \let>=\normalgreater
        !          11786:   \let^=\normalcaret
        !          11787:   \let_=\normalunderscore
        !          11788:   \let|=\normalverticalbar
        !          11789:   \let~=\normaltilde
1.1       snw      11790:   \otherbackslash
1.2     ! snw      11791:   \setregularquotes
        !          11792:   \unsepspaces
1.1       snw      11793: }
                   11794: 
1.2     ! snw      11795: % If a .fmt file is being used, characters that might appear in a file
        !          11796: % name cannot be active until we have parsed the command line.
        !          11797: % So turn them off again, and have \loadconf turn them back on.
        !          11798: \catcode`+=\other \catcode`\_=\other
        !          11799: 
1.1       snw      11800: 
                   11801: % \backslashcurfont outputs one backslash character in current font,
                   11802: % as in \char`\\.
                   11803: \global\chardef\backslashcurfont=`\\
                   11804: 
                   11805: % Print a typewriter backslash.  For math mode, we can't simply use
                   11806: % \backslashcurfont: the story here is that in math mode, the \char
                   11807: % of \backslashcurfont ends up printing the roman \ from the math symbol
                   11808: % font (because \char in math mode uses the \mathcode, and plain.tex
                   11809: % sets \mathcode`\\="026E).  Hence we use an explicit \mathchar,
                   11810: % which is the decimal equivalent of "715c (class 7, e.g., use \fam;
                   11811: % ignored family value; char position "5C).  We can't use " for the
                   11812: % usual hex value because it has already been made active.
                   11813: 
1.2     ! snw      11814: \def\ttbackslash{{\tt \ifmmode \mathchar29020 \else \backslashcurfont \fi}}
        !          11815: \let\backslashchar = \ttbackslash % \backslashchar{} is for user documents.
1.1       snw      11816: 
1.2     ! snw      11817: % These are made active for url-breaking, so need
        !          11818: % active definitions as the normal characters.
        !          11819: \def\normaldot{.}
        !          11820: \def\normalquest{?}
        !          11821: \def\normalslash{/}
        !          11822: 
        !          11823: % \newlinesloadsconf - call \loadconf as soon as possible in the
        !          11824: % file, e.g. at the first newline.
        !          11825: %
        !          11826: {\catcode`\^=7
        !          11827: \catcode`\^^M=13
        !          11828: \gdef\newlineloadsconf{%
        !          11829:   \catcode`\^^M=13 %
        !          11830:   \newlineloadsconfzz%
        !          11831: }
        !          11832: \gdef\newlineloadsconfzz#1^^M{%
        !          11833:   \def\c{\loadconf\c}%
        !          11834:   % Definition for the first newline read in the file
        !          11835:   \def ^^M{\loadconf}%
        !          11836:   % In case the first line has a whole-line or environment command on it
        !          11837:   \let\originalparsearg\parsearg%
        !          11838:   \def\parsearg{\loadconf\originalparsearg}%
        !          11839:   %
        !          11840:   % \startenvironment is in the expansion of commands defined with \envdef
        !          11841:   \let\originalstartenvironment\startenvironment%
        !          11842:   \def\startenvironment{\loadconf\startenvironment}%
1.1       snw      11843: }}
                   11844: 
                   11845: 
                   11846: % Emergency active definition of newline, in case an active newline token
                   11847: % appears by mistake.
1.2     ! snw      11848: {\catcode`\^=7 \catcode13=13%
        !          11849: \gdef\enableemergencynewline{%
        !          11850:   \gdef^^M{%
        !          11851:     \par%
        !          11852:     %<warning: active newline>\par%
1.1       snw      11853: }}}
                   11854: 
                   11855: 
1.2     ! snw      11856: % \loadconf gets called at the beginning of every Texinfo file.
        !          11857: % If texinfo.cnf is present on the system, read it.  Useful for site-wide
        !          11858: % @afourpaper, etc.  Not opening texinfo.cnf directly in texinfo.tex
        !          11859: % makes it possible to make a format file for Texinfo.
        !          11860: %
        !          11861: \gdef\loadconf{%
        !          11862:   \relax  % Terminate the filename if running as "tex '&texinfo' FILE.texi".
        !          11863:   %
        !          11864:   % Turn off the definitions that trigger \loadconf
        !          11865:   \everyjobreset
        !          11866:   \catcode13=5 % regular end of line
        !          11867:   \enableemergencynewline
        !          11868:   \let\c=\comment
        !          11869:   \let\parsearg\originalparsearg
        !          11870:   \let\startenvironment\originalstartenvironment
        !          11871:   %
1.1       snw      11872:   % Also turn back on active characters that might appear in the input
                   11873:   % file name, in case not using a pre-dumped format.
1.2     ! snw      11874:   \catcode`+=\active
        !          11875:   \catcode`\_=\active
1.1       snw      11876:   %
1.2     ! snw      11877:   \openin 1 texinfo.cnf
        !          11878:   \ifeof 1 \else \input texinfo.cnf \fi
        !          11879:   \closein 1
1.1       snw      11880: }
                   11881: 
1.2     ! snw      11882: % Redefine some control sequences to be controlled by the \ifdummies
        !          11883: % and \ifindexnofonts switches.  Do this at the end so that the control
        !          11884: % sequences are all defined.
        !          11885: \definedummies
        !          11886: 
        !          11887: 
        !          11888: 
        !          11889: 
        !          11890: \catcode`\@=0
        !          11891: 
        !          11892: % \realbackslash is an actual character `\' with catcode other.
        !          11893: {\catcode`\\=\other @gdef@realbackslash{\}}
        !          11894: 
        !          11895: % In Texinfo, backslash is an active character; it prints the backslash
        !          11896: % in fixed width font.
        !          11897: \catcode`\\=\active  % @ for escape char from now on.
        !          11898: 
        !          11899: @let\ = @ttbackslash
        !          11900: 
        !          11901: % If in a .fmt file, print the version number.
        !          11902: % \eatinput stops the `\input texinfo' from showing up.
        !          11903: % After that, `\' should revert to printing a backslash.
        !          11904: % Turn on active characters that we couldn't do earlier because
        !          11905: % they might have appeared in the input file name.
        !          11906: %
        !          11907: @everyjob{@message{[Texinfo version @texinfoversion]}%
        !          11908:   @global@let\ = @eatinput
        !          11909:   @catcode`+=@active @catcode`@_=@active}
        !          11910: 
        !          11911: {@catcode`@^=7 @catcode`@^^M=13%
        !          11912: @gdef@eatinput input texinfo#1^^M{@loadconf}}
        !          11913: 
        !          11914: @def@everyjobreset{@ifx\@eatinput @let\ = @ttbackslash @fi}
        !          11915: 
        !          11916: % \otherbackslash defines an active \ to be a literal `\' character with
        !          11917: % catcode other.
        !          11918: @gdef@otherbackslash{@let\=@realbackslash}
        !          11919: 
        !          11920: % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
        !          11921: % the literal character `\'.
        !          11922: %
        !          11923: {@catcode`- = @active
        !          11924:  @gdef@normalturnoffactive{%
        !          11925:    @turnoffactive
        !          11926:    @let\=@ttbackslash
        !          11927:  }
        !          11928: }
1.1       snw      11929: 
                   11930: % Say @foo, not \foo, in error messages.
                   11931: @escapechar = `@@
                   11932: 
                   11933: % These look ok in all fonts, so just make them not special.
                   11934: % @hashchar{} gets its own user-level command, because of #line.
                   11935: @catcode`@& = @other @def@normalamp{&}
                   11936: @catcode`@# = @other @def@normalhash{#}
                   11937: @catcode`@% = @other @def@normalpercent{%}
                   11938: 
                   11939: @let @hashchar = @normalhash
                   11940: 
                   11941: @c Finally, make ` and ' active, so that txicodequoteundirected and
                   11942: @c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}.  If we
                   11943: @c don't make ` and ' active, @code will not get them as active chars.
                   11944: @c Do this last of all since we use ` in the previous @catcode assignments.
                   11945: @catcode`@'=@active
                   11946: @catcode`@`=@active
                   11947: 
                   11948: @c Local variables:
1.2     ! snw      11949: @c eval: (add-hook 'before-save-hook 'time-stamp nil t)
        !          11950: @c time-stamp-pattern: "texinfoversion{%Y-%02m-%02d.%02H}"
        !          11951: @c page-delimiter: "^\\\\message"
1.1       snw      11952: @c End:
                   11953: 
1.2     ! snw      11954: @newlineloadsconf

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>