File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / quagga / doc / texinfo.tex
Revision 1.1.1.5 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Wed Nov 2 10:09:11 2016 UTC (7 years, 8 months ago) by misho
Branches: quagga, MAIN
CVS tags: v1_0_20160315, HEAD
quagga 1.0.20160315

    1: % texinfo.tex -- TeX macros to handle Texinfo files.
    2: % 
    3: % Load plain if necessary, i.e., if running under initex.
    4: \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
    5: %
    6: \def\texinfoversion{2016-02-05.07}
    7: %
    8: % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
    9: % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
   10: % 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016
   11: % Free Software Foundation, Inc.
   12: %
   13: % This texinfo.tex file is free software: you can redistribute it and/or
   14: % modify it under the terms of the GNU General Public License as
   15: % published by the Free Software Foundation, either version 3 of the
   16: % License, or (at your option) any later version.
   17: %
   18: % This texinfo.tex file is distributed in the hope that it will be
   19: % useful, but WITHOUT ANY WARRANTY; without even the implied warranty
   20: % of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   21: % General Public License for more details.
   22: %
   23: % You should have received a copy of the GNU General Public License
   24: % along with this program.  If not, see <http://www.gnu.org/licenses/>.
   25: %
   26: % As a special exception, when this file is read by TeX when processing
   27: % a Texinfo source document, you may use the result without
   28: % restriction. This Exception is an additional permission under section 7
   29: % of the GNU General Public License, version 3 ("GPLv3").
   30: %
   31: % Please try the latest version of texinfo.tex before submitting bug
   32: % reports; you can get the latest version from:
   33: %   http://ftp.gnu.org/gnu/texinfo/ (the Texinfo release area), or
   34: %   http://ftpmirror.gnu.org/texinfo/ (same, via a mirror), or
   35: %   http://www.gnu.org/software/texinfo/ (the Texinfo home page)
   36: % The texinfo.tex in any given distribution could well be out
   37: % of date, so if that's what you're using, please check.
   38: %
   39: % Send bug reports to bug-texinfo@gnu.org.  Please include including a
   40: % complete document in each bug report with which we can reproduce the
   41: % problem.  Patches are, of course, greatly appreciated.
   42: %
   43: % To process a Texinfo manual with TeX, it's most reliable to use the
   44: % texi2dvi shell script that comes with the distribution.  For a simple
   45: % manual foo.texi, however, you can get away with this:
   46: %   tex foo.texi
   47: %   texindex foo.??
   48: %   tex foo.texi
   49: %   tex foo.texi
   50: %   dvips foo.dvi -o  # or whatever; this makes foo.ps.
   51: % The extra TeX runs get the cross-reference information correct.
   52: % Sometimes one run after texindex suffices, and sometimes you need more
   53: % than two; texi2dvi does it as many times as necessary.
   54: %
   55: % It is possible to adapt texinfo.tex for other languages, to some
   56: % extent.  You can get the existing language-specific files from the
   57: % full Texinfo distribution.
   58: %
   59: % The GNU Texinfo home page is http://www.gnu.org/software/texinfo.
   60: 
   61: 
   62: \message{Loading texinfo [version \texinfoversion]:}
   63: 
   64: % If in a .fmt file, print the version number
   65: % and turn on active characters that we couldn't do earlier because
   66: % they might have appeared in the input file name.
   67: \everyjob{\message{[Texinfo version \texinfoversion]}%
   68:   \catcode`+=\active \catcode`\_=\active}
   69: 
   70: \chardef\other=12
   71: 
   72: % We never want plain's \outer definition of \+ in Texinfo.
   73: % For @tex, we can use \tabalign.
   74: \let\+ = \relax
   75: 
   76: % Save some plain tex macros whose names we will redefine.
   77: \let\ptexb=\b
   78: \let\ptexbullet=\bullet
   79: \let\ptexc=\c
   80: \let\ptexcomma=\,
   81: \let\ptexdot=\.
   82: \let\ptexdots=\dots
   83: \let\ptexend=\end
   84: \let\ptexequiv=\equiv
   85: \let\ptexexclam=\!
   86: \let\ptexfootnote=\footnote
   87: \let\ptexgtr=>
   88: \let\ptexhat=^
   89: \let\ptexi=\i
   90: \let\ptexindent=\indent
   91: \let\ptexinsert=\insert
   92: \let\ptexlbrace=\{
   93: \let\ptexless=<
   94: \let\ptexnewwrite\newwrite
   95: \let\ptexnoindent=\noindent
   96: \let\ptexplus=+
   97: \let\ptexraggedright=\raggedright
   98: \let\ptexrbrace=\}
   99: \let\ptexslash=\/
  100: \let\ptexsp=\sp
  101: \let\ptexstar=\*
  102: \let\ptexsup=\sup
  103: \let\ptext=\t
  104: \let\ptextop=\top
  105: {\catcode`\'=\active \global\let\ptexquoteright'}% active in plain's math mode
  106: 
  107: % If this character appears in an error message or help string, it
  108: % starts a new line in the output.
  109: \newlinechar = `^^J
  110: 
  111: % Use TeX 3.0's \inputlineno to get the line number, for better error
  112: % messages, but if we're using an old version of TeX, don't do anything.
  113: %
  114: \ifx\inputlineno\thisisundefined
  115:   \let\linenumber = \empty % Pre-3.0.
  116: \else
  117:   \def\linenumber{l.\the\inputlineno:\space}
  118: \fi
  119: 
  120: % Set up fixed words for English if not already set.
  121: \ifx\putwordAppendix\undefined  \gdef\putwordAppendix{Appendix}\fi
  122: \ifx\putwordChapter\undefined   \gdef\putwordChapter{Chapter}\fi
  123: \ifx\putworderror\undefined     \gdef\putworderror{error}\fi
  124: \ifx\putwordfile\undefined      \gdef\putwordfile{file}\fi
  125: \ifx\putwordin\undefined        \gdef\putwordin{in}\fi
  126: \ifx\putwordIndexIsEmpty\undefined       \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
  127: \ifx\putwordIndexNonexistent\undefined   \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
  128: \ifx\putwordInfo\undefined      \gdef\putwordInfo{Info}\fi
  129: \ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
  130: \ifx\putwordMethodon\undefined  \gdef\putwordMethodon{Method on}\fi
  131: \ifx\putwordNoTitle\undefined   \gdef\putwordNoTitle{No Title}\fi
  132: \ifx\putwordof\undefined        \gdef\putwordof{of}\fi
  133: \ifx\putwordon\undefined        \gdef\putwordon{on}\fi
  134: \ifx\putwordpage\undefined      \gdef\putwordpage{page}\fi
  135: \ifx\putwordsection\undefined   \gdef\putwordsection{section}\fi
  136: \ifx\putwordSection\undefined   \gdef\putwordSection{Section}\fi
  137: \ifx\putwordsee\undefined       \gdef\putwordsee{see}\fi
  138: \ifx\putwordSee\undefined       \gdef\putwordSee{See}\fi
  139: \ifx\putwordShortTOC\undefined  \gdef\putwordShortTOC{Short Contents}\fi
  140: \ifx\putwordTOC\undefined       \gdef\putwordTOC{Table of Contents}\fi
  141: %
  142: \ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
  143: \ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
  144: \ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
  145: \ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
  146: \ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
  147: \ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
  148: \ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
  149: \ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
  150: \ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
  151: \ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
  152: \ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
  153: \ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
  154: %
  155: \ifx\putwordDefmac\undefined    \gdef\putwordDefmac{Macro}\fi
  156: \ifx\putwordDefspec\undefined   \gdef\putwordDefspec{Special Form}\fi
  157: \ifx\putwordDefvar\undefined    \gdef\putwordDefvar{Variable}\fi
  158: \ifx\putwordDefopt\undefined    \gdef\putwordDefopt{User Option}\fi
  159: \ifx\putwordDeffunc\undefined   \gdef\putwordDeffunc{Function}\fi
  160: 
  161: % Give the space character the catcode for a space.
  162: \def\spaceisspace{\catcode`\ =10\relax}
  163: 
  164: \chardef\dashChar  = `\-
  165: \chardef\slashChar = `\/
  166: \chardef\underChar = `\_
  167: 
  168: % Ignore a token.
  169: %
  170: \def\gobble#1{}
  171: 
  172: % The following is used inside several \edef's.
  173: \def\makecsname#1{\expandafter\noexpand\csname#1\endcsname}
  174: 
  175: % Hyphenation fixes.
  176: \hyphenation{
  177:   Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script
  178:   ap-pen-dix bit-map bit-maps
  179:   data-base data-bases eshell fall-ing half-way long-est man-u-script
  180:   man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm
  181:   par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces
  182:   spell-ing spell-ings
  183:   stand-alone strong-est time-stamp time-stamps which-ever white-space
  184:   wide-spread wrap-around
  185: }
  186: 
  187: % Sometimes it is convenient to have everything in the transcript file
  188: % and nothing on the terminal.  We don't just call \tracingall here,
  189: % since that produces some useless output on the terminal.  We also make
  190: % some effort to order the tracing commands to reduce output in the log
  191: % file; cf. trace.sty in LaTeX.
  192: %
  193: \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
  194: \def\loggingall{%
  195:   \tracingstats2
  196:   \tracingpages1
  197:   \tracinglostchars2  % 2 gives us more in etex
  198:   \tracingparagraphs1
  199:   \tracingoutput1
  200:   \tracingmacros2
  201:   \tracingrestores1
  202:   \showboxbreadth\maxdimen \showboxdepth\maxdimen
  203:   \ifx\eTeXversion\thisisundefined\else % etex gives us more logging
  204:     \tracingscantokens1
  205:     \tracingifs1
  206:     \tracinggroups1
  207:     \tracingnesting2
  208:     \tracingassigns1
  209:   \fi
  210:   \tracingcommands3  % 3 gives us more in etex
  211:   \errorcontextlines16
  212: }%
  213: 
  214: % @errormsg{MSG}.  Do the index-like expansions on MSG, but if things
  215: % aren't perfect, it's not the end of the world, being an error message,
  216: % after all.
  217: % 
  218: \def\errormsg{\begingroup \indexnofonts \doerrormsg}
  219: \def\doerrormsg#1{\errmessage{#1}}
  220: 
  221: % add check for \lastpenalty to plain's definitions.  If the last thing
  222: % we did was a \nobreak, we don't want to insert more space.
  223: %
  224: \def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount
  225:   \removelastskip\penalty-50\smallskip\fi\fi}
  226: \def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount
  227:   \removelastskip\penalty-100\medskip\fi\fi}
  228: \def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
  229:   \removelastskip\penalty-200\bigskip\fi\fi}
  230: 
  231: % Output routine
  232: %
  233: 
  234: % For a final copy, take out the rectangles
  235: % that mark overfull boxes (in case you have decided
  236: % that the text looks ok even though it passes the margin).
  237: %
  238: \def\finalout{\overfullrule=0pt }
  239: 
  240: % Do @cropmarks to get crop marks.
  241: %
  242: \newif\ifcropmarks
  243: \let\cropmarks = \cropmarkstrue
  244: %
  245: % Dimensions to add cropmarks at corners.
  246: % Added by P. A. MacKay, 12 Nov. 1986
  247: %
  248: \newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
  249: \newdimen\cornerlong  \cornerlong=1pc
  250: \newdimen\cornerthick \cornerthick=.3pt
  251: \newdimen\topandbottommargin \topandbottommargin=.75in
  252: 
  253: % Output a mark which sets \thischapter, \thissection and \thiscolor.
  254: % We dump everything together because we only have one kind of mark.
  255: % This works because we only use \botmark / \topmark, not \firstmark.
  256: %
  257: % A mark contains a subexpression of the \ifcase ... \fi construct.
  258: % \get*marks macros below extract the needed part using \ifcase.
  259: %
  260: % Another complication is to let the user choose whether \thischapter
  261: % (\thissection) refers to the chapter (section) in effect at the top
  262: % of a page, or that at the bottom of a page.
  263: 
  264: % \domark is called twice inside \chapmacro, to add one
  265: % mark before the section break, and one after.
  266: %   In the second call \prevchapterdefs is the same as \lastchapterdefs,
  267: % and \prevsectiondefs is the same as \lastsectiondefs.
  268: %   Then if the page is not broken at the mark, some of the previous
  269: % section appears on the page, and we can get the name of this section
  270: % from \firstmark for @everyheadingmarks top.
  271: %   @everyheadingmarks bottom uses \botmark.
  272: %
  273: % See page 260 of The TeXbook.
  274: \def\domark{%
  275:   \toks0=\expandafter{\lastchapterdefs}%
  276:   \toks2=\expandafter{\lastsectiondefs}%
  277:   \toks4=\expandafter{\prevchapterdefs}%
  278:   \toks6=\expandafter{\prevsectiondefs}%
  279:   \toks8=\expandafter{\lastcolordefs}%
  280:   \mark{%
  281:                    \the\toks0 \the\toks2  % 0: marks for @everyheadingmarks top
  282:       \noexpand\or \the\toks4 \the\toks6  % 1: for @everyheadingmarks bottom
  283:     \noexpand\else \the\toks8             % 2: color marks
  284:   }%
  285: }
  286: 
  287: % \gettopheadingmarks, \getbottomheadingmarks,
  288: % \getcolormarks - extract needed part of mark.
  289: %
  290: % \topmark doesn't work for the very first chapter (after the title
  291: % page or the contents), so we use \firstmark there -- this gets us
  292: % the mark with the chapter defs, unless the user sneaks in, e.g.,
  293: % @setcolor (or @url, or @link, etc.) between @contents and the very
  294: % first @chapter.
  295: \def\gettopheadingmarks{%
  296:   \ifcase0\topmark\fi
  297:   \ifx\thischapter\empty \ifcase0\firstmark\fi \fi
  298: }
  299: \def\getbottomheadingmarks{\ifcase1\botmark\fi}
  300: \def\getcolormarks{\ifcase2\topmark\fi}
  301: 
  302: % Avoid "undefined control sequence" errors.
  303: \def\lastchapterdefs{}
  304: \def\lastsectiondefs{}
  305: \def\lastsection{}
  306: \def\prevchapterdefs{}
  307: \def\prevsectiondefs{}
  308: \def\lastcolordefs{}
  309: 
  310: % Margin to add to right of even pages, to left of odd pages.
  311: \newdimen\bindingoffset
  312: \newdimen\normaloffset
  313: \newdimen\pagewidth \newdimen\pageheight
  314: 
  315: % Main output routine.
  316: %
  317: \chardef\PAGE = 255
  318: \output = {\onepageout{\pagecontents\PAGE}}
  319: 
  320: \newbox\headlinebox
  321: \newbox\footlinebox
  322: 
  323: % \onepageout takes a vbox as an argument.
  324: % \shipout a vbox for a single page, adding an optional header, footer,
  325: % cropmarks, and footnote.  This also causes index entries for this page
  326: % to be written to the auxiliary files.
  327: %
  328: \def\onepageout#1{%
  329:   \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
  330:   %
  331:   \ifodd\pageno  \advance\hoffset by \bindingoffset
  332:   \else \advance\hoffset by -\bindingoffset\fi
  333:   %
  334:   % Common context changes for both heading and footing.
  335:   % Do this outside of the \shipout so @code etc. will be expanded in
  336:   % the headline as they should be, not taken literally (outputting ''code).
  337:   \def\commmonheadfootline{\let\hsize=\pagewidth \texinfochars}
  338:   %
  339:   % Retrieve the information for the headings from the marks in the page,
  340:   % and call Plain TeX's \makeheadline and \makefootline, which use the
  341:   % values in \headline and \footline.
  342:   %
  343:   % This is used to check if we are on the first page of a chapter.
  344:   \ifcase1\topmark\fi
  345:   \let\prevchaptername\thischaptername
  346:   \ifcase0\firstmark\fi
  347:   \let\curchaptername\thischaptername
  348:   %
  349:   \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
  350:   \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi
  351:   %
  352:   \ifx\curchaptername\prevchaptername
  353:     \let\thischapterheading\thischapter
  354:   \else
  355:     % \thischapterheading is the same as \thischapter except it is blank
  356:     % for the first page of a chapter.  This is to prevent the chapter name 
  357:     % being shown twice.
  358:     \def\thischapterheading{}%
  359:   \fi
  360:   %
  361:   \global\setbox\headlinebox = \vbox{\commmonheadfootline \makeheadline}%
  362:   \global\setbox\footlinebox = \vbox{\commmonheadfootline \makefootline}%
  363:   %
  364:   {%
  365:     % Set context for writing to auxiliary files like index files.
  366:     % Have to do this stuff outside the \shipout because we want it to
  367:     % take effect in \write's, yet the group defined by the \vbox ends
  368:     % before the \shipout runs.
  369:     %
  370:     \indexdummies         % don't expand commands in the output.
  371:     \normalturnoffactive  % \ in index entries must not stay \, e.g., if
  372:                % the page break happens to be in the middle of an example.
  373:                % We don't want .vr (or whatever) entries like this:
  374:                % \entry{{\indexbackslash }acronym}{32}{\code {\acronym}}
  375:                % "\acronym" won't work when it's read back in;
  376:                % it needs to be
  377:                % {\code {{\backslashcurfont }acronym}
  378:     \shipout\vbox{%
  379:       % Do this early so pdf references go to the beginning of the page.
  380:       \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi
  381:       %
  382:       \ifcropmarks \vbox to \outervsize\bgroup
  383:         \hsize = \outerhsize
  384:         \vskip-\topandbottommargin
  385:         \vtop to0pt{%
  386:           \line{\ewtop\hfil\ewtop}%
  387:           \nointerlineskip
  388:           \line{%
  389:             \vbox{\moveleft\cornerthick\nstop}%
  390:             \hfill
  391:             \vbox{\moveright\cornerthick\nstop}%
  392:           }%
  393:           \vss}%
  394:         \vskip\topandbottommargin
  395:         \line\bgroup
  396:           \hfil % center the page within the outer (page) hsize.
  397:           \ifodd\pageno\hskip\bindingoffset\fi
  398:           \vbox\bgroup
  399:       \fi
  400:       %
  401:       \unvbox\headlinebox
  402:       \pagebody{#1}%
  403:       \ifdim\ht\footlinebox > 0pt
  404:         % Only leave this space if the footline is nonempty.
  405:         % (We lessened \vsize for it in \oddfootingyyy.)
  406:         % The \baselineskip=24pt in plain's \makefootline has no effect.
  407:         \vskip 24pt
  408:         \unvbox\footlinebox
  409:       \fi
  410:       %
  411:       \ifcropmarks
  412:           \egroup % end of \vbox\bgroup
  413:         \hfil\egroup % end of (centering) \line\bgroup
  414:         \vskip\topandbottommargin plus1fill minus1fill
  415:         \boxmaxdepth = \cornerthick
  416:         \vbox to0pt{\vss
  417:           \line{%
  418:             \vbox{\moveleft\cornerthick\nsbot}%
  419:             \hfill
  420:             \vbox{\moveright\cornerthick\nsbot}%
  421:           }%
  422:           \nointerlineskip
  423:           \line{\ewbot\hfil\ewbot}%
  424:         }%
  425:       \egroup % \vbox from first cropmarks clause
  426:       \fi
  427:     }% end of \shipout\vbox
  428:   }% end of group with \indexdummies
  429:   \advancepageno
  430:   \ifnum\outputpenalty>-20000 \else\dosupereject\fi
  431: }
  432: 
  433: \newinsert\margin \dimen\margin=\maxdimen
  434: 
  435: % Main part of page, including any footnotes
  436: \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
  437: {\catcode`\@ =11
  438: \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
  439: % marginal hacks, juha@viisa.uucp (Juha Takala)
  440: \ifvoid\margin\else % marginal info is present
  441:   \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
  442: \dimen@=\dp#1\relax \unvbox#1\relax
  443: \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
  444: \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
  445: }
  446: 
  447: % Here are the rules for the cropmarks.  Note that they are
  448: % offset so that the space between them is truly \outerhsize or \outervsize
  449: % (P. A. MacKay, 12 November, 1986)
  450: %
  451: \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
  452: \def\nstop{\vbox
  453:   {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
  454: \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
  455: \def\nsbot{\vbox
  456:   {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
  457: 
  458: 
  459: % Argument parsing
  460: 
  461: % Parse an argument, then pass it to #1.  The argument is the rest of
  462: % the input line (except we remove a trailing comment).  #1 should be a
  463: % macro which expects an ordinary undelimited TeX argument.
  464: % For example, \def\foo{\parsearg\fooxxx}.
  465: %
  466: \def\parsearg{\parseargusing{}}
  467: \def\parseargusing#1#2{%
  468:   \def\argtorun{#2}%
  469:   \begingroup
  470:     \obeylines
  471:     \spaceisspace
  472:     #1%
  473:     \parseargline\empty% Insert the \empty token, see \finishparsearg below.
  474: }
  475: 
  476: {\obeylines %
  477:   \gdef\parseargline#1^^M{%
  478:     \endgroup % End of the group started in \parsearg.
  479:     \argremovecomment #1\comment\ArgTerm%
  480:   }%
  481: }
  482: 
  483: % First remove any @comment, then any @c comment.  Also remove a @texinfoc
  484: % comment (see \scanmacro for details).  Pass the result on to \argcheckspaces.
  485: \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
  486: \def\argremovec#1\c#2\ArgTerm{\argremovetexinfoc #1\texinfoc\ArgTerm}
  487: \def\argremovetexinfoc#1\texinfoc#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
  488: 
  489: % Each occurrence of `\^^M' or `<space>\^^M' is replaced by a single space.
  490: %
  491: % \argremovec might leave us with trailing space, e.g.,
  492: %    @end itemize  @c foo
  493: % This space token undergoes the same procedure and is eventually removed
  494: % by \finishparsearg.
  495: %
  496: \def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M}
  497: \def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M}
  498: \def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{%
  499:   \def\temp{#3}%
  500:   \ifx\temp\empty
  501:     % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp:
  502:     \let\temp\finishparsearg
  503:   \else
  504:     \let\temp\argcheckspaces
  505:   \fi
  506:   % Put the space token in:
  507:   \temp#1 #3\ArgTerm
  508: }
  509: 
  510: % If a _delimited_ argument is enclosed in braces, they get stripped; so
  511: % to get _exactly_ the rest of the line, we had to prevent such situation.
  512: % We prepended an \empty token at the very beginning and we expand it now,
  513: % just before passing the control to \argtorun.
  514: % (Similarly, we have to think about #3 of \argcheckspacesY above: it is
  515: % either the null string, or it ends with \^^M---thus there is no danger
  516: % that a pair of braces would be stripped.
  517: %
  518: % But first, we have to remove the trailing space token.
  519: %
  520: \def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}}
  521: 
  522: 
  523: % \parseargdef - define a command taking an argument on the line
  524: %
  525: % \parseargdef\foo{...}
  526: %	is roughly equivalent to
  527: % \def\foo{\parsearg\Xfoo}
  528: % \def\Xfoo#1{...}
  529: \def\parseargdef#1{%
  530:   \expandafter \doparseargdef \csname\string#1\endcsname #1%
  531: }
  532: \def\doparseargdef#1#2{%
  533:   \def#2{\parsearg#1}%
  534:   \def#1##1%
  535: }
  536: 
  537: % Several utility definitions with active space:
  538: {
  539:   \obeyspaces
  540:   \gdef\obeyedspace{ }
  541: 
  542:   % Make each space character in the input produce a normal interword
  543:   % space in the output.  Don't allow a line break at this space, as this
  544:   % is used only in environments like @example, where each line of input
  545:   % should produce a line of output anyway.
  546:   %
  547:   \gdef\sepspaces{\obeyspaces\let =\tie}
  548: 
  549:   % If an index command is used in an @example environment, any spaces
  550:   % therein should become regular spaces in the raw index file, not the
  551:   % expansion of \tie (\leavevmode \penalty \@M \ ).
  552:   \gdef\unsepspaces{\let =\space}
  553: }
  554: 
  555: 
  556: \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
  557: 
  558: % Define the framework for environments in texinfo.tex.  It's used like this:
  559: %
  560: %   \envdef\foo{...}
  561: %   \def\Efoo{...}
  562: %
  563: % It's the responsibility of \envdef to insert \begingroup before the
  564: % actual body; @end closes the group after calling \Efoo.  \envdef also
  565: % defines \thisenv, so the current environment is known; @end checks
  566: % whether the environment name matches.  The \checkenv macro can also be
  567: % used to check whether the current environment is the one expected.
  568: %
  569: % Non-false conditionals (@iftex, @ifset) don't fit into this, so they
  570: % are not treated as environments; they don't open a group.  (The
  571: % implementation of @end takes care not to call \endgroup in this
  572: % special case.)
  573: 
  574: 
  575: % At run-time, environments start with this:
  576: \def\startenvironment#1{\begingroup\def\thisenv{#1}}
  577: % initialize
  578: \let\thisenv\empty
  579: 
  580: % ... but they get defined via ``\envdef\foo{...}'':
  581: \long\def\envdef#1#2{\def#1{\startenvironment#1#2}}
  582: \def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}}
  583: 
  584: % Check whether we're in the right environment:
  585: \def\checkenv#1{%
  586:   \def\temp{#1}%
  587:   \ifx\thisenv\temp
  588:   \else
  589:     \badenverr
  590:   \fi
  591: }
  592: 
  593: % Environment mismatch, #1 expected:
  594: \def\badenverr{%
  595:   \errhelp = \EMsimple
  596:   \errmessage{This command can appear only \inenvironment\temp,
  597:     not \inenvironment\thisenv}%
  598: }
  599: \def\inenvironment#1{%
  600:   \ifx#1\empty
  601:     outside of any environment%
  602:   \else
  603:     in environment \expandafter\string#1%
  604:   \fi
  605: }
  606: 
  607: % @end foo executes the definition of \Efoo.
  608: % But first, it executes a specialized version of \checkenv
  609: %
  610: \parseargdef\end{%
  611:   \if 1\csname iscond.#1\endcsname
  612:   \else
  613:     % The general wording of \badenverr may not be ideal.
  614:     \expandafter\checkenv\csname#1\endcsname
  615:     \csname E#1\endcsname
  616:     \endgroup
  617:   \fi
  618: }
  619: 
  620: \newhelp\EMsimple{Press RETURN to continue.}
  621: 
  622: 
  623: % Be sure we're in horizontal mode when doing a tie, since we make space
  624: % equivalent to this in @example-like environments. Otherwise, a space
  625: % at the beginning of a line will start with \penalty -- and
  626: % since \penalty is valid in vertical mode, we'd end up putting the
  627: % penalty on the vertical list instead of in the new paragraph.
  628: {\catcode`@ = 11
  629:  % Avoid using \@M directly, because that causes trouble
  630:  % if the definition is written into an index file.
  631:  \global\let\tiepenalty = \@M
  632:  \gdef\tie{\leavevmode\penalty\tiepenalty\ }
  633: }
  634: 
  635: % @: forces normal size whitespace following.
  636: \def\:{\spacefactor=1000 }
  637: 
  638: % @* forces a line break.
  639: \def\*{\unskip\hfil\break\hbox{}\ignorespaces}
  640: 
  641: % @/ allows a line break.
  642: \let\/=\allowbreak
  643: 
  644: % @. is an end-of-sentence period.
  645: \def\.{.\spacefactor=\endofsentencespacefactor\space}
  646: 
  647: % @! is an end-of-sentence bang.
  648: \def\!{!\spacefactor=\endofsentencespacefactor\space}
  649: 
  650: % @? is an end-of-sentence query.
  651: \def\?{?\spacefactor=\endofsentencespacefactor\space}
  652: 
  653: % @frenchspacing on|off  says whether to put extra space after punctuation.
  654: %
  655: \def\onword{on}
  656: \def\offword{off}
  657: %
  658: \parseargdef\frenchspacing{%
  659:   \def\temp{#1}%
  660:   \ifx\temp\onword \plainfrenchspacing
  661:   \else\ifx\temp\offword \plainnonfrenchspacing
  662:   \else
  663:     \errhelp = \EMsimple
  664:     \errmessage{Unknown @frenchspacing option `\temp', must be on|off}%
  665:   \fi\fi
  666: }
  667: 
  668: % @w prevents a word break.  Without the \leavevmode, @w at the
  669: % beginning of a paragraph, when TeX is still in vertical mode, would
  670: % produce a whole line of output instead of starting the paragraph.
  671: \def\w#1{\leavevmode\hbox{#1}}
  672: 
  673: % @group ... @end group forces ... to be all on one page, by enclosing
  674: % it in a TeX vbox.  We use \vtop instead of \vbox to construct the box
  675: % to keep its height that of a normal line.  According to the rules for
  676: % \topskip (p.114 of the TeXbook), the glue inserted is
  677: % max (\topskip - \ht (first item), 0).  If that height is large,
  678: % therefore, no glue is inserted, and the space between the headline and
  679: % the text is small, which looks bad.
  680: %
  681: % Another complication is that the group might be very large.  This can
  682: % cause the glue on the previous page to be unduly stretched, because it
  683: % does not have much material.  In this case, it's better to add an
  684: % explicit \vfill so that the extra space is at the bottom.  The
  685: % threshold for doing this is if the group is more than \vfilllimit
  686: % percent of a page (\vfilllimit can be changed inside of @tex).
  687: %
  688: \newbox\groupbox
  689: \def\vfilllimit{0.7}
  690: %
  691: \envdef\group{%
  692:   \ifnum\catcode`\^^M=\active \else
  693:     \errhelp = \groupinvalidhelp
  694:     \errmessage{@group invalid in context where filling is enabled}%
  695:   \fi
  696:   \startsavinginserts
  697:   %
  698:   \setbox\groupbox = \vtop\bgroup
  699:     % Do @comment since we are called inside an environment such as
  700:     % @example, where each end-of-line in the input causes an
  701:     % end-of-line in the output.  We don't want the end-of-line after
  702:     % the `@group' to put extra space in the output.  Since @group
  703:     % should appear on a line by itself (according to the Texinfo
  704:     % manual), we don't worry about eating any user text.
  705:     \comment
  706: }
  707: %
  708: % The \vtop produces a box with normal height and large depth; thus, TeX puts
  709: % \baselineskip glue before it, and (when the next line of text is done)
  710: % \lineskip glue after it.  Thus, space below is not quite equal to space
  711: % above.  But it's pretty close.
  712: \def\Egroup{%
  713:     % To get correct interline space between the last line of the group
  714:     % and the first line afterwards, we have to propagate \prevdepth.
  715:     \endgraf % Not \par, as it may have been set to \lisppar.
  716:     \global\dimen1 = \prevdepth
  717:   \egroup           % End the \vtop.
  718:   \addgroupbox
  719:   \prevdepth = \dimen1
  720:   \checkinserts
  721: }
  722: 
  723: \def\addgroupbox{
  724:   % \dimen0 is the vertical size of the group's box.
  725:   \dimen0 = \ht\groupbox  \advance\dimen0 by \dp\groupbox
  726:   % \dimen2 is how much space is left on the page (more or less).
  727:   \dimen2 = \pageheight   \advance\dimen2 by -\pagetotal
  728:   % if the group doesn't fit on the current page, and it's a big big
  729:   % group, force a page break.
  730:   \ifdim \dimen0 > \dimen2
  731:     \ifdim \pagetotal < \vfilllimit\pageheight
  732:       \page
  733:     \fi
  734:   \fi
  735:   \box\groupbox
  736: }
  737: 
  738: %
  739: % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
  740: % message, so this ends up printing `@group can only ...'.
  741: %
  742: \newhelp\groupinvalidhelp{%
  743: group can only be used in environments such as @example,^^J%
  744: where each line of input produces a line of output.}
  745: 
  746: % @need space-in-mils
  747: % forces a page break if there is not space-in-mils remaining.
  748: 
  749: \newdimen\mil  \mil=0.001in
  750: 
  751: \parseargdef\need{%
  752:   % Ensure vertical mode, so we don't make a big box in the middle of a
  753:   % paragraph.
  754:   \par
  755:   %
  756:   % If the @need value is less than one line space, it's useless.
  757:   \dimen0 = #1\mil
  758:   \dimen2 = \ht\strutbox
  759:   \advance\dimen2 by \dp\strutbox
  760:   \ifdim\dimen0 > \dimen2
  761:     %
  762:     % Do a \strut just to make the height of this box be normal, so the
  763:     % normal leading is inserted relative to the preceding line.
  764:     % And a page break here is fine.
  765:     \vtop to #1\mil{\strut\vfil}%
  766:     %
  767:     % TeX does not even consider page breaks if a penalty added to the
  768:     % main vertical list is 10000 or more.  But in order to see if the
  769:     % empty box we just added fits on the page, we must make it consider
  770:     % page breaks.  On the other hand, we don't want to actually break the
  771:     % page after the empty box.  So we use a penalty of 9999.
  772:     %
  773:     % There is an extremely small chance that TeX will actually break the
  774:     % page at this \penalty, if there are no other feasible breakpoints in
  775:     % sight.  (If the user is using lots of big @group commands, which
  776:     % almost-but-not-quite fill up a page, TeX will have a hard time doing
  777:     % good page breaking, for example.)  However, I could not construct an
  778:     % example where a page broke at this \penalty; if it happens in a real
  779:     % document, then we can reconsider our strategy.
  780:     \penalty9999
  781:     %
  782:     % Back up by the size of the box, whether we did a page break or not.
  783:     \kern -#1\mil
  784:     %
  785:     % Do not allow a page break right after this kern.
  786:     \nobreak
  787:   \fi
  788: }
  789: 
  790: % @br   forces paragraph break (and is undocumented).
  791: 
  792: \let\br = \par
  793: 
  794: % @page forces the start of a new page.
  795: %
  796: \def\page{\par\vfill\supereject}
  797: 
  798: % @exdent text....
  799: % outputs text on separate line in roman font, starting at standard page margin
  800: 
  801: % This records the amount of indent in the innermost environment.
  802: % That's how much \exdent should take out.
  803: \newskip\exdentamount
  804: 
  805: % This defn is used inside fill environments such as @defun.
  806: \parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}
  807: 
  808: % This defn is used inside nofill environments such as @example.
  809: \parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount
  810:   \leftline{\hskip\leftskip{\rm#1}}}}
  811: 
  812: % @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
  813: % paragraph.  For more general purposes, use the \margin insertion
  814: % class.  WHICH is `l' or `r'.  Not documented, written for gawk manual.
  815: %
  816: \newskip\inmarginspacing \inmarginspacing=1cm
  817: \def\strutdepth{\dp\strutbox}
  818: %
  819: \def\doinmargin#1#2{\strut\vadjust{%
  820:   \nobreak
  821:   \kern-\strutdepth
  822:   \vtop to \strutdepth{%
  823:     \baselineskip=\strutdepth
  824:     \vss
  825:     % if you have multiple lines of stuff to put here, you'll need to
  826:     % make the vbox yourself of the appropriate size.
  827:     \ifx#1l%
  828:       \llap{\ignorespaces #2\hskip\inmarginspacing}%
  829:     \else
  830:       \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
  831:     \fi
  832:     \null
  833:   }%
  834: }}
  835: \def\inleftmargin{\doinmargin l}
  836: \def\inrightmargin{\doinmargin r}
  837: %
  838: % @inmargin{TEXT [, RIGHT-TEXT]}
  839: % (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
  840: % else use TEXT for both).
  841: %
  842: \def\inmargin#1{\parseinmargin #1,,\finish}
  843: \def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
  844:   \setbox0 = \hbox{\ignorespaces #2}%
  845:   \ifdim\wd0 > 0pt
  846:     \def\lefttext{#1}%  have both texts
  847:     \def\righttext{#2}%
  848:   \else
  849:     \def\lefttext{#1}%  have only one text
  850:     \def\righttext{#1}%
  851:   \fi
  852:   %
  853:   \ifodd\pageno
  854:     \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
  855:   \else
  856:     \def\temp{\inleftmargin\lefttext}%
  857:   \fi
  858:   \temp
  859: }
  860: 
  861: % @| inserts a changebar to the left of the current line.  It should
  862: % surround any changed text.  This approach does *not* work if the
  863: % change spans more than two lines of output.  To handle that, we would
  864: % have adopt a much more difficult approach (putting marks into the main
  865: % vertical list for the beginning and end of each change).  This command
  866: % is not documented, not supported, and doesn't work.
  867: %
  868: \def\|{%
  869:   % \vadjust can only be used in horizontal mode.
  870:   \leavevmode
  871:   %
  872:   % Append this vertical mode material after the current line in the output.
  873:   \vadjust{%
  874:     % We want to insert a rule with the height and depth of the current
  875:     % leading; that is exactly what \strutbox is supposed to record.
  876:     \vskip-\baselineskip
  877:     %
  878:     % \vadjust-items are inserted at the left edge of the type.  So
  879:     % the \llap here moves out into the left-hand margin.
  880:     \llap{%
  881:       %
  882:       % For a thicker or thinner bar, change the `1pt'.
  883:       \vrule height\baselineskip width1pt
  884:       %
  885:       % This is the space between the bar and the text.
  886:       \hskip 12pt
  887:     }%
  888:   }%
  889: }
  890: 
  891: % @include FILE -- \input text of FILE.
  892: %
  893: \def\include{\parseargusing\filenamecatcodes\includezzz}
  894: \def\includezzz#1{%
  895:   \pushthisfilestack
  896:   \def\thisfile{#1}%
  897:   {%
  898:     \makevalueexpandable  % we want to expand any @value in FILE.
  899:     \turnoffactive        % and allow special characters in the expansion
  900:     \indexnofonts         % Allow `@@' and other weird things in file names.
  901:     \wlog{texinfo.tex: doing @include of #1^^J}%
  902:     \edef\temp{\noexpand\input #1 }%
  903:     %
  904:     % This trickery is to read FILE outside of a group, in case it makes
  905:     % definitions, etc.
  906:     \expandafter
  907:   }\temp
  908:   \popthisfilestack
  909: }
  910: \def\filenamecatcodes{%
  911:   \catcode`\\=\other
  912:   \catcode`~=\other
  913:   \catcode`^=\other
  914:   \catcode`_=\other
  915:   \catcode`|=\other
  916:   \catcode`<=\other
  917:   \catcode`>=\other
  918:   \catcode`+=\other
  919:   \catcode`-=\other
  920:   \catcode`\`=\other
  921:   \catcode`\'=\other
  922: }
  923: 
  924: \def\pushthisfilestack{%
  925:   \expandafter\pushthisfilestackX\popthisfilestack\StackTerm
  926: }
  927: \def\pushthisfilestackX{%
  928:   \expandafter\pushthisfilestackY\thisfile\StackTerm
  929: }
  930: \def\pushthisfilestackY #1\StackTerm #2\StackTerm {%
  931:   \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}%
  932: }
  933: 
  934: \def\popthisfilestack{\errthisfilestackempty}
  935: \def\errthisfilestackempty{\errmessage{Internal error:
  936:   the stack of filenames is empty.}}
  937: %
  938: \def\thisfile{}
  939: 
  940: % @center line
  941: % outputs that line, centered.
  942: %
  943: \parseargdef\center{%
  944:   \ifhmode
  945:     \let\centersub\centerH
  946:   \else
  947:     \let\centersub\centerV
  948:   \fi
  949:   \centersub{\hfil \ignorespaces#1\unskip \hfil}%
  950:   \let\centersub\relax % don't let the definition persist, just in case
  951: }
  952: \def\centerH#1{{%
  953:   \hfil\break
  954:   \advance\hsize by -\leftskip
  955:   \advance\hsize by -\rightskip
  956:   \line{#1}%
  957:   \break
  958: }}
  959: %
  960: \newcount\centerpenalty
  961: \def\centerV#1{%
  962:   % The idea here is the same as in \startdefun, \cartouche, etc.: if
  963:   % @center is the first thing after a section heading, we need to wipe
  964:   % out the negative parskip inserted by \sectionheading, but still
  965:   % prevent a page break here.
  966:   \centerpenalty = \lastpenalty
  967:   \ifnum\centerpenalty>10000 \vskip\parskip \fi
  968:   \ifnum\centerpenalty>9999 \penalty\centerpenalty \fi
  969:   \line{\kern\leftskip #1\kern\rightskip}%
  970: }
  971: 
  972: % @sp n   outputs n lines of vertical space
  973: %
  974: \parseargdef\sp{\vskip #1\baselineskip}
  975: 
  976: % @comment ...line which is ignored...
  977: % @c is the same as @comment
  978: % @ignore ... @end ignore  is another way to write a comment
  979: %
  980: \def\comment{\begingroup \catcode`\^^M=\active%
  981: \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other\commentxxx}%
  982: 
  983: {\catcode`\^^M=\active%
  984: \gdef\commentxxx#1^^M{\endgroup%
  985: \futurelet\nexttoken\commentxxxx}%
  986: \gdef\commentxxxx{\ifx\nexttoken\aftermacro\expandafter\comment\fi}%
  987: }
  988: 
  989: \def\c{\begingroup \catcode`\^^M=\active%
  990: \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
  991: \cxxx}
  992: {\catcode`\^^M=\active \gdef\cxxx#1^^M{\endgroup}}
  993: % See comment in \scanmacro about why the definitions of @c and @comment differ
  994: 
  995: % @paragraphindent NCHARS
  996: % We'll use ems for NCHARS, close enough.
  997: % NCHARS can also be the word `asis' or `none'.
  998: % We cannot feasibly implement @paragraphindent asis, though.
  999: %
 1000: \def\asisword{asis} % no translation, these are keywords
 1001: \def\noneword{none}
 1002: %
 1003: \parseargdef\paragraphindent{%
 1004:   \def\temp{#1}%
 1005:   \ifx\temp\asisword
 1006:   \else
 1007:     \ifx\temp\noneword
 1008:       \defaultparindent = 0pt
 1009:     \else
 1010:       \defaultparindent = #1em
 1011:     \fi
 1012:   \fi
 1013:   \parindent = \defaultparindent
 1014: }
 1015: 
 1016: % @exampleindent NCHARS
 1017: % We'll use ems for NCHARS like @paragraphindent.
 1018: % It seems @exampleindent asis isn't necessary, but
 1019: % I preserve it to make it similar to @paragraphindent.
 1020: \parseargdef\exampleindent{%
 1021:   \def\temp{#1}%
 1022:   \ifx\temp\asisword
 1023:   \else
 1024:     \ifx\temp\noneword
 1025:       \lispnarrowing = 0pt
 1026:     \else
 1027:       \lispnarrowing = #1em
 1028:     \fi
 1029:   \fi
 1030: }
 1031: 
 1032: % @firstparagraphindent WORD
 1033: % If WORD is `none', then suppress indentation of the first paragraph
 1034: % after a section heading.  If WORD is `insert', then do indent at such
 1035: % paragraphs.
 1036: %
 1037: % The paragraph indentation is suppressed or not by calling
 1038: % \suppressfirstparagraphindent, which the sectioning commands do.
 1039: % We switch the definition of this back and forth according to WORD.
 1040: % By default, we suppress indentation.
 1041: %
 1042: \def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
 1043: \def\insertword{insert}
 1044: %
 1045: \parseargdef\firstparagraphindent{%
 1046:   \def\temp{#1}%
 1047:   \ifx\temp\noneword
 1048:     \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
 1049:   \else\ifx\temp\insertword
 1050:     \let\suppressfirstparagraphindent = \relax
 1051:   \else
 1052:     \errhelp = \EMsimple
 1053:     \errmessage{Unknown @firstparagraphindent option `\temp'}%
 1054:   \fi\fi
 1055: }
 1056: 
 1057: % Here is how we actually suppress indentation.  Redefine \everypar to
 1058: % \kern backwards by \parindent, and then reset itself to empty.
 1059: %
 1060: % We also make \indent itself not actually do anything until the next
 1061: % paragraph.
 1062: %
 1063: \gdef\dosuppressfirstparagraphindent{%
 1064:   \gdef\indent  {\restorefirstparagraphindent \indent}%
 1065:   \gdef\noindent{\restorefirstparagraphindent \noindent}%
 1066:   \global\everypar = {\kern -\parindent \restorefirstparagraphindent}%
 1067: }
 1068: %
 1069: \gdef\restorefirstparagraphindent{%
 1070:   \global\let\indent = \ptexindent
 1071:   \global\let\noindent = \ptexnoindent
 1072:   \global\everypar = {}%
 1073: }
 1074: 
 1075: 
 1076: % @refill is a no-op.
 1077: \let\refill=\relax
 1078: 
 1079: % @setfilename INFO-FILENAME - ignored
 1080: \let\setfilename=\comment
 1081: 
 1082: % @bye.
 1083: \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
 1084: 
 1085: 
 1086: \message{pdf,}
 1087: % adobe `portable' document format
 1088: \newcount\tempnum
 1089: \newcount\lnkcount
 1090: \newtoks\filename
 1091: \newcount\filenamelength
 1092: \newcount\pgn
 1093: \newtoks\toksA
 1094: \newtoks\toksB
 1095: \newtoks\toksC
 1096: \newtoks\toksD
 1097: \newbox\boxA
 1098: \newbox\boxB
 1099: \newcount\countA
 1100: \newif\ifpdf
 1101: \newif\ifpdfmakepagedest
 1102: 
 1103: % when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
 1104: % can be set).  So we test for \relax and 0 as well as being undefined.
 1105: \ifx\pdfoutput\thisisundefined
 1106: \else
 1107:   \ifx\pdfoutput\relax
 1108:   \else
 1109:     \ifcase\pdfoutput
 1110:     \else
 1111:       \pdftrue
 1112:     \fi
 1113:   \fi
 1114: \fi
 1115: 
 1116: % PDF uses PostScript string constants for the names of xref targets,
 1117: % for display in the outlines, and in other places.  Thus, we have to
 1118: % double any backslashes.  Otherwise, a name like "\node" will be
 1119: % interpreted as a newline (\n), followed by o, d, e.  Not good.
 1120: % 
 1121: % See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and
 1122: % related messages.  The final outcome is that it is up to the TeX user
 1123: % to double the backslashes and otherwise make the string valid, so
 1124: % that's what we do.  pdftex 1.30.0 (ca.2005) introduced a primitive to
 1125: % do this reliably, so we use it.
 1126: 
 1127: % #1 is a control sequence in which to do the replacements,
 1128: % which we \xdef.
 1129: \def\txiescapepdf#1{%
 1130:   \ifx\pdfescapestring\thisisundefined
 1131:     % No primitive available; should we give a warning or log?
 1132:     % Many times it won't matter.
 1133:   \else
 1134:     % The expandable \pdfescapestring primitive escapes parentheses,
 1135:     % backslashes, and other special chars.
 1136:     \xdef#1{\pdfescapestring{#1}}%
 1137:   \fi
 1138: }
 1139: 
 1140: \newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images
 1141: with PDF output, and none of those formats could be found.  (.eps cannot
 1142: be supported due to the design of the PDF format; use regular TeX (DVI
 1143: output) for that.)}
 1144: 
 1145: \ifpdf
 1146:   %
 1147:   % Color manipulation macros using ideas from pdfcolor.tex,
 1148:   % except using rgb instead of cmyk; the latter is said to render as a
 1149:   % very dark gray on-screen and a very dark halftone in print, instead
 1150:   % of actual black. The dark red here is dark enough to print on paper as
 1151:   % nearly black, but still distinguishable for online viewing.  We use
 1152:   % black by default, though.
 1153:   \def\rgbDarkRed{0.50 0.09 0.12}
 1154:   \def\rgbBlack{0 0 0}
 1155:   %
 1156:   % rg sets the color for filling (usual text, etc.);
 1157:   % RG sets the color for stroking (thin rules, e.g., normal _'s).
 1158:   \def\pdfsetcolor#1{\pdfliteral{#1 rg  #1 RG}}
 1159:   %
 1160:   % Set color, and create a mark which defines \thiscolor accordingly,
 1161:   % so that \makeheadline knows which color to restore.
 1162:   \def\setcolor#1{%
 1163:     \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}%
 1164:     \domark
 1165:     \pdfsetcolor{#1}%
 1166:   }
 1167:   %
 1168:   \def\maincolor{\rgbBlack}
 1169:   \pdfsetcolor{\maincolor}
 1170:   \edef\thiscolor{\maincolor}
 1171:   \def\lastcolordefs{}
 1172:   %
 1173:   \def\makefootline{%
 1174:     \baselineskip24pt
 1175:     \line{\pdfsetcolor{\maincolor}\the\footline}%
 1176:   }
 1177:   %
 1178:   \def\makeheadline{%
 1179:     \vbox to 0pt{%
 1180:       \vskip-22.5pt
 1181:       \line{%
 1182:         \vbox to8.5pt{}%
 1183:         % Extract \thiscolor definition from the marks.
 1184:         \getcolormarks
 1185:         % Typeset the headline with \maincolor, then restore the color.
 1186:         \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
 1187:       }%
 1188:       \vss
 1189:     }%
 1190:     \nointerlineskip
 1191:   }
 1192:   %
 1193:   %
 1194:   \pdfcatalog{/PageMode /UseOutlines}
 1195:   %
 1196:   % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
 1197:   \def\dopdfimage#1#2#3{%
 1198:     \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
 1199:     \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
 1200:     %
 1201:     % pdftex (and the PDF format) support .pdf, .png, .jpg (among
 1202:     % others).  Let's try in that order, PDF first since if
 1203:     % someone has a scalable image, presumably better to use that than a
 1204:     % bitmap.
 1205:     \let\pdfimgext=\empty
 1206:     \begingroup
 1207:       \openin 1 #1.pdf \ifeof 1
 1208:         \openin 1 #1.PDF \ifeof 1
 1209:           \openin 1 #1.png \ifeof 1
 1210:             \openin 1 #1.jpg \ifeof 1
 1211:               \openin 1 #1.jpeg \ifeof 1
 1212:                 \openin 1 #1.JPG \ifeof 1
 1213:                   \errhelp = \nopdfimagehelp
 1214:                   \errmessage{Could not find image file #1 for pdf}%
 1215:                 \else \gdef\pdfimgext{JPG}%
 1216:                 \fi
 1217:               \else \gdef\pdfimgext{jpeg}%
 1218:               \fi
 1219:             \else \gdef\pdfimgext{jpg}%
 1220:             \fi
 1221:           \else \gdef\pdfimgext{png}%
 1222:           \fi
 1223:         \else \gdef\pdfimgext{PDF}%
 1224:         \fi
 1225:       \else \gdef\pdfimgext{pdf}%
 1226:       \fi
 1227:       \closein 1
 1228:     \endgroup
 1229:     %
 1230:     % without \immediate, ancient pdftex seg faults when the same image is
 1231:     % included twice.  (Version 3.14159-pre-1.0-unofficial-20010704.)
 1232:     \ifnum\pdftexversion < 14
 1233:       \immediate\pdfimage
 1234:     \else
 1235:       \immediate\pdfximage
 1236:     \fi
 1237:       \ifdim \wd0 >0pt width \pdfimagewidth \fi
 1238:       \ifdim \wd2 >0pt height \pdfimageheight \fi
 1239:       \ifnum\pdftexversion<13
 1240:          #1.\pdfimgext
 1241:        \else
 1242:          {#1.\pdfimgext}%
 1243:        \fi
 1244:     \ifnum\pdftexversion < 14 \else
 1245:       \pdfrefximage \pdflastximage
 1246:     \fi}
 1247:   %
 1248:   \def\pdfmkdest#1{{%
 1249:     % We have to set dummies so commands such as @code, and characters
 1250:     % such as \, aren't expanded when present in a section title.
 1251:     \indexnofonts
 1252:     \turnoffactive
 1253:     \makevalueexpandable
 1254:     \def\pdfdestname{#1}%
 1255:     \txiescapepdf\pdfdestname
 1256:     \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
 1257:   }}
 1258:   %
 1259:   % used to mark target names; must be expandable.
 1260:   \def\pdfmkpgn#1{#1}
 1261:   %
 1262:   % by default, use black for everything.
 1263:   \def\urlcolor{\rgbBlack}
 1264:   \def\linkcolor{\rgbBlack}
 1265:   \def\endlink{\setcolor{\maincolor}\pdfendlink}
 1266:   %
 1267:   % Adding outlines to PDF; macros for calculating structure of outlines
 1268:   % come from Petr Olsak
 1269:   \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
 1270:     \else \csname#1\endcsname \fi}
 1271:   \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
 1272:     \advance\tempnum by 1
 1273:     \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
 1274:   %
 1275:   % #1 is the section text, which is what will be displayed in the
 1276:   % outline by the pdf viewer.  #2 is the pdf expression for the number
 1277:   % of subentries (or empty, for subsubsections).  #3 is the node text,
 1278:   % which might be empty if this toc entry had no corresponding node.
 1279:   % #4 is the page number
 1280:   %
 1281:   \def\dopdfoutline#1#2#3#4{%
 1282:     % Generate a link to the node text if that exists; else, use the
 1283:     % page number.  We could generate a destination for the section
 1284:     % text in the case where a section has no node, but it doesn't
 1285:     % seem worth the trouble, since most documents are normally structured.
 1286:     \edef\pdfoutlinedest{#3}%
 1287:     \ifx\pdfoutlinedest\empty
 1288:       \def\pdfoutlinedest{#4}%
 1289:     \else
 1290:       \txiescapepdf\pdfoutlinedest
 1291:     \fi
 1292:     %
 1293:     % Also escape PDF chars in the display string.
 1294:     \edef\pdfoutlinetext{#1}%
 1295:     \txiescapepdf\pdfoutlinetext
 1296:     %
 1297:     \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}%
 1298:   }
 1299:   %
 1300:   \def\pdfmakeoutlines{%
 1301:     \begingroup
 1302:       % Read toc silently, to get counts of subentries for \pdfoutline.
 1303:       \def\partentry##1##2##3##4{}% ignore parts in the outlines
 1304:       \def\numchapentry##1##2##3##4{%
 1305: 	\def\thischapnum{##2}%
 1306: 	\def\thissecnum{0}%
 1307: 	\def\thissubsecnum{0}%
 1308:       }%
 1309:       \def\numsecentry##1##2##3##4{%
 1310: 	\advancenumber{chap\thischapnum}%
 1311: 	\def\thissecnum{##2}%
 1312: 	\def\thissubsecnum{0}%
 1313:       }%
 1314:       \def\numsubsecentry##1##2##3##4{%
 1315: 	\advancenumber{sec\thissecnum}%
 1316: 	\def\thissubsecnum{##2}%
 1317:       }%
 1318:       \def\numsubsubsecentry##1##2##3##4{%
 1319: 	\advancenumber{subsec\thissubsecnum}%
 1320:       }%
 1321:       \def\thischapnum{0}%
 1322:       \def\thissecnum{0}%
 1323:       \def\thissubsecnum{0}%
 1324:       %
 1325:       % use \def rather than \let here because we redefine \chapentry et
 1326:       % al. a second time, below.
 1327:       \def\appentry{\numchapentry}%
 1328:       \def\appsecentry{\numsecentry}%
 1329:       \def\appsubsecentry{\numsubsecentry}%
 1330:       \def\appsubsubsecentry{\numsubsubsecentry}%
 1331:       \def\unnchapentry{\numchapentry}%
 1332:       \def\unnsecentry{\numsecentry}%
 1333:       \def\unnsubsecentry{\numsubsecentry}%
 1334:       \def\unnsubsubsecentry{\numsubsubsecentry}%
 1335:       \readdatafile{toc}%
 1336:       %
 1337:       % Read toc second time, this time actually producing the outlines.
 1338:       % The `-' means take the \expnumber as the absolute number of
 1339:       % subentries, which we calculated on our first read of the .toc above.
 1340:       %
 1341:       % We use the node names as the destinations.
 1342:       \def\numchapentry##1##2##3##4{%
 1343:         \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}%
 1344:       \def\numsecentry##1##2##3##4{%
 1345:         \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}%
 1346:       \def\numsubsecentry##1##2##3##4{%
 1347:         \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}%
 1348:       \def\numsubsubsecentry##1##2##3##4{% count is always zero
 1349:         \dopdfoutline{##1}{}{##3}{##4}}%
 1350:       %
 1351:       % PDF outlines are displayed using system fonts, instead of
 1352:       % document fonts.  Therefore we cannot use special characters,
 1353:       % since the encoding is unknown.  For example, the eogonek from
 1354:       % Latin 2 (0xea) gets translated to a | character.  Info from
 1355:       % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
 1356:       %
 1357:       % TODO this right, we have to translate 8-bit characters to
 1358:       % their "best" equivalent, based on the @documentencoding.  Too
 1359:       % much work for too little return.  Just use the ASCII equivalents
 1360:       % we use for the index sort strings.
 1361:       % 
 1362:       \indexnofonts
 1363:       \setupdatafile
 1364:       % We can have normal brace characters in the PDF outlines, unlike
 1365:       % Texinfo index files.  So set that up.
 1366:       \def\{{\lbracecharliteral}%
 1367:       \def\}{\rbracecharliteral}%
 1368:       \catcode`\\=\active \otherbackslash
 1369:       \input \tocreadfilename
 1370:     \endgroup
 1371:   }
 1372:   {\catcode`[=1 \catcode`]=2
 1373:    \catcode`{=\other \catcode`}=\other
 1374:    \gdef\lbracecharliteral[{]%
 1375:    \gdef\rbracecharliteral[}]%
 1376:   ]
 1377:   %
 1378:   \def\skipspaces#1{\def\PP{#1}\def\D{|}%
 1379:     \ifx\PP\D\let\nextsp\relax
 1380:     \else\let\nextsp\skipspaces
 1381:       \addtokens{\filename}{\PP}%
 1382:       \advance\filenamelength by 1
 1383:     \fi
 1384:     \nextsp}
 1385:   \def\getfilename#1{%
 1386:     \filenamelength=0
 1387:     % If we don't expand the argument now, \skipspaces will get
 1388:     % snagged on things like "@value{foo}".
 1389:     \edef\temp{#1}%
 1390:     \expandafter\skipspaces\temp|\relax
 1391:   }
 1392:   \ifnum\pdftexversion < 14
 1393:     \let \startlink \pdfannotlink
 1394:   \else
 1395:     \let \startlink \pdfstartlink
 1396:   \fi
 1397:   % make a live url in pdf output.
 1398:   \def\pdfurl#1{%
 1399:     \begingroup
 1400:       % it seems we really need yet another set of dummies; have not
 1401:       % tried to figure out what each command should do in the context
 1402:       % of @url.  for now, just make @/ a no-op, that's the only one
 1403:       % people have actually reported a problem with.
 1404:       %
 1405:       \normalturnoffactive
 1406:       \def\@{@}%
 1407:       \let\/=\empty
 1408:       \makevalueexpandable
 1409:       % do we want to go so far as to use \indexnofonts instead of just
 1410:       % special-casing \var here?
 1411:       \def\var##1{##1}%
 1412:       %
 1413:       \leavevmode\setcolor{\urlcolor}%
 1414:       \startlink attr{/Border [0 0 0]}%
 1415:         user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
 1416:     \endgroup}
 1417:   \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
 1418:   \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
 1419:   \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
 1420:   \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
 1421:   \def\maketoks{%
 1422:     \expandafter\poptoks\the\toksA|ENDTOKS|\relax
 1423:     \ifx\first0\adn0
 1424:     \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
 1425:     \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
 1426:     \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
 1427:     \else
 1428:       \ifnum0=\countA\else\makelink\fi
 1429:       \ifx\first.\let\next=\done\else
 1430:         \let\next=\maketoks
 1431:         \addtokens{\toksB}{\the\toksD}
 1432:         \ifx\first,\addtokens{\toksB}{\space}\fi
 1433:       \fi
 1434:     \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
 1435:     \next}
 1436:   \def\makelink{\addtokens{\toksB}%
 1437:     {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
 1438:   \def\pdflink#1{%
 1439:     \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
 1440:     \setcolor{\linkcolor}#1\endlink}
 1441:   \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
 1442: \else
 1443:   % non-pdf mode
 1444:   \let\pdfmkdest = \gobble
 1445:   \let\pdfurl = \gobble
 1446:   \let\endlink = \relax
 1447:   \let\setcolor = \gobble
 1448:   \let\pdfsetcolor = \gobble
 1449:   \let\pdfmakeoutlines = \relax
 1450: \fi  % \ifx\pdfoutput
 1451: 
 1452: %
 1453: % @image support for XeTeX
 1454: %
 1455: \newif\ifxeteximgpdf
 1456: \ifx\XeTeXrevision\thisisundefined
 1457: \else
 1458:   %
 1459:   % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
 1460:   \def\doxeteximage#1#2#3{%
 1461:     \def\xeteximagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
 1462:     \def\xeteximageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
 1463:     %
 1464:     % XeTeX (and the PDF format) support .pdf, .png, .jpg (among
 1465:     % others).  Let's try in that order, PDF first since if
 1466:     % someone has a scalable image, presumably better to use that than a
 1467:     % bitmap.
 1468:     \let\xeteximgext=\empty
 1469:     \xeteximgpdffalse
 1470:     \begingroup
 1471:       \openin 1 #1.pdf \ifeof 1
 1472:         \openin 1 #1.PDF \ifeof 1
 1473:           \openin 1 #1.png \ifeof 1
 1474:             \openin 1 #1.jpg \ifeof 1
 1475:               \openin 1 #1.jpeg \ifeof 1
 1476:                 \openin 1 #1.JPG \ifeof 1
 1477:                   \errmessage{Could not find image file #1 for XeTeX}%
 1478:                 \else \gdef\xeteximgext{JPG}%
 1479:                 \fi
 1480:               \else \gdef\xeteximgext{jpeg}%
 1481:               \fi
 1482:             \else \gdef\xeteximgext{jpg}%
 1483:             \fi
 1484:           \else \gdef\xeteximgext{png}%
 1485:           \fi
 1486:         \else \gdef\xeteximgext{PDF} \global\xeteximgpdftrue%
 1487:         \fi
 1488:       \else \gdef\xeteximgext{pdf} \global\xeteximgpdftrue%
 1489:       \fi
 1490:       \closein 1
 1491:     \endgroup
 1492:     %
 1493:     \ifxeteximgpdf
 1494:       \XeTeXpdffile "#1".\xeteximgext ""
 1495:     \else
 1496:       \XeTeXpicfile "#1".\xeteximgext ""
 1497:     \fi
 1498:     \ifdim \wd0 >0pt width \xeteximagewidth \fi
 1499:     \ifdim \wd2 >0pt height \xeteximageheight \fi \relax
 1500:   }
 1501: \fi
 1502: 
 1503: \message{fonts,}
 1504: 
 1505: % Change the current font style to #1, remembering it in \curfontstyle.
 1506: % For now, we do not accumulate font styles: @b{@i{foo}} prints foo in
 1507: % italics, not bold italics.
 1508: %
 1509: \def\setfontstyle#1{%
 1510:   \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd.
 1511:   \csname ten#1\endcsname  % change the current font
 1512: }
 1513: 
 1514: % Select #1 fonts with the current style.
 1515: %
 1516: \def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname}
 1517: 
 1518: \def\rm{\fam=0 \setfontstyle{rm}}
 1519: \def\it{\fam=\itfam \setfontstyle{it}}
 1520: \def\sl{\fam=\slfam \setfontstyle{sl}}
 1521: \def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
 1522: \def\tt{\fam=\ttfam \setfontstyle{tt}}
 1523: 
 1524: % Unfortunately, we have to override this for titles and the like, since
 1525: % in those cases "rm" is bold.  Sigh.
 1526: \def\rmisbold{\rm\def\curfontstyle{bf}}
 1527: 
 1528: % Texinfo sort of supports the sans serif font style, which plain TeX does not.
 1529: % So we set up a \sf.
 1530: \newfam\sffam
 1531: \def\sf{\fam=\sffam \setfontstyle{sf}}
 1532: \let\li = \sf % Sometimes we call it \li, not \sf.
 1533: 
 1534: % We don't need math for this font style.
 1535: \def\ttsl{\setfontstyle{ttsl}}
 1536: 
 1537: 
 1538: % Set the baselineskip to #1, and the lineskip and strut size
 1539: % correspondingly.  There is no deep meaning behind these magic numbers
 1540: % used as factors; they just match (closely enough) what Knuth defined.
 1541: %
 1542: \def\lineskipfactor{.08333}
 1543: \def\strutheightpercent{.70833}
 1544: \def\strutdepthpercent {.29167}
 1545: %
 1546: % can get a sort of poor man's double spacing by redefining this.
 1547: \def\baselinefactor{1}
 1548: %
 1549: \newdimen\textleading
 1550: \def\setleading#1{%
 1551:   \dimen0 = #1\relax
 1552:   \normalbaselineskip = \baselinefactor\dimen0
 1553:   \normallineskip = \lineskipfactor\normalbaselineskip
 1554:   \normalbaselines
 1555:   \setbox\strutbox =\hbox{%
 1556:     \vrule width0pt height\strutheightpercent\baselineskip
 1557:                     depth \strutdepthpercent \baselineskip
 1558:   }%
 1559: }
 1560: 
 1561: % PDF CMaps.  See also LaTeX's t1.cmap.
 1562: %
 1563: % do nothing with this by default.
 1564: \expandafter\let\csname cmapOT1\endcsname\gobble
 1565: \expandafter\let\csname cmapOT1IT\endcsname\gobble
 1566: \expandafter\let\csname cmapOT1TT\endcsname\gobble
 1567: 
 1568: % if we are producing pdf, and we have \pdffontattr, then define cmaps.
 1569: % (\pdffontattr was introduced many years ago, but people still run
 1570: % older pdftex's; it's easy to conditionalize, so we do.)
 1571: \ifpdf \ifx\pdffontattr\thisisundefined \else
 1572:   \begingroup
 1573:     \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
 1574:     \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
 1575: %%DocumentNeededResources: ProcSet (CIDInit)
 1576: %%IncludeResource: ProcSet (CIDInit)
 1577: %%BeginResource: CMap (TeX-OT1-0)
 1578: %%Title: (TeX-OT1-0 TeX OT1 0)
 1579: %%Version: 1.000
 1580: %%EndComments
 1581: /CIDInit /ProcSet findresource begin
 1582: 12 dict begin
 1583: begincmap
 1584: /CIDSystemInfo
 1585: << /Registry (TeX)
 1586: /Ordering (OT1)
 1587: /Supplement 0
 1588: >> def
 1589: /CMapName /TeX-OT1-0 def
 1590: /CMapType 2 def
 1591: 1 begincodespacerange
 1592: <00> <7F>
 1593: endcodespacerange
 1594: 8 beginbfrange
 1595: <00> <01> <0393>
 1596: <09> <0A> <03A8>
 1597: <23> <26> <0023>
 1598: <28> <3B> <0028>
 1599: <3F> <5B> <003F>
 1600: <5D> <5E> <005D>
 1601: <61> <7A> <0061>
 1602: <7B> <7C> <2013>
 1603: endbfrange
 1604: 40 beginbfchar
 1605: <02> <0398>
 1606: <03> <039B>
 1607: <04> <039E>
 1608: <05> <03A0>
 1609: <06> <03A3>
 1610: <07> <03D2>
 1611: <08> <03A6>
 1612: <0B> <00660066>
 1613: <0C> <00660069>
 1614: <0D> <0066006C>
 1615: <0E> <006600660069>
 1616: <0F> <00660066006C>
 1617: <10> <0131>
 1618: <11> <0237>
 1619: <12> <0060>
 1620: <13> <00B4>
 1621: <14> <02C7>
 1622: <15> <02D8>
 1623: <16> <00AF>
 1624: <17> <02DA>
 1625: <18> <00B8>
 1626: <19> <00DF>
 1627: <1A> <00E6>
 1628: <1B> <0153>
 1629: <1C> <00F8>
 1630: <1D> <00C6>
 1631: <1E> <0152>
 1632: <1F> <00D8>
 1633: <21> <0021>
 1634: <22> <201D>
 1635: <27> <2019>
 1636: <3C> <00A1>
 1637: <3D> <003D>
 1638: <3E> <00BF>
 1639: <5C> <201C>
 1640: <5F> <02D9>
 1641: <60> <2018>
 1642: <7D> <02DD>
 1643: <7E> <007E>
 1644: <7F> <00A8>
 1645: endbfchar
 1646: endcmap
 1647: CMapName currentdict /CMap defineresource pop
 1648: end
 1649: end
 1650: %%EndResource
 1651: %%EOF
 1652:     }\endgroup
 1653:   \expandafter\edef\csname cmapOT1\endcsname#1{%
 1654:     \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
 1655:   }%
 1656: %
 1657: % \cmapOT1IT
 1658:   \begingroup
 1659:     \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
 1660:     \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
 1661: %%DocumentNeededResources: ProcSet (CIDInit)
 1662: %%IncludeResource: ProcSet (CIDInit)
 1663: %%BeginResource: CMap (TeX-OT1IT-0)
 1664: %%Title: (TeX-OT1IT-0 TeX OT1IT 0)
 1665: %%Version: 1.000
 1666: %%EndComments
 1667: /CIDInit /ProcSet findresource begin
 1668: 12 dict begin
 1669: begincmap
 1670: /CIDSystemInfo
 1671: << /Registry (TeX)
 1672: /Ordering (OT1IT)
 1673: /Supplement 0
 1674: >> def
 1675: /CMapName /TeX-OT1IT-0 def
 1676: /CMapType 2 def
 1677: 1 begincodespacerange
 1678: <00> <7F>
 1679: endcodespacerange
 1680: 8 beginbfrange
 1681: <00> <01> <0393>
 1682: <09> <0A> <03A8>
 1683: <25> <26> <0025>
 1684: <28> <3B> <0028>
 1685: <3F> <5B> <003F>
 1686: <5D> <5E> <005D>
 1687: <61> <7A> <0061>
 1688: <7B> <7C> <2013>
 1689: endbfrange
 1690: 42 beginbfchar
 1691: <02> <0398>
 1692: <03> <039B>
 1693: <04> <039E>
 1694: <05> <03A0>
 1695: <06> <03A3>
 1696: <07> <03D2>
 1697: <08> <03A6>
 1698: <0B> <00660066>
 1699: <0C> <00660069>
 1700: <0D> <0066006C>
 1701: <0E> <006600660069>
 1702: <0F> <00660066006C>
 1703: <10> <0131>
 1704: <11> <0237>
 1705: <12> <0060>
 1706: <13> <00B4>
 1707: <14> <02C7>
 1708: <15> <02D8>
 1709: <16> <00AF>
 1710: <17> <02DA>
 1711: <18> <00B8>
 1712: <19> <00DF>
 1713: <1A> <00E6>
 1714: <1B> <0153>
 1715: <1C> <00F8>
 1716: <1D> <00C6>
 1717: <1E> <0152>
 1718: <1F> <00D8>
 1719: <21> <0021>
 1720: <22> <201D>
 1721: <23> <0023>
 1722: <24> <00A3>
 1723: <27> <2019>
 1724: <3C> <00A1>
 1725: <3D> <003D>
 1726: <3E> <00BF>
 1727: <5C> <201C>
 1728: <5F> <02D9>
 1729: <60> <2018>
 1730: <7D> <02DD>
 1731: <7E> <007E>
 1732: <7F> <00A8>
 1733: endbfchar
 1734: endcmap
 1735: CMapName currentdict /CMap defineresource pop
 1736: end
 1737: end
 1738: %%EndResource
 1739: %%EOF
 1740:     }\endgroup
 1741:   \expandafter\edef\csname cmapOT1IT\endcsname#1{%
 1742:     \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
 1743:   }%
 1744: %
 1745: % \cmapOT1TT
 1746:   \begingroup
 1747:     \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
 1748:     \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
 1749: %%DocumentNeededResources: ProcSet (CIDInit)
 1750: %%IncludeResource: ProcSet (CIDInit)
 1751: %%BeginResource: CMap (TeX-OT1TT-0)
 1752: %%Title: (TeX-OT1TT-0 TeX OT1TT 0)
 1753: %%Version: 1.000
 1754: %%EndComments
 1755: /CIDInit /ProcSet findresource begin
 1756: 12 dict begin
 1757: begincmap
 1758: /CIDSystemInfo
 1759: << /Registry (TeX)
 1760: /Ordering (OT1TT)
 1761: /Supplement 0
 1762: >> def
 1763: /CMapName /TeX-OT1TT-0 def
 1764: /CMapType 2 def
 1765: 1 begincodespacerange
 1766: <00> <7F>
 1767: endcodespacerange
 1768: 5 beginbfrange
 1769: <00> <01> <0393>
 1770: <09> <0A> <03A8>
 1771: <21> <26> <0021>
 1772: <28> <5F> <0028>
 1773: <61> <7E> <0061>
 1774: endbfrange
 1775: 32 beginbfchar
 1776: <02> <0398>
 1777: <03> <039B>
 1778: <04> <039E>
 1779: <05> <03A0>
 1780: <06> <03A3>
 1781: <07> <03D2>
 1782: <08> <03A6>
 1783: <0B> <2191>
 1784: <0C> <2193>
 1785: <0D> <0027>
 1786: <0E> <00A1>
 1787: <0F> <00BF>
 1788: <10> <0131>
 1789: <11> <0237>
 1790: <12> <0060>
 1791: <13> <00B4>
 1792: <14> <02C7>
 1793: <15> <02D8>
 1794: <16> <00AF>
 1795: <17> <02DA>
 1796: <18> <00B8>
 1797: <19> <00DF>
 1798: <1A> <00E6>
 1799: <1B> <0153>
 1800: <1C> <00F8>
 1801: <1D> <00C6>
 1802: <1E> <0152>
 1803: <1F> <00D8>
 1804: <20> <2423>
 1805: <27> <2019>
 1806: <60> <2018>
 1807: <7F> <00A8>
 1808: endbfchar
 1809: endcmap
 1810: CMapName currentdict /CMap defineresource pop
 1811: end
 1812: end
 1813: %%EndResource
 1814: %%EOF
 1815:     }\endgroup
 1816:   \expandafter\edef\csname cmapOT1TT\endcsname#1{%
 1817:     \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
 1818:   }%
 1819: \fi\fi
 1820: 
 1821: 
 1822: % Set the font macro #1 to the font named \fontprefix#2.
 1823: % #3 is the font's design size, #4 is a scale factor, #5 is the CMap
 1824: % encoding (only OT1, OT1IT and OT1TT are allowed, or empty to omit).
 1825: % Example:
 1826: % #1 = \textrm
 1827: % #2 = \rmshape
 1828: % #3 = 10
 1829: % #4 = \mainmagstep
 1830: % #5 = OT1
 1831: %
 1832: \def\setfont#1#2#3#4#5{%
 1833:   \font#1=\fontprefix#2#3 scaled #4
 1834:   \csname cmap#5\endcsname#1%
 1835: }
 1836: % This is what gets called when #5 of \setfont is empty.
 1837: \let\cmap\gobble
 1838: %
 1839: % (end of cmaps)
 1840: 
 1841: % Use cm as the default font prefix.
 1842: % To specify the font prefix, you must define \fontprefix
 1843: % before you read in texinfo.tex.
 1844: \ifx\fontprefix\thisisundefined
 1845: \def\fontprefix{cm}
 1846: \fi
 1847: % Support font families that don't use the same naming scheme as CM.
 1848: \def\rmshape{r}
 1849: \def\rmbshape{bx}               % where the normal face is bold
 1850: \def\bfshape{b}
 1851: \def\bxshape{bx}
 1852: \def\ttshape{tt}
 1853: \def\ttbshape{tt}
 1854: \def\ttslshape{sltt}
 1855: \def\itshape{ti}
 1856: \def\itbshape{bxti}
 1857: \def\slshape{sl}
 1858: \def\slbshape{bxsl}
 1859: \def\sfshape{ss}
 1860: \def\sfbshape{ss}
 1861: \def\scshape{csc}
 1862: \def\scbshape{csc}
 1863: 
 1864: % Definitions for a main text size of 11pt.  (The default in Texinfo.)
 1865: %
 1866: \def\definetextfontsizexi{%
 1867: % Text fonts (11.2pt, magstep1).
 1868: \def\textnominalsize{11pt}
 1869: \edef\mainmagstep{\magstephalf}
 1870: \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
 1871: \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
 1872: \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
 1873: \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
 1874: \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
 1875: \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
 1876: \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
 1877: \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
 1878: \font\texti=cmmi10 scaled \mainmagstep
 1879: \font\textsy=cmsy10 scaled \mainmagstep
 1880: \def\textecsize{1095}
 1881: 
 1882: % A few fonts for @defun names and args.
 1883: \setfont\defbf\bfshape{10}{\magstep1}{OT1}
 1884: \setfont\deftt\ttshape{10}{\magstep1}{OT1TT}
 1885: \setfont\defsl\slshape{10}{\magstep1}{OT1TT}
 1886: \setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT}
 1887: \def\df{\let\tentt=\deftt \let\tenbf = \defbf
 1888: \let\tenttsl=\defttsl \let\tensl=\defsl \bf}
 1889: 
 1890: % Fonts for indices, footnotes, small examples (9pt).
 1891: \def\smallnominalsize{9pt}
 1892: \setfont\smallrm\rmshape{9}{1000}{OT1}
 1893: \setfont\smalltt\ttshape{9}{1000}{OT1TT}
 1894: \setfont\smallbf\bfshape{10}{900}{OT1}
 1895: \setfont\smallit\itshape{9}{1000}{OT1IT}
 1896: \setfont\smallsl\slshape{9}{1000}{OT1}
 1897: \setfont\smallsf\sfshape{9}{1000}{OT1}
 1898: \setfont\smallsc\scshape{10}{900}{OT1}
 1899: \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
 1900: \font\smalli=cmmi9
 1901: \font\smallsy=cmsy9
 1902: \def\smallecsize{0900}
 1903: 
 1904: % Fonts for small examples (8pt).
 1905: \def\smallernominalsize{8pt}
 1906: \setfont\smallerrm\rmshape{8}{1000}{OT1}
 1907: \setfont\smallertt\ttshape{8}{1000}{OT1TT}
 1908: \setfont\smallerbf\bfshape{10}{800}{OT1}
 1909: \setfont\smallerit\itshape{8}{1000}{OT1IT}
 1910: \setfont\smallersl\slshape{8}{1000}{OT1}
 1911: \setfont\smallersf\sfshape{8}{1000}{OT1}
 1912: \setfont\smallersc\scshape{10}{800}{OT1}
 1913: \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
 1914: \font\smalleri=cmmi8
 1915: \font\smallersy=cmsy8
 1916: \def\smallerecsize{0800}
 1917: 
 1918: % Fonts for title page (20.4pt):
 1919: \def\titlenominalsize{20pt}
 1920: \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
 1921: \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
 1922: \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
 1923: \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
 1924: \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
 1925: \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
 1926: \let\titlebf=\titlerm
 1927: \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
 1928: \font\titlei=cmmi12 scaled \magstep3
 1929: \font\titlesy=cmsy10 scaled \magstep4
 1930: \def\titleecsize{2074}
 1931: 
 1932: % Chapter (and unnumbered) fonts (17.28pt).
 1933: \def\chapnominalsize{17pt}
 1934: \setfont\chaprm\rmbshape{12}{\magstep2}{OT1}
 1935: \setfont\chapit\itbshape{10}{\magstep3}{OT1IT}
 1936: \setfont\chapsl\slbshape{10}{\magstep3}{OT1}
 1937: \setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT}
 1938: \setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT}
 1939: \setfont\chapsf\sfbshape{17}{1000}{OT1}
 1940: \let\chapbf=\chaprm
 1941: \setfont\chapsc\scbshape{10}{\magstep3}{OT1}
 1942: \font\chapi=cmmi12 scaled \magstep2
 1943: \font\chapsy=cmsy10 scaled \magstep3
 1944: \def\chapecsize{1728}
 1945: 
 1946: % Section fonts (14.4pt).
 1947: \def\secnominalsize{14pt}
 1948: \setfont\secrm\rmbshape{12}{\magstep1}{OT1}
 1949: \setfont\secrmnotbold\rmshape{12}{\magstep1}{OT1}
 1950: \setfont\secit\itbshape{10}{\magstep2}{OT1IT}
 1951: \setfont\secsl\slbshape{10}{\magstep2}{OT1}
 1952: \setfont\sectt\ttbshape{12}{\magstep1}{OT1TT}
 1953: \setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT}
 1954: \setfont\secsf\sfbshape{12}{\magstep1}{OT1}
 1955: \let\secbf\secrm
 1956: \setfont\secsc\scbshape{10}{\magstep2}{OT1}
 1957: \font\seci=cmmi12 scaled \magstep1
 1958: \font\secsy=cmsy10 scaled \magstep2
 1959: \def\sececsize{1440}
 1960: 
 1961: % Subsection fonts (13.15pt).
 1962: \def\ssecnominalsize{13pt}
 1963: \setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1}
 1964: \setfont\ssecit\itbshape{10}{1315}{OT1IT}
 1965: \setfont\ssecsl\slbshape{10}{1315}{OT1}
 1966: \setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT}
 1967: \setfont\ssecttsl\ttslshape{10}{1315}{OT1TT}
 1968: \setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1}
 1969: \let\ssecbf\ssecrm
 1970: \setfont\ssecsc\scbshape{10}{1315}{OT1}
 1971: \font\sseci=cmmi12 scaled \magstephalf
 1972: \font\ssecsy=cmsy10 scaled 1315
 1973: \def\ssececsize{1200}
 1974: 
 1975: % Reduced fonts for @acro in text (10pt).
 1976: \def\reducednominalsize{10pt}
 1977: \setfont\reducedrm\rmshape{10}{1000}{OT1}
 1978: \setfont\reducedtt\ttshape{10}{1000}{OT1TT}
 1979: \setfont\reducedbf\bfshape{10}{1000}{OT1}
 1980: \setfont\reducedit\itshape{10}{1000}{OT1IT}
 1981: \setfont\reducedsl\slshape{10}{1000}{OT1}
 1982: \setfont\reducedsf\sfshape{10}{1000}{OT1}
 1983: \setfont\reducedsc\scshape{10}{1000}{OT1}
 1984: \setfont\reducedttsl\ttslshape{10}{1000}{OT1TT}
 1985: \font\reducedi=cmmi10
 1986: \font\reducedsy=cmsy10
 1987: \def\reducedecsize{1000}
 1988: 
 1989: \textleading = 13.2pt % line spacing for 11pt CM
 1990: \textfonts            % reset the current fonts
 1991: \rm
 1992: } % end of 11pt text font size definitions, \definetextfontsizexi
 1993: 
 1994: 
 1995: % Definitions to make the main text be 10pt Computer Modern, with
 1996: % section, chapter, etc., sizes following suit.  This is for the GNU
 1997: % Press printing of the Emacs 22 manual.  Maybe other manuals in the
 1998: % future.  Used with @smallbook, which sets the leading to 12pt.
 1999: %
 2000: \def\definetextfontsizex{%
 2001: % Text fonts (10pt).
 2002: \def\textnominalsize{10pt}
 2003: \edef\mainmagstep{1000}
 2004: \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
 2005: \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
 2006: \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
 2007: \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
 2008: \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
 2009: \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
 2010: \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
 2011: \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
 2012: \font\texti=cmmi10 scaled \mainmagstep
 2013: \font\textsy=cmsy10 scaled \mainmagstep
 2014: \def\textecsize{1000}
 2015: 
 2016: % A few fonts for @defun names and args.
 2017: \setfont\defbf\bfshape{10}{\magstephalf}{OT1}
 2018: \setfont\deftt\ttshape{10}{\magstephalf}{OT1TT}
 2019: \setfont\defsl\slshape{10}{\magstephalf}{OT1TT}
 2020: \setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT}
 2021: \def\df{\let\tentt=\deftt \let\tenbf = \defbf
 2022: \let\tensl=\defsl \let\tenttsl=\defttsl \bf}
 2023: 
 2024: % Fonts for indices, footnotes, small examples (9pt).
 2025: \def\smallnominalsize{9pt}
 2026: \setfont\smallrm\rmshape{9}{1000}{OT1}
 2027: \setfont\smalltt\ttshape{9}{1000}{OT1TT}
 2028: \setfont\smallbf\bfshape{10}{900}{OT1}
 2029: \setfont\smallit\itshape{9}{1000}{OT1IT}
 2030: \setfont\smallsl\slshape{9}{1000}{OT1}
 2031: \setfont\smallsf\sfshape{9}{1000}{OT1}
 2032: \setfont\smallsc\scshape{10}{900}{OT1}
 2033: \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
 2034: \font\smalli=cmmi9
 2035: \font\smallsy=cmsy9
 2036: \def\smallecsize{0900}
 2037: 
 2038: % Fonts for small examples (8pt).
 2039: \def\smallernominalsize{8pt}
 2040: \setfont\smallerrm\rmshape{8}{1000}{OT1}
 2041: \setfont\smallertt\ttshape{8}{1000}{OT1TT}
 2042: \setfont\smallerbf\bfshape{10}{800}{OT1}
 2043: \setfont\smallerit\itshape{8}{1000}{OT1IT}
 2044: \setfont\smallersl\slshape{8}{1000}{OT1}
 2045: \setfont\smallersf\sfshape{8}{1000}{OT1}
 2046: \setfont\smallersc\scshape{10}{800}{OT1}
 2047: \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
 2048: \font\smalleri=cmmi8
 2049: \font\smallersy=cmsy8
 2050: \def\smallerecsize{0800}
 2051: 
 2052: % Fonts for title page (20.4pt):
 2053: \def\titlenominalsize{20pt}
 2054: \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
 2055: \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
 2056: \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
 2057: \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
 2058: \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
 2059: \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
 2060: \let\titlebf=\titlerm
 2061: \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
 2062: \font\titlei=cmmi12 scaled \magstep3
 2063: \font\titlesy=cmsy10 scaled \magstep4
 2064: \def\titleecsize{2074}
 2065: 
 2066: % Chapter fonts (14.4pt).
 2067: \def\chapnominalsize{14pt}
 2068: \setfont\chaprm\rmbshape{12}{\magstep1}{OT1}
 2069: \setfont\chapit\itbshape{10}{\magstep2}{OT1IT}
 2070: \setfont\chapsl\slbshape{10}{\magstep2}{OT1}
 2071: \setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT}
 2072: \setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT}
 2073: \setfont\chapsf\sfbshape{12}{\magstep1}{OT1}
 2074: \let\chapbf\chaprm
 2075: \setfont\chapsc\scbshape{10}{\magstep2}{OT1}
 2076: \font\chapi=cmmi12 scaled \magstep1
 2077: \font\chapsy=cmsy10 scaled \magstep2
 2078: \def\chapecsize{1440}
 2079: 
 2080: % Section fonts (12pt).
 2081: \def\secnominalsize{12pt}
 2082: \setfont\secrm\rmbshape{12}{1000}{OT1}
 2083: \setfont\secit\itbshape{10}{\magstep1}{OT1IT}
 2084: \setfont\secsl\slbshape{10}{\magstep1}{OT1}
 2085: \setfont\sectt\ttbshape{12}{1000}{OT1TT}
 2086: \setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT}
 2087: \setfont\secsf\sfbshape{12}{1000}{OT1}
 2088: \let\secbf\secrm
 2089: \setfont\secsc\scbshape{10}{\magstep1}{OT1}
 2090: \font\seci=cmmi12
 2091: \font\secsy=cmsy10 scaled \magstep1
 2092: \def\sececsize{1200}
 2093: 
 2094: % Subsection fonts (10pt).
 2095: \def\ssecnominalsize{10pt}
 2096: \setfont\ssecrm\rmbshape{10}{1000}{OT1}
 2097: \setfont\ssecit\itbshape{10}{1000}{OT1IT}
 2098: \setfont\ssecsl\slbshape{10}{1000}{OT1}
 2099: \setfont\ssectt\ttbshape{10}{1000}{OT1TT}
 2100: \setfont\ssecttsl\ttslshape{10}{1000}{OT1TT}
 2101: \setfont\ssecsf\sfbshape{10}{1000}{OT1}
 2102: \let\ssecbf\ssecrm
 2103: \setfont\ssecsc\scbshape{10}{1000}{OT1}
 2104: \font\sseci=cmmi10
 2105: \font\ssecsy=cmsy10
 2106: \def\ssececsize{1000}
 2107: 
 2108: % Reduced fonts for @acro in text (9pt).
 2109: \def\reducednominalsize{9pt}
 2110: \setfont\reducedrm\rmshape{9}{1000}{OT1}
 2111: \setfont\reducedtt\ttshape{9}{1000}{OT1TT}
 2112: \setfont\reducedbf\bfshape{10}{900}{OT1}
 2113: \setfont\reducedit\itshape{9}{1000}{OT1IT}
 2114: \setfont\reducedsl\slshape{9}{1000}{OT1}
 2115: \setfont\reducedsf\sfshape{9}{1000}{OT1}
 2116: \setfont\reducedsc\scshape{10}{900}{OT1}
 2117: \setfont\reducedttsl\ttslshape{10}{900}{OT1TT}
 2118: \font\reducedi=cmmi9
 2119: \font\reducedsy=cmsy9
 2120: \def\reducedecsize{0900}
 2121: 
 2122: \divide\parskip by 2  % reduce space between paragraphs
 2123: \textleading = 12pt   % line spacing for 10pt CM
 2124: \textfonts            % reset the current fonts
 2125: \rm
 2126: } % end of 10pt text font size definitions, \definetextfontsizex
 2127: 
 2128: 
 2129: % We provide the user-level command
 2130: %   @fonttextsize 10
 2131: % (or 11) to redefine the text font size.  pt is assumed.
 2132: %
 2133: \def\xiword{11}
 2134: \def\xword{10}
 2135: \def\xwordpt{10pt}
 2136: %
 2137: \parseargdef\fonttextsize{%
 2138:   \def\textsizearg{#1}%
 2139:   %\wlog{doing @fonttextsize \textsizearg}%
 2140:   %
 2141:   % Set \globaldefs so that documents can use this inside @tex, since
 2142:   % makeinfo 4.8 does not support it, but we need it nonetheless.
 2143:   %
 2144:  \begingroup \globaldefs=1
 2145:   \ifx\textsizearg\xword \definetextfontsizex
 2146:   \else \ifx\textsizearg\xiword \definetextfontsizexi
 2147:   \else
 2148:     \errhelp=\EMsimple
 2149:     \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'}
 2150:   \fi\fi
 2151:  \endgroup
 2152: }
 2153: 
 2154: % In order for the font changes to affect most math symbols and letters,
 2155: % we have to define the \textfont of the standard families.  We don't
 2156: % bother to reset \scriptfont and \scriptscriptfont; awaiting user need.
 2157: %
 2158: \def\resetmathfonts{%
 2159:   \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy
 2160:   \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf
 2161:   \textfont\ttfam=\tentt \textfont\sffam=\tensf
 2162: }
 2163: 
 2164: % The font-changing commands redefine the meanings of \tenSTYLE, instead
 2165: % of just \STYLE.  We do this because \STYLE needs to also set the
 2166: % current \fam for math mode.  Our \STYLE (e.g., \rm) commands hardwire
 2167: % \tenSTYLE to set the current font.
 2168: %
 2169: % Each font-changing command also sets the names \lsize (one size lower)
 2170: % and \lllsize (three sizes lower).  These relative commands are used
 2171: % in, e.g., the LaTeX logo and acronyms.
 2172: %
 2173: % This all needs generalizing, badly.
 2174: %
 2175: \def\textfonts{%
 2176:   \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
 2177:   \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
 2178:   \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy
 2179:   \let\tenttsl=\textttsl
 2180:   \def\curfontsize{text}%
 2181:   \def\lsize{reduced}\def\lllsize{smaller}%
 2182:   \resetmathfonts \setleading{\textleading}}
 2183: \def\titlefonts{%
 2184:   \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl
 2185:   \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc
 2186:   \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
 2187:   \let\tenttsl=\titlettsl
 2188:   \def\curfontsize{title}%
 2189:   \def\lsize{chap}\def\lllsize{subsec}%
 2190:   \resetmathfonts \setleading{27pt}}
 2191: \def\titlefont#1{{\titlefonts\rmisbold #1}}
 2192: \def\chapfonts{%
 2193:   \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
 2194:   \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
 2195:   \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy
 2196:   \let\tenttsl=\chapttsl
 2197:   \def\curfontsize{chap}%
 2198:   \def\lsize{sec}\def\lllsize{text}%
 2199:   \resetmathfonts \setleading{19pt}}
 2200: \def\secfonts{%
 2201:   \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
 2202:   \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
 2203:   \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy
 2204:   \let\tenttsl=\secttsl
 2205:   \def\curfontsize{sec}%
 2206:   \def\lsize{subsec}\def\lllsize{reduced}%
 2207:   \resetmathfonts \setleading{17pt}}
 2208: \def\subsecfonts{%
 2209:   \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
 2210:   \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
 2211:   \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy
 2212:   \let\tenttsl=\ssecttsl
 2213:   \def\curfontsize{ssec}%
 2214:   \def\lsize{text}\def\lllsize{small}%
 2215:   \resetmathfonts \setleading{15pt}}
 2216: \let\subsubsecfonts = \subsecfonts
 2217: \def\reducedfonts{%
 2218:   \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl
 2219:   \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc
 2220:   \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy
 2221:   \let\tenttsl=\reducedttsl
 2222:   \def\curfontsize{reduced}%
 2223:   \def\lsize{small}\def\lllsize{smaller}%
 2224:   \resetmathfonts \setleading{10.5pt}}
 2225: \def\smallfonts{%
 2226:   \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl
 2227:   \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc
 2228:   \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy
 2229:   \let\tenttsl=\smallttsl
 2230:   \def\curfontsize{small}%
 2231:   \def\lsize{smaller}\def\lllsize{smaller}%
 2232:   \resetmathfonts \setleading{10.5pt}}
 2233: \def\smallerfonts{%
 2234:   \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl
 2235:   \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc
 2236:   \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy
 2237:   \let\tenttsl=\smallerttsl
 2238:   \def\curfontsize{smaller}%
 2239:   \def\lsize{smaller}\def\lllsize{smaller}%
 2240:   \resetmathfonts \setleading{9.5pt}}
 2241: 
 2242: % Fonts for short table of contents.
 2243: \setfont\shortcontrm\rmshape{12}{1000}{OT1}
 2244: \setfont\shortcontbf\bfshape{10}{\magstep1}{OT1}  % no cmb12
 2245: \setfont\shortcontsl\slshape{12}{1000}{OT1}
 2246: \setfont\shortconttt\ttshape{12}{1000}{OT1TT}
 2247: 
 2248: % Define these just so they can be easily changed for other fonts.
 2249: \def\angleleft{$\langle$}
 2250: \def\angleright{$\rangle$}
 2251: 
 2252: % Set the fonts to use with the @small... environments.
 2253: \let\smallexamplefonts = \smallfonts
 2254: 
 2255: % About \smallexamplefonts.  If we use \smallfonts (9pt), @smallexample
 2256: % can fit this many characters:
 2257: %   8.5x11=86   smallbook=72  a4=90  a5=69
 2258: % If we use \scriptfonts (8pt), then we can fit this many characters:
 2259: %   8.5x11=90+  smallbook=80  a4=90+  a5=77
 2260: % For me, subjectively, the few extra characters that fit aren't worth
 2261: % the additional smallness of 8pt.  So I'm making the default 9pt.
 2262: %
 2263: % By the way, for comparison, here's what fits with @example (10pt):
 2264: %   8.5x11=71  smallbook=60  a4=75  a5=58
 2265: % --karl, 24jan03.
 2266: 
 2267: % Set up the default fonts, so we can use them for creating boxes.
 2268: %
 2269: \definetextfontsizexi
 2270: 
 2271: 
 2272: \message{markup,}
 2273: 
 2274: % Check if we are currently using a typewriter font.  Since all the
 2275: % Computer Modern typewriter fonts have zero interword stretch (and
 2276: % shrink), and it is reasonable to expect all typewriter fonts to have
 2277: % this property, we can check that font parameter.
 2278: %
 2279: \def\ifmonospace{\ifdim\fontdimen3\font=0pt }
 2280: 
 2281: % Markup style infrastructure.  \defmarkupstylesetup\INITMACRO will
 2282: % define and register \INITMACRO to be called on markup style changes.
 2283: % \INITMACRO can check \currentmarkupstyle for the innermost
 2284: % style and the set of \ifmarkupSTYLE switches for all styles
 2285: % currently in effect.
 2286: \newif\ifmarkupvar
 2287: \newif\ifmarkupsamp
 2288: \newif\ifmarkupkey
 2289: %\newif\ifmarkupfile % @file == @samp.
 2290: %\newif\ifmarkupoption % @option == @samp.
 2291: \newif\ifmarkupcode
 2292: \newif\ifmarkupkbd
 2293: %\newif\ifmarkupenv % @env == @code.
 2294: %\newif\ifmarkupcommand % @command == @code.
 2295: \newif\ifmarkuptex % @tex (and part of @math, for now).
 2296: \newif\ifmarkupexample
 2297: \newif\ifmarkupverb
 2298: \newif\ifmarkupverbatim
 2299: 
 2300: \let\currentmarkupstyle\empty
 2301: 
 2302: \def\setupmarkupstyle#1{%
 2303:   \csname markup#1true\endcsname
 2304:   \def\currentmarkupstyle{#1}%
 2305:   \markupstylesetup
 2306: }
 2307: 
 2308: \let\markupstylesetup\empty
 2309: 
 2310: \def\defmarkupstylesetup#1{%
 2311:   \expandafter\def\expandafter\markupstylesetup
 2312:     \expandafter{\markupstylesetup #1}%
 2313:   \def#1%
 2314: }
 2315: 
 2316: % Markup style setup for left and right quotes.
 2317: \defmarkupstylesetup\markupsetuplq{%
 2318:   \expandafter\let\expandafter \temp
 2319:     \csname markupsetuplq\currentmarkupstyle\endcsname
 2320:   \ifx\temp\relax \markupsetuplqdefault \else \temp \fi
 2321: }
 2322: 
 2323: \defmarkupstylesetup\markupsetuprq{%
 2324:   \expandafter\let\expandafter \temp
 2325:     \csname markupsetuprq\currentmarkupstyle\endcsname
 2326:   \ifx\temp\relax \markupsetuprqdefault \else \temp \fi
 2327: }
 2328: 
 2329: {
 2330: \catcode`\'=\active
 2331: \catcode`\`=\active
 2332: 
 2333: \gdef\markupsetuplqdefault{\let`\lq}
 2334: \gdef\markupsetuprqdefault{\let'\rq}
 2335: 
 2336: \gdef\markupsetcodequoteleft{\let`\codequoteleft}
 2337: \gdef\markupsetcodequoteright{\let'\codequoteright}
 2338: }
 2339: 
 2340: \let\markupsetuplqcode \markupsetcodequoteleft
 2341: \let\markupsetuprqcode \markupsetcodequoteright
 2342: %
 2343: \let\markupsetuplqexample \markupsetcodequoteleft
 2344: \let\markupsetuprqexample \markupsetcodequoteright
 2345: %
 2346: \let\markupsetuplqkbd     \markupsetcodequoteleft
 2347: \let\markupsetuprqkbd     \markupsetcodequoteright
 2348: %
 2349: \let\markupsetuplqsamp \markupsetcodequoteleft
 2350: \let\markupsetuprqsamp \markupsetcodequoteright
 2351: %
 2352: \let\markupsetuplqverb \markupsetcodequoteleft
 2353: \let\markupsetuprqverb \markupsetcodequoteright
 2354: %
 2355: \let\markupsetuplqverbatim \markupsetcodequoteleft
 2356: \let\markupsetuprqverbatim \markupsetcodequoteright
 2357: 
 2358: % Allow an option to not use regular directed right quote/apostrophe
 2359: % (char 0x27), but instead the undirected quote from cmtt (char 0x0d).
 2360: % The undirected quote is ugly, so don't make it the default, but it
 2361: % works for pasting with more pdf viewers (at least evince), the
 2362: % lilypond developers report.  xpdf does work with the regular 0x27.
 2363: %
 2364: \def\codequoteright{%
 2365:   \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax
 2366:     \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax
 2367:       '%
 2368:     \else \char'15 \fi
 2369:   \else \char'15 \fi
 2370: }
 2371: %
 2372: % and a similar option for the left quote char vs. a grave accent.
 2373: % Modern fonts display ASCII 0x60 as a grave accent, so some people like
 2374: % the code environments to do likewise.
 2375: %
 2376: \def\codequoteleft{%
 2377:   \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax
 2378:     \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax
 2379:       % [Knuth] pp. 380,381,391
 2380:       % \relax disables Spanish ligatures ?` and !` of \tt font.
 2381:       \relax`%
 2382:     \else \char'22 \fi
 2383:   \else \char'22 \fi
 2384: }
 2385: 
 2386: % Commands to set the quote options.
 2387: % 
 2388: \parseargdef\codequoteundirected{%
 2389:   \def\temp{#1}%
 2390:   \ifx\temp\onword
 2391:     \expandafter\let\csname SETtxicodequoteundirected\endcsname
 2392:       = t%
 2393:   \else\ifx\temp\offword
 2394:     \expandafter\let\csname SETtxicodequoteundirected\endcsname
 2395:       = \relax
 2396:   \else
 2397:     \errhelp = \EMsimple
 2398:     \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}%
 2399:   \fi\fi
 2400: }
 2401: %
 2402: \parseargdef\codequotebacktick{%
 2403:   \def\temp{#1}%
 2404:   \ifx\temp\onword
 2405:     \expandafter\let\csname SETtxicodequotebacktick\endcsname
 2406:       = t%
 2407:   \else\ifx\temp\offword
 2408:     \expandafter\let\csname SETtxicodequotebacktick\endcsname
 2409:       = \relax
 2410:   \else
 2411:     \errhelp = \EMsimple
 2412:     \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}%
 2413:   \fi\fi
 2414: }
 2415: 
 2416: % [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font.
 2417: \def\noligaturesquoteleft{\relax\lq}
 2418: 
 2419: % Count depth in font-changes, for error checks
 2420: \newcount\fontdepth \fontdepth=0
 2421: 
 2422: % Font commands.
 2423: 
 2424: % #1 is the font command (\sl or \it), #2 is the text to slant.
 2425: % If we are in a monospaced environment, however, 1) always use \ttsl,
 2426: % and 2) do not add an italic correction.
 2427: \def\dosmartslant#1#2{%
 2428:   \ifusingtt 
 2429:     {{\ttsl #2}\let\next=\relax}%
 2430:     {\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}%
 2431:   \next
 2432: }
 2433: \def\smartslanted{\dosmartslant\sl}
 2434: \def\smartitalic{\dosmartslant\it}
 2435: 
 2436: % Output an italic correction unless \next (presumed to be the following
 2437: % character) is such as not to need one.
 2438: \def\smartitaliccorrection{%
 2439:   \ifx\next,%
 2440:   \else\ifx\next-%
 2441:   \else\ifx\next.%
 2442:   \else\ifx\next\.%
 2443:   \else\ifx\next\comma%
 2444:   \else\ptexslash
 2445:   \fi\fi\fi\fi\fi
 2446:   \aftersmartic
 2447: }
 2448: 
 2449: % Unconditional use \ttsl, and no ic.  @var is set to this for defuns.
 2450: \def\ttslanted#1{{\ttsl #1}}
 2451: 
 2452: % @cite is like \smartslanted except unconditionally use \sl.  We never want
 2453: % ttsl for book titles, do we?
 2454: \def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection}
 2455: 
 2456: \def\aftersmartic{}
 2457: \def\var#1{%
 2458:   \let\saveaftersmartic = \aftersmartic
 2459:   \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}%
 2460:   \smartslanted{#1}%
 2461: }
 2462: 
 2463: \let\i=\smartitalic
 2464: \let\slanted=\smartslanted
 2465: \let\dfn=\smartslanted
 2466: \let\emph=\smartitalic
 2467: 
 2468: % Explicit font changes: @r, @sc, undocumented @ii.
 2469: \def\r#1{{\rm #1}}              % roman font
 2470: \def\sc#1{{\smallcaps#1}}       % smallcaps font
 2471: \def\ii#1{{\it #1}}             % italic font
 2472: 
 2473: % @b, explicit bold.  Also @strong.
 2474: \def\b#1{{\bf #1}}
 2475: \let\strong=\b
 2476: 
 2477: % @sansserif, explicit sans.
 2478: \def\sansserif#1{{\sf #1}}
 2479: 
 2480: % We can't just use \exhyphenpenalty, because that only has effect at
 2481: % the end of a paragraph.  Restore normal hyphenation at the end of the
 2482: % group within which \nohyphenation is presumably called.
 2483: %
 2484: \def\nohyphenation{\hyphenchar\font = -1  \aftergroup\restorehyphenation}
 2485: \def\restorehyphenation{\hyphenchar\font = `- }
 2486: 
 2487: % Set sfcode to normal for the chars that usually have another value.
 2488: % Can't use plain's \frenchspacing because it uses the `\x notation, and
 2489: % sometimes \x has an active definition that messes things up.
 2490: %
 2491: \catcode`@=11
 2492:   \def\plainfrenchspacing{%
 2493:     \sfcode`\.=\@m \sfcode`\?=\@m \sfcode`\!=\@m
 2494:     \sfcode`\:=\@m \sfcode`\;=\@m \sfcode`\,=\@m
 2495:     \def\endofsentencespacefactor{1000}% for @. and friends
 2496:   }
 2497:   \def\plainnonfrenchspacing{%
 2498:     \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000
 2499:     \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250
 2500:     \def\endofsentencespacefactor{3000}% for @. and friends
 2501:   }
 2502: \catcode`@=\other
 2503: \def\endofsentencespacefactor{3000}% default
 2504: 
 2505: % @t, explicit typewriter.
 2506: \def\t#1{%
 2507:   {\tt \rawbackslash \plainfrenchspacing #1}%
 2508:   \null
 2509: }
 2510: 
 2511: % @samp.
 2512: \def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}}
 2513: 
 2514: % @indicateurl is \samp, that is, with quotes.
 2515: \let\indicateurl=\samp
 2516: 
 2517: % @code (and similar) prints in typewriter, but with spaces the same
 2518: % size as normal in the surrounding text, without hyphenation, etc.
 2519: % This is a subroutine for that.
 2520: \def\tclose#1{%
 2521:   {%
 2522:     % Change normal interword space to be same as for the current font.
 2523:     \spaceskip = \fontdimen2\font
 2524:     %
 2525:     % Switch to typewriter.
 2526:     \tt
 2527:     %
 2528:     % But `\ ' produces the large typewriter interword space.
 2529:     \def\ {{\spaceskip = 0pt{} }}%
 2530:     %
 2531:     % Turn off hyphenation.
 2532:     \nohyphenation
 2533:     %
 2534:     \rawbackslash
 2535:     \plainfrenchspacing
 2536:     #1%
 2537:   }%
 2538:   \null % reset spacefactor to 1000
 2539: }
 2540: 
 2541: % We *must* turn on hyphenation at `-' and `_' in @code.
 2542: % (But see \codedashfinish below.)
 2543: % Otherwise, it is too hard to avoid overfull hboxes
 2544: % in the Emacs manual, the Library manual, etc.
 2545: %
 2546: % Unfortunately, TeX uses one parameter (\hyphenchar) to control
 2547: % both hyphenation at - and hyphenation within words.
 2548: % We must therefore turn them both off (\tclose does that)
 2549: % and arrange explicitly to hyphenate at a dash. -- rms.
 2550: {
 2551:   \catcode`\-=\active \catcode`\_=\active
 2552:   \catcode`\'=\active \catcode`\`=\active
 2553:   \global\let'=\rq \global\let`=\lq  % default definitions
 2554:   %
 2555:   \global\def\code{\begingroup
 2556:     \setupmarkupstyle{code}%
 2557:     % The following should really be moved into \setupmarkupstyle handlers.
 2558:     \catcode\dashChar=\active  \catcode\underChar=\active
 2559:     \ifallowcodebreaks
 2560:      \let-\codedash
 2561:      \let_\codeunder
 2562:     \else
 2563:      \let-\normaldash
 2564:      \let_\realunder
 2565:     \fi
 2566:     % Given -foo (with a single dash), we do not want to allow a break
 2567:     % after the hyphen.
 2568:     \global\let\codedashprev=\codedash
 2569:     %
 2570:     \codex
 2571:   }
 2572:   %
 2573:   \gdef\codedash{\futurelet\next\codedashfinish}
 2574:   \gdef\codedashfinish{%
 2575:     \normaldash % always output the dash character itself.
 2576:     % 
 2577:     % Now, output a discretionary to allow a line break, unless
 2578:     % (a) the next character is a -, or
 2579:     % (b) the preceding character is a -.
 2580:     % E.g., given --posix, we do not want to allow a break after either -.
 2581:     % Given --foo-bar, we do want to allow a break between the - and the b.
 2582:     \ifx\next\codedash \else
 2583:       \ifx\codedashprev\codedash 
 2584:       \else \discretionary{}{}{}\fi
 2585:     \fi
 2586:     % we need the space after the = for the case when \next itself is a
 2587:     % space token; it would get swallowed otherwise.  As in @code{- a}.
 2588:     \global\let\codedashprev= \next
 2589:   }
 2590: }
 2591: \def\normaldash{-}
 2592: %
 2593: \def\codex #1{\tclose{#1}\endgroup}
 2594: 
 2595: \def\codeunder{%
 2596:   % this is all so @math{@code{var_name}+1} can work.  In math mode, _
 2597:   % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
 2598:   % will therefore expand the active definition of _, which is us
 2599:   % (inside @code that is), therefore an endless loop.
 2600:   \ifusingtt{\ifmmode
 2601:                \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_.
 2602:              \else\normalunderscore \fi
 2603:              \discretionary{}{}{}}%
 2604:             {\_}%
 2605: }
 2606: 
 2607: % An additional complication: the above will allow breaks after, e.g.,
 2608: % each of the four underscores in __typeof__.  This is bad.
 2609: % @allowcodebreaks provides a document-level way to turn breaking at -
 2610: % and _ on and off.
 2611: %
 2612: \newif\ifallowcodebreaks  \allowcodebreakstrue
 2613: 
 2614: \def\keywordtrue{true}
 2615: \def\keywordfalse{false}
 2616: 
 2617: \parseargdef\allowcodebreaks{%
 2618:   \def\txiarg{#1}%
 2619:   \ifx\txiarg\keywordtrue
 2620:     \allowcodebreakstrue
 2621:   \else\ifx\txiarg\keywordfalse
 2622:     \allowcodebreaksfalse
 2623:   \else
 2624:     \errhelp = \EMsimple
 2625:     \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}%
 2626:   \fi\fi
 2627: }
 2628: 
 2629: % For @command, @env, @file, @option quotes seem unnecessary,
 2630: % so use \code rather than \samp.
 2631: \let\command=\code
 2632: \let\env=\code
 2633: \let\file=\code
 2634: \let\option=\code
 2635: 
 2636: % @uref (abbreviation for `urlref') aka @url takes an optional
 2637: % (comma-separated) second argument specifying the text to display and
 2638: % an optional third arg as text to display instead of (rather than in
 2639: % addition to) the url itself.  First (mandatory) arg is the url.
 2640: 
 2641: % TeX-only option to allow changing PDF output to show only the second
 2642: % arg (if given), and not the url (which is then just the link target).
 2643: \newif\ifurefurlonlylink
 2644: 
 2645: % The main macro is \urefbreak, which allows breaking at expected
 2646: % places within the url.  (There used to be another version, which
 2647: % didn't support automatic breaking.)
 2648: \def\urefbreak{\begingroup \urefcatcodes \dourefbreak}
 2649: \let\uref=\urefbreak
 2650: %
 2651: \def\dourefbreak#1{\urefbreakfinish #1,,,\finish}
 2652: \def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example
 2653:   \unsepspaces
 2654:   \pdfurl{#1}%
 2655:   \setbox0 = \hbox{\ignorespaces #3}%
 2656:   \ifdim\wd0 > 0pt
 2657:     \unhbox0 % third arg given, show only that
 2658:   \else
 2659:     \setbox0 = \hbox{\ignorespaces #2}% look for second arg
 2660:     \ifdim\wd0 > 0pt
 2661:       \ifpdf
 2662:         \ifurefurlonlylink
 2663:           % PDF plus option to not display url, show just arg
 2664:           \unhbox0             
 2665:         \else
 2666:           % PDF, normally display both arg and url for consistency,
 2667:           % visibility, if the pdf is eventually used to print, etc.
 2668:           \unhbox0\ (\urefcode{#1})%
 2669:         \fi
 2670:       \else
 2671:         \unhbox0\ (\urefcode{#1})% DVI, always show arg and url
 2672:       \fi
 2673:     \else
 2674:       \urefcode{#1}% only url given, so show it
 2675:     \fi
 2676:   \fi
 2677:   \endlink
 2678: \endgroup}
 2679: 
 2680: % Allow line breaks around only a few characters (only).
 2681: \def\urefcatcodes{%
 2682:   \catcode`\&=\active \catcode`\.=\active
 2683:   \catcode`\#=\active \catcode`\?=\active
 2684:   \catcode`\/=\active
 2685: }
 2686: {
 2687:   \urefcatcodes
 2688:   %
 2689:   \global\def\urefcode{\begingroup
 2690:     \setupmarkupstyle{code}%
 2691:     \urefcatcodes
 2692:     \let&\urefcodeamp
 2693:     \let.\urefcodedot
 2694:     \let#\urefcodehash
 2695:     \let?\urefcodequest
 2696:     \let/\urefcodeslash
 2697:     \codex
 2698:   }
 2699:   %
 2700:   % By default, they are just regular characters.
 2701:   \global\def&{\normalamp}
 2702:   \global\def.{\normaldot}
 2703:   \global\def#{\normalhash}
 2704:   \global\def?{\normalquest}
 2705:   \global\def/{\normalslash}
 2706: }
 2707: 
 2708: % we put a little stretch before and after the breakable chars, to help
 2709: % line breaking of long url's.  The unequal skips make look better in
 2710: % cmtt at least, especially for dots.
 2711: \def\urefprestretchamount{.13em}
 2712: \def\urefpoststretchamount{.1em}
 2713: \def\urefprestretch{\urefprebreak \hskip0pt plus\urefprestretchamount\relax}
 2714: \def\urefpoststretch{\urefpostbreak \hskip0pt plus\urefprestretchamount\relax}
 2715: %
 2716: \def\urefcodeamp{\urefprestretch \&\urefpoststretch}
 2717: \def\urefcodedot{\urefprestretch .\urefpoststretch}
 2718: \def\urefcodehash{\urefprestretch \#\urefpoststretch}
 2719: \def\urefcodequest{\urefprestretch ?\urefpoststretch}
 2720: \def\urefcodeslash{\futurelet\next\urefcodeslashfinish}
 2721: {
 2722:   \catcode`\/=\active
 2723:   \global\def\urefcodeslashfinish{%
 2724:     \urefprestretch \slashChar
 2725:     % Allow line break only after the final / in a sequence of
 2726:     % slashes, to avoid line break between the slashes in http://.
 2727:     \ifx\next/\else \urefpoststretch \fi
 2728:   }
 2729: }
 2730: 
 2731: % One more complication: by default we'll break after the special
 2732: % characters, but some people like to break before the special chars, so
 2733: % allow that.  Also allow no breaking at all, for manual control.
 2734: % 
 2735: \parseargdef\urefbreakstyle{%
 2736:   \def\txiarg{#1}%
 2737:   \ifx\txiarg\wordnone
 2738:     \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak}
 2739:   \else\ifx\txiarg\wordbefore
 2740:     \def\urefprebreak{\allowbreak}\def\urefpostbreak{\nobreak}
 2741:   \else\ifx\txiarg\wordafter
 2742:     \def\urefprebreak{\nobreak}\def\urefpostbreak{\allowbreak}
 2743:   \else
 2744:     \errhelp = \EMsimple
 2745:     \errmessage{Unknown @urefbreakstyle setting `\txiarg'}%
 2746:   \fi\fi\fi
 2747: }
 2748: \def\wordafter{after}
 2749: \def\wordbefore{before}
 2750: \def\wordnone{none}
 2751: 
 2752: \urefbreakstyle after
 2753: 
 2754: % @url synonym for @uref, since that's how everyone uses it.
 2755: %
 2756: \let\url=\uref
 2757: 
 2758: % rms does not like angle brackets --karl, 17may97.
 2759: % So now @email is just like @uref, unless we are pdf.
 2760: %
 2761: %\def\email#1{\angleleft{\tt #1}\angleright}
 2762: \ifpdf
 2763:   \def\email#1{\doemail#1,,\finish}
 2764:   \def\doemail#1,#2,#3\finish{\begingroup
 2765:     \unsepspaces
 2766:     \pdfurl{mailto:#1}%
 2767:     \setbox0 = \hbox{\ignorespaces #2}%
 2768:     \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
 2769:     \endlink
 2770:   \endgroup}
 2771: \else
 2772:   \let\email=\uref
 2773: \fi
 2774: 
 2775: % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
 2776: %   `example' (@kbd uses ttsl only inside of @example and friends),
 2777: %   or `code' (@kbd uses normal tty font always).
 2778: \parseargdef\kbdinputstyle{%
 2779:   \def\txiarg{#1}%
 2780:   \ifx\txiarg\worddistinct
 2781:     \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
 2782:   \else\ifx\txiarg\wordexample
 2783:     \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
 2784:   \else\ifx\txiarg\wordcode
 2785:     \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
 2786:   \else
 2787:     \errhelp = \EMsimple
 2788:     \errmessage{Unknown @kbdinputstyle setting `\txiarg'}%
 2789:   \fi\fi\fi
 2790: }
 2791: \def\worddistinct{distinct}
 2792: \def\wordexample{example}
 2793: \def\wordcode{code}
 2794: 
 2795: % Default is `distinct'.
 2796: \kbdinputstyle distinct
 2797: 
 2798: % @kbd is like @code, except that if the argument is just one @key command,
 2799: % then @kbd has no effect.
 2800: \def\kbd#1{{\def\look{#1}\expandafter\kbdsub\look??\par}}
 2801: 
 2802: \def\xkey{\key}
 2803: \def\kbdsub#1#2#3\par{%
 2804:   \def\one{#1}\def\three{#3}\def\threex{??}%
 2805:   \ifx\one\xkey\ifx\threex\three \key{#2}%
 2806:   \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
 2807:   \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
 2808: }
 2809: 
 2810: % definition of @key that produces a lozenge.  Doesn't adjust to text size.
 2811: %\setfont\keyrm\rmshape{8}{1000}{OT1}
 2812: %\font\keysy=cmsy9
 2813: %\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
 2814: %  \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
 2815: %    \vbox{\hrule\kern-0.4pt
 2816: %     \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
 2817: %    \kern-0.4pt\hrule}%
 2818: %  \kern-.06em\raise0.4pt\hbox{\angleright}}}}
 2819: 
 2820: % definition of @key with no lozenge.  If the current font is already
 2821: % monospace, don't change it; that way, we respect @kbdinputstyle.  But
 2822: % if it isn't monospace, then use \tt.
 2823: %
 2824: \def\key#1{{\setupmarkupstyle{key}%
 2825:   \nohyphenation
 2826:   \ifmonospace\else\tt\fi
 2827:   #1}\null}
 2828: 
 2829: % @clicksequence{File @click{} Open ...}
 2830: \def\clicksequence#1{\begingroup #1\endgroup}
 2831: 
 2832: % @clickstyle @arrow   (by default)
 2833: \parseargdef\clickstyle{\def\click{#1}}
 2834: \def\click{\arrow}
 2835: 
 2836: % Typeset a dimension, e.g., `in' or `pt'.  The only reason for the
 2837: % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
 2838: %
 2839: \def\dmn#1{\thinspace #1}
 2840: 
 2841: % @acronym for "FBI", "NATO", and the like.
 2842: % We print this one point size smaller, since it's intended for
 2843: % all-uppercase.
 2844: %
 2845: \def\acronym#1{\doacronym #1,,\finish}
 2846: \def\doacronym#1,#2,#3\finish{%
 2847:   {\selectfonts\lsize #1}%
 2848:   \def\temp{#2}%
 2849:   \ifx\temp\empty \else
 2850:     \space ({\unsepspaces \ignorespaces \temp \unskip})%
 2851:   \fi
 2852:   \null % reset \spacefactor=1000
 2853: }
 2854: 
 2855: % @abbr for "Comput. J." and the like.
 2856: % No font change, but don't do end-of-sentence spacing.
 2857: %
 2858: \def\abbr#1{\doabbr #1,,\finish}
 2859: \def\doabbr#1,#2,#3\finish{%
 2860:   {\plainfrenchspacing #1}%
 2861:   \def\temp{#2}%
 2862:   \ifx\temp\empty \else
 2863:     \space ({\unsepspaces \ignorespaces \temp \unskip})%
 2864:   \fi
 2865:   \null % reset \spacefactor=1000
 2866: }
 2867: 
 2868: % @asis just yields its argument.  Used with @table, for example.
 2869: %
 2870: \def\asis#1{#1}
 2871: 
 2872: % @math outputs its argument in math mode.
 2873: %
 2874: % One complication: _ usually means subscripts, but it could also mean
 2875: % an actual _ character, as in @math{@var{some_variable} + 1}.  So make
 2876: % _ active, and distinguish by seeing if the current family is \slfam,
 2877: % which is what @var uses.
 2878: {
 2879:   \catcode`\_ = \active
 2880:   \gdef\mathunderscore{%
 2881:     \catcode`\_=\active
 2882:     \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
 2883:   }
 2884: }
 2885: % Another complication: we want \\ (and @\) to output a math (or tt) \.
 2886: % FYI, plain.tex uses \\ as a temporary control sequence (for no
 2887: % particular reason), but this is not advertised and we don't care.
 2888: %
 2889: % The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
 2890: \def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
 2891: %
 2892: \def\math{%
 2893:   \ifmmode\else % only go into math if not in math mode already
 2894:     \tex
 2895:     \mathunderscore
 2896:     \let\\ = \mathbackslash
 2897:     \mathactive
 2898:     % make the texinfo accent commands work in math mode
 2899:     \let\"=\ddot
 2900:     \let\'=\acute
 2901:     \let\==\bar
 2902:     \let\^=\hat
 2903:     \let\`=\grave
 2904:     \let\u=\breve
 2905:     \let\v=\check
 2906:     \let\~=\tilde
 2907:     \let\dotaccent=\dot
 2908:     % have to provide another name for sup operator
 2909:     \let\mathopsup=\sup
 2910:   $\expandafter\finishmath\fi
 2911: }
 2912: \def\finishmath#1{#1$\endgroup}  % Close the group opened by \tex.
 2913: 
 2914: % Some active characters (such as <) are spaced differently in math.
 2915: % We have to reset their definitions in case the @math was an argument
 2916: % to a command which sets the catcodes (such as @item or @section).
 2917: %
 2918: {
 2919:   \catcode`^ = \active
 2920:   \catcode`< = \active
 2921:   \catcode`> = \active
 2922:   \catcode`+ = \active
 2923:   \catcode`' = \active
 2924:   \gdef\mathactive{%
 2925:     \let^ = \ptexhat
 2926:     \let< = \ptexless
 2927:     \let> = \ptexgtr
 2928:     \let+ = \ptexplus
 2929:     \let' = \ptexquoteright
 2930:   }
 2931: }
 2932: 
 2933: % for @sub and @sup, if in math mode, just do a normal sub/superscript.
 2934: % If in text, use math to place as sub/superscript, but switch
 2935: % into text mode, with smaller fonts.  This is a different font than the
 2936: % one used for real math sub/superscripts (8pt vs. 7pt), but let's not
 2937: % fix it (significant additions to font machinery) until someone notices.
 2938: %
 2939: \def\sub{\ifmmode \expandafter\sb \else \expandafter\finishsub\fi}
 2940: \def\finishsub#1{$\sb{\hbox{\selectfonts\lllsize #1}}$}%
 2941: %
 2942: \def\sup{\ifmmode \expandafter\ptexsp \else \expandafter\finishsup\fi}
 2943: \def\finishsup#1{$\ptexsp{\hbox{\selectfonts\lllsize #1}}$}%
 2944: 
 2945: % @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}.
 2946: % Ignore unless FMTNAME == tex; then it is like @iftex and @tex,
 2947: % except specified as a normal braced arg, so no newlines to worry about.
 2948: % 
 2949: \def\outfmtnametex{tex}
 2950: %
 2951: \long\def\inlinefmt#1{\doinlinefmt #1,\finish}
 2952: \long\def\doinlinefmt#1,#2,\finish{%
 2953:   \def\inlinefmtname{#1}%
 2954:   \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi
 2955: }
 2956: % 
 2957: % @inlinefmtifelse{FMTNAME,THEN-TEXT,ELSE-TEXT} expands THEN-TEXT if
 2958: % FMTNAME is tex, else ELSE-TEXT.
 2959: \long\def\inlinefmtifelse#1{\doinlinefmtifelse #1,,,\finish}
 2960: \long\def\doinlinefmtifelse#1,#2,#3,#4,\finish{%
 2961:   \def\inlinefmtname{#1}%
 2962:   \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\else \ignorespaces #3\fi
 2963: }
 2964: %
 2965: % For raw, must switch into @tex before parsing the argument, to avoid
 2966: % setting catcodes prematurely.  Doing it this way means that, for
 2967: % example, @inlineraw{html, foo{bar} gets a parse error instead of being
 2968: % ignored.  But this isn't important because if people want a literal
 2969: % *right* brace they would have to use a command anyway, so they may as
 2970: % well use a command to get a left brace too.  We could re-use the
 2971: % delimiter character idea from \verb, but it seems like overkill.
 2972: % 
 2973: \long\def\inlineraw{\tex \doinlineraw}
 2974: \long\def\doinlineraw#1{\doinlinerawtwo #1,\finish}
 2975: \def\doinlinerawtwo#1,#2,\finish{%
 2976:   \def\inlinerawname{#1}%
 2977:   \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi
 2978:   \endgroup % close group opened by \tex.
 2979: }
 2980: 
 2981: % @inlineifset{VAR, TEXT} expands TEXT if VAR is @set.
 2982: %
 2983: \long\def\inlineifset#1{\doinlineifset #1,\finish}
 2984: \long\def\doinlineifset#1,#2,\finish{%
 2985:   \def\inlinevarname{#1}%
 2986:   \expandafter\ifx\csname SET\inlinevarname\endcsname\relax
 2987:   \else\ignorespaces#2\fi
 2988: }
 2989: 
 2990: % @inlineifclear{VAR, TEXT} expands TEXT if VAR is not @set.
 2991: %
 2992: \long\def\inlineifclear#1{\doinlineifclear #1,\finish}
 2993: \long\def\doinlineifclear#1,#2,\finish{%
 2994:   \def\inlinevarname{#1}%
 2995:   \expandafter\ifx\csname SET\inlinevarname\endcsname\relax \ignorespaces#2\fi
 2996: }
 2997: 
 2998: 
 2999: \message{glyphs,}
 3000: % and logos.
 3001: 
 3002: % @@ prints an @, as does @atchar{}.
 3003: \def\@{\char64 }
 3004: \let\atchar=\@
 3005: 
 3006: % @{ @} @lbracechar{} @rbracechar{} all generate brace characters.
 3007: % Unless we're in typewriter, use \ecfont because the CM text fonts do
 3008: % not have braces, and we don't want to switch into math.
 3009: \def\mylbrace{{\ifmonospace\else\ecfont\fi \char123}}
 3010: \def\myrbrace{{\ifmonospace\else\ecfont\fi \char125}}
 3011: \let\{=\mylbrace \let\lbracechar=\{
 3012: \let\}=\myrbrace \let\rbracechar=\}
 3013: \begingroup
 3014:   % Definitions to produce \{ and \} commands for indices,
 3015:   % and @{ and @} for the aux/toc files.
 3016:   \catcode`\{ = \other \catcode`\} = \other
 3017:   \catcode`\[ = 1 \catcode`\] = 2
 3018:   \catcode`\! = 0 \catcode`\\ = \other
 3019:   !gdef!lbracecmd[\{]%
 3020:   !gdef!rbracecmd[\}]%
 3021:   !gdef!lbraceatcmd[@{]%
 3022:   !gdef!rbraceatcmd[@}]%
 3023: !endgroup
 3024: 
 3025: % @comma{} to avoid , parsing problems.
 3026: \let\comma = ,
 3027: 
 3028: % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
 3029: % Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
 3030: \let\, = \ptexc
 3031: \let\dotaccent = \ptexdot
 3032: \def\ringaccent#1{{\accent23 #1}}
 3033: \let\tieaccent = \ptext
 3034: \let\ubaraccent = \ptexb
 3035: \let\udotaccent = \d
 3036: 
 3037: % Other special characters: @questiondown @exclamdown @ordf @ordm
 3038: % Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
 3039: \def\questiondown{?`}
 3040: \def\exclamdown{!`}
 3041: \def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}}
 3042: \def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}}
 3043: 
 3044: % Dotless i and dotless j, used for accents.
 3045: \def\imacro{i}
 3046: \def\jmacro{j}
 3047: \def\dotless#1{%
 3048:   \def\temp{#1}%
 3049:   \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi
 3050:   \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi
 3051:   \else \errmessage{@dotless can be used only with i or j}%
 3052:   \fi\fi
 3053: }
 3054: 
 3055: % The \TeX{} logo, as in plain, but resetting the spacing so that a
 3056: % period following counts as ending a sentence.  (Idea found in latex.)
 3057: %
 3058: \edef\TeX{\TeX \spacefactor=1000 }
 3059: 
 3060: % @LaTeX{} logo.  Not quite the same results as the definition in
 3061: % latex.ltx, since we use a different font for the raised A; it's most
 3062: % convenient for us to use an explicitly smaller font, rather than using
 3063: % the \scriptstyle font (since we don't reset \scriptstyle and
 3064: % \scriptscriptstyle).
 3065: %
 3066: \def\LaTeX{%
 3067:   L\kern-.36em
 3068:   {\setbox0=\hbox{T}%
 3069:    \vbox to \ht0{\hbox{%
 3070:      \ifx\textnominalsize\xwordpt
 3071:        % for 10pt running text, \lllsize (8pt) is too small for the A in LaTeX.
 3072:        % Revert to plain's \scriptsize, which is 7pt.
 3073:        \count255=\the\fam $\fam\count255 \scriptstyle A$%
 3074:      \else
 3075:        % For 11pt, we can use our lllsize.
 3076:        \selectfonts\lllsize A%
 3077:      \fi
 3078:      }%
 3079:      \vss
 3080:   }}%
 3081:   \kern-.15em
 3082:   \TeX
 3083: }
 3084: 
 3085: % Some math mode symbols.  Define \ensuremath to switch into math mode
 3086: % unless we are already there.  Expansion tricks may not be needed here,
 3087: % but safer, and can't hurt.
 3088: \def\ensuremath{\ifmmode \expandafter\asis \else\expandafter\ensuredmath \fi}
 3089: \def\ensuredmath#1{$\relax#1$}
 3090: %
 3091: \def\bullet{\ensuremath\ptexbullet}
 3092: \def\geq{\ensuremath\ge}
 3093: \def\leq{\ensuremath\le}
 3094: \def\minus{\ensuremath-}
 3095: 
 3096: % @dots{} outputs an ellipsis using the current font.
 3097: % We do .5em per period so that it has the same spacing in the cm
 3098: % typewriter fonts as three actual period characters; on the other hand,
 3099: % in other typewriter fonts three periods are wider than 1.5em.  So do
 3100: % whichever is larger.
 3101: %
 3102: \def\dots{%
 3103:   \leavevmode
 3104:   \setbox0=\hbox{...}% get width of three periods
 3105:   \ifdim\wd0 > 1.5em
 3106:     \dimen0 = \wd0
 3107:   \else
 3108:     \dimen0 = 1.5em
 3109:   \fi
 3110:   \hbox to \dimen0{%
 3111:     \hskip 0pt plus.25fil
 3112:     .\hskip 0pt plus1fil
 3113:     .\hskip 0pt plus1fil
 3114:     .\hskip 0pt plus.5fil
 3115:   }%
 3116: }
 3117: 
 3118: % @enddots{} is an end-of-sentence ellipsis.
 3119: %
 3120: \def\enddots{%
 3121:   \dots
 3122:   \spacefactor=\endofsentencespacefactor
 3123: }
 3124: 
 3125: % @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
 3126: %
 3127: % Since these characters are used in examples, they should be an even number of
 3128: % \tt widths. Each \tt character is 1en, so two makes it 1em.
 3129: %
 3130: \def\point{$\star$}
 3131: \def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}}
 3132: \def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
 3133: \def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}}
 3134: \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
 3135: \def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}}
 3136: 
 3137: % The @error{} command.
 3138: % Adapted from the TeXbook's \boxit.
 3139: %
 3140: \newbox\errorbox
 3141: %
 3142: {\tentt \global\dimen0 = 3em}% Width of the box.
 3143: \dimen2 = .55pt % Thickness of rules
 3144: % The text. (`r' is open on the right, `e' somewhat less so on the left.)
 3145: \setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt}
 3146: %
 3147: \setbox\errorbox=\hbox to \dimen0{\hfil
 3148:    \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
 3149:    \advance\hsize by -2\dimen2 % Rules.
 3150:    \vbox{%
 3151:       \hrule height\dimen2
 3152:       \hbox{\vrule width\dimen2 \kern3pt          % Space to left of text.
 3153:          \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
 3154:          \kern3pt\vrule width\dimen2}% Space to right.
 3155:       \hrule height\dimen2}
 3156:     \hfil}
 3157: %
 3158: \def\error{\leavevmode\lower.7ex\copy\errorbox}
 3159: 
 3160: % @pounds{} is a sterling sign, which Knuth put in the CM italic font.
 3161: %
 3162: \def\pounds{{\it\$}}
 3163: 
 3164: % @euro{} comes from a separate font, depending on the current style.
 3165: % We use the free feym* fonts from the eurosym package by Henrik
 3166: % Theiling, which support regular, slanted, bold and bold slanted (and
 3167: % "outlined" (blackboard board, sort of) versions, which we don't need).
 3168: % It is available from http://www.ctan.org/tex-archive/fonts/eurosym.
 3169: %
 3170: % Although only regular is the truly official Euro symbol, we ignore
 3171: % that.  The Euro is designed to be slightly taller than the regular
 3172: % font height.
 3173: %
 3174: % feymr - regular
 3175: % feymo - slanted
 3176: % feybr - bold
 3177: % feybo - bold slanted
 3178: %
 3179: % There is no good (free) typewriter version, to my knowledge.
 3180: % A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide.
 3181: % Hmm.
 3182: %
 3183: % Also doesn't work in math.  Do we need to do math with euro symbols?
 3184: % Hope not.
 3185: %
 3186: %
 3187: \def\euro{{\eurofont e}}
 3188: \def\eurofont{%
 3189:   % We set the font at each command, rather than predefining it in
 3190:   % \textfonts and the other font-switching commands, so that
 3191:   % installations which never need the symbol don't have to have the
 3192:   % font installed.
 3193:   %
 3194:   % There is only one designed size (nominal 10pt), so we always scale
 3195:   % that to the current nominal size.
 3196:   %
 3197:   % By the way, simply using "at 1em" works for cmr10 and the like, but
 3198:   % does not work for cmbx10 and other extended/shrunken fonts.
 3199:   %
 3200:   \def\eurosize{\csname\curfontsize nominalsize\endcsname}%
 3201:   %
 3202:   \ifx\curfontstyle\bfstylename
 3203:     % bold:
 3204:     \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize
 3205:   \else
 3206:     % regular:
 3207:     \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize
 3208:   \fi
 3209:   \thiseurofont
 3210: }
 3211: 
 3212: % Glyphs from the EC fonts.  We don't use \let for the aliases, because
 3213: % sometimes we redefine the original macro, and the alias should reflect
 3214: % the redefinition.
 3215: %
 3216: % Use LaTeX names for the Icelandic letters.
 3217: \def\DH{{\ecfont \char"D0}} % Eth
 3218: \def\dh{{\ecfont \char"F0}} % eth
 3219: \def\TH{{\ecfont \char"DE}} % Thorn
 3220: \def\th{{\ecfont \char"FE}} % thorn
 3221: %
 3222: \def\guillemetleft{{\ecfont \char"13}}
 3223: \def\guillemotleft{\guillemetleft}
 3224: \def\guillemetright{{\ecfont \char"14}}
 3225: \def\guillemotright{\guillemetright}
 3226: \def\guilsinglleft{{\ecfont \char"0E}}
 3227: \def\guilsinglright{{\ecfont \char"0F}}
 3228: \def\quotedblbase{{\ecfont \char"12}}
 3229: \def\quotesinglbase{{\ecfont \char"0D}}
 3230: %
 3231: % This positioning is not perfect (see the ogonek LaTeX package), but
 3232: % we have the precomposed glyphs for the most common cases.  We put the
 3233: % tests to use those glyphs in the single \ogonek macro so we have fewer
 3234: % dummy definitions to worry about for index entries, etc.
 3235: %
 3236: % ogonek is also used with other letters in Lithuanian (IOU), but using
 3237: % the precomposed glyphs for those is not so easy since they aren't in
 3238: % the same EC font.
 3239: \def\ogonek#1{{%
 3240:   \def\temp{#1}%
 3241:   \ifx\temp\macrocharA\Aogonek
 3242:   \else\ifx\temp\macrochara\aogonek
 3243:   \else\ifx\temp\macrocharE\Eogonek
 3244:   \else\ifx\temp\macrochare\eogonek
 3245:   \else
 3246:     \ecfont \setbox0=\hbox{#1}%
 3247:     \ifdim\ht0=1ex\accent"0C #1%
 3248:     \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}%
 3249:     \fi
 3250:   \fi\fi\fi\fi
 3251:   }%
 3252: }
 3253: \def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A}
 3254: \def\aogonek{{\ecfont \char"A1}}\def\macrochara{a}
 3255: \def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E}
 3256: \def\eogonek{{\ecfont \char"A6}}\def\macrochare{e}
 3257: %
 3258: % Use the European Computer Modern fonts (cm-super in outline format)
 3259: % for non-CM glyphs.  That is ec* for regular text and tc* for the text
 3260: % companion symbols (LaTeX TS1 encoding).  Both are part of the ec
 3261: % package and follow the same conventions.
 3262: % 
 3263: \def\ecfont{\etcfont{e}}
 3264: \def\tcfont{\etcfont{t}}
 3265: %
 3266: \def\etcfont#1{%
 3267:   % We can't distinguish serif/sans and italic/slanted, but this
 3268:   % is used for crude hacks anyway (like adding French and German
 3269:   % quotes to documents typeset with CM, where we lose kerning), so
 3270:   % hopefully nobody will notice/care.
 3271:   \edef\ecsize{\csname\curfontsize ecsize\endcsname}%
 3272:   \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}%
 3273:   \ifmonospace
 3274:     % typewriter:
 3275:     \font\thisecfont = #1ctt\ecsize \space at \nominalsize
 3276:   \else
 3277:     \ifx\curfontstyle\bfstylename
 3278:       % bold:
 3279:       \font\thisecfont = #1cb\ifusingit{i}{x}\ecsize \space at \nominalsize
 3280:     \else
 3281:       % regular:
 3282:       \font\thisecfont = #1c\ifusingit{ti}{rm}\ecsize \space at \nominalsize
 3283:     \fi
 3284:   \fi
 3285:   \thisecfont
 3286: }
 3287: 
 3288: % @registeredsymbol - R in a circle.  The font for the R should really
 3289: % be smaller yet, but lllsize is the best we can do for now.
 3290: % Adapted from the plain.tex definition of \copyright.
 3291: %
 3292: \def\registeredsymbol{%
 3293:   $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}%
 3294:                \hfil\crcr\Orb}}%
 3295:     }$%
 3296: }
 3297: 
 3298: % @textdegree - the normal degrees sign.
 3299: %
 3300: \def\textdegree{$^\circ$}
 3301: 
 3302: % Laurent Siebenmann reports \Orb undefined with:
 3303: %  Textures 1.7.7 (preloaded format=plain 93.10.14)  (68K)  16 APR 2004 02:38
 3304: % so we'll define it if necessary.
 3305: %
 3306: \ifx\Orb\thisisundefined
 3307: \def\Orb{\mathhexbox20D}
 3308: \fi
 3309: 
 3310: % Quotes.
 3311: \chardef\quotedblleft="5C
 3312: \chardef\quotedblright=`\"
 3313: \chardef\quoteleft=`\`
 3314: \chardef\quoteright=`\'
 3315: 
 3316: 
 3317: \message{page headings,}
 3318: 
 3319: \newskip\titlepagetopglue \titlepagetopglue = 1.5in
 3320: \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
 3321: 
 3322: % First the title page.  Must do @settitle before @titlepage.
 3323: \newif\ifseenauthor
 3324: \newif\iffinishedtitlepage
 3325: 
 3326: % Do an implicit @contents or @shortcontents after @end titlepage if the
 3327: % user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage.
 3328: %
 3329: \newif\ifsetcontentsaftertitlepage
 3330:  \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue
 3331: \newif\ifsetshortcontentsaftertitlepage
 3332:  \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue
 3333: 
 3334: \parseargdef\shorttitlepage{%
 3335:   \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}%
 3336:   \endgroup\page\hbox{}\page}
 3337: 
 3338: \envdef\titlepage{%
 3339:   % Open one extra group, as we want to close it in the middle of \Etitlepage.
 3340:   \begingroup
 3341:     \parindent=0pt \textfonts
 3342:     % Leave some space at the very top of the page.
 3343:     \vglue\titlepagetopglue
 3344:     % No rule at page bottom unless we print one at the top with @title.
 3345:     \finishedtitlepagetrue
 3346:     %
 3347:     % Most title ``pages'' are actually two pages long, with space
 3348:     % at the top of the second.  We don't want the ragged left on the second.
 3349:     \let\oldpage = \page
 3350:     \def\page{%
 3351:       \iffinishedtitlepage\else
 3352: 	 \finishtitlepage
 3353:       \fi
 3354:       \let\page = \oldpage
 3355:       \page
 3356:       \null
 3357:     }%
 3358: }
 3359: 
 3360: \def\Etitlepage{%
 3361:     \iffinishedtitlepage\else
 3362: 	\finishtitlepage
 3363:     \fi
 3364:     % It is important to do the page break before ending the group,
 3365:     % because the headline and footline are only empty inside the group.
 3366:     % If we use the new definition of \page, we always get a blank page
 3367:     % after the title page, which we certainly don't want.
 3368:     \oldpage
 3369:   \endgroup
 3370:   %
 3371:   % Need this before the \...aftertitlepage checks so that if they are
 3372:   % in effect the toc pages will come out with page numbers.
 3373:   \HEADINGSon
 3374:   %
 3375:   % If they want short, they certainly want long too.
 3376:   \ifsetshortcontentsaftertitlepage
 3377:     \shortcontents
 3378:     \contents
 3379:     \global\let\shortcontents = \relax
 3380:     \global\let\contents = \relax
 3381:   \fi
 3382:   %
 3383:   \ifsetcontentsaftertitlepage
 3384:     \contents
 3385:     \global\let\contents = \relax
 3386:     \global\let\shortcontents = \relax
 3387:   \fi
 3388: }
 3389: 
 3390: \def\finishtitlepage{%
 3391:   \vskip4pt \hrule height 2pt width \hsize
 3392:   \vskip\titlepagebottomglue
 3393:   \finishedtitlepagetrue
 3394: }
 3395: 
 3396: % Settings used for typesetting titles: no hyphenation, no indentation,
 3397: % don't worry much about spacing, ragged right.  This should be used
 3398: % inside a \vbox, and fonts need to be set appropriately first.  Because
 3399: % it is always used for titles, nothing else, we call \rmisbold.  \par
 3400: % should be specified before the end of the \vbox, since a vbox is a group.
 3401: % 
 3402: \def\raggedtitlesettings{%
 3403:   \rmisbold
 3404:   \hyphenpenalty=10000
 3405:   \parindent=0pt
 3406:   \tolerance=5000
 3407:   \ptexraggedright
 3408: }
 3409: 
 3410: % Macros to be used within @titlepage:
 3411: 
 3412: \let\subtitlerm=\tenrm
 3413: \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}
 3414: 
 3415: \parseargdef\title{%
 3416:   \checkenv\titlepage
 3417:   \vbox{\titlefonts \raggedtitlesettings #1\par}%
 3418:   % print a rule at the page bottom also.
 3419:   \finishedtitlepagefalse
 3420:   \vskip4pt \hrule height 4pt width \hsize \vskip4pt
 3421: }
 3422: 
 3423: \parseargdef\subtitle{%
 3424:   \checkenv\titlepage
 3425:   {\subtitlefont \rightline{#1}}%
 3426: }
 3427: 
 3428: % @author should come last, but may come many times.
 3429: % It can also be used inside @quotation.
 3430: %
 3431: \parseargdef\author{%
 3432:   \def\temp{\quotation}%
 3433:   \ifx\thisenv\temp
 3434:     \def\quotationauthor{#1}% printed in \Equotation.
 3435:   \else
 3436:     \checkenv\titlepage
 3437:     \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi
 3438:     {\secfonts\rmisbold \leftline{#1}}%
 3439:   \fi
 3440: }
 3441: 
 3442: 
 3443: % Set up page headings and footings.
 3444: 
 3445: \let\thispage=\folio
 3446: 
 3447: \newtoks\evenheadline    % headline on even pages
 3448: \newtoks\oddheadline     % headline on odd pages
 3449: \newtoks\evenfootline    % footline on even pages
 3450: \newtoks\oddfootline     % footline on odd pages
 3451: 
 3452: % Now make \makeheadline and \makefootline in Plain TeX use those variables
 3453: \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
 3454:                             \else \the\evenheadline \fi}}
 3455: \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
 3456:                             \else \the\evenfootline \fi}\HEADINGShook}
 3457: \let\HEADINGShook=\relax
 3458: 
 3459: % Commands to set those variables.
 3460: % For example, this is what  @headings on  does
 3461: % @evenheading @thistitle|@thispage|@thischapter
 3462: % @oddheading @thischapter|@thispage|@thistitle
 3463: % @evenfooting @thisfile||
 3464: % @oddfooting ||@thisfile
 3465: 
 3466: 
 3467: \def\evenheading{\parsearg\evenheadingxxx}
 3468: \def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish}
 3469: \def\evenheadingyyy #1\|#2\|#3\|#4\finish{%
 3470: \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
 3471: 
 3472: \def\oddheading{\parsearg\oddheadingxxx}
 3473: \def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish}
 3474: \def\oddheadingyyy #1\|#2\|#3\|#4\finish{%
 3475: \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
 3476: 
 3477: \parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
 3478: 
 3479: \def\evenfooting{\parsearg\evenfootingxxx}
 3480: \def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish}
 3481: \def\evenfootingyyy #1\|#2\|#3\|#4\finish{%
 3482: \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
 3483: 
 3484: \def\oddfooting{\parsearg\oddfootingxxx}
 3485: \def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish}
 3486: \def\oddfootingyyy #1\|#2\|#3\|#4\finish{%
 3487:   \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
 3488:   %
 3489:   % Leave some space for the footline.  Hopefully ok to assume
 3490:   % @evenfooting will not be used by itself.
 3491:   \global\advance\pageheight by -12pt
 3492:   \global\advance\vsize by -12pt
 3493: }
 3494: 
 3495: \parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}}
 3496: 
 3497: % @evenheadingmarks top     \thischapter <- chapter at the top of a page
 3498: % @evenheadingmarks bottom  \thischapter <- chapter at the bottom of a page
 3499: %
 3500: % The same set of arguments for:
 3501: %
 3502: % @oddheadingmarks
 3503: % @evenfootingmarks
 3504: % @oddfootingmarks
 3505: % @everyheadingmarks
 3506: % @everyfootingmarks
 3507: 
 3508: % These define \getoddheadingmarks, \getevenheadingmarks,
 3509: % \getoddfootingmarks, and \getevenfootingmarks, each to one of
 3510: % \gettopheadingmarks, \getbottomheadingmarks.
 3511: %
 3512: \def\evenheadingmarks{\headingmarks{even}{heading}}
 3513: \def\oddheadingmarks{\headingmarks{odd}{heading}}
 3514: \def\evenfootingmarks{\headingmarks{even}{footing}}
 3515: \def\oddfootingmarks{\headingmarks{odd}{footing}}
 3516: \def\everyheadingmarks#1 {\headingmarks{even}{heading}{#1}
 3517:                           \headingmarks{odd}{heading}{#1} }
 3518: \def\everyfootingmarks#1 {\headingmarks{even}{footing}{#1}
 3519:                           \headingmarks{odd}{footing}{#1} }
 3520: % #1 = even/odd, #2 = heading/footing, #3 = top/bottom.
 3521: \def\headingmarks#1#2#3 {%
 3522:   \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname
 3523:   \global\expandafter\let\csname get#1#2marks\endcsname \temp
 3524: }
 3525: 
 3526: \everyheadingmarks bottom
 3527: \everyfootingmarks bottom
 3528: 
 3529: % @headings double      turns headings on for double-sided printing.
 3530: % @headings single      turns headings on for single-sided printing.
 3531: % @headings off         turns them off.
 3532: % @headings on          same as @headings double, retained for compatibility.
 3533: % @headings after       turns on double-sided headings after this page.
 3534: % @headings doubleafter turns on double-sided headings after this page.
 3535: % @headings singleafter turns on single-sided headings after this page.
 3536: % By default, they are off at the start of a document,
 3537: % and turned `on' after @end titlepage.
 3538: 
 3539: \def\headings #1 {\csname HEADINGS#1\endcsname}
 3540: 
 3541: \def\headingsoff{% non-global headings elimination
 3542:   \evenheadline={\hfil}\evenfootline={\hfil}%
 3543:    \oddheadline={\hfil}\oddfootline={\hfil}%
 3544: }
 3545: 
 3546: \def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting
 3547: \HEADINGSoff  % it's the default
 3548: 
 3549: % When we turn headings on, set the page number to 1.
 3550: % For double-sided printing, put current file name in lower left corner,
 3551: % chapter name on inside top of right hand pages, document
 3552: % title on inside top of left hand pages, and page numbers on outside top
 3553: % edge of all pages.
 3554: \def\HEADINGSdouble{%
 3555: \global\pageno=1
 3556: \global\evenfootline={\hfil}
 3557: \global\oddfootline={\hfil}
 3558: \global\evenheadline={\line{\folio\hfil\thistitle}}
 3559: \global\oddheadline={\line{\thischapterheading\hfil\folio}}
 3560: \global\let\contentsalignmacro = \chapoddpage
 3561: }
 3562: \let\contentsalignmacro = \chappager
 3563: 
 3564: % For single-sided printing, chapter title goes across top left of page,
 3565: % page number on top right.
 3566: \def\HEADINGSsingle{%
 3567: \global\pageno=1
 3568: \global\evenfootline={\hfil}
 3569: \global\oddfootline={\hfil}
 3570: \global\evenheadline={\line{\thischapterheading\hfil\folio}}
 3571: \global\oddheadline={\line{\thischapterheading\hfil\folio}}
 3572: \global\let\contentsalignmacro = \chappager
 3573: }
 3574: \def\HEADINGSon{\HEADINGSdouble}
 3575: 
 3576: \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
 3577: \let\HEADINGSdoubleafter=\HEADINGSafter
 3578: \def\HEADINGSdoublex{%
 3579: \global\evenfootline={\hfil}
 3580: \global\oddfootline={\hfil}
 3581: \global\evenheadline={\line{\folio\hfil\thistitle}}
 3582: \global\oddheadline={\line{\thischapterheading\hfil\folio}}
 3583: \global\let\contentsalignmacro = \chapoddpage
 3584: }
 3585: 
 3586: \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
 3587: \def\HEADINGSsinglex{%
 3588: \global\evenfootline={\hfil}
 3589: \global\oddfootline={\hfil}
 3590: \global\evenheadline={\line{\thischapterheading\hfil\folio}}
 3591: \global\oddheadline={\line{\thischapterheading\hfil\folio}}
 3592: \global\let\contentsalignmacro = \chappager
 3593: }
 3594: 
 3595: % Subroutines used in generating headings
 3596: % This produces Day Month Year style of output.
 3597: % Only define if not already defined, in case a txi-??.tex file has set
 3598: % up a different format (e.g., txi-cs.tex does this).
 3599: \ifx\today\thisisundefined
 3600: \def\today{%
 3601:   \number\day\space
 3602:   \ifcase\month
 3603:   \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
 3604:   \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
 3605:   \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
 3606:   \fi
 3607:   \space\number\year}
 3608: \fi
 3609: 
 3610: % @settitle line...  specifies the title of the document, for headings.
 3611: % It generates no output of its own.
 3612: \def\thistitle{\putwordNoTitle}
 3613: \def\settitle{\parsearg{\gdef\thistitle}}
 3614: 
 3615: 
 3616: \message{tables,}
 3617: % Tables -- @table, @ftable, @vtable, @item(x).
 3618: 
 3619: % default indentation of table text
 3620: \newdimen\tableindent \tableindent=.8in
 3621: % default indentation of @itemize and @enumerate text
 3622: \newdimen\itemindent  \itemindent=.3in
 3623: % margin between end of table item and start of table text.
 3624: \newdimen\itemmargin  \itemmargin=.1in
 3625: 
 3626: % used internally for \itemindent minus \itemmargin
 3627: \newdimen\itemmax
 3628: 
 3629: % Note @table, @ftable, and @vtable define @item, @itemx, etc., with
 3630: % these defs.
 3631: % They also define \itemindex
 3632: % to index the item name in whatever manner is desired (perhaps none).
 3633: 
 3634: \newif\ifitemxneedsnegativevskip
 3635: 
 3636: \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
 3637: 
 3638: \def\internalBitem{\smallbreak \parsearg\itemzzz}
 3639: \def\internalBitemx{\itemxpar \parsearg\itemzzz}
 3640: 
 3641: \def\itemzzz #1{\begingroup %
 3642:   \advance\hsize by -\rightskip
 3643:   \advance\hsize by -\tableindent
 3644:   \setbox0=\hbox{\itemindicate{#1}}%
 3645:   \itemindex{#1}%
 3646:   \nobreak % This prevents a break before @itemx.
 3647:   %
 3648:   % If the item text does not fit in the space we have, put it on a line
 3649:   % by itself, and do not allow a page break either before or after that
 3650:   % line.  We do not start a paragraph here because then if the next
 3651:   % command is, e.g., @kindex, the whatsit would get put into the
 3652:   % horizontal list on a line by itself, resulting in extra blank space.
 3653:   \ifdim \wd0>\itemmax
 3654:     %
 3655:     % Make this a paragraph so we get the \parskip glue and wrapping,
 3656:     % but leave it ragged-right.
 3657:     \begingroup
 3658:       \advance\leftskip by-\tableindent
 3659:       \advance\hsize by\tableindent
 3660:       \advance\rightskip by0pt plus1fil\relax
 3661:       \leavevmode\unhbox0\par
 3662:     \endgroup
 3663:     %
 3664:     % We're going to be starting a paragraph, but we don't want the
 3665:     % \parskip glue -- logically it's part of the @item we just started.
 3666:     \nobreak \vskip-\parskip
 3667:     %
 3668:     % Stop a page break at the \parskip glue coming up.  However, if
 3669:     % what follows is an environment such as @example, there will be no
 3670:     % \parskip glue; then the negative vskip we just inserted would
 3671:     % cause the example and the item to crash together.  So we use this
 3672:     % bizarre value of 10001 as a signal to \aboveenvbreak to insert
 3673:     % \parskip glue after all.  Section titles are handled this way also.
 3674:     %
 3675:     \penalty 10001
 3676:     \endgroup
 3677:     \itemxneedsnegativevskipfalse
 3678:   \else
 3679:     % The item text fits into the space.  Start a paragraph, so that the
 3680:     % following text (if any) will end up on the same line.
 3681:     \noindent
 3682:     % Do this with kerns and \unhbox so that if there is a footnote in
 3683:     % the item text, it can migrate to the main vertical list and
 3684:     % eventually be printed.
 3685:     \nobreak\kern-\tableindent
 3686:     \dimen0 = \itemmax  \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
 3687:     \unhbox0
 3688:     \nobreak\kern\dimen0
 3689:     \endgroup
 3690:     \itemxneedsnegativevskiptrue
 3691:   \fi
 3692: }
 3693: 
 3694: \def\item{\errmessage{@item while not in a list environment}}
 3695: \def\itemx{\errmessage{@itemx while not in a list environment}}
 3696: 
 3697: % @table, @ftable, @vtable.
 3698: \envdef\table{%
 3699:   \let\itemindex\gobble
 3700:   \tablecheck{table}%
 3701: }
 3702: \envdef\ftable{%
 3703:   \def\itemindex ##1{\doind {fn}{\code{##1}}}%
 3704:   \tablecheck{ftable}%
 3705: }
 3706: \envdef\vtable{%
 3707:   \def\itemindex ##1{\doind {vr}{\code{##1}}}%
 3708:   \tablecheck{vtable}%
 3709: }
 3710: \def\tablecheck#1{%
 3711:   \ifnum \the\catcode`\^^M=\active
 3712:     \endgroup
 3713:     \errmessage{This command won't work in this context; perhaps the problem is
 3714:       that we are \inenvironment\thisenv}%
 3715:     \def\next{\doignore{#1}}%
 3716:   \else
 3717:     \let\next\tablex
 3718:   \fi
 3719:   \next
 3720: }
 3721: \def\tablex#1{%
 3722:   \def\itemindicate{#1}%
 3723:   \parsearg\tabley
 3724: }
 3725: \def\tabley#1{%
 3726:   {%
 3727:     \makevalueexpandable
 3728:     \edef\temp{\noexpand\tablez #1\space\space\space}%
 3729:     \expandafter
 3730:   }\temp \endtablez
 3731: }
 3732: \def\tablez #1 #2 #3 #4\endtablez{%
 3733:   \aboveenvbreak
 3734:   \ifnum 0#1>0 \advance \leftskip by #1\mil \fi
 3735:   \ifnum 0#2>0 \tableindent=#2\mil \fi
 3736:   \ifnum 0#3>0 \advance \rightskip by #3\mil \fi
 3737:   \itemmax=\tableindent
 3738:   \advance \itemmax by -\itemmargin
 3739:   \advance \leftskip by \tableindent
 3740:   \exdentamount=\tableindent
 3741:   \parindent = 0pt
 3742:   \parskip = \smallskipamount
 3743:   \ifdim \parskip=0pt \parskip=2pt \fi
 3744:   \let\item = \internalBitem
 3745:   \let\itemx = \internalBitemx
 3746: }
 3747: \def\Etable{\endgraf\afterenvbreak}
 3748: \let\Eftable\Etable
 3749: \let\Evtable\Etable
 3750: \let\Eitemize\Etable
 3751: \let\Eenumerate\Etable
 3752: 
 3753: % This is the counter used by @enumerate, which is really @itemize
 3754: 
 3755: \newcount \itemno
 3756: 
 3757: \envdef\itemize{\parsearg\doitemize}
 3758: 
 3759: \def\doitemize#1{%
 3760:   \aboveenvbreak
 3761:   \itemmax=\itemindent
 3762:   \advance\itemmax by -\itemmargin
 3763:   \advance\leftskip by \itemindent
 3764:   \exdentamount=\itemindent
 3765:   \parindent=0pt
 3766:   \parskip=\smallskipamount
 3767:   \ifdim\parskip=0pt \parskip=2pt \fi
 3768:   %
 3769:   % Try typesetting the item mark so that if the document erroneously says
 3770:   % something like @itemize @samp (intending @table), there's an error
 3771:   % right away at the @itemize.  It's not the best error message in the
 3772:   % world, but it's better than leaving it to the @item.  This means if
 3773:   % the user wants an empty mark, they have to say @w{} not just @w.
 3774:   \def\itemcontents{#1}%
 3775:   \setbox0 = \hbox{\itemcontents}%
 3776:   %
 3777:   % @itemize with no arg is equivalent to @itemize @bullet.
 3778:   \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
 3779:   %
 3780:   \let\item=\itemizeitem
 3781: }
 3782: 
 3783: % Definition of @item while inside @itemize and @enumerate.
 3784: %
 3785: \def\itemizeitem{%
 3786:   \advance\itemno by 1  % for enumerations
 3787:   {\let\par=\endgraf \smallbreak}% reasonable place to break
 3788:   {%
 3789:    % If the document has an @itemize directly after a section title, a
 3790:    % \nobreak will be last on the list, and \sectionheading will have
 3791:    % done a \vskip-\parskip.  In that case, we don't want to zero
 3792:    % parskip, or the item text will crash with the heading.  On the
 3793:    % other hand, when there is normal text preceding the item (as there
 3794:    % usually is), we do want to zero parskip, or there would be too much
 3795:    % space.  In that case, we won't have a \nobreak before.  At least
 3796:    % that's the theory.
 3797:    \ifnum\lastpenalty<10000 \parskip=0in \fi
 3798:    \noindent
 3799:    \hbox to 0pt{\hss \itemcontents \kern\itemmargin}%
 3800:    %
 3801:    \ifinner\else
 3802:      \vadjust{\penalty 1200}% not good to break after first line of item.
 3803:    \fi
 3804:    % We can be in inner vertical mode in a footnote, although an
 3805:    % @itemize looks awful there.
 3806:   }%
 3807:   \flushcr
 3808: }
 3809: 
 3810: % \splitoff TOKENS\endmark defines \first to be the first token in
 3811: % TOKENS, and \rest to be the remainder.
 3812: %
 3813: \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
 3814: 
 3815: % Allow an optional argument of an uppercase letter, lowercase letter,
 3816: % or number, to specify the first label in the enumerated list.  No
 3817: % argument is the same as `1'.
 3818: %
 3819: \envparseargdef\enumerate{\enumeratey #1  \endenumeratey}
 3820: \def\enumeratey #1 #2\endenumeratey{%
 3821:   % If we were given no argument, pretend we were given `1'.
 3822:   \def\thearg{#1}%
 3823:   \ifx\thearg\empty \def\thearg{1}\fi
 3824:   %
 3825:   % Detect if the argument is a single token.  If so, it might be a
 3826:   % letter.  Otherwise, the only valid thing it can be is a number.
 3827:   % (We will always have one token, because of the test we just made.
 3828:   % This is a good thing, since \splitoff doesn't work given nothing at
 3829:   % all -- the first parameter is undelimited.)
 3830:   \expandafter\splitoff\thearg\endmark
 3831:   \ifx\rest\empty
 3832:     % Only one token in the argument.  It could still be anything.
 3833:     % A ``lowercase letter'' is one whose \lccode is nonzero.
 3834:     % An ``uppercase letter'' is one whose \lccode is both nonzero, and
 3835:     %   not equal to itself.
 3836:     % Otherwise, we assume it's a number.
 3837:     %
 3838:     % We need the \relax at the end of the \ifnum lines to stop TeX from
 3839:     % continuing to look for a <number>.
 3840:     %
 3841:     \ifnum\lccode\expandafter`\thearg=0\relax
 3842:       \numericenumerate % a number (we hope)
 3843:     \else
 3844:       % It's a letter.
 3845:       \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
 3846:         \lowercaseenumerate % lowercase letter
 3847:       \else
 3848:         \uppercaseenumerate % uppercase letter
 3849:       \fi
 3850:     \fi
 3851:   \else
 3852:     % Multiple tokens in the argument.  We hope it's a number.
 3853:     \numericenumerate
 3854:   \fi
 3855: }
 3856: 
 3857: % An @enumerate whose labels are integers.  The starting integer is
 3858: % given in \thearg.
 3859: %
 3860: \def\numericenumerate{%
 3861:   \itemno = \thearg
 3862:   \startenumeration{\the\itemno}%
 3863: }
 3864: 
 3865: % The starting (lowercase) letter is in \thearg.
 3866: \def\lowercaseenumerate{%
 3867:   \itemno = \expandafter`\thearg
 3868:   \startenumeration{%
 3869:     % Be sure we're not beyond the end of the alphabet.
 3870:     \ifnum\itemno=0
 3871:       \errmessage{No more lowercase letters in @enumerate; get a bigger
 3872:                   alphabet}%
 3873:     \fi
 3874:     \char\lccode\itemno
 3875:   }%
 3876: }
 3877: 
 3878: % The starting (uppercase) letter is in \thearg.
 3879: \def\uppercaseenumerate{%
 3880:   \itemno = \expandafter`\thearg
 3881:   \startenumeration{%
 3882:     % Be sure we're not beyond the end of the alphabet.
 3883:     \ifnum\itemno=0
 3884:       \errmessage{No more uppercase letters in @enumerate; get a bigger
 3885:                   alphabet}
 3886:     \fi
 3887:     \char\uccode\itemno
 3888:   }%
 3889: }
 3890: 
 3891: % Call \doitemize, adding a period to the first argument and supplying the
 3892: % common last two arguments.  Also subtract one from the initial value in
 3893: % \itemno, since @item increments \itemno.
 3894: %
 3895: \def\startenumeration#1{%
 3896:   \advance\itemno by -1
 3897:   \doitemize{#1.}\flushcr
 3898: }
 3899: 
 3900: % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
 3901: % to @enumerate.
 3902: %
 3903: \def\alphaenumerate{\enumerate{a}}
 3904: \def\capsenumerate{\enumerate{A}}
 3905: \def\Ealphaenumerate{\Eenumerate}
 3906: \def\Ecapsenumerate{\Eenumerate}
 3907: 
 3908: 
 3909: % @multitable macros
 3910: % Amy Hendrickson, 8/18/94, 3/6/96
 3911: %
 3912: % @multitable ... @end multitable will make as many columns as desired.
 3913: % Contents of each column will wrap at width given in preamble.  Width
 3914: % can be specified either with sample text given in a template line,
 3915: % or in percent of \hsize, the current width of text on page.
 3916: 
 3917: % Table can continue over pages but will only break between lines.
 3918: 
 3919: % To make preamble:
 3920: %
 3921: % Either define widths of columns in terms of percent of \hsize:
 3922: %   @multitable @columnfractions .25 .3 .45
 3923: %   @item ...
 3924: %
 3925: %   Numbers following @columnfractions are the percent of the total
 3926: %   current hsize to be used for each column. You may use as many
 3927: %   columns as desired.
 3928: 
 3929: 
 3930: % Or use a template:
 3931: %   @multitable {Column 1 template} {Column 2 template} {Column 3 template}
 3932: %   @item ...
 3933: %   using the widest term desired in each column.
 3934: 
 3935: % Each new table line starts with @item, each subsequent new column
 3936: % starts with @tab. Empty columns may be produced by supplying @tab's
 3937: % with nothing between them for as many times as empty columns are needed,
 3938: % ie, @tab@tab@tab will produce two empty columns.
 3939: 
 3940: % @item, @tab do not need to be on their own lines, but it will not hurt
 3941: % if they are.
 3942: 
 3943: % Sample multitable:
 3944: 
 3945: %   @multitable {Column 1 template} {Column 2 template} {Column 3 template}
 3946: %   @item first col stuff @tab second col stuff @tab third col
 3947: %   @item
 3948: %   first col stuff
 3949: %   @tab
 3950: %   second col stuff
 3951: %   @tab
 3952: %   third col
 3953: %   @item first col stuff @tab second col stuff
 3954: %   @tab Many paragraphs of text may be used in any column.
 3955: %
 3956: %         They will wrap at the width determined by the template.
 3957: %   @item@tab@tab This will be in third column.
 3958: %   @end multitable
 3959: 
 3960: % Default dimensions may be reset by user.
 3961: % @multitableparskip is vertical space between paragraphs in table.
 3962: % @multitableparindent is paragraph indent in table.
 3963: % @multitablecolmargin is horizontal space to be left between columns.
 3964: % @multitablelinespace is space to leave between table items, baseline
 3965: %                                                            to baseline.
 3966: %   0pt means it depends on current normal line spacing.
 3967: %
 3968: \newskip\multitableparskip
 3969: \newskip\multitableparindent
 3970: \newdimen\multitablecolspace
 3971: \newskip\multitablelinespace
 3972: \multitableparskip=0pt
 3973: \multitableparindent=6pt
 3974: \multitablecolspace=12pt
 3975: \multitablelinespace=0pt
 3976: 
 3977: % Macros used to set up halign preamble:
 3978: %
 3979: \let\endsetuptable\relax
 3980: \def\xendsetuptable{\endsetuptable}
 3981: \let\columnfractions\relax
 3982: \def\xcolumnfractions{\columnfractions}
 3983: \newif\ifsetpercent
 3984: 
 3985: % #1 is the @columnfraction, usually a decimal number like .5, but might
 3986: % be just 1.  We just use it, whatever it is.
 3987: %
 3988: \def\pickupwholefraction#1 {%
 3989:   \global\advance\colcount by 1
 3990:   \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}%
 3991:   \setuptable
 3992: }
 3993: 
 3994: \newcount\colcount
 3995: \def\setuptable#1{%
 3996:   \def\firstarg{#1}%
 3997:   \ifx\firstarg\xendsetuptable
 3998:     \let\go = \relax
 3999:   \else
 4000:     \ifx\firstarg\xcolumnfractions
 4001:       \global\setpercenttrue
 4002:     \else
 4003:       \ifsetpercent
 4004:          \let\go\pickupwholefraction
 4005:       \else
 4006:          \global\advance\colcount by 1
 4007:          \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a
 4008:                    % separator; typically that is always in the input, anyway.
 4009:          \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
 4010:       \fi
 4011:     \fi
 4012:     \ifx\go\pickupwholefraction
 4013:       % Put the argument back for the \pickupwholefraction call, so
 4014:       % we'll always have a period there to be parsed.
 4015:       \def\go{\pickupwholefraction#1}%
 4016:     \else
 4017:       \let\go = \setuptable
 4018:     \fi%
 4019:   \fi
 4020:   \go
 4021: }
 4022: 
 4023: % multitable-only commands.
 4024: % 
 4025: % @headitem starts a heading row, which we typeset in bold.  Assignments
 4026: % have to be global since we are inside the implicit group of an
 4027: % alignment entry.  \everycr below resets \everytab so we don't have to
 4028: % undo it ourselves.
 4029: \def\headitemfont{\b}% for people to use in the template row; not changeable
 4030: \def\headitem{%
 4031:   \checkenv\multitable
 4032:   \crcr
 4033:   \gdef\headitemcrhook{\nobreak}% attempt to avoid page break after headings
 4034:   \global\everytab={\bf}% can't use \headitemfont since the parsing differs
 4035:   \the\everytab % for the first item
 4036: }%
 4037: %
 4038: % default for tables with no headings.
 4039: \let\headitemcrhook=\relax
 4040: %
 4041: % A \tab used to include \hskip1sp.  But then the space in a template
 4042: % line is not enough.  That is bad.  So let's go back to just `&' until
 4043: % we again encounter the problem the 1sp was intended to solve.
 4044: %					--karl, nathan@acm.org, 20apr99.
 4045: \def\tab{\checkenv\multitable &\the\everytab}%
 4046: 
 4047: % @multitable ... @end multitable definitions:
 4048: %
 4049: \newtoks\everytab  % insert after every tab.
 4050: %
 4051: \envdef\multitable{%
 4052:   \vskip\parskip
 4053:   \startsavinginserts
 4054:   %
 4055:   % @item within a multitable starts a normal row.
 4056:   % We use \def instead of \let so that if one of the multitable entries
 4057:   % contains an @itemize, we don't choke on the \item (seen as \crcr aka
 4058:   % \endtemplate) expanding \doitemize.
 4059:   \def\item{\crcr}%
 4060:   %
 4061:   \tolerance=9500
 4062:   \hbadness=9500
 4063:   \setmultitablespacing
 4064:   \parskip=\multitableparskip
 4065:   \parindent=\multitableparindent
 4066:   \overfullrule=0pt
 4067:   \global\colcount=0
 4068:   %
 4069:   \everycr = {%
 4070:     \noalign{%
 4071:       \global\everytab={}% Reset from possible headitem.
 4072:       \global\colcount=0 % Reset the column counter.
 4073:       %
 4074:       % Check for saved footnotes, etc.:
 4075:       \checkinserts
 4076:       %
 4077:       % Perhaps a \nobreak, then reset:
 4078:       \headitemcrhook
 4079:       \global\let\headitemcrhook=\relax
 4080:     }%
 4081:   }%
 4082:   %
 4083:   \parsearg\domultitable
 4084: }
 4085: \def\domultitable#1{%
 4086:   % To parse everything between @multitable and @item:
 4087:   \setuptable#1 \endsetuptable
 4088:   %
 4089:   % This preamble sets up a generic column definition, which will
 4090:   % be used as many times as user calls for columns.
 4091:   % \vtop will set a single line and will also let text wrap and
 4092:   % continue for many paragraphs if desired.
 4093:   \halign\bgroup &%
 4094:     \global\advance\colcount by 1
 4095:     \multistrut
 4096:     \vtop{%
 4097:       % Use the current \colcount to find the correct column width:
 4098:       \hsize=\expandafter\csname col\the\colcount\endcsname
 4099:       %
 4100:       % In order to keep entries from bumping into each other
 4101:       % we will add a \leftskip of \multitablecolspace to all columns after
 4102:       % the first one.
 4103:       %
 4104:       % If a template has been used, we will add \multitablecolspace
 4105:       % to the width of each template entry.
 4106:       %
 4107:       % If the user has set preamble in terms of percent of \hsize we will
 4108:       % use that dimension as the width of the column, and the \leftskip
 4109:       % will keep entries from bumping into each other.  Table will start at
 4110:       % left margin and final column will justify at right margin.
 4111:       %
 4112:       % Make sure we don't inherit \rightskip from the outer environment.
 4113:       \rightskip=0pt
 4114:       \ifnum\colcount=1
 4115: 	% The first column will be indented with the surrounding text.
 4116: 	\advance\hsize by\leftskip
 4117:       \else
 4118: 	\ifsetpercent \else
 4119: 	  % If user has not set preamble in terms of percent of \hsize
 4120: 	  % we will advance \hsize by \multitablecolspace.
 4121: 	  \advance\hsize by \multitablecolspace
 4122: 	\fi
 4123:        % In either case we will make \leftskip=\multitablecolspace:
 4124:       \leftskip=\multitablecolspace
 4125:       \fi
 4126:       % Ignoring space at the beginning and end avoids an occasional spurious
 4127:       % blank line, when TeX decides to break the line at the space before the
 4128:       % box from the multistrut, so the strut ends up on a line by itself.
 4129:       % For example:
 4130:       % @multitable @columnfractions .11 .89
 4131:       % @item @code{#}
 4132:       % @tab Legal holiday which is valid in major parts of the whole country.
 4133:       % Is automatically provided with highlighting sequences respectively
 4134:       % marking characters.
 4135:       \noindent\ignorespaces##\unskip\multistrut
 4136:     }\cr
 4137: }
 4138: \def\Emultitable{%
 4139:   \crcr
 4140:   \egroup % end the \halign
 4141:   \global\setpercentfalse
 4142: }
 4143: 
 4144: \def\setmultitablespacing{%
 4145:   \def\multistrut{\strut}% just use the standard line spacing
 4146:   %
 4147:   % Compute \multitablelinespace (if not defined by user) for use in
 4148:   % \multitableparskip calculation.  We used define \multistrut based on
 4149:   % this, but (ironically) that caused the spacing to be off.
 4150:   % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100.
 4151: \ifdim\multitablelinespace=0pt
 4152: \setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
 4153: \global\advance\multitablelinespace by-\ht0
 4154: \fi
 4155: % Test to see if parskip is larger than space between lines of
 4156: % table. If not, do nothing.
 4157: %        If so, set to same dimension as multitablelinespace.
 4158: \ifdim\multitableparskip>\multitablelinespace
 4159: \global\multitableparskip=\multitablelinespace
 4160: \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
 4161:                                       % than skip between lines in the table.
 4162: \fi%
 4163: \ifdim\multitableparskip=0pt
 4164: \global\multitableparskip=\multitablelinespace
 4165: \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
 4166:                                       % than skip between lines in the table.
 4167: \fi}
 4168: 
 4169: 
 4170: \message{conditionals,}
 4171: 
 4172: % @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext,
 4173: % @ifnotxml always succeed.  They currently do nothing; we don't
 4174: % attempt to check whether the conditionals are properly nested.  But we
 4175: % have to remember that they are conditionals, so that @end doesn't
 4176: % attempt to close an environment group.
 4177: %
 4178: \def\makecond#1{%
 4179:   \expandafter\let\csname #1\endcsname = \relax
 4180:   \expandafter\let\csname iscond.#1\endcsname = 1
 4181: }
 4182: \makecond{iftex}
 4183: \makecond{ifnotdocbook}
 4184: \makecond{ifnothtml}
 4185: \makecond{ifnotinfo}
 4186: \makecond{ifnotplaintext}
 4187: \makecond{ifnotxml}
 4188: 
 4189: % Ignore @ignore, @ifhtml, @ifinfo, and the like.
 4190: %
 4191: \def\direntry{\doignore{direntry}}
 4192: \def\documentdescription{\doignore{documentdescription}}
 4193: \def\docbook{\doignore{docbook}}
 4194: \def\html{\doignore{html}}
 4195: \def\ifdocbook{\doignore{ifdocbook}}
 4196: \def\ifhtml{\doignore{ifhtml}}
 4197: \def\ifinfo{\doignore{ifinfo}}
 4198: \def\ifnottex{\doignore{ifnottex}}
 4199: \def\ifplaintext{\doignore{ifplaintext}}
 4200: \def\ifxml{\doignore{ifxml}}
 4201: \def\ignore{\doignore{ignore}}
 4202: \def\menu{\doignore{menu}}
 4203: \def\xml{\doignore{xml}}
 4204: 
 4205: % Ignore text until a line `@end #1', keeping track of nested conditionals.
 4206: %
 4207: % A count to remember the depth of nesting.
 4208: \newcount\doignorecount
 4209: 
 4210: \def\doignore#1{\begingroup
 4211:   % Scan in ``verbatim'' mode:
 4212:   \obeylines
 4213:   \catcode`\@ = \other
 4214:   \catcode`\{ = \other
 4215:   \catcode`\} = \other
 4216:   %
 4217:   % Make sure that spaces turn into tokens that match what \doignoretext wants.
 4218:   \spaceisspace
 4219:   %
 4220:   % Count number of #1's that we've seen.
 4221:   \doignorecount = 0
 4222:   %
 4223:   % Swallow text until we reach the matching `@end #1'.
 4224:   \dodoignore{#1}%
 4225: }
 4226: 
 4227: { \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source.
 4228:   \obeylines %
 4229:   %
 4230:   \gdef\dodoignore#1{%
 4231:     % #1 contains the command name as a string, e.g., `ifinfo'.
 4232:     %
 4233:     % Define a command to find the next `@end #1'.
 4234:     \long\def\doignoretext##1^^M@end #1{%
 4235:       \doignoretextyyy##1^^M@#1\_STOP_}%
 4236:     %
 4237:     % And this command to find another #1 command, at the beginning of a
 4238:     % line.  (Otherwise, we would consider a line `@c @ifset', for
 4239:     % example, to count as an @ifset for nesting.)
 4240:     \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}%
 4241:     %
 4242:     % And now expand that command.
 4243:     \doignoretext ^^M%
 4244:   }%
 4245: }
 4246: 
 4247: \def\doignoreyyy#1{%
 4248:   \def\temp{#1}%
 4249:   \ifx\temp\empty			% Nothing found.
 4250:     \let\next\doignoretextzzz
 4251:   \else					% Found a nested condition, ...
 4252:     \advance\doignorecount by 1
 4253:     \let\next\doignoretextyyy		% ..., look for another.
 4254:     % If we're here, #1 ends with ^^M\ifinfo (for example).
 4255:   \fi
 4256:   \next #1% the token \_STOP_ is present just after this macro.
 4257: }
 4258: 
 4259: % We have to swallow the remaining "\_STOP_".
 4260: %
 4261: \def\doignoretextzzz#1{%
 4262:   \ifnum\doignorecount = 0	% We have just found the outermost @end.
 4263:     \let\next\enddoignore
 4264:   \else				% Still inside a nested condition.
 4265:     \advance\doignorecount by -1
 4266:     \let\next\doignoretext      % Look for the next @end.
 4267:   \fi
 4268:   \next
 4269: }
 4270: 
 4271: % Finish off ignored text.
 4272: { \obeylines%
 4273:   % Ignore anything after the last `@end #1'; this matters in verbatim
 4274:   % environments, where otherwise the newline after an ignored conditional
 4275:   % would result in a blank line in the output.
 4276:   \gdef\enddoignore#1^^M{\endgroup\ignorespaces}%
 4277: }
 4278: 
 4279: 
 4280: % @set VAR sets the variable VAR to an empty value.
 4281: % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
 4282: %
 4283: % Since we want to separate VAR from REST-OF-LINE (which might be
 4284: % empty), we can't just use \parsearg; we have to insert a space of our
 4285: % own to delimit the rest of the line, and then take it out again if we
 4286: % didn't need it.
 4287: % We rely on the fact that \parsearg sets \catcode`\ =10.
 4288: %
 4289: \parseargdef\set{\setyyy#1 \endsetyyy}
 4290: \def\setyyy#1 #2\endsetyyy{%
 4291:   {%
 4292:     \makevalueexpandable
 4293:     \def\temp{#2}%
 4294:     \edef\next{\gdef\makecsname{SET#1}}%
 4295:     \ifx\temp\empty
 4296:       \next{}%
 4297:     \else
 4298:       \setzzz#2\endsetzzz
 4299:     \fi
 4300:   }%
 4301: }
 4302: % Remove the trailing space \setxxx inserted.
 4303: \def\setzzz#1 \endsetzzz{\next{#1}}
 4304: 
 4305: % @clear VAR clears (i.e., unsets) the variable VAR.
 4306: %
 4307: \parseargdef\clear{%
 4308:   {%
 4309:     \makevalueexpandable
 4310:     \global\expandafter\let\csname SET#1\endcsname=\relax
 4311:   }%
 4312: }
 4313: 
 4314: % @value{foo} gets the text saved in variable foo.
 4315: \def\value{\begingroup\makevalueexpandable\valuexxx}
 4316: \def\valuexxx#1{\expandablevalue{#1}\endgroup}
 4317: {
 4318:   \catcode`\-=\active \catcode`\_=\active
 4319:   %
 4320:   \gdef\makevalueexpandable{%
 4321:     \let\value = \expandablevalue
 4322:     % We don't want these characters active, ...
 4323:     \catcode`\-=\other \catcode`\_=\other
 4324:     % ..., but we might end up with active ones in the argument if
 4325:     % we're called from @code, as @code{@value{foo-bar_}}, though.
 4326:     % So \let them to their normal equivalents.
 4327:     \let-\normaldash \let_\normalunderscore
 4328:   }
 4329: }
 4330: 
 4331: % We have this subroutine so that we can handle at least some @value's
 4332: % properly in indexes (we call \makevalueexpandable in \indexdummies).
 4333: % The command has to be fully expandable (if the variable is set), since
 4334: % the result winds up in the index file.  This means that if the
 4335: % variable's value contains other Texinfo commands, it's almost certain
 4336: % it will fail (although perhaps we could fix that with sufficient work
 4337: % to do a one-level expansion on the result, instead of complete).
 4338: % 
 4339: % Unfortunately, this has the consequence that when _ is in the *value*
 4340: % of an @set, it does not print properly in the roman fonts (get the cmr
 4341: % dot accent at position 126 instead).  No fix comes to mind, and it's
 4342: % been this way since 2003 or earlier, so just ignore it.
 4343: % 
 4344: \def\expandablevalue#1{%
 4345:   \expandafter\ifx\csname SET#1\endcsname\relax
 4346:     {[No value for ``#1'']}%
 4347:     \message{Variable `#1', used in @value, is not set.}%
 4348:   \else
 4349:     \csname SET#1\endcsname
 4350:   \fi
 4351: }
 4352: 
 4353: % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
 4354: % with @set.
 4355: % 
 4356: % To get the special treatment we need for `@end ifset,' we call
 4357: % \makecond and then redefine.
 4358: %
 4359: \makecond{ifset}
 4360: \def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}}
 4361: \def\doifset#1#2{%
 4362:   {%
 4363:     \makevalueexpandable
 4364:     \let\next=\empty
 4365:     \expandafter\ifx\csname SET#2\endcsname\relax
 4366:       #1% If not set, redefine \next.
 4367:     \fi
 4368:     \expandafter
 4369:   }\next
 4370: }
 4371: \def\ifsetfail{\doignore{ifset}}
 4372: 
 4373: % @ifclear VAR ... @end executes the `...' iff VAR has never been
 4374: % defined with @set, or has been undefined with @clear.
 4375: %
 4376: % The `\else' inside the `\doifset' parameter is a trick to reuse the
 4377: % above code: if the variable is not set, do nothing, if it is set,
 4378: % then redefine \next to \ifclearfail.
 4379: %
 4380: \makecond{ifclear}
 4381: \def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}}
 4382: \def\ifclearfail{\doignore{ifclear}}
 4383: 
 4384: % @ifcommandisdefined CMD ... @end executes the `...' if CMD (written
 4385: % without the @) is in fact defined.  We can only feasibly check at the
 4386: % TeX level, so something like `mathcode' is going to considered
 4387: % defined even though it is not a Texinfo command.
 4388: % 
 4389: \makecond{ifcommanddefined}
 4390: \def\ifcommanddefined{\parsearg{\doifcmddefined{\let\next=\ifcmddefinedfail}}}
 4391: %
 4392: \def\doifcmddefined#1#2{{%
 4393:     \makevalueexpandable
 4394:     \let\next=\empty
 4395:     \expandafter\ifx\csname #2\endcsname\relax
 4396:       #1% If not defined, \let\next as above.
 4397:     \fi
 4398:     \expandafter
 4399:   }\next
 4400: }
 4401: \def\ifcmddefinedfail{\doignore{ifcommanddefined}}
 4402: 
 4403: % @ifcommandnotdefined CMD ... handled similar to @ifclear above.
 4404: \makecond{ifcommandnotdefined}
 4405: \def\ifcommandnotdefined{%
 4406:   \parsearg{\doifcmddefined{\else \let\next=\ifcmdnotdefinedfail}}}
 4407: \def\ifcmdnotdefinedfail{\doignore{ifcommandnotdefined}}
 4408: 
 4409: % Set the `txicommandconditionals' variable, so documents have a way to
 4410: % test if the @ifcommand...defined conditionals are available.
 4411: \set txicommandconditionals
 4412: 
 4413: % @dircategory CATEGORY  -- specify a category of the dir file
 4414: % which this file should belong to.  Ignore this in TeX.
 4415: \let\dircategory=\comment
 4416: 
 4417: % @defininfoenclose.
 4418: \let\definfoenclose=\comment
 4419: 
 4420: 
 4421: \message{indexing,}
 4422: % Index generation facilities
 4423: 
 4424: % Define \newwrite to be identical to plain tex's \newwrite
 4425: % except not \outer, so it can be used within macros and \if's.
 4426: \edef\newwrite{\makecsname{ptexnewwrite}}
 4427: 
 4428: % \newindex {foo} defines an index named IX.
 4429: % It automatically defines \IXindex such that
 4430: % \IXindex ...rest of line... puts an entry in the index IX.
 4431: % It also defines \IXindfile to be the number of the output channel for
 4432: % the file that accumulates this index.  The file's extension is IX.
 4433: % The name of an index should be no more than 2 characters long
 4434: % for the sake of vms.
 4435: %
 4436: \def\newindex#1{%
 4437:   \expandafter\chardef\csname#1indfile\endcsname=0
 4438:   \expandafter\xdef\csname#1index\endcsname{%     % Define @#1index
 4439:     \noexpand\doindex{#1}}
 4440: }
 4441: 
 4442: % @defindex foo  ==  \newindex{foo}
 4443: %
 4444: \def\defindex{\parsearg\newindex}
 4445: 
 4446: % Define @defcodeindex, like @defindex except put all entries in @code.
 4447: %
 4448: \def\defcodeindex{\parsearg\newcodeindex}
 4449: %
 4450: \def\newcodeindex#1{%
 4451:   \expandafter\chardef\csname#1indfile\endcsname=0
 4452:   \expandafter\xdef\csname#1index\endcsname{%
 4453:     \noexpand\docodeindex{#1}}%
 4454: }
 4455: 
 4456: % The default indices:
 4457: \newindex{cp}%      concepts,
 4458: \newcodeindex{fn}%  functions,
 4459: \newcodeindex{vr}%  variables,
 4460: \newcodeindex{tp}%  types,
 4461: \newcodeindex{ky}%  keys
 4462: \newcodeindex{pg}%  and programs.
 4463: 
 4464: 
 4465: % @synindex foo bar    makes index foo feed into index bar.
 4466: % Do this instead of @defindex foo if you don't want it as a separate index.
 4467: %
 4468: % @syncodeindex foo bar   similar, but put all entries made for index foo
 4469: % inside @code.
 4470: %
 4471: \def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
 4472: \def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}
 4473: 
 4474: % #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
 4475: % #3 the target index (bar).
 4476: \def\dosynindex#1#2#3{%
 4477:   % Only do \closeout if we haven't already done it, else we'll end up
 4478:   % closing the target index.
 4479:   \expandafter \ifx\csname donesynindex#2\endcsname \relax
 4480:     % The \closeout helps reduce unnecessary open files; the limit on the
 4481:     % Acorn RISC OS is a mere 16 files.
 4482:     \expandafter\closeout\csname#2indfile\endcsname
 4483:     \expandafter\let\csname donesynindex#2\endcsname = 1
 4484:   \fi
 4485:   % redefine \fooindfile:
 4486:   \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
 4487:   \expandafter\let\csname#2indfile\endcsname=\temp
 4488:   % redefine \fooindex:
 4489:   \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
 4490: }
 4491: 
 4492: % Define \doindex, the driver for all index macros.
 4493: % Argument #1 is generated by the calling \fooindex macro,
 4494: % and it the two-letter name of the index.
 4495: 
 4496: \def\doindex#1{\edef\indexname{#1}\parsearg\doindexxxx}
 4497: \def\doindexxxx #1{\doind{\indexname}{#1}}
 4498: 
 4499: % like the previous two, but they put @code around the argument.
 4500: \def\docodeindex#1{\edef\indexname{#1}\parsearg\docodeindexxxx}
 4501: \def\docodeindexxxx #1{\doind{\indexname}{\code{#1}}}
 4502: 
 4503: % Used when writing an index entry out to an index file, to prevent
 4504: % expansion of Texinfo commands that can appear in an index entry.
 4505: %
 4506: \def\indexdummies{%
 4507:   \escapechar = `\\     % use backslash in output files.
 4508:   \def\@{@}% change to @@ when we switch to @ as escape char in index files.
 4509:   \def\ {\realbackslash\space }%
 4510:   %
 4511:   % Need these unexpandable (because we define \tt as a dummy)
 4512:   % definitions when @{ or @} appear in index entry text.  Also, more
 4513:   % complicated, when \tex is in effect and \{ is a \delimiter again.
 4514:   % We can't use \lbracecmd and \rbracecmd because texindex assumes
 4515:   % braces and backslashes are used only as delimiters.  Perhaps we
 4516:   % should use @lbracechar and @rbracechar?
 4517:   \def\{{{\tt\char123}}%
 4518:   \def\}{{\tt\char125}}%
 4519:   %
 4520:   % Do the redefinitions.
 4521:   \commondummies
 4522: }
 4523: 
 4524: % For the aux and toc files, @ is the escape character.  So we want to
 4525: % redefine everything using @ as the escape character (instead of
 4526: % \realbackslash, still used for index files).  When everything uses @,
 4527: % this will be simpler.
 4528: %
 4529: \def\atdummies{%
 4530:   \def\@{@@}%
 4531:   \def\ {@ }%
 4532:   \let\{ = \lbraceatcmd
 4533:   \let\} = \rbraceatcmd
 4534:   %
 4535:   % Do the redefinitions.
 4536:   \commondummies
 4537:   \otherbackslash
 4538: }
 4539: 
 4540: % Called from \indexdummies and \atdummies.
 4541: %
 4542: \def\commondummies{%
 4543:   % \definedummyword defines \#1 as \string\#1\space, thus effectively
 4544:   % preventing its expansion.  This is used only for control words,
 4545:   % not control letters, because the \space would be incorrect for
 4546:   % control characters, but is needed to separate the control word
 4547:   % from whatever follows.
 4548:   %
 4549:   % For control letters, we have \definedummyletter, which omits the
 4550:   % space.
 4551:   %
 4552:   % These can be used both for control words that take an argument and
 4553:   % those that do not.  If it is followed by {arg} in the input, then
 4554:   % that will dutifully get written to the index (or wherever).
 4555:   %
 4556:   \def\definedummyword  ##1{\def##1{\string##1\space}}%
 4557:   \def\definedummyletter##1{\def##1{\string##1}}%
 4558:   \let\definedummyaccent\definedummyletter
 4559:   %
 4560:   \commondummiesnofonts
 4561:   %
 4562:   \definedummyletter\_%
 4563:   \definedummyletter\-%
 4564:   %
 4565:   % Non-English letters.
 4566:   \definedummyword\AA
 4567:   \definedummyword\AE
 4568:   \definedummyword\DH
 4569:   \definedummyword\L
 4570:   \definedummyword\O
 4571:   \definedummyword\OE
 4572:   \definedummyword\TH
 4573:   \definedummyword\aa
 4574:   \definedummyword\ae
 4575:   \definedummyword\dh
 4576:   \definedummyword\exclamdown
 4577:   \definedummyword\l
 4578:   \definedummyword\o
 4579:   \definedummyword\oe
 4580:   \definedummyword\ordf
 4581:   \definedummyword\ordm
 4582:   \definedummyword\questiondown
 4583:   \definedummyword\ss
 4584:   \definedummyword\th
 4585:   %
 4586:   % Although these internal commands shouldn't show up, sometimes they do.
 4587:   \definedummyword\bf
 4588:   \definedummyword\gtr
 4589:   \definedummyword\hat
 4590:   \definedummyword\less
 4591:   \definedummyword\sf
 4592:   \definedummyword\sl
 4593:   \definedummyword\tclose
 4594:   \definedummyword\tt
 4595:   %
 4596:   \definedummyword\LaTeX
 4597:   \definedummyword\TeX
 4598:   %
 4599:   % Assorted special characters.
 4600:   \definedummyword\arrow
 4601:   \definedummyword\bullet
 4602:   \definedummyword\comma
 4603:   \definedummyword\copyright
 4604:   \definedummyword\registeredsymbol
 4605:   \definedummyword\dots
 4606:   \definedummyword\enddots
 4607:   \definedummyword\entrybreak
 4608:   \definedummyword\equiv
 4609:   \definedummyword\error
 4610:   \definedummyword\euro
 4611:   \definedummyword\expansion
 4612:   \definedummyword\geq
 4613:   \definedummyword\guillemetleft
 4614:   \definedummyword\guillemetright
 4615:   \definedummyword\guilsinglleft
 4616:   \definedummyword\guilsinglright
 4617:   \definedummyword\lbracechar
 4618:   \definedummyword\leq
 4619:   \definedummyword\mathopsup
 4620:   \definedummyword\minus
 4621:   \definedummyword\ogonek
 4622:   \definedummyword\pounds
 4623:   \definedummyword\point
 4624:   \definedummyword\print
 4625:   \definedummyword\quotedblbase
 4626:   \definedummyword\quotedblleft
 4627:   \definedummyword\quotedblright
 4628:   \definedummyword\quoteleft
 4629:   \definedummyword\quoteright
 4630:   \definedummyword\quotesinglbase
 4631:   \definedummyword\rbracechar
 4632:   \definedummyword\result
 4633:   \definedummyword\sub
 4634:   \definedummyword\sup
 4635:   \definedummyword\textdegree
 4636:   %
 4637:   % We want to disable all macros so that they are not expanded by \write.
 4638:   \macrolist
 4639:   %
 4640:   \normalturnoffactive
 4641:   %
 4642:   % Handle some cases of @value -- where it does not contain any
 4643:   % (non-fully-expandable) commands.
 4644:   \makevalueexpandable
 4645: }
 4646: 
 4647: % \commondummiesnofonts: common to \commondummies and \indexnofonts.
 4648: % Define \definedumyletter, \definedummyaccent and \definedummyword before
 4649: % using.
 4650: %
 4651: \def\commondummiesnofonts{%
 4652:   % Control letters and accents.
 4653:   \definedummyletter\!%
 4654:   \definedummyaccent\"%
 4655:   \definedummyaccent\'%
 4656:   \definedummyletter\*%
 4657:   \definedummyaccent\,%
 4658:   \definedummyletter\.%
 4659:   \definedummyletter\/%
 4660:   \definedummyletter\:%
 4661:   \definedummyaccent\=%
 4662:   \definedummyletter\?%
 4663:   \definedummyaccent\^%
 4664:   \definedummyaccent\`%
 4665:   \definedummyaccent\~%
 4666:   \definedummyword\u
 4667:   \definedummyword\v
 4668:   \definedummyword\H
 4669:   \definedummyword\dotaccent
 4670:   \definedummyword\ogonek
 4671:   \definedummyword\ringaccent
 4672:   \definedummyword\tieaccent
 4673:   \definedummyword\ubaraccent
 4674:   \definedummyword\udotaccent
 4675:   \definedummyword\dotless
 4676:   %
 4677:   % Texinfo font commands.
 4678:   \definedummyword\b
 4679:   \definedummyword\i
 4680:   \definedummyword\r
 4681:   \definedummyword\sansserif
 4682:   \definedummyword\sc
 4683:   \definedummyword\slanted
 4684:   \definedummyword\t
 4685:   %
 4686:   % Commands that take arguments.
 4687:   \definedummyword\abbr
 4688:   \definedummyword\acronym
 4689:   \definedummyword\anchor
 4690:   \definedummyword\cite
 4691:   \definedummyword\code
 4692:   \definedummyword\command
 4693:   \definedummyword\dfn
 4694:   \definedummyword\dmn
 4695:   \definedummyword\email
 4696:   \definedummyword\emph
 4697:   \definedummyword\env
 4698:   \definedummyword\file
 4699:   \definedummyword\image
 4700:   \definedummyword\indicateurl
 4701:   \definedummyword\inforef
 4702:   \definedummyword\kbd
 4703:   \definedummyword\key
 4704:   \definedummyword\math
 4705:   \definedummyword\option
 4706:   \definedummyword\pxref
 4707:   \definedummyword\ref
 4708:   \definedummyword\samp
 4709:   \definedummyword\strong
 4710:   \definedummyword\tie
 4711:   \definedummyword\U
 4712:   \definedummyword\uref
 4713:   \definedummyword\url
 4714:   \definedummyword\var
 4715:   \definedummyword\verb
 4716:   \definedummyword\w
 4717:   \definedummyword\xref
 4718: }
 4719: 
 4720: % For testing: output @{ and @} in index sort strings as \{ and \}.
 4721: \newif\ifusebracesinindexes
 4722: 
 4723: \let\indexlbrace\relax
 4724: \let\indexrbrace\relax
 4725: 
 4726: {\catcode`\@=0
 4727: \catcode`\\=13
 4728:   @gdef@backslashdisappear{@def\{}}
 4729: }
 4730: 
 4731: {
 4732: \catcode`\<=13
 4733: \catcode`\-=13
 4734: \catcode`\`=13
 4735:   \gdef\indexnonalnumdisappear{%
 4736:     \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax\else
 4737:       % @set txiindexlquoteignore makes us ignore left quotes in the sort term.
 4738:       % (Introduced for FSFS 2nd ed.)
 4739:       \let`=\empty
 4740:     \fi
 4741:     %
 4742:     \expandafter\ifx\csname SETtxiindexbackslashignore\endcsname\relax\else
 4743:       \backslashdisappear
 4744:     \fi
 4745:     %
 4746:     \expandafter\ifx\csname SETtxiindexhyphenignore\endcsname\relax\else
 4747:       \def-{}%
 4748:     \fi
 4749:     \expandafter\ifx\csname SETtxiindexlessthanignore\endcsname\relax\else
 4750:       \def<{}%
 4751:     \fi
 4752:     \expandafter\ifx\csname SETtxiindexatsignignore\endcsname\relax\else
 4753:       \def\@{}%
 4754:     \fi
 4755:   }
 4756: 
 4757:   \gdef\indexnonalnumreappear{%
 4758:     \useindexbackslash
 4759:     \let-\normaldash
 4760:     \let<\normalless
 4761:     \def\@{@}%
 4762:   }
 4763: }
 4764: 
 4765: 
 4766: % \indexnofonts is used when outputting the strings to sort the index
 4767: % by, and when constructing control sequence names.  It eliminates all
 4768: % control sequences and just writes whatever the best ASCII sort string
 4769: % would be for a given command (usually its argument).
 4770: %
 4771: \def\indexnofonts{%
 4772:   % Accent commands should become @asis.
 4773:   \def\definedummyaccent##1{\let##1\asis}%
 4774:   % We can just ignore other control letters.
 4775:   \def\definedummyletter##1{\let##1\empty}%
 4776:   % All control words become @asis by default; overrides below.
 4777:   \let\definedummyword\definedummyaccent
 4778:   \commondummiesnofonts
 4779:   %
 4780:   % Don't no-op \tt, since it isn't a user-level command
 4781:   % and is used in the definitions of the active chars like <, >, |, etc.
 4782:   % Likewise with the other plain tex font commands.
 4783:   %\let\tt=\asis
 4784:   %
 4785:   \def\ { }%
 4786:   \def\@{@}%
 4787:   \def\_{\normalunderscore}%
 4788:   \def\-{}% @- shouldn't affect sorting
 4789:   %
 4790:   \uccode`\1=`\{ \uppercase{\def\{{1}}%
 4791:   \uccode`\1=`\} \uppercase{\def\}{1}}%
 4792:   \let\lbracechar\{%
 4793:   \let\rbracechar\}%
 4794:   %
 4795:   % Non-English letters.
 4796:   \def\AA{AA}%
 4797:   \def\AE{AE}%
 4798:   \def\DH{DZZ}%
 4799:   \def\L{L}%
 4800:   \def\OE{OE}%
 4801:   \def\O{O}%
 4802:   \def\TH{TH}%
 4803:   \def\aa{aa}%
 4804:   \def\ae{ae}%
 4805:   \def\dh{dzz}%
 4806:   \def\exclamdown{!}%
 4807:   \def\l{l}%
 4808:   \def\oe{oe}%
 4809:   \def\ordf{a}%
 4810:   \def\ordm{o}%
 4811:   \def\o{o}%
 4812:   \def\questiondown{?}%
 4813:   \def\ss{ss}%
 4814:   \def\th{th}%
 4815:   %
 4816:   \def\LaTeX{LaTeX}%
 4817:   \def\TeX{TeX}%
 4818:   %
 4819:   % Assorted special characters.
 4820:   % (The following {} will end up in the sort string, but that's ok.)
 4821:   \def\arrow{->}%
 4822:   \def\bullet{bullet}%
 4823:   \def\comma{,}%
 4824:   \def\copyright{copyright}%
 4825:   \def\dots{...}%
 4826:   \def\enddots{...}%
 4827:   \def\equiv{==}%
 4828:   \def\error{error}%
 4829:   \def\euro{euro}%
 4830:   \def\expansion{==>}%
 4831:   \def\geq{>=}%
 4832:   \def\guillemetleft{<<}%
 4833:   \def\guillemetright{>>}%
 4834:   \def\guilsinglleft{<}%
 4835:   \def\guilsinglright{>}%
 4836:   \def\leq{<=}%
 4837:   \def\minus{-}%
 4838:   \def\point{.}%
 4839:   \def\pounds{pounds}%
 4840:   \def\print{-|}%
 4841:   \def\quotedblbase{"}%
 4842:   \def\quotedblleft{"}%
 4843:   \def\quotedblright{"}%
 4844:   \def\quoteleft{`}%
 4845:   \def\quoteright{'}%
 4846:   \def\quotesinglbase{,}%
 4847:   \def\registeredsymbol{R}%
 4848:   \def\result{=>}%
 4849:   \def\textdegree{o}%
 4850:   %
 4851:   % We need to get rid of all macros, leaving only the arguments (if present).
 4852:   % Of course this is not nearly correct, but it is the best we can do for now.
 4853:   % makeinfo does not expand macros in the argument to @deffn, which ends up
 4854:   % writing an index entry, and texindex isn't prepared for an index sort entry
 4855:   % that starts with \.
 4856:   %
 4857:   % Since macro invocations are followed by braces, we can just redefine them
 4858:   % to take a single TeX argument.  The case of a macro invocation that
 4859:   % goes to end-of-line is not handled.
 4860:   %
 4861:   \macrolist
 4862: }
 4863: 
 4864: 
 4865: \let\SETmarginindex=\relax % put index entries in margin (undocumented)?
 4866: 
 4867: % Most index entries go through here, but \dosubind is the general case.
 4868: % #1 is the index name, #2 is the entry text.
 4869: \def\doind#1#2{\dosubind{#1}{#2}{}}
 4870: 
 4871: % There is also \dosubind {index}{topic}{subtopic}
 4872: % which makes an entry in a two-level index such as the operation index.
 4873: % TODO: Two-level index?  Operation index?
 4874: 
 4875: % Workhorse for all indexes.
 4876: % #1 is name of index, #2 is stuff to put there, #3 is subentry --
 4877: % empty if called from \doind, as we usually are (the main exception
 4878: % is with most defuns, which call us directly).
 4879: %
 4880: \def\dosubind#1#2#3{%
 4881:   \iflinks
 4882:   {%
 4883:     \requireopenindexfile{#1}%
 4884:     % Store the main index entry text (including the third arg).
 4885:     \toks0 = {#2}%
 4886:     % If third arg is present, precede it with a space.
 4887:     \def\thirdarg{#3}%
 4888:     \ifx\thirdarg\empty \else
 4889:       \toks0 = \expandafter{\the\toks0 \space #3}%
 4890:     \fi
 4891:     %
 4892:     \edef\writeto{\csname#1indfile\endcsname}%
 4893:     %
 4894:     \safewhatsit\dosubindwrite
 4895:   }%
 4896:   \fi
 4897: }
 4898: 
 4899: % Check if an index file has been opened, and if not, open it.
 4900: \def\requireopenindexfile#1{%
 4901: \ifnum\csname #1indfile\endcsname=0
 4902:   \expandafter\newwrite \csname#1indfile\endcsname
 4903:   \edef\suffix{#1}%
 4904:   % A .fls suffix would conflict with the file extension for the output
 4905:   % of -recorder, so use .f1s instead.
 4906:   \ifx\suffix\indexisfl\def\suffix{f1}\fi
 4907:   % Open the file
 4908:   \immediate\openout\csname#1indfile\endcsname \jobname.\suffix
 4909:   % Using \immediate here prevents an object entering into the current box,
 4910:   % which could confound checks such as those in \safewhatsit for preceding
 4911:   % skips.
 4912: \fi}
 4913: \def\indexisfl{fl}
 4914: 
 4915: % Output \ as {\indexbackslash}, because \ is an escape character in
 4916: % the index files.
 4917: \let\indexbackslash=\relax
 4918: {\catcode`\@=0 \catcode`\\=\active
 4919:   @gdef@useindexbackslash{@def\{{@indexbackslash}}}
 4920: }
 4921: 
 4922: % Definition for writing index entry text.
 4923: \def\sortas#1{\ignorespaces}%
 4924: 
 4925: % Definition for writing index entry sort key.  Should occur at the at
 4926: % the beginning of the index entry, like
 4927: %     @cindex @sortas{september} \september
 4928: % The \ignorespaces takes care of following space, but there's no way
 4929: % to remove space before it.
 4930: {
 4931: \catcode`\-=13
 4932: \gdef\indexwritesortas{%
 4933:   \begingroup
 4934:   \indexnonalnumreappear
 4935:   \indexwritesortasxxx}
 4936: \gdef\indexwritesortasxxx#1{%
 4937:   \xdef\indexsortkey{#1}\endgroup}
 4938: }
 4939: 
 4940: 
 4941: % Write the entry in \toks0 to the index file.
 4942: %
 4943: \def\dosubindwrite{%
 4944:   % Put the index entry in the margin if desired.
 4945:   \ifx\SETmarginindex\relax\else
 4946:     \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}%
 4947:   \fi
 4948:   %
 4949:   % Remember, we are within a group.
 4950:   \indexdummies % Must do this here, since \bf, etc expand at this stage
 4951:   \useindexbackslash % \indexbackslash isn't defined now so it will be output 
 4952:                      % as is; and it will print as backslash.
 4953:   % The braces around \indexbrace are recognized by texindex.
 4954:   %
 4955:   % Get the string to sort by, by processing the index entry with all
 4956:   % font commands turned off.
 4957:   {\indexnofonts
 4958:    \def\lbracechar{{\indexlbrace}}%
 4959:    \def\rbracechar{{\indexrbrace}}%
 4960:    \let\{=\lbracechar
 4961:    \let\}=\rbracechar
 4962:    \indexnonalnumdisappear
 4963:    \xdef\indexsortkey{}%
 4964:    \let\sortas=\indexwritesortas
 4965:    \edef\temp{\the\toks0}%
 4966:    \setbox\dummybox = \hbox{\temp}% Make sure to execute any \sortas
 4967:    \ifx\indexsortkey\empty
 4968:      \xdef\indexsortkey{\temp}%
 4969:      \ifx\indexsortkey\empty\xdef\indexsortkey{ }\fi
 4970:    \fi
 4971:   }%
 4972:   %
 4973:   % Set up the complete index entry, with both the sort key and
 4974:   % the original text, including any font commands.  We write
 4975:   % three arguments to \entry to the .?? file (four in the
 4976:   % subentry case), texindex reduces to two when writing the .??s
 4977:   % sorted result.
 4978:   \edef\temp{%
 4979:     \write\writeto{%
 4980:       \string\entry{\indexsortkey}{\noexpand\folio}{\the\toks0}}%
 4981:   }%
 4982:   \temp
 4983: }
 4984: \newbox\dummybox % used above
 4985: 
 4986: % Take care of unwanted page breaks/skips around a whatsit:
 4987: %
 4988: % If a skip is the last thing on the list now, preserve it
 4989: % by backing up by \lastskip, doing the \write, then inserting
 4990: % the skip again.  Otherwise, the whatsit generated by the
 4991: % \write or \pdfdest will make \lastskip zero.  The result is that
 4992: % sequences like this:
 4993: % @end defun
 4994: % @tindex whatever
 4995: % @defun ...
 4996: % will have extra space inserted, because the \medbreak in the
 4997: % start of the @defun won't see the skip inserted by the @end of
 4998: % the previous defun.
 4999: %
 5000: % But don't do any of this if we're not in vertical mode.  We
 5001: % don't want to do a \vskip and prematurely end a paragraph.
 5002: %
 5003: % Avoid page breaks due to these extra skips, too.
 5004: %
 5005: % But wait, there is a catch there:
 5006: % We'll have to check whether \lastskip is zero skip.  \ifdim is not
 5007: % sufficient for this purpose, as it ignores stretch and shrink parts
 5008: % of the skip.  The only way seems to be to check the textual
 5009: % representation of the skip.
 5010: %
 5011: % The following is almost like \def\zeroskipmacro{0.0pt} except that
 5012: % the ``p'' and ``t'' characters have catcode \other, not 11 (letter).
 5013: %
 5014: \edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname}
 5015: %
 5016: \newskip\whatsitskip
 5017: \newcount\whatsitpenalty
 5018: %
 5019: % ..., ready, GO:
 5020: %
 5021: \def\safewhatsit#1{\ifhmode
 5022:   #1%
 5023:  \else
 5024:   % \lastskip and \lastpenalty cannot both be nonzero simultaneously.
 5025:   \whatsitskip = \lastskip
 5026:   \edef\lastskipmacro{\the\lastskip}%
 5027:   \whatsitpenalty = \lastpenalty
 5028:   %
 5029:   % If \lastskip is nonzero, that means the last item was a
 5030:   % skip.  And since a skip is discardable, that means this
 5031:   % -\whatsitskip glue we're inserting is preceded by a
 5032:   % non-discardable item, therefore it is not a potential
 5033:   % breakpoint, therefore no \nobreak needed.
 5034:   \ifx\lastskipmacro\zeroskipmacro
 5035:   \else
 5036:     \vskip-\whatsitskip
 5037:   \fi
 5038:   %
 5039:   #1%
 5040:   %
 5041:   \ifx\lastskipmacro\zeroskipmacro
 5042:     % If \lastskip was zero, perhaps the last item was a penalty, and
 5043:     % perhaps it was >=10000, e.g., a \nobreak.  In that case, we want
 5044:     % to re-insert the same penalty (values >10000 are used for various
 5045:     % signals); since we just inserted a non-discardable item, any
 5046:     % following glue (such as a \parskip) would be a breakpoint.  For example:
 5047:     %   @deffn deffn-whatever
 5048:     %   @vindex index-whatever
 5049:     %   Description.
 5050:     % would allow a break between the index-whatever whatsit
 5051:     % and the "Description." paragraph.
 5052:     \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi
 5053:   \else
 5054:     % On the other hand, if we had a nonzero \lastskip,
 5055:     % this make-up glue would be preceded by a non-discardable item
 5056:     % (the whatsit from the \write), so we must insert a \nobreak.
 5057:     \nobreak\vskip\whatsitskip
 5058:   \fi
 5059: \fi}
 5060: 
 5061: % The index entry written in the file actually looks like
 5062: %  \entry {sortstring}{page}{topic}
 5063: % or
 5064: %  \entry {sortstring}{page}{topic}{subtopic}
 5065: % The texindex program reads in these files and writes files
 5066: % containing these kinds of lines:
 5067: %  \initial {c}
 5068: %     before the first topic whose initial is c
 5069: %  \entry {topic}{pagelist}
 5070: %     for a topic that is used without subtopics
 5071: %  \primary {topic}
 5072: %     for the beginning of a topic that is used with subtopics
 5073: %  \secondary {subtopic}{pagelist}
 5074: %     for each subtopic.
 5075: 
 5076: % Define the user-accessible indexing commands
 5077: % @findex, @vindex, @kindex, @cindex.
 5078: 
 5079: \def\findex {\fnindex}
 5080: \def\kindex {\kyindex}
 5081: \def\cindex {\cpindex}
 5082: \def\vindex {\vrindex}
 5083: \def\tindex {\tpindex}
 5084: \def\pindex {\pgindex}
 5085: 
 5086: \def\cindexsub {\begingroup\obeylines\cindexsub}
 5087: {\obeylines %
 5088: \gdef\cindexsub "#1" #2^^M{\endgroup %
 5089: \dosubind{cp}{#2}{#1}}}
 5090: 
 5091: % Define the macros used in formatting output of the sorted index material.
 5092: 
 5093: % @printindex causes a particular index (the ??s file) to get printed.
 5094: % It does not print any chapter heading (usually an @unnumbered).
 5095: %
 5096: \parseargdef\printindex{\begingroup
 5097:   \dobreak \chapheadingskip{10000}%
 5098:   %
 5099:   \smallfonts \rm
 5100:   \tolerance = 9500
 5101:   \plainfrenchspacing
 5102:   \everypar = {}% don't want the \kern\-parindent from indentation suppression.
 5103:   %
 5104:   % See if the index file exists and is nonempty.
 5105:   % Change catcode of @ here so that if the index file contains
 5106:   % \initial {@}
 5107:   % as its first line, TeX doesn't complain about mismatched braces
 5108:   % (because it thinks @} is a control sequence).
 5109:   \catcode`\@ = 11
 5110:   % See comment in \requireopenindexfile.
 5111:   \def\indexname{#1}\ifx\indexname\indexisfl\def\indexname{f1}\fi
 5112:   \openin 1 \jobname.\indexname s
 5113:   \ifeof 1
 5114:     % \enddoublecolumns gets confused if there is no text in the index,
 5115:     % and it loses the chapter title and the aux file entries for the
 5116:     % index.  The easiest way to prevent this problem is to make sure
 5117:     % there is some text.
 5118:     \putwordIndexNonexistent
 5119:   \else
 5120:     \catcode`\\ = 0
 5121:     \escapechar = `\\
 5122:     %
 5123:     % If the index file exists but is empty, then \openin leaves \ifeof
 5124:     % false.  We have to make TeX try to read something from the file, so
 5125:     % it can discover if there is anything in it.
 5126:     \read 1 to \thisline
 5127:     \ifeof 1
 5128:       \putwordIndexIsEmpty
 5129:     \else
 5130:       % Index files are almost Texinfo source, but we use \ as the escape
 5131:       % character.  It would be better to use @, but that's too big a change
 5132:       % to make right now.
 5133:       \def\indexbackslash{\ttbackslash}%
 5134:       \let\indexlbrace\{   % Likewise, set these sequences for braces
 5135:       \let\indexrbrace\}   % used in the sort key.
 5136:       \begindoublecolumns
 5137:       \let\entryorphanpenalty=\indexorphanpenalty
 5138:       %
 5139:       % Read input from the index file line by line.
 5140:       \loopdo
 5141:         \ifeof1
 5142:           \let\firsttoken\relax
 5143:         \else
 5144:           \read 1 to \nextline
 5145:           \edef\act{\gdef\noexpand\firsttoken{\getfirsttoken\nextline}}%
 5146:           \act
 5147:         \fi
 5148:         \thisline
 5149:         %
 5150:         \ifeof1\else
 5151:         \let\thisline\nextline
 5152:       \repeat
 5153:       %%
 5154:       \enddoublecolumns
 5155:     \fi
 5156:   \fi
 5157:   \closein 1
 5158: \endgroup}
 5159: 
 5160: \def\getfirsttoken#1{\expandafter\getfirsttokenx#1\endfirsttoken}
 5161: \long\def\getfirsttokenx#1#2\endfirsttoken{\noexpand#1}
 5162: 
 5163: \def\loopdo#1\repeat{\def\body{#1}\loopdoxxx}
 5164: \def\loopdoxxx{\let\next=\relax\body\let\next=\loopdoxxx\fi\next}
 5165: 
 5166: % These macros are used by the sorted index file itself.
 5167: % Change them to control the appearance of the index.
 5168: 
 5169: {\catcode`\/=13 \catcode`\-=13 \catcode`\^=13 \catcode`\~=13 \catcode`\_=13
 5170: \catcode`\|=13 \catcode`\<=13 \catcode`\>=13 \catcode`\+=13 \catcode`\"=13
 5171: \catcode`\$=3
 5172: \gdef\initialglyphs{%
 5173:   % Some changes for non-alphabetic characters.  Using the glyphs from the
 5174:   % math fonts looks more consistent than the typewriter font used elsewhere
 5175:   % for these characters.
 5176:   \def\indexbackslash{\math{\backslash}}%
 5177:   \let\\=\indexbackslash
 5178:   %
 5179:   % Can't get bold backslash so don't use bold forward slash
 5180:   \catcode`\/=13
 5181:   \def/{{\secrmnotbold \normalslash}}%
 5182:   \def-{{\normaldash\normaldash}}% en dash `--'
 5183:   \def^{{\chapbf \normalcaret}}%
 5184:   \def~{{\chapbf \normaltilde}}%
 5185:   \def\_{%
 5186:      \leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }%
 5187:   \def|{$\vert$}%
 5188:   \def<{$\less$}%
 5189:   \def>{$\gtr$}%
 5190:   \def+{$\normalplus$}%
 5191: }}
 5192: 
 5193: \def\initial{%
 5194:   \bgroup
 5195:   \initialglyphs
 5196:   \initialx
 5197: }
 5198: 
 5199: \def\initialx#1{%
 5200:   % Remove any glue we may have, we'll be inserting our own.
 5201:   \removelastskip
 5202:   %
 5203:   % We like breaks before the index initials, so insert a bonus.
 5204:   % The glue before the bonus allows a little bit of space at the
 5205:   % bottom of a column to reduce an increase in inter-line spacing.
 5206:   \nobreak
 5207:   \vskip 0pt plus 5\baselineskip
 5208:   \penalty -300 
 5209:   \vskip 0pt plus -5\baselineskip
 5210:   %
 5211:   % Typeset the initial.  Making this add up to a whole number of
 5212:   % baselineskips increases the chance of the dots lining up from column
 5213:   % to column.  It still won't often be perfect, because of the stretch
 5214:   % we need before each entry, but it's better.
 5215:   %
 5216:   % No shrink because it confuses \balancecolumns.
 5217:   \vskip 1.67\baselineskip plus 1\baselineskip
 5218:   \leftline{\secfonts \kern-0.05em \secbf #1}%
 5219:   % \secfonts is inside the argument of \leftline so that the change of
 5220:   % \baselineskip will not affect any glue inserted before the vbox that
 5221:   % \leftline creates.
 5222:   % Do our best not to break after the initial.
 5223:   \nobreak
 5224:   \vskip .33\baselineskip plus .1\baselineskip
 5225:   \egroup % \initialglyphs
 5226: }
 5227: 
 5228: \newdimen\entryrightmargin
 5229: \entryrightmargin=0pt
 5230: 
 5231: % \entry typesets a paragraph consisting of the text (#1), dot leaders, and
 5232: % then page number (#2) flushed to the right margin.  It is used for index
 5233: % and table of contents entries.  The paragraph is indented by \leftskip.
 5234: %
 5235: \def\entry{%
 5236:   \begingroup
 5237:     %
 5238:     % Start a new paragraph if necessary, so our assignments below can't
 5239:     % affect previous text.
 5240:     \par
 5241:     %
 5242:     % No extra space above this paragraph.
 5243:     \parskip = 0in
 5244:     %
 5245:     % When reading the text of entry, convert explicit line breaks
 5246:     % from @* into spaces.  The user might give these in long section
 5247:     % titles, for instance.
 5248:     \def\*{\unskip\space\ignorespaces}%
 5249:     \def\entrybreak{\hfil\break}% An undocumented command
 5250:     %
 5251:     % A bit of stretch before each entry for the benefit of balancing
 5252:     % columns.
 5253:     \vskip 0pt plus0.5pt
 5254:     %
 5255:     % Swallow the left brace of the text (first parameter):
 5256:     \afterassignment\doentry
 5257:     \let\temp =
 5258: }
 5259: \def\entrybreak{\unskip\space\ignorespaces}%
 5260: \def\doentry{%
 5261:     % Save the text of the entry
 5262:     \global\setbox\boxA=\hbox\bgroup
 5263:     \bgroup % Instead of the swallowed brace.
 5264:       \noindent
 5265:       \aftergroup\finishentry
 5266:       % And now comes the text of the entry.
 5267:       % Not absorbing as a macro argument reduces the chance of problems
 5268:       % with catcodes occurring.
 5269: }
 5270: {\catcode`\@=11
 5271: \gdef\finishentry#1{%
 5272:     \egroup % end box A
 5273:     \dimen@ = \wd\boxA % Length of text of entry
 5274:     \global\setbox\boxA=\hbox\bgroup\unhbox\boxA
 5275:     % #1 is the page number.
 5276:     %
 5277:     % Get the width of the page numbers, and only use
 5278:     % leaders if they are present.
 5279:     \global\setbox\boxB = \hbox{#1}%
 5280:     \ifdim\wd\boxB = 0pt
 5281:       \null\nobreak\hfill\ %
 5282:     \else
 5283:       %
 5284:       \null\nobreak\indexdotfill % Have leaders before the page number.
 5285:       %
 5286:       \ifpdf
 5287:         \pdfgettoks#1.%
 5288:         \bgroup\let\domark\relax
 5289:           \hskip\skip\thinshrinkable\the\toksA
 5290:         \egroup
 5291:         % The redefinion of \domark stops marks being added in \pdflink to 
 5292:         % preserve coloured links across page boundaries.  Otherwise the marks
 5293:         % would get in the way of \lastbox in \insertindexentrybox.
 5294:       \else
 5295:         \hskip\skip\thinshrinkable #1%
 5296:       \fi
 5297:     \fi
 5298:     \egroup % end \boxA
 5299:     \ifdim\wd\boxB = 0pt
 5300:       \global\setbox\entryindexbox=\vbox{\unhbox\boxA}%
 5301:     \else
 5302:     \global\setbox\entryindexbox=\vbox\bgroup
 5303:       \prevdepth=\entrylinedepth
 5304:       \noindent
 5305:       % We want the text of the entries to be aligned to the left, and the
 5306:       % page numbers to be aligned to the right.
 5307:       %
 5308:       \advance\leftskip by 0pt plus 1fil
 5309:       \advance\leftskip by 0pt plus -1fill
 5310:       \rightskip = 0pt plus -1fil
 5311:       \advance\rightskip by 0pt plus 1fill
 5312:       % Cause last line, which could consist of page numbers on their own
 5313:       % if the list of page numbers is long, to be aligned to the right.
 5314:       \parfillskip=0pt plus -1fill
 5315:       %
 5316:       \hangindent=1em
 5317:       %
 5318:       \advance\rightskip by \entryrightmargin
 5319:       % Determine how far we can stretch into the margin.
 5320:       % This allows, e.g., "Appendix H  GNU Free Documentation License" to
 5321:       % fit on one line in @letterpaper format.
 5322:       \ifdim\entryrightmargin>2.1em
 5323:         \dimen@i=2.1em
 5324:       \else
 5325:         \dimen@i=0em
 5326:       \fi
 5327:       \advance \parfillskip by 0pt minus 1\dimen@i
 5328:       %
 5329:       \dimen@ii = \hsize
 5330:       \advance\dimen@ii by -1\leftskip
 5331:       \advance\dimen@ii by -1\entryrightmargin
 5332:       \advance\dimen@ii by 1\dimen@i
 5333:       \ifdim\wd\boxA > \dimen@ii % If the entry doesn't fit in one line
 5334:       \ifdim\dimen@ > 0.8\dimen@ii   % due to long index text
 5335:         \dimen@ = 0.7\dimen@ % Try to split the text roughly evenly
 5336:         \dimen@ii = \hsize
 5337:         \advance \dimen@ii by -1em
 5338:         \ifnum\dimen@>\dimen@ii
 5339:           % If the entry is too long, use the whole line
 5340:           \dimen@ = \dimen@ii
 5341:         \fi
 5342:         \advance\leftskip by 0pt plus 1fill % ragged right
 5343:         \advance \dimen@ by 1\rightskip
 5344:         \parshape = 2 0pt \dimen@ 1em \dimen@ii
 5345:         % Ideally we'd add a finite glue at the end of the first line only, but
 5346:         % TeX doesn't seem to provide a way to do such a thing.
 5347:       \fi\fi
 5348:       \unhbox\boxA
 5349:       %
 5350:       % Do not prefer a separate line ending with a hyphen to fewer lines.
 5351:       \finalhyphendemerits = 0
 5352:       %
 5353:       % Word spacing - no stretch
 5354:       \spaceskip=\fontdimen2\font minus \fontdimen4\font
 5355:       %
 5356:       \linepenalty=1000  % Discourage line breaks.
 5357:       \hyphenpenalty=5000  % Discourage hyphenation.
 5358:       %
 5359:       \par % format the paragraph
 5360:     \egroup % The \vbox
 5361:     \fi
 5362:   \endgroup
 5363:   % delay text of entry until after penalty
 5364:   \bgroup\aftergroup\insertindexentrybox
 5365:   \entryorphanpenalty
 5366: }}
 5367: 
 5368: \newskip\thinshrinkable
 5369: \skip\thinshrinkable=.15em minus .15em
 5370: 
 5371: \newbox\entryindexbox
 5372: \def\insertindexentrybox{%
 5373:   \copy\entryindexbox
 5374:   % The following gets the depth of the last box.  This is for even
 5375:   % line spacing when entries span several lines.
 5376:   \setbox\dummybox\vbox{%
 5377:     \unvbox\entryindexbox
 5378:     \nointerlineskip
 5379:     \lastbox
 5380:     \global\entrylinedepth=\prevdepth
 5381:   }%
 5382:   % Note that we couldn't simply \unvbox\entryindexbox followed by 
 5383:   % \nointerlineskip\lastbox to remove the last box and then reinstate it, 
 5384:   % because this resets how far the box has been \moveleft'ed to 0.  \unvbox
 5385:   % doesn't affect \prevdepth either.
 5386: }
 5387: \newdimen\entrylinedepth
 5388: 
 5389: % Default is no penalty
 5390: \let\entryorphanpenalty\egroup
 5391: 
 5392: % Used from \printindex.  \firsttoken should be the first token
 5393: % after the \entry.  If it's not another \entry, we are at the last
 5394: % line of a group of index entries, so insert a penalty to discourage
 5395: % orphaned index entries.
 5396: \long\def\indexorphanpenalty{%
 5397:   \def\isentry{\entry}%
 5398:   \ifx\firsttoken\isentry
 5399:   \else
 5400:     \unskip\penalty 9000
 5401:     % The \unskip here stops breaking before the glue.  It relies on the
 5402:     % \vskip above being there, otherwise there is an error
 5403:     % "You can't use `\unskip' in vertical mode".  There has to be glue
 5404:     % in the current vertical list that hasn't been added to the
 5405:     % "current page".  See Chapter 24 of the TeXbook.  This contradicts
 5406:     % Section 8.3.7 in "TeX by Topic," though.
 5407:   \fi
 5408:   \egroup % now comes the box added with \aftergroup
 5409: }
 5410: 
 5411: % Like plain.tex's \dotfill, except uses up at least 1 em.
 5412: % The filll stretch here overpowers both the fil and fill stretch to push
 5413: % the page number to the right.
 5414: \def\indexdotfill{\cleaders
 5415:   \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1filll}
 5416: 
 5417: 
 5418: \def\primary #1{\line{#1\hfil}}
 5419: 
 5420: \newskip\secondaryindent \secondaryindent=0.5cm
 5421: \def\secondary#1#2{{%
 5422:   \parfillskip=0in
 5423:   \parskip=0in
 5424:   \hangindent=1in
 5425:   \hangafter=1
 5426:   \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill
 5427:   \ifpdf
 5428:     \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
 5429:   \else
 5430:     #2
 5431:   \fi
 5432:   \par
 5433: }}
 5434: 
 5435: % Define two-column mode, which we use to typeset indexes.
 5436: % Adapted from the TeXbook, page 416, which is to say,
 5437: % the manmac.tex format used to print the TeXbook itself.
 5438: \catcode`\@=11  % private names
 5439: 
 5440: \newbox\partialpage
 5441: \newdimen\doublecolumnhsize
 5442: \newdimen\doublecolumntopgap
 5443: \doublecolumntopgap = 0pt
 5444: 
 5445: % Use inside an output routine to save \topmark and \firstmark
 5446: \def\savemarks{%
 5447:   \global\savedtopmark=\expandafter{\topmark }%
 5448:   \global\savedfirstmark=\expandafter{\firstmark }%
 5449: }
 5450: \newtoks\savedtopmark
 5451: \newtoks\savedfirstmark
 5452: 
 5453: % Set \topmark and \firstmark for next time \output runs.
 5454: % Can't be run from withinside \output (because any material
 5455: % added while an output routine is active, including 
 5456: % penalties, is saved for after it finishes).  The page so far
 5457: % should be empty, otherwise what's on it will be thrown away.
 5458: \def\restoremarks{%
 5459:   \mark{\the\savedtopmark}%
 5460:   \bgroup\output = {%
 5461:     \setbox\dummybox=\box\PAGE
 5462:   }abc\eject\egroup
 5463:   % "abc" because output routine doesn't fire for a completely empty page.
 5464:   \mark{\the\savedfirstmark}%
 5465: }
 5466: 
 5467: \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
 5468:   % If not much space left on page, start a new page.
 5469:   \ifdim\pagetotal>0.8\vsize\vfill\eject\fi
 5470:   %
 5471:   % Grab any single-column material above us.
 5472:   \output = {%
 5473:     %
 5474:     % Here is a possibility not foreseen in manmac: if we accumulate a
 5475:     % whole lot of material, we might end up calling this \output
 5476:     % routine twice in a row (see the doublecol-lose test, which is
 5477:     % essentially a couple of indexes with @setchapternewpage off).  In
 5478:     % that case we just ship out what is in \partialpage with the normal
 5479:     % output routine.  Generally, \partialpage will be empty when this
 5480:     % runs and this will be a no-op.  See the indexspread.tex test case.
 5481:     \ifvoid\partialpage \else
 5482:       \onepageout{\pagecontents\partialpage}%
 5483:     \fi
 5484:     %
 5485:     \global\setbox\partialpage = \vbox{%
 5486:       % Unvbox the main output page.
 5487:       \unvbox\PAGE
 5488:       \kern-\topskip \kern\baselineskip
 5489:     }%
 5490:     \savemarks
 5491:   }%
 5492:   \eject % run that output routine to set \partialpage
 5493:   \restoremarks
 5494:   %
 5495:   % We recover the two marks that the last output routine saved in order
 5496:   % to propagate the information in marks added around a chapter heading,
 5497:   % which could be otherwise be lost by the time the final page is output.
 5498:   %
 5499:   %
 5500:   % Use the double-column output routine for subsequent pages.
 5501:   \output = {\doublecolumnout}%
 5502:   %
 5503:   % Change the page size parameters.  We could do this once outside this
 5504:   % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
 5505:   % format, but then we repeat the same computation.  Repeating a couple
 5506:   % of assignments once per index is clearly meaningless for the
 5507:   % execution time, so we may as well do it in one place.
 5508:   %
 5509:   % First we halve the line length, less a little for the gutter between
 5510:   % the columns.  We compute the gutter based on the line length, so it
 5511:   % changes automatically with the paper format.  The magic constant
 5512:   % below is chosen so that the gutter has the same value (well, +-<1pt)
 5513:   % as it did when we hard-coded it.
 5514:   %
 5515:   % We put the result in a separate register, \doublecolumhsize, so we
 5516:   % can restore it in \pagesofar, after \hsize itself has (potentially)
 5517:   % been clobbered.
 5518:   %
 5519:   \doublecolumnhsize = \hsize
 5520:     \advance\doublecolumnhsize by -.04154\hsize
 5521:     \divide\doublecolumnhsize by 2
 5522:   \hsize = \doublecolumnhsize
 5523:   %
 5524:   % Double the \vsize as well.  (We don't need a separate register here,
 5525:   % since nobody clobbers \vsize.)
 5526:   \global\doublecolumntopgap = \topskip
 5527:   \global\advance\doublecolumntopgap by -1\baselineskip
 5528:   \advance\vsize by -1\doublecolumntopgap
 5529:   \vsize = 2\vsize
 5530:   \topskip=0pt
 5531:   \global\entrylinedepth=0pt\relax
 5532: }
 5533: 
 5534: % The double-column output routine for all double-column pages except
 5535: % the last, which is done by \balancecolumns.
 5536: %
 5537: \def\doublecolumnout{%
 5538:   %
 5539:   \splittopskip=\topskip \splitmaxdepth=\maxdepth
 5540:   % Get the available space for the double columns -- the normal
 5541:   % (undoubled) page height minus any material left over from the
 5542:   % previous page.
 5543:   \dimen@ = \vsize
 5544:   \divide\dimen@ by 2
 5545:   \advance\dimen@ by -\ht\partialpage
 5546:   %
 5547:   % box0 will be the left-hand column, box2 the right.
 5548:   \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
 5549:   \onepageout\pagesofar
 5550:   \unvbox255
 5551:   \penalty\outputpenalty
 5552: }
 5553: %
 5554: % Re-output the contents of the output page -- any previous material,
 5555: % followed by the two boxes we just split, in box0 and box2.
 5556: \def\pagesofar{%
 5557:   \unvbox\partialpage
 5558:   %
 5559:   \hsize = \doublecolumnhsize
 5560:   \wd0=\hsize \wd2=\hsize
 5561:   \vbox{%
 5562:     \vskip\doublecolumntopgap
 5563:     \hbox to\pagewidth{\box0\hfil\box2}}%
 5564: }
 5565: 
 5566: 
 5567: % Finished with with double columns.
 5568: \def\enddoublecolumns{%
 5569:   % The following penalty ensures that the page builder is exercised
 5570:   % _before_ we change the output routine.  This is necessary in the
 5571:   % following situation:
 5572:   %
 5573:   % The last section of the index consists only of a single entry.
 5574:   % Before this section, \pagetotal is less than \pagegoal, so no
 5575:   % break occurs before the last section starts.  However, the last
 5576:   % section, consisting of \initial and the single \entry, does not
 5577:   % fit on the page and has to be broken off.  Without the following
 5578:   % penalty the page builder will not be exercised until \eject
 5579:   % below, and by that time we'll already have changed the output
 5580:   % routine to the \balancecolumns version, so the next-to-last
 5581:   % double-column page will be processed with \balancecolumns, which
 5582:   % is wrong:  The two columns will go to the main vertical list, with
 5583:   % the broken-off section in the recent contributions.  As soon as
 5584:   % the output routine finishes, TeX starts reconsidering the page
 5585:   % break.  The two columns and the broken-off section both fit on the
 5586:   % page, because the two columns now take up only half of the page
 5587:   % goal.  When TeX sees \eject from below which follows the final
 5588:   % section, it invokes the new output routine that we've set after
 5589:   % \balancecolumns below; \onepageout will try to fit the two columns
 5590:   % and the final section into the vbox of \pageheight (see
 5591:   % \pagebody), causing an overfull box.
 5592:   %
 5593:   % Note that glue won't work here, because glue does not exercise the
 5594:   % page builder, unlike penalties (see The TeXbook, pp. 280-281).
 5595:   \penalty0
 5596:   %
 5597:   \output = {%
 5598:     % Split the last of the double-column material.
 5599:     \savemarks
 5600:     \balancecolumns
 5601:     %
 5602:     % Having called \balancecolumns once, we do not
 5603:     % want to call it again.  Therefore, reset \output to its normal
 5604:     % definition right away.
 5605:     \global\output = {\onepageout{\pagecontents\PAGE}}%
 5606:   }%
 5607:   \eject
 5608:   \endgroup % started in \begindoublecolumns
 5609:   \restoremarks
 5610:   % Leave the double-column material on the current page, no automatic
 5611:   % page break.
 5612:   \box\balancedcolumns
 5613:   %
 5614:   % \pagegoal was set to the doubled \vsize above, since we restarted
 5615:   % the current page.  We're now back to normal single-column
 5616:   % typesetting, so reset \pagegoal to the normal \vsize (after the
 5617:   % \endgroup where \vsize got restored).
 5618:   \pagegoal = \vsize
 5619: }
 5620: \newbox\balancedcolumns
 5621: \setbox\balancedcolumns=\vbox{shouldnt see this}%
 5622: %
 5623: % Only called for the last of the double column material.  \doublecolumnout 
 5624: % does the others.
 5625: \def\balancecolumns{%
 5626:   \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120.
 5627:   \dimen@ = \ht0
 5628:   \advance\dimen@ by \topskip
 5629:   \advance\dimen@ by-\baselineskip
 5630:   \ifdim\dimen@<14\baselineskip
 5631:     % Don't split a short final column in two.
 5632:     \setbox2=\vbox{}%
 5633:   \else
 5634:     \divide\dimen@ by 2 % target to split to
 5635:     \dimen@ii = \dimen@
 5636:     \splittopskip = \topskip
 5637:     % Loop until the second column is no higher than the first
 5638:     {%
 5639:       \vbadness = 10000
 5640:       \loop
 5641:         \global\setbox3 = \copy0
 5642:         \global\setbox1 = \vsplit3 to \dimen@
 5643:         % Remove glue from bottom of first column to
 5644:         % make sure it is higher than the second.
 5645:         \global\setbox1 = \vbox{\unvbox1\unpenalty\unskip}%
 5646:       \ifdim\ht3>\ht1
 5647:         \global\advance\dimen@ by 1pt
 5648:       \repeat
 5649:     }%
 5650:     \multiply\dimen@ii by 4
 5651:     \divide\dimen@ii by 5
 5652:     \ifdim\ht3<\dimen@ii
 5653:       % Column heights are too different, so don't make their bottoms
 5654:       % flush with each other.  The glue at the end of the second column
 5655:       % allows a second column to stretch, reducing the difference in
 5656:       % height between the two.
 5657:       \setbox0=\vbox to\dimen@{\unvbox1\vfill}%
 5658:       \setbox2=\vbox to\dimen@{\unvbox3\vskip 0pt plus 0.3\ht0}%
 5659:     \else
 5660:       \setbox0=\vbox to\dimen@{\unvbox1}%
 5661:       \setbox2=\vbox to\dimen@{\unvbox3}%
 5662:     \fi
 5663:   \fi
 5664:   %
 5665:   \global\setbox\balancedcolumns=\vbox{\pagesofar}%
 5666: }
 5667: \catcode`\@ = \other
 5668: 
 5669: 
 5670: \message{sectioning,}
 5671: % Chapters, sections, etc.
 5672: 
 5673: % Let's start with @part.
 5674: \outer\parseargdef\part{\partzzz{#1}}
 5675: \def\partzzz#1{%
 5676:   \chapoddpage
 5677:   \null
 5678:   \vskip.3\vsize  % move it down on the page a bit
 5679:   \begingroup
 5680:     \noindent \titlefonts\rmisbold #1\par % the text
 5681:     \let\lastnode=\empty      % no node to associate with
 5682:     \writetocentry{part}{#1}{}% but put it in the toc
 5683:     \headingsoff              % no headline or footline on the part page
 5684:     % This outputs a mark at the end of the page that clears \thischapter
 5685:     % and \thissection, as is done in \startcontents.
 5686:     \let\pchapsepmacro\relax
 5687:     \chapmacro{}{Yomitfromtoc}{}%
 5688:     \chapoddpage
 5689:   \endgroup
 5690: }
 5691: 
 5692: % \unnumberedno is an oxymoron.  But we count the unnumbered
 5693: % sections so that we can refer to them unambiguously in the pdf
 5694: % outlines by their "section number".  We avoid collisions with chapter
 5695: % numbers by starting them at 10000.  (If a document ever has 10000
 5696: % chapters, we're in trouble anyway, I'm sure.)
 5697: \newcount\unnumberedno \unnumberedno = 10000
 5698: \newcount\chapno
 5699: \newcount\secno        \secno=0
 5700: \newcount\subsecno     \subsecno=0
 5701: \newcount\subsubsecno  \subsubsecno=0
 5702: 
 5703: % This counter is funny since it counts through charcodes of letters A, B, ...
 5704: \newcount\appendixno  \appendixno = `\@
 5705: %
 5706: % \def\appendixletter{\char\the\appendixno}
 5707: % We do the following ugly conditional instead of the above simple
 5708: % construct for the sake of pdftex, which needs the actual
 5709: % letter in the expansion, not just typeset.
 5710: %
 5711: \def\appendixletter{%
 5712:   \ifnum\appendixno=`A A%
 5713:   \else\ifnum\appendixno=`B B%
 5714:   \else\ifnum\appendixno=`C C%
 5715:   \else\ifnum\appendixno=`D D%
 5716:   \else\ifnum\appendixno=`E E%
 5717:   \else\ifnum\appendixno=`F F%
 5718:   \else\ifnum\appendixno=`G G%
 5719:   \else\ifnum\appendixno=`H H%
 5720:   \else\ifnum\appendixno=`I I%
 5721:   \else\ifnum\appendixno=`J J%
 5722:   \else\ifnum\appendixno=`K K%
 5723:   \else\ifnum\appendixno=`L L%
 5724:   \else\ifnum\appendixno=`M M%
 5725:   \else\ifnum\appendixno=`N N%
 5726:   \else\ifnum\appendixno=`O O%
 5727:   \else\ifnum\appendixno=`P P%
 5728:   \else\ifnum\appendixno=`Q Q%
 5729:   \else\ifnum\appendixno=`R R%
 5730:   \else\ifnum\appendixno=`S S%
 5731:   \else\ifnum\appendixno=`T T%
 5732:   \else\ifnum\appendixno=`U U%
 5733:   \else\ifnum\appendixno=`V V%
 5734:   \else\ifnum\appendixno=`W W%
 5735:   \else\ifnum\appendixno=`X X%
 5736:   \else\ifnum\appendixno=`Y Y%
 5737:   \else\ifnum\appendixno=`Z Z%
 5738:   % The \the is necessary, despite appearances, because \appendixletter is
 5739:   % expanded while writing the .toc file.  \char\appendixno is not
 5740:   % expandable, thus it is written literally, thus all appendixes come out
 5741:   % with the same letter (or @) in the toc without it.
 5742:   \else\char\the\appendixno
 5743:   \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
 5744:   \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
 5745: 
 5746: % Each @chapter defines these (using marks) as the number+name, number
 5747: % and name of the chapter.  Page headings and footings can use
 5748: % these.  @section does likewise.
 5749: \def\thischapter{}
 5750: \def\thischapternum{}
 5751: \def\thischaptername{}
 5752: \def\thissection{}
 5753: \def\thissectionnum{}
 5754: \def\thissectionname{}
 5755: 
 5756: \newcount\absseclevel % used to calculate proper heading level
 5757: \newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count
 5758: 
 5759: % @raisesections: treat @section as chapter, @subsection as section, etc.
 5760: \def\raisesections{\global\advance\secbase by -1}
 5761: \let\up=\raisesections % original BFox name
 5762: 
 5763: % @lowersections: treat @chapter as section, @section as subsection, etc.
 5764: \def\lowersections{\global\advance\secbase by 1}
 5765: \let\down=\lowersections % original BFox name
 5766: 
 5767: % we only have subsub.
 5768: \chardef\maxseclevel = 3
 5769: %
 5770: % A numbered section within an unnumbered changes to unnumbered too.
 5771: % To achieve this, remember the "biggest" unnum. sec. we are currently in:
 5772: \chardef\unnlevel = \maxseclevel
 5773: %
 5774: % Trace whether the current chapter is an appendix or not:
 5775: % \chapheadtype is "N" or "A", unnumbered chapters are ignored.
 5776: \def\chapheadtype{N}
 5777: 
 5778: % Choose a heading macro
 5779: % #1 is heading type
 5780: % #2 is heading level
 5781: % #3 is text for heading
 5782: \def\genhead#1#2#3{%
 5783:   % Compute the abs. sec. level:
 5784:   \absseclevel=#2
 5785:   \advance\absseclevel by \secbase
 5786:   % Make sure \absseclevel doesn't fall outside the range:
 5787:   \ifnum \absseclevel < 0
 5788:     \absseclevel = 0
 5789:   \else
 5790:     \ifnum \absseclevel > 3
 5791:       \absseclevel = 3
 5792:     \fi
 5793:   \fi
 5794:   % The heading type:
 5795:   \def\headtype{#1}%
 5796:   \if \headtype U%
 5797:     \ifnum \absseclevel < \unnlevel
 5798:       \chardef\unnlevel = \absseclevel
 5799:     \fi
 5800:   \else
 5801:     % Check for appendix sections:
 5802:     \ifnum \absseclevel = 0
 5803:       \edef\chapheadtype{\headtype}%
 5804:     \else
 5805:       \if \headtype A\if \chapheadtype N%
 5806: 	\errmessage{@appendix... within a non-appendix chapter}%
 5807:       \fi\fi
 5808:     \fi
 5809:     % Check for numbered within unnumbered:
 5810:     \ifnum \absseclevel > \unnlevel
 5811:       \def\headtype{U}%
 5812:     \else
 5813:       \chardef\unnlevel = 3
 5814:     \fi
 5815:   \fi
 5816:   % Now print the heading:
 5817:   \if \headtype U%
 5818:     \ifcase\absseclevel
 5819: 	\unnumberedzzz{#3}%
 5820:     \or \unnumberedseczzz{#3}%
 5821:     \or \unnumberedsubseczzz{#3}%
 5822:     \or \unnumberedsubsubseczzz{#3}%
 5823:     \fi
 5824:   \else
 5825:     \if \headtype A%
 5826:       \ifcase\absseclevel
 5827: 	  \appendixzzz{#3}%
 5828:       \or \appendixsectionzzz{#3}%
 5829:       \or \appendixsubseczzz{#3}%
 5830:       \or \appendixsubsubseczzz{#3}%
 5831:       \fi
 5832:     \else
 5833:       \ifcase\absseclevel
 5834: 	  \chapterzzz{#3}%
 5835:       \or \seczzz{#3}%
 5836:       \or \numberedsubseczzz{#3}%
 5837:       \or \numberedsubsubseczzz{#3}%
 5838:       \fi
 5839:     \fi
 5840:   \fi
 5841:   \suppressfirstparagraphindent
 5842: }
 5843: 
 5844: % an interface:
 5845: \def\numhead{\genhead N}
 5846: \def\apphead{\genhead A}
 5847: \def\unnmhead{\genhead U}
 5848: 
 5849: % @chapter, @appendix, @unnumbered.  Increment top-level counter, reset
 5850: % all lower-level sectioning counters to zero.
 5851: %
 5852: % Also set \chaplevelprefix, which we prepend to @float sequence numbers
 5853: % (e.g., figures), q.v.  By default (before any chapter), that is empty.
 5854: \let\chaplevelprefix = \empty
 5855: %
 5856: \outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz
 5857: \def\chapterzzz#1{%
 5858:   % section resetting is \global in case the chapter is in a group, such
 5859:   % as an @include file.
 5860:   \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
 5861:     \global\advance\chapno by 1
 5862:   %
 5863:   % Used for \float.
 5864:   \gdef\chaplevelprefix{\the\chapno.}%
 5865:   \resetallfloatnos
 5866:   %
 5867:   % \putwordChapter can contain complex things in translations.
 5868:   \toks0=\expandafter{\putwordChapter}%
 5869:   \message{\the\toks0 \space \the\chapno}%
 5870:   %
 5871:   % Write the actual heading.
 5872:   \chapmacro{#1}{Ynumbered}{\the\chapno}%
 5873:   %
 5874:   % So @section and the like are numbered underneath this chapter.
 5875:   \global\let\section = \numberedsec
 5876:   \global\let\subsection = \numberedsubsec
 5877:   \global\let\subsubsection = \numberedsubsubsec
 5878: }
 5879: 
 5880: \outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz
 5881: %
 5882: \def\appendixzzz#1{%
 5883:   \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
 5884:     \global\advance\appendixno by 1
 5885:   \gdef\chaplevelprefix{\appendixletter.}%
 5886:   \resetallfloatnos
 5887:   %
 5888:   % \putwordAppendix can contain complex things in translations.
 5889:   \toks0=\expandafter{\putwordAppendix}%
 5890:   \message{\the\toks0 \space \appendixletter}%
 5891:   %
 5892:   \chapmacro{#1}{Yappendix}{\appendixletter}%
 5893:   %
 5894:   \global\let\section = \appendixsec
 5895:   \global\let\subsection = \appendixsubsec
 5896:   \global\let\subsubsection = \appendixsubsubsec
 5897: }
 5898: 
 5899: % normally unnmhead0 calls unnumberedzzz:
 5900: \outer\parseargdef\unnumbered{\unnmhead0{#1}}
 5901: \def\unnumberedzzz#1{%
 5902:   \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
 5903:     \global\advance\unnumberedno by 1
 5904:   %
 5905:   % Since an unnumbered has no number, no prefix for figures.
 5906:   \global\let\chaplevelprefix = \empty
 5907:   \resetallfloatnos
 5908:   %
 5909:   % This used to be simply \message{#1}, but TeX fully expands the
 5910:   % argument to \message.  Therefore, if #1 contained @-commands, TeX
 5911:   % expanded them.  For example, in `@unnumbered The @cite{Book}', TeX
 5912:   % expanded @cite (which turns out to cause errors because \cite is meant
 5913:   % to be executed, not expanded).
 5914:   %
 5915:   % Anyway, we don't want the fully-expanded definition of @cite to appear
 5916:   % as a result of the \message, we just want `@cite' itself.  We use
 5917:   % \the<toks register> to achieve this: TeX expands \the<toks> only once,
 5918:   % simply yielding the contents of <toks register>.  (We also do this for
 5919:   % the toc entries.)
 5920:   \toks0 = {#1}%
 5921:   \message{(\the\toks0)}%
 5922:   %
 5923:   \chapmacro{#1}{Ynothing}{\the\unnumberedno}%
 5924:   %
 5925:   \global\let\section = \unnumberedsec
 5926:   \global\let\subsection = \unnumberedsubsec
 5927:   \global\let\subsubsection = \unnumberedsubsubsec
 5928: }
 5929: 
 5930: % @centerchap is like @unnumbered, but the heading is centered.
 5931: \outer\parseargdef\centerchap{%
 5932:   \let\centerparametersmaybe = \centerparameters
 5933:   \unnmhead0{#1}%
 5934:   \let\centerparametersmaybe = \relax
 5935: }
 5936: 
 5937: % @top is like @unnumbered.
 5938: \let\top\unnumbered
 5939: 
 5940: % Sections.
 5941: % 
 5942: \outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz
 5943: \def\seczzz#1{%
 5944:   \global\subsecno=0 \global\subsubsecno=0  \global\advance\secno by 1
 5945:   \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}%
 5946: }
 5947: 
 5948: % normally calls appendixsectionzzz:
 5949: \outer\parseargdef\appendixsection{\apphead1{#1}}
 5950: \def\appendixsectionzzz#1{%
 5951:   \global\subsecno=0 \global\subsubsecno=0  \global\advance\secno by 1
 5952:   \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}%
 5953: }
 5954: \let\appendixsec\appendixsection
 5955: 
 5956: % normally calls unnumberedseczzz:
 5957: \outer\parseargdef\unnumberedsec{\unnmhead1{#1}}
 5958: \def\unnumberedseczzz#1{%
 5959:   \global\subsecno=0 \global\subsubsecno=0  \global\advance\secno by 1
 5960:   \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}%
 5961: }
 5962: 
 5963: % Subsections.
 5964: % 
 5965: % normally calls numberedsubseczzz:
 5966: \outer\parseargdef\numberedsubsec{\numhead2{#1}}
 5967: \def\numberedsubseczzz#1{%
 5968:   \global\subsubsecno=0  \global\advance\subsecno by 1
 5969:   \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}%
 5970: }
 5971: 
 5972: % normally calls appendixsubseczzz:
 5973: \outer\parseargdef\appendixsubsec{\apphead2{#1}}
 5974: \def\appendixsubseczzz#1{%
 5975:   \global\subsubsecno=0  \global\advance\subsecno by 1
 5976:   \sectionheading{#1}{subsec}{Yappendix}%
 5977:                  {\appendixletter.\the\secno.\the\subsecno}%
 5978: }
 5979: 
 5980: % normally calls unnumberedsubseczzz:
 5981: \outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}}
 5982: \def\unnumberedsubseczzz#1{%
 5983:   \global\subsubsecno=0  \global\advance\subsecno by 1
 5984:   \sectionheading{#1}{subsec}{Ynothing}%
 5985:                  {\the\unnumberedno.\the\secno.\the\subsecno}%
 5986: }
 5987: 
 5988: % Subsubsections.
 5989: % 
 5990: % normally numberedsubsubseczzz:
 5991: \outer\parseargdef\numberedsubsubsec{\numhead3{#1}}
 5992: \def\numberedsubsubseczzz#1{%
 5993:   \global\advance\subsubsecno by 1
 5994:   \sectionheading{#1}{subsubsec}{Ynumbered}%
 5995:                  {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}%
 5996: }
 5997: 
 5998: % normally appendixsubsubseczzz:
 5999: \outer\parseargdef\appendixsubsubsec{\apphead3{#1}}
 6000: \def\appendixsubsubseczzz#1{%
 6001:   \global\advance\subsubsecno by 1
 6002:   \sectionheading{#1}{subsubsec}{Yappendix}%
 6003:                  {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}%
 6004: }
 6005: 
 6006: % normally unnumberedsubsubseczzz:
 6007: \outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}}
 6008: \def\unnumberedsubsubseczzz#1{%
 6009:   \global\advance\subsubsecno by 1
 6010:   \sectionheading{#1}{subsubsec}{Ynothing}%
 6011:                  {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}%
 6012: }
 6013: 
 6014: % These macros control what the section commands do, according
 6015: % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
 6016: % Define them by default for a numbered chapter.
 6017: \let\section = \numberedsec
 6018: \let\subsection = \numberedsubsec
 6019: \let\subsubsection = \numberedsubsubsec
 6020: 
 6021: % Define @majorheading, @heading and @subheading
 6022: 
 6023: \def\majorheading{%
 6024:   {\advance\chapheadingskip by 10pt \chapbreak }%
 6025:   \parsearg\chapheadingzzz
 6026: }
 6027: 
 6028: \def\chapheading{\chapbreak \parsearg\chapheadingzzz}
 6029: \def\chapheadingzzz#1{%
 6030:   \vbox{\chapfonts \raggedtitlesettings #1\par}%
 6031:   \nobreak\bigskip \nobreak
 6032:   \suppressfirstparagraphindent
 6033: }
 6034: 
 6035: % @heading, @subheading, @subsubheading.
 6036: \parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{}
 6037:   \suppressfirstparagraphindent}
 6038: \parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{}
 6039:   \suppressfirstparagraphindent}
 6040: \parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{}
 6041:   \suppressfirstparagraphindent}
 6042: 
 6043: % These macros generate a chapter, section, etc. heading only
 6044: % (including whitespace, linebreaking, etc. around it),
 6045: % given all the information in convenient, parsed form.
 6046: 
 6047: % Args are the skip and penalty (usually negative)
 6048: \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
 6049: 
 6050: % Parameter controlling skip before chapter headings (if needed)
 6051: \newskip\chapheadingskip
 6052: 
 6053: % Define plain chapter starts, and page on/off switching for it.
 6054: \def\chapbreak{\dobreak \chapheadingskip {-4000}}
 6055: 
 6056: % Start a new page
 6057: \def\chappager{\par\vfill\supereject}
 6058: 
 6059: % \chapoddpage - start on an odd page for a new chapter
 6060: % Because \domark is called before \chapoddpage, the filler page will
 6061: % get the headings for the next chapter, which is wrong.  But we don't
 6062: % care -- we just disable all headings on the filler page.
 6063: \def\chapoddpage{%
 6064:   \chappager
 6065:   \ifodd\pageno \else
 6066:     \begingroup
 6067:       \headingsoff
 6068:       \null
 6069:       \chappager
 6070:     \endgroup
 6071:   \fi
 6072: }
 6073: 
 6074: \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
 6075: 
 6076: \def\CHAPPAGoff{%
 6077: \global\let\contentsalignmacro = \chappager
 6078: \global\let\pchapsepmacro=\chapbreak
 6079: \global\let\pagealignmacro=\chappager}
 6080: 
 6081: \def\CHAPPAGon{%
 6082: \global\let\contentsalignmacro = \chappager
 6083: \global\let\pchapsepmacro=\chappager
 6084: \global\let\pagealignmacro=\chappager
 6085: \global\def\HEADINGSon{\HEADINGSsingle}}
 6086: 
 6087: \def\CHAPPAGodd{%
 6088: \global\let\contentsalignmacro = \chapoddpage
 6089: \global\let\pchapsepmacro=\chapoddpage
 6090: \global\let\pagealignmacro=\chapoddpage
 6091: \global\def\HEADINGSon{\HEADINGSdouble}}
 6092: 
 6093: \CHAPPAGon
 6094: 
 6095: % \chapmacro - Chapter opening.
 6096: %
 6097: % #1 is the text, #2 is the section type (Ynumbered, Ynothing,
 6098: % Yappendix, Yomitfromtoc), #3 the chapter number.
 6099: % Not used for @heading series.
 6100: %
 6101: % To test against our argument.
 6102: \def\Ynothingkeyword{Ynothing}
 6103: \def\Yappendixkeyword{Yappendix}
 6104: \def\Yomitfromtockeyword{Yomitfromtoc}
 6105: %
 6106: \def\chapmacro#1#2#3{%
 6107:   \expandafter\ifx\thisenv\titlepage\else
 6108:     \checkenv{}% chapters, etc., should not start inside an environment.
 6109:   \fi
 6110:   % FIXME: \chapmacro is currently called from inside \titlepage when
 6111:   % \setcontentsaftertitlepage to print the "Table of Contents" heading, but
 6112:   % this should probably be done by \sectionheading with an option to print
 6113:   % in chapter size.
 6114:   %
 6115:   % Insert the first mark before the heading break (see notes for \domark).
 6116:   \let\prevchapterdefs=\lastchapterdefs
 6117:   \let\prevsectiondefs=\lastsectiondefs
 6118:   \gdef\lastsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}%
 6119:                         \gdef\thissection{}}%
 6120:   %
 6121:   \def\temptype{#2}%
 6122:   \ifx\temptype\Ynothingkeyword
 6123:     \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
 6124:                           \gdef\thischapter{\thischaptername}}%
 6125:   \else\ifx\temptype\Yomitfromtockeyword
 6126:     \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
 6127:                           \gdef\thischapter{}}%
 6128:   \else\ifx\temptype\Yappendixkeyword
 6129:     \toks0={#1}%
 6130:     \xdef\lastchapterdefs{%
 6131:       \gdef\noexpand\thischaptername{\the\toks0}%
 6132:       \gdef\noexpand\thischapternum{\appendixletter}%
 6133:       % \noexpand\putwordAppendix avoids expanding indigestible
 6134:       % commands in some of the translations.
 6135:       \gdef\noexpand\thischapter{\noexpand\putwordAppendix{}
 6136:                                  \noexpand\thischapternum:
 6137:                                  \noexpand\thischaptername}%
 6138:     }%
 6139:   \else
 6140:     \toks0={#1}%
 6141:     \xdef\lastchapterdefs{%
 6142:       \gdef\noexpand\thischaptername{\the\toks0}%
 6143:       \gdef\noexpand\thischapternum{\the\chapno}%
 6144:       % \noexpand\putwordChapter avoids expanding indigestible
 6145:       % commands in some of the translations.
 6146:       \gdef\noexpand\thischapter{\noexpand\putwordChapter{}
 6147:                                  \noexpand\thischapternum:
 6148:                                  \noexpand\thischaptername}%
 6149:     }%
 6150:   \fi\fi\fi
 6151:   %
 6152:   % Output the mark.  Pass it through \safewhatsit, to take care of
 6153:   % the preceding space.
 6154:   \safewhatsit\domark
 6155:   %
 6156:   % Insert the chapter heading break.
 6157:   \pchapsepmacro
 6158:   %
 6159:   % Now the second mark, after the heading break.  No break points
 6160:   % between here and the heading.
 6161:   \let\prevchapterdefs=\lastchapterdefs
 6162:   \let\prevsectiondefs=\lastsectiondefs
 6163:   \domark
 6164:   %
 6165:   {%
 6166:     \chapfonts \rmisbold
 6167:     \let\footnote=\errfootnoteheading % give better error message
 6168:     %
 6169:     % Have to define \lastsection before calling \donoderef, because the
 6170:     % xref code eventually uses it.  On the other hand, it has to be called
 6171:     % after \pchapsepmacro, or the headline will change too soon.
 6172:     \gdef\lastsection{#1}%
 6173:     %
 6174:     % Only insert the separating space if we have a chapter/appendix
 6175:     % number, and don't print the unnumbered ``number''.
 6176:     \ifx\temptype\Ynothingkeyword
 6177:       \setbox0 = \hbox{}%
 6178:       \def\toctype{unnchap}%
 6179:     \else\ifx\temptype\Yomitfromtockeyword
 6180:       \setbox0 = \hbox{}% contents like unnumbered, but no toc entry
 6181:       \def\toctype{omit}%
 6182:     \else\ifx\temptype\Yappendixkeyword
 6183:       \setbox0 = \hbox{\putwordAppendix{} #3\enspace}%
 6184:       \def\toctype{app}%
 6185:     \else
 6186:       \setbox0 = \hbox{#3\enspace}%
 6187:       \def\toctype{numchap}%
 6188:     \fi\fi\fi
 6189:     %
 6190:     % Write the toc entry for this chapter.  Must come before the
 6191:     % \donoderef, because we include the current node name in the toc
 6192:     % entry, and \donoderef resets it to empty.
 6193:     \writetocentry{\toctype}{#1}{#3}%
 6194:     %
 6195:     % For pdftex, we have to write out the node definition (aka, make
 6196:     % the pdfdest) after any page break, but before the actual text has
 6197:     % been typeset.  If the destination for the pdf outline is after the
 6198:     % text, then jumping from the outline may wind up with the text not
 6199:     % being visible, for instance under high magnification.
 6200:     \donoderef{#2}%
 6201:     %
 6202:     % Typeset the actual heading.
 6203:     \nobreak % Avoid page breaks at the interline glue.
 6204:     \vbox{\raggedtitlesettings \hangindent=\wd0 \centerparametersmaybe
 6205:           \unhbox0 #1\par}%
 6206:   }%
 6207:   \nobreak\bigskip % no page break after a chapter title
 6208:   \nobreak
 6209: }
 6210: 
 6211: % @centerchap -- centered and unnumbered.
 6212: \let\centerparametersmaybe = \relax
 6213: \def\centerparameters{%
 6214:   \advance\rightskip by 3\rightskip
 6215:   \leftskip = \rightskip
 6216:   \parfillskip = 0pt
 6217: }
 6218: 
 6219: 
 6220: % I don't think this chapter style is supported any more, so I'm not
 6221: % updating it with the new noderef stuff.  We'll see.  --karl, 11aug03.
 6222: %
 6223: \def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
 6224: %
 6225: \def\unnchfopen #1{%
 6226:   \chapoddpage
 6227:   \vbox{\chapfonts \raggedtitlesettings #1\par}%
 6228:   \nobreak\bigskip\nobreak
 6229: }
 6230: \def\chfopen #1#2{\chapoddpage {\chapfonts
 6231: \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
 6232: \par\penalty 5000 %
 6233: }
 6234: \def\centerchfopen #1{%
 6235:   \chapoddpage
 6236:   \vbox{\chapfonts \raggedtitlesettings \hfill #1\hfill}%
 6237:   \nobreak\bigskip \nobreak
 6238: }
 6239: \def\CHAPFopen{%
 6240:   \global\let\chapmacro=\chfopen
 6241:   \global\let\centerchapmacro=\centerchfopen}
 6242: 
 6243: 
 6244: % Section titles.  These macros combine the section number parts and
 6245: % call the generic \sectionheading to do the printing.
 6246: %
 6247: \newskip\secheadingskip
 6248: \def\secheadingbreak{\dobreak \secheadingskip{-1000}}
 6249: 
 6250: % Subsection titles.
 6251: \newskip\subsecheadingskip
 6252: \def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}}
 6253: 
 6254: % Subsubsection titles.
 6255: \def\subsubsecheadingskip{\subsecheadingskip}
 6256: \def\subsubsecheadingbreak{\subsecheadingbreak}
 6257: 
 6258: 
 6259: % Print any size, any type, section title.
 6260: %
 6261: % #1 is the text of the title,
 6262: % #2 is the section level (sec/subsec/subsubsec),
 6263: % #3 is the section type (Ynumbered, Ynothing, Yappendix, Yomitfromtoc),
 6264: % #4 is the section number.
 6265: %
 6266: \def\seckeyword{sec}
 6267: %
 6268: \def\sectionheading#1#2#3#4{%
 6269:   {%
 6270:     \def\sectionlevel{#2}%
 6271:     \def\temptype{#3}%
 6272:     %
 6273:     % It is ok for the @heading series commands to appear inside an
 6274:     % environment (it's been historically allowed, though the logic is
 6275:     % dubious), but not the others.
 6276:     \ifx\temptype\Yomitfromtockeyword\else
 6277:       \checkenv{}% non-@*heading should not be in an environment.
 6278:     \fi
 6279:     \let\footnote=\errfootnoteheading
 6280:     %
 6281:     % Switch to the right set of fonts.
 6282:     \csname #2fonts\endcsname \rmisbold
 6283:     %
 6284:     % Insert first mark before the heading break (see notes for \domark).
 6285:     \let\prevsectiondefs=\lastsectiondefs
 6286:     \ifx\temptype\Ynothingkeyword
 6287:       \ifx\sectionlevel\seckeyword
 6288:         \gdef\lastsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}%
 6289:                               \gdef\thissection{\thissectionname}}%
 6290:       \fi
 6291:     \else\ifx\temptype\Yomitfromtockeyword
 6292:       % Don't redefine \thissection.
 6293:     \else\ifx\temptype\Yappendixkeyword
 6294:       \ifx\sectionlevel\seckeyword
 6295:         \toks0={#1}%
 6296:         \xdef\lastsectiondefs{%
 6297:           \gdef\noexpand\thissectionname{\the\toks0}%
 6298:           \gdef\noexpand\thissectionnum{#4}%
 6299:           % \noexpand\putwordSection avoids expanding indigestible
 6300:           % commands in some of the translations.
 6301:           \gdef\noexpand\thissection{\noexpand\putwordSection{}
 6302:                                      \noexpand\thissectionnum:
 6303:                                      \noexpand\thissectionname}%
 6304:         }%
 6305:       \fi
 6306:     \else
 6307:       \ifx\sectionlevel\seckeyword
 6308:         \toks0={#1}%
 6309:         \xdef\lastsectiondefs{%
 6310:           \gdef\noexpand\thissectionname{\the\toks0}%
 6311:           \gdef\noexpand\thissectionnum{#4}%
 6312:           % \noexpand\putwordSection avoids expanding indigestible
 6313:           % commands in some of the translations.
 6314:           \gdef\noexpand\thissection{\noexpand\putwordSection{}
 6315:                                      \noexpand\thissectionnum:
 6316:                                      \noexpand\thissectionname}%
 6317:         }%
 6318:       \fi
 6319:     \fi\fi\fi
 6320:     %
 6321:     % Go into vertical mode.  Usually we'll already be there, but we
 6322:     % don't want the following whatsit to end up in a preceding paragraph
 6323:     % if the document didn't happen to have a blank line.
 6324:     \par
 6325:     %
 6326:     % Output the mark.  Pass it through \safewhatsit, to take care of
 6327:     % the preceding space.
 6328:     \safewhatsit\domark
 6329:     %
 6330:     % Insert space above the heading.
 6331:     \csname #2headingbreak\endcsname
 6332:     %
 6333:     % Now the second mark, after the heading break.  No break points
 6334:     % between here and the heading.
 6335:     \global\let\prevsectiondefs=\lastsectiondefs
 6336:     \domark
 6337:     %
 6338:     % Only insert the space after the number if we have a section number.
 6339:     \ifx\temptype\Ynothingkeyword
 6340:       \setbox0 = \hbox{}%
 6341:       \def\toctype{unn}%
 6342:       \gdef\lastsection{#1}%
 6343:     \else\ifx\temptype\Yomitfromtockeyword
 6344:       % for @headings -- no section number, don't include in toc,
 6345:       % and don't redefine \lastsection.
 6346:       \setbox0 = \hbox{}%
 6347:       \def\toctype{omit}%
 6348:       \let\sectionlevel=\empty
 6349:     \else\ifx\temptype\Yappendixkeyword
 6350:       \setbox0 = \hbox{#4\enspace}%
 6351:       \def\toctype{app}%
 6352:       \gdef\lastsection{#1}%
 6353:     \else
 6354:       \setbox0 = \hbox{#4\enspace}%
 6355:       \def\toctype{num}%
 6356:       \gdef\lastsection{#1}%
 6357:     \fi\fi\fi
 6358:     %
 6359:     % Write the toc entry (before \donoderef).  See comments in \chapmacro.
 6360:     \writetocentry{\toctype\sectionlevel}{#1}{#4}%
 6361:     %
 6362:     % Write the node reference (= pdf destination for pdftex).
 6363:     % Again, see comments in \chapmacro.
 6364:     \donoderef{#3}%
 6365:     %
 6366:     % Interline glue will be inserted when the vbox is completed.
 6367:     % That glue will be a valid breakpoint for the page, since it'll be
 6368:     % preceded by a whatsit (usually from the \donoderef, or from the
 6369:     % \writetocentry if there was no node).  We don't want to allow that
 6370:     % break, since then the whatsits could end up on page n while the
 6371:     % section is on page n+1, thus toc/etc. are wrong.  Debian bug 276000.
 6372:     \nobreak
 6373:     %
 6374:     % Output the actual section heading.
 6375:     \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright
 6376:           \hangindent=\wd0  % zero if no section number
 6377:           \unhbox0 #1}%
 6378:   }%
 6379:   % Add extra space after the heading -- half of whatever came above it.
 6380:   % Don't allow stretch, though.
 6381:   \kern .5 \csname #2headingskip\endcsname
 6382:   %
 6383:   % Do not let the kern be a potential breakpoint, as it would be if it
 6384:   % was followed by glue.
 6385:   \nobreak
 6386:   %
 6387:   % We'll almost certainly start a paragraph next, so don't let that
 6388:   % glue accumulate.  (Not a breakpoint because it's preceded by a
 6389:   % discardable item.)  However, when a paragraph is not started next
 6390:   % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out
 6391:   % or the negative glue will cause weirdly wrong output, typically
 6392:   % obscuring the section heading with something else.
 6393:   \vskip-\parskip
 6394:   %
 6395:   % This is so the last item on the main vertical list is a known
 6396:   % \penalty > 10000, so \startdefun, etc., can recognize the situation
 6397:   % and do the needful.
 6398:   \penalty 10001
 6399: }
 6400: 
 6401: 
 6402: \message{toc,}
 6403: % Table of contents.
 6404: \newwrite\tocfile
 6405: 
 6406: % Write an entry to the toc file, opening it if necessary.
 6407: % Called from @chapter, etc.
 6408: %
 6409: % Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno}
 6410: % We append the current node name (if any) and page number as additional
 6411: % arguments for the \{chap,sec,...}entry macros which will eventually
 6412: % read this.  The node name is used in the pdf outlines as the
 6413: % destination to jump to.
 6414: %
 6415: % We open the .toc file for writing here instead of at @setfilename (or
 6416: % any other fixed time) so that @contents can be anywhere in the document.
 6417: % But if #1 is `omit', then we don't do anything.  This is used for the
 6418: % table of contents chapter openings themselves.
 6419: %
 6420: \newif\iftocfileopened
 6421: \def\omitkeyword{omit}%
 6422: %
 6423: \def\writetocentry#1#2#3{%
 6424:   \edef\writetoctype{#1}%
 6425:   \ifx\writetoctype\omitkeyword \else
 6426:     \iftocfileopened\else
 6427:       \immediate\openout\tocfile = \jobname.toc
 6428:       \global\tocfileopenedtrue
 6429:     \fi
 6430:     %
 6431:     \iflinks
 6432:       {\atdummies
 6433:        \edef\temp{%
 6434:          \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}%
 6435:        \temp
 6436:       }%
 6437:     \fi
 6438:   \fi
 6439:   %
 6440:   % Tell \shipout to create a pdf destination on each page, if we're
 6441:   % writing pdf.  These are used in the table of contents.  We can't
 6442:   % just write one on every page because the title pages are numbered
 6443:   % 1 and 2 (the page numbers aren't printed), and so are the first
 6444:   % two pages of the document.  Thus, we'd have two destinations named
 6445:   % `1', and two named `2'.
 6446:   \ifpdf \global\pdfmakepagedesttrue \fi
 6447: }
 6448: 
 6449: 
 6450: % These characters do not print properly in the Computer Modern roman
 6451: % fonts, so we must take special care.  This is more or less redundant
 6452: % with the Texinfo input format setup at the end of this file.
 6453: %
 6454: \def\activecatcodes{%
 6455:   \catcode`\"=\active
 6456:   \catcode`\$=\active
 6457:   \catcode`\<=\active
 6458:   \catcode`\>=\active
 6459:   \catcode`\\=\active
 6460:   \catcode`\^=\active
 6461:   \catcode`\_=\active
 6462:   \catcode`\|=\active
 6463:   \catcode`\~=\active
 6464: }
 6465: 
 6466: 
 6467: % Read the toc file, which is essentially Texinfo input.
 6468: \def\readtocfile{%
 6469:   \setupdatafile
 6470:   \activecatcodes
 6471:   \input \tocreadfilename
 6472: }
 6473: 
 6474: \newskip\contentsrightmargin \contentsrightmargin=1in
 6475: \newcount\savepageno
 6476: \newcount\lastnegativepageno \lastnegativepageno = -1
 6477: 
 6478: % Prepare to read what we've written to \tocfile.
 6479: %
 6480: \def\startcontents#1{%
 6481:   % If @setchapternewpage on, and @headings double, the contents should
 6482:   % start on an odd page, unlike chapters.  Thus, we maintain
 6483:   % \contentsalignmacro in parallel with \pagealignmacro.
 6484:   % From: Torbjorn Granlund <tege@matematik.su.se>
 6485:   \contentsalignmacro
 6486:   \immediate\closeout\tocfile
 6487:   %
 6488:   % Don't need to put `Contents' or `Short Contents' in the headline.
 6489:   % It is abundantly clear what they are.
 6490:   \chapmacro{#1}{Yomitfromtoc}{}%
 6491:   %
 6492:   \savepageno = \pageno
 6493:   \begingroup                  % Set up to handle contents files properly.
 6494:     \raggedbottom              % Worry more about breakpoints than the bottom.
 6495:     \entryrightmargin=\contentsrightmargin % Don't use the full line length.
 6496:     %
 6497:     % Roman numerals for page numbers.
 6498:     \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
 6499: }
 6500: 
 6501: % redefined for the two-volume lispref.  We always output on
 6502: % \jobname.toc even if this is redefined.
 6503: %
 6504: \def\tocreadfilename{\jobname.toc}
 6505: 
 6506: % Normal (long) toc.
 6507: %
 6508: \def\contents{%
 6509:   \startcontents{\putwordTOC}%
 6510:     \openin 1 \tocreadfilename\space
 6511:     \ifeof 1 \else
 6512:       \readtocfile
 6513:     \fi
 6514:     \vfill \eject
 6515:     \contentsalignmacro % in case @setchapternewpage odd is in effect
 6516:     \ifeof 1 \else
 6517:       \pdfmakeoutlines
 6518:     \fi
 6519:     \closein 1
 6520:   \endgroup
 6521:   \lastnegativepageno = \pageno
 6522:   \global\pageno = \savepageno
 6523: }
 6524: 
 6525: % And just the chapters.
 6526: \def\summarycontents{%
 6527:   \startcontents{\putwordShortTOC}%
 6528:     %
 6529:     \let\partentry = \shortpartentry
 6530:     \let\numchapentry = \shortchapentry
 6531:     \let\appentry = \shortchapentry
 6532:     \let\unnchapentry = \shortunnchapentry
 6533:     % We want a true roman here for the page numbers.
 6534:     \secfonts
 6535:     \let\rm=\shortcontrm \let\bf=\shortcontbf
 6536:     \let\sl=\shortcontsl \let\tt=\shortconttt
 6537:     \rm
 6538:     \hyphenpenalty = 10000
 6539:     \advance\baselineskip by 1pt % Open it up a little.
 6540:     \def\numsecentry##1##2##3##4{}
 6541:     \let\appsecentry = \numsecentry
 6542:     \let\unnsecentry = \numsecentry
 6543:     \let\numsubsecentry = \numsecentry
 6544:     \let\appsubsecentry = \numsecentry
 6545:     \let\unnsubsecentry = \numsecentry
 6546:     \let\numsubsubsecentry = \numsecentry
 6547:     \let\appsubsubsecentry = \numsecentry
 6548:     \let\unnsubsubsecentry = \numsecentry
 6549:     \openin 1 \tocreadfilename\space
 6550:     \ifeof 1 \else
 6551:       \readtocfile
 6552:     \fi
 6553:     \closein 1
 6554:     \vfill \eject
 6555:     \contentsalignmacro % in case @setchapternewpage odd is in effect
 6556:   \endgroup
 6557:   \lastnegativepageno = \pageno
 6558:   \global\pageno = \savepageno
 6559: }
 6560: \let\shortcontents = \summarycontents
 6561: 
 6562: % Typeset the label for a chapter or appendix for the short contents.
 6563: % The arg is, e.g., `A' for an appendix, or `3' for a chapter.
 6564: %
 6565: \def\shortchaplabel#1{%
 6566:   % This space should be enough, since a single number is .5em, and the
 6567:   % widest letter (M) is 1em, at least in the Computer Modern fonts.
 6568:   % But use \hss just in case.
 6569:   % (This space doesn't include the extra space that gets added after
 6570:   % the label; that gets put in by \shortchapentry above.)
 6571:   %
 6572:   % We'd like to right-justify chapter numbers, but that looks strange
 6573:   % with appendix letters.  And right-justifying numbers and
 6574:   % left-justifying letters looks strange when there is less than 10
 6575:   % chapters.  Have to read the whole toc once to know how many chapters
 6576:   % there are before deciding ...
 6577:   \hbox to 1em{#1\hss}%
 6578: }
 6579: 
 6580: % These macros generate individual entries in the table of contents.
 6581: % The first argument is the chapter or section name.
 6582: % The last argument is the page number.
 6583: % The arguments in between are the chapter number, section number, ...
 6584: 
 6585: % Parts, in the main contents.  Replace the part number, which doesn't
 6586: % exist, with an empty box.  Let's hope all the numbers have the same width.
 6587: % Also ignore the page number, which is conventionally not printed.
 6588: \def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}}
 6589: \def\partentry#1#2#3#4{\dochapentry{\numeralbox\labelspace#1}{}}
 6590: %
 6591: % Parts, in the short toc.
 6592: \def\shortpartentry#1#2#3#4{%
 6593:   \penalty-300
 6594:   \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip
 6595:   \shortchapentry{{\bf #1}}{\numeralbox}{}{}%
 6596: }
 6597: 
 6598: % Chapters, in the main contents.
 6599: \def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}}
 6600: 
 6601: % Chapters, in the short toc.
 6602: % See comments in \dochapentry re vbox and related settings.
 6603: \def\shortchapentry#1#2#3#4{%
 6604:   \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}%
 6605: }
 6606: 
 6607: % Appendices, in the main contents.
 6608: % Need the word Appendix, and a fixed-size box.
 6609: %
 6610: \def\appendixbox#1{%
 6611:   % We use M since it's probably the widest letter.
 6612:   \setbox0 = \hbox{\putwordAppendix{} M}%
 6613:   \hbox to \wd0{\putwordAppendix{} #1\hss}}
 6614: %
 6615: \def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\hskip.7em#1}{#4}}
 6616: 
 6617: % Unnumbered chapters.
 6618: \def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}}
 6619: \def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}}
 6620: 
 6621: % Sections.
 6622: \def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}}
 6623: \let\appsecentry=\numsecentry
 6624: \def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}}
 6625: 
 6626: % Subsections.
 6627: \def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}}
 6628: \let\appsubsecentry=\numsubsecentry
 6629: \def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}}
 6630: 
 6631: % And subsubsections.
 6632: \def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}}
 6633: \let\appsubsubsecentry=\numsubsubsecentry
 6634: \def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}}
 6635: 
 6636: % This parameter controls the indentation of the various levels.
 6637: % Same as \defaultparindent.
 6638: \newdimen\tocindent \tocindent = 15pt
 6639: 
 6640: % Now for the actual typesetting. In all these, #1 is the text and #2 is the
 6641: % page number.
 6642: %
 6643: % If the toc has to be broken over pages, we want it to be at chapters
 6644: % if at all possible; hence the \penalty.
 6645: \def\dochapentry#1#2{%
 6646:    \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
 6647:    \begingroup
 6648:      % Move the page numbers slightly to the right
 6649:      \advance\entryrightmargin by -0.05em
 6650:      \chapentryfonts
 6651:      \tocentry{#1}{\dopageno\bgroup#2\egroup}%
 6652:    \endgroup
 6653:    \nobreak\vskip .25\baselineskip plus.1\baselineskip
 6654: }
 6655: 
 6656: \def\dosecentry#1#2{\begingroup
 6657:   \secentryfonts \leftskip=\tocindent
 6658:   \tocentry{#1}{\dopageno\bgroup#2\egroup}%
 6659: \endgroup}
 6660: 
 6661: \def\dosubsecentry#1#2{\begingroup
 6662:   \subsecentryfonts \leftskip=2\tocindent
 6663:   \tocentry{#1}{\dopageno\bgroup#2\egroup}%
 6664: \endgroup}
 6665: 
 6666: \def\dosubsubsecentry#1#2{\begingroup
 6667:   \subsubsecentryfonts \leftskip=3\tocindent
 6668:   \tocentry{#1}{\dopageno\bgroup#2\egroup}%
 6669: \endgroup}
 6670: 
 6671: % We use the same \entry macro as for the index entries.
 6672: \let\tocentry = \entry
 6673: 
 6674: % Space between chapter (or whatever) number and the title.
 6675: \def\labelspace{\hskip1em \relax}
 6676: 
 6677: \def\dopageno#1{{\rm #1}}
 6678: \def\doshortpageno#1{{\rm #1}}
 6679: 
 6680: \def\chapentryfonts{\secfonts \rm}
 6681: \def\secentryfonts{\textfonts}
 6682: \def\subsecentryfonts{\textfonts}
 6683: \def\subsubsecentryfonts{\textfonts}
 6684: 
 6685: 
 6686: \message{environments,}
 6687: % @foo ... @end foo.
 6688: 
 6689: % @tex ... @end tex    escapes into raw TeX temporarily.
 6690: % One exception: @ is still an escape character, so that @end tex works.
 6691: % But \@ or @@ will get a plain @ character.
 6692: 
 6693: \envdef\tex{%
 6694:   \setupmarkupstyle{tex}%
 6695:   \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
 6696:   \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
 6697:   \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
 6698:   \catcode `\%=14
 6699:   \catcode `\+=\other
 6700:   \catcode `\"=\other
 6701:   \catcode `\|=\other
 6702:   \catcode `\<=\other
 6703:   \catcode `\>=\other
 6704:   \catcode `\`=\other
 6705:   \catcode `\'=\other
 6706:   \escapechar=`\\
 6707:   %
 6708:   % ' is active in math mode (mathcode"8000).  So reset it, and all our
 6709:   % other math active characters (just in case), to plain's definitions.
 6710:   \mathactive
 6711:   %
 6712:   % Inverse of the list at the beginning of the file.
 6713:   \let\b=\ptexb
 6714:   \let\bullet=\ptexbullet
 6715:   \let\c=\ptexc
 6716:   \let\,=\ptexcomma
 6717:   \let\.=\ptexdot
 6718:   \let\dots=\ptexdots
 6719:   \let\equiv=\ptexequiv
 6720:   \let\!=\ptexexclam
 6721:   \let\i=\ptexi
 6722:   \let\indent=\ptexindent
 6723:   \let\noindent=\ptexnoindent
 6724:   \let\{=\ptexlbrace
 6725:   \let\+=\tabalign
 6726:   \let\}=\ptexrbrace
 6727:   \let\/=\ptexslash
 6728:   \let\sp=\ptexsp
 6729:   \let\*=\ptexstar
 6730:   %\let\sup=\ptexsup % do not redefine, we want @sup to work in math mode
 6731:   \let\t=\ptext
 6732:   \expandafter \let\csname top\endcsname=\ptextop  % we've made it outer
 6733:   \let\frenchspacing=\plainfrenchspacing
 6734:   %
 6735:   \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
 6736:   \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
 6737:   \def\@{@}%
 6738: }
 6739: % There is no need to define \Etex.
 6740: 
 6741: % Define @lisp ... @end lisp.
 6742: % @lisp environment forms a group so it can rebind things,
 6743: % including the definition of @end lisp (which normally is erroneous).
 6744: 
 6745: % Amount to narrow the margins by for @lisp.
 6746: \newskip\lispnarrowing \lispnarrowing=0.4in
 6747: 
 6748: % This is the definition that ^^M gets inside @lisp, @example, and other
 6749: % such environments.  \null is better than a space, since it doesn't
 6750: % have any width.
 6751: \def\lisppar{\null\endgraf}
 6752: 
 6753: % This space is always present above and below environments.
 6754: \newskip\envskipamount \envskipamount = 0pt
 6755: 
 6756: % Make spacing and below environment symmetrical.  We use \parskip here
 6757: % to help in doing that, since in @example-like environments \parskip
 6758: % is reset to zero; thus the \afterenvbreak inserts no space -- but the
 6759: % start of the next paragraph will insert \parskip.
 6760: %
 6761: \def\aboveenvbreak{{%
 6762:   % =10000 instead of <10000 because of a special case in \itemzzz and
 6763:   % \sectionheading, q.v.
 6764:   \ifnum \lastpenalty=10000 \else
 6765:     \advance\envskipamount by \parskip
 6766:     \endgraf
 6767:     \ifdim\lastskip<\envskipamount
 6768:       \removelastskip
 6769:       \ifnum\lastpenalty<10000
 6770:         % Penalize breaking before the environment, because preceding text
 6771:         % often leads into it.
 6772:         \penalty100
 6773:       \fi
 6774:       \vskip\envskipamount
 6775:     \fi
 6776:   \fi
 6777: }}
 6778: 
 6779: \def\afterenvbreak{{%
 6780:   % =10000 instead of <10000 because of a special case in \itemzzz and
 6781:   % \sectionheading, q.v.
 6782:   \ifnum \lastpenalty=10000 \else
 6783:     \advance\envskipamount by \parskip
 6784:     \endgraf
 6785:     \ifdim\lastskip<\envskipamount
 6786:       \removelastskip
 6787:       % it's not a good place to break if the last penalty was \nobreak
 6788:       % or better ...
 6789:       \ifnum\lastpenalty<10000 \penalty-50 \fi
 6790:       \vskip\envskipamount
 6791:     \fi
 6792:   \fi
 6793: }}
 6794: 
 6795: % \nonarrowing is a flag.  If "set", @lisp etc don't narrow margins; it will
 6796: % also clear it, so that its embedded environments do the narrowing again.
 6797: \let\nonarrowing=\relax
 6798: 
 6799: % @cartouche ... @end cartouche: draw rectangle w/rounded corners around
 6800: % environment contents.
 6801: \font\circle=lcircle10
 6802: \newdimen\circthick
 6803: \newdimen\cartouter\newdimen\cartinner
 6804: \newskip\normbskip\newskip\normpskip\newskip\normlskip
 6805: \circthick=\fontdimen8\circle
 6806: %
 6807: \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
 6808: \def\ctr{{\hskip 6pt\circle\char'010}}
 6809: \def\cbl{{\circle\char'012\hskip -6pt}}
 6810: \def\cbr{{\hskip 6pt\circle\char'011}}
 6811: \def\carttop{\hbox to \cartouter{\hskip\lskip
 6812:         \ctl\leaders\hrule height\circthick\hfil\ctr
 6813:         \hskip\rskip}}
 6814: \def\cartbot{\hbox to \cartouter{\hskip\lskip
 6815:         \cbl\leaders\hrule height\circthick\hfil\cbr
 6816:         \hskip\rskip}}
 6817: %
 6818: \newskip\lskip\newskip\rskip
 6819: 
 6820: \envdef\cartouche{%
 6821:   \ifhmode\par\fi  % can't be in the midst of a paragraph.
 6822:   \startsavinginserts
 6823:   \lskip=\leftskip \rskip=\rightskip
 6824:   \leftskip=0pt\rightskip=0pt % we want these *outside*.
 6825:   \cartinner=\hsize \advance\cartinner by-\lskip
 6826:   \advance\cartinner by-\rskip
 6827:   \cartouter=\hsize
 6828:   \advance\cartouter by 18.4pt	% allow for 3pt kerns on either
 6829: 				% side, and for 6pt waste from
 6830: 				% each corner char, and rule thickness
 6831:   \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
 6832:   %
 6833:   % If this cartouche directly follows a sectioning command, we need the
 6834:   % \parskip glue (backspaced over by default) or the cartouche can
 6835:   % collide with the section heading.
 6836:   \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi
 6837:   %
 6838:   \setbox\groupbox=\vbox\bgroup
 6839:       \baselineskip=0pt\parskip=0pt\lineskip=0pt
 6840:       \carttop
 6841:       \hbox\bgroup
 6842: 	  \hskip\lskip
 6843: 	  \vrule\kern3pt
 6844: 	  \vbox\bgroup
 6845: 	      \kern3pt
 6846: 	      \hsize=\cartinner
 6847: 	      \baselineskip=\normbskip
 6848: 	      \lineskip=\normlskip
 6849: 	      \parskip=\normpskip
 6850: 	      \vskip -\parskip
 6851: 	      \comment % For explanation, see the end of def\group.
 6852: }
 6853: \def\Ecartouche{%
 6854:               \ifhmode\par\fi
 6855: 	      \kern3pt
 6856: 	  \egroup
 6857: 	  \kern3pt\vrule
 6858: 	  \hskip\rskip
 6859:       \egroup
 6860:       \cartbot
 6861:   \egroup
 6862:   \addgroupbox
 6863:   \checkinserts
 6864: }
 6865: 
 6866: 
 6867: % This macro is called at the beginning of all the @example variants,
 6868: % inside a group.
 6869: \newdimen\nonfillparindent
 6870: \def\nonfillstart{%
 6871:   \aboveenvbreak
 6872:   \ifdim\hfuzz < 12pt \hfuzz = 12pt \fi % Don't be fussy
 6873:   \sepspaces % Make spaces be word-separators rather than space tokens.
 6874:   \let\par = \lisppar % don't ignore blank lines
 6875:   \obeylines % each line of input is a line of output
 6876:   \parskip = 0pt
 6877:   % Turn off paragraph indentation but redefine \indent to emulate
 6878:   % the normal \indent.
 6879:   \nonfillparindent=\parindent
 6880:   \parindent = 0pt
 6881:   \let\indent\nonfillindent
 6882:   %
 6883:   \emergencystretch = 0pt % don't try to avoid overfull boxes
 6884:   \ifx\nonarrowing\relax
 6885:     \advance \leftskip by \lispnarrowing
 6886:     \exdentamount=\lispnarrowing
 6887:   \else
 6888:     \let\nonarrowing = \relax
 6889:   \fi
 6890:   \let\exdent=\nofillexdent
 6891: }
 6892: 
 6893: \begingroup
 6894: \obeyspaces
 6895: % We want to swallow spaces (but not other tokens) after the fake
 6896: % @indent in our nonfill-environments, where spaces are normally
 6897: % active and set to @tie, resulting in them not being ignored after
 6898: % @indent.
 6899: \gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}%
 6900: \gdef\nonfillindentcheck{%
 6901: \ifx\temp %
 6902: \expandafter\nonfillindentgobble%
 6903: \else%
 6904: \leavevmode\nonfillindentbox%
 6905: \fi%
 6906: }%
 6907: \endgroup
 6908: \def\nonfillindentgobble#1{\nonfillindent}
 6909: \def\nonfillindentbox{\hbox to \nonfillparindent{\hss}}
 6910: 
 6911: % If you want all examples etc. small: @set dispenvsize small.
 6912: % If you want even small examples the full size: @set dispenvsize nosmall.
 6913: % This affects the following displayed environments:
 6914: %    @example, @display, @format, @lisp
 6915: %
 6916: \def\smallword{small}
 6917: \def\nosmallword{nosmall}
 6918: \let\SETdispenvsize\relax
 6919: \def\setnormaldispenv{%
 6920:   \ifx\SETdispenvsize\smallword
 6921:     % end paragraph for sake of leading, in case document has no blank
 6922:     % line.  This is redundant with what happens in \aboveenvbreak, but
 6923:     % we need to do it before changing the fonts, and it's inconvenient
 6924:     % to change the fonts afterward.
 6925:     \ifnum \lastpenalty=10000 \else \endgraf \fi
 6926:     \smallexamplefonts \rm
 6927:   \fi
 6928: }
 6929: \def\setsmalldispenv{%
 6930:   \ifx\SETdispenvsize\nosmallword
 6931:   \else
 6932:     \ifnum \lastpenalty=10000 \else \endgraf \fi
 6933:     \smallexamplefonts \rm
 6934:   \fi
 6935: }
 6936: 
 6937: % We often define two environments, @foo and @smallfoo.
 6938: % Let's do it in one command.  #1 is the env name, #2 the definition.
 6939: \def\makedispenvdef#1#2{%
 6940:   \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}%
 6941:   \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}%
 6942:   \expandafter\let\csname E#1\endcsname \afterenvbreak
 6943:   \expandafter\let\csname Esmall#1\endcsname \afterenvbreak
 6944: }
 6945: 
 6946: % Define two environment synonyms (#1 and #2) for an environment.
 6947: \def\maketwodispenvdef#1#2#3{%
 6948:   \makedispenvdef{#1}{#3}%
 6949:   \makedispenvdef{#2}{#3}%
 6950: }
 6951: %
 6952: % @lisp: indented, narrowed, typewriter font;
 6953: % @example: same as @lisp.
 6954: %
 6955: % @smallexample and @smalllisp: use smaller fonts.
 6956: % Originally contributed by Pavel@xerox.
 6957: %
 6958: \maketwodispenvdef{lisp}{example}{%
 6959:   \nonfillstart
 6960:   \tt\setupmarkupstyle{example}%
 6961:   \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
 6962:   \gobble % eat return
 6963: }
 6964: % @display/@smalldisplay: same as @lisp except keep current font.
 6965: %
 6966: \makedispenvdef{display}{%
 6967:   \nonfillstart
 6968:   \gobble
 6969: }
 6970: 
 6971: % @format/@smallformat: same as @display except don't narrow margins.
 6972: %
 6973: \makedispenvdef{format}{%
 6974:   \let\nonarrowing = t%
 6975:   \nonfillstart
 6976:   \gobble
 6977: }
 6978: 
 6979: % @flushleft: same as @format, but doesn't obey \SETdispenvsize.
 6980: \envdef\flushleft{%
 6981:   \let\nonarrowing = t%
 6982:   \nonfillstart
 6983:   \gobble
 6984: }
 6985: \let\Eflushleft = \afterenvbreak
 6986: 
 6987: % @flushright.
 6988: %
 6989: \envdef\flushright{%
 6990:   \let\nonarrowing = t%
 6991:   \nonfillstart
 6992:   \advance\leftskip by 0pt plus 1fill\relax
 6993:   \gobble
 6994: }
 6995: \let\Eflushright = \afterenvbreak
 6996: 
 6997: 
 6998: % @raggedright does more-or-less normal line breaking but no right
 6999: % justification.  From plain.tex.  Don't stretch around special
 7000: % characters in urls in this environment, since the stretch at the right
 7001: % should be enough.
 7002: \envdef\raggedright{%
 7003:   \rightskip0pt plus2.4em \spaceskip.3333em \xspaceskip.5em\relax
 7004:   \def\urefprestretchamount{0pt}%
 7005:   \def\urefpoststretchamount{0pt}%
 7006: }
 7007: \let\Eraggedright\par
 7008: 
 7009: \envdef\raggedleft{%
 7010:   \parindent=0pt \leftskip0pt plus2em
 7011:   \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
 7012:   \hbadness=10000 % Last line will usually be underfull, so turn off
 7013:                   % badness reporting.
 7014: }
 7015: \let\Eraggedleft\par
 7016: 
 7017: \envdef\raggedcenter{%
 7018:   \parindent=0pt \rightskip0pt plus1em \leftskip0pt plus1em
 7019:   \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
 7020:   \hbadness=10000 % Last line will usually be underfull, so turn off
 7021:                   % badness reporting.
 7022: }
 7023: \let\Eraggedcenter\par
 7024: 
 7025: 
 7026: % @quotation does normal linebreaking (hence we can't use \nonfillstart)
 7027: % and narrows the margins.  We keep \parskip nonzero in general, since
 7028: % we're doing normal filling.  So, when using \aboveenvbreak and
 7029: % \afterenvbreak, temporarily make \parskip 0.
 7030: %
 7031: \makedispenvdef{quotation}{\quotationstart}
 7032: %
 7033: \def\quotationstart{%
 7034:   \indentedblockstart % same as \indentedblock, but increase right margin too.
 7035:   \ifx\nonarrowing\relax
 7036:     \advance\rightskip by \lispnarrowing
 7037:   \fi
 7038:   \parsearg\quotationlabel
 7039: }
 7040: 
 7041: % We have retained a nonzero parskip for the environment, since we're
 7042: % doing normal filling.
 7043: %
 7044: \def\Equotation{%
 7045:   \par
 7046:   \ifx\quotationauthor\thisisundefined\else
 7047:     % indent a bit.
 7048:     \leftline{\kern 2\leftskip \sl ---\quotationauthor}%
 7049:   \fi
 7050:   {\parskip=0pt \afterenvbreak}%
 7051: }
 7052: \def\Esmallquotation{\Equotation}
 7053: 
 7054: % If we're given an argument, typeset it in bold with a colon after.
 7055: \def\quotationlabel#1{%
 7056:   \def\temp{#1}%
 7057:   \ifx\temp\empty \else
 7058:     {\bf #1: }%
 7059:   \fi
 7060: }
 7061: 
 7062: % @indentedblock is like @quotation, but indents only on the left and
 7063: % has no optional argument.
 7064: % 
 7065: \makedispenvdef{indentedblock}{\indentedblockstart}
 7066: %
 7067: \def\indentedblockstart{%
 7068:   {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
 7069:   \parindent=0pt
 7070:   %
 7071:   % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
 7072:   \ifx\nonarrowing\relax
 7073:     \advance\leftskip by \lispnarrowing
 7074:     \exdentamount = \lispnarrowing
 7075:   \else
 7076:     \let\nonarrowing = \relax
 7077:   \fi
 7078: }
 7079: 
 7080: % Keep a nonzero parskip for the environment, since we're doing normal filling.
 7081: %
 7082: \def\Eindentedblock{%
 7083:   \par
 7084:   {\parskip=0pt \afterenvbreak}%
 7085: }
 7086: \def\Esmallindentedblock{\Eindentedblock}
 7087: 
 7088: 
 7089: % LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
 7090: % If we want to allow any <char> as delimiter,
 7091: % we need the curly braces so that makeinfo sees the @verb command, eg:
 7092: % `@verbx...x' would look like the '@verbx' command.  --janneke@gnu.org
 7093: %
 7094: % [Knuth]: Donald Ervin Knuth, 1996.  The TeXbook.
 7095: %
 7096: % [Knuth] p.344; only we need to do the other characters Texinfo sets
 7097: % active too.  Otherwise, they get lost as the first character on a
 7098: % verbatim line.
 7099: \def\dospecials{%
 7100:   \do\ \do\\\do\{\do\}\do\$\do\&%
 7101:   \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~%
 7102:   \do\<\do\>\do\|\do\@\do+\do\"%
 7103:   % Don't do the quotes -- if we do, @set txicodequoteundirected and
 7104:   % @set txicodequotebacktick will not have effect on @verb and
 7105:   % @verbatim, and ?` and !` ligatures won't get disabled.
 7106:   %\do\`\do\'%
 7107: }
 7108: %
 7109: % [Knuth] p. 380
 7110: \def\uncatcodespecials{%
 7111:   \def\do##1{\catcode`##1=\other}\dospecials}
 7112: %
 7113: % Setup for the @verb command.
 7114: %
 7115: % Eight spaces for a tab
 7116: \begingroup
 7117:   \catcode`\^^I=\active
 7118:   \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
 7119: \endgroup
 7120: %
 7121: \def\setupverb{%
 7122:   \tt  % easiest (and conventionally used) font for verbatim
 7123:   \def\par{\leavevmode\endgraf}%
 7124:   \setupmarkupstyle{verb}%
 7125:   \tabeightspaces
 7126:   % Respect line breaks,
 7127:   % print special symbols as themselves, and
 7128:   % make each space count
 7129:   % must do in this order:
 7130:   \obeylines \uncatcodespecials \sepspaces
 7131: }
 7132: 
 7133: % Setup for the @verbatim environment
 7134: %
 7135: % Real tab expansion.
 7136: \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
 7137: %
 7138: % We typeset each line of the verbatim in an \hbox, so we can handle
 7139: % tabs.  The \global is in case the verbatim line starts with an accent,
 7140: % or some other command that starts with a begin-group.  Otherwise, the
 7141: % entire \verbbox would disappear at the corresponding end-group, before
 7142: % it is typeset.  Meanwhile, we can't have nested verbatim commands
 7143: % (can we?), so the \global won't be overwriting itself.
 7144: \newbox\verbbox
 7145: \def\starttabbox{\global\setbox\verbbox=\hbox\bgroup}
 7146: %
 7147: \begingroup
 7148:   \catcode`\^^I=\active
 7149:   \gdef\tabexpand{%
 7150:     \catcode`\^^I=\active
 7151:     \def^^I{\leavevmode\egroup
 7152:       \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab
 7153:       \divide\dimen\verbbox by\tabw
 7154:       \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw
 7155:       \advance\dimen\verbbox by\tabw  % advance to next multiple of \tabw
 7156:       \wd\verbbox=\dimen\verbbox \box\verbbox \starttabbox
 7157:     }%
 7158:   }
 7159: \endgroup
 7160: 
 7161: % start the verbatim environment.
 7162: \def\setupverbatim{%
 7163:   \let\nonarrowing = t%
 7164:   \nonfillstart
 7165:   \tt % easiest (and conventionally used) font for verbatim
 7166:   % The \leavevmode here is for blank lines.  Otherwise, we would
 7167:   % never \starttabox and the \egroup would end verbatim mode.
 7168:   \def\par{\leavevmode\egroup\box\verbbox\endgraf}%
 7169:   \tabexpand
 7170:   \setupmarkupstyle{verbatim}%
 7171:   % Respect line breaks,
 7172:   % print special symbols as themselves, and
 7173:   % make each space count.
 7174:   % Must do in this order:
 7175:   \obeylines \uncatcodespecials \sepspaces
 7176:   \everypar{\starttabbox}%
 7177: }
 7178: 
 7179: % Do the @verb magic: verbatim text is quoted by unique
 7180: % delimiter characters.  Before first delimiter expect a
 7181: % right brace, after last delimiter expect closing brace:
 7182: %
 7183: %    \def\doverb'{'<char>#1<char>'}'{#1}
 7184: %
 7185: % [Knuth] p. 382; only eat outer {}
 7186: \begingroup
 7187:   \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other
 7188:   \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
 7189: \endgroup
 7190: %
 7191: \def\verb{\begingroup\setupverb\doverb}
 7192: %
 7193: %
 7194: % Do the @verbatim magic: define the macro \doverbatim so that
 7195: % the (first) argument ends when '@end verbatim' is reached, ie:
 7196: %
 7197: %     \def\doverbatim#1@end verbatim{#1}
 7198: %
 7199: % For Texinfo it's a lot easier than for LaTeX,
 7200: % because texinfo's \verbatim doesn't stop at '\end{verbatim}':
 7201: % we need not redefine '\', '{' and '}'.
 7202: %
 7203: % Inspired by LaTeX's verbatim command set [latex.ltx]
 7204: %
 7205: \begingroup
 7206:   \catcode`\ =\active
 7207:   \obeylines %
 7208:   % ignore everything up to the first ^^M, that's the newline at the end
 7209:   % of the @verbatim input line itself.  Otherwise we get an extra blank
 7210:   % line in the output.
 7211:   \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}%
 7212:   % We really want {...\end verbatim} in the body of the macro, but
 7213:   % without the active space; thus we have to use \xdef and \gobble.
 7214: \endgroup
 7215: %
 7216: \envdef\verbatim{%
 7217:     \setupverbatim\doverbatim
 7218: }
 7219: \let\Everbatim = \afterenvbreak
 7220: 
 7221: 
 7222: % @verbatiminclude FILE - insert text of file in verbatim environment.
 7223: %
 7224: \def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude}
 7225: %
 7226: \def\doverbatiminclude#1{%
 7227:   {%
 7228:     \makevalueexpandable
 7229:     \setupverbatim
 7230:     \indexnofonts       % Allow `@@' and other weird things in file names.
 7231:     \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}%
 7232:     \input #1
 7233:     \afterenvbreak
 7234:   }%
 7235: }
 7236: 
 7237: % @copying ... @end copying.
 7238: % Save the text away for @insertcopying later.
 7239: %
 7240: % We save the uninterpreted tokens, rather than creating a box.
 7241: % Saving the text in a box would be much easier, but then all the
 7242: % typesetting commands (@smallbook, font changes, etc.) have to be done
 7243: % beforehand -- and a) we want @copying to be done first in the source
 7244: % file; b) letting users define the frontmatter in as flexible order as
 7245: % possible is desirable.
 7246: %
 7247: \def\copying{\checkenv{}\begingroup\scanargctxt\docopying}
 7248: \def\docopying#1@end copying{\endgroup\def\copyingtext{#1}}
 7249: %
 7250: \def\insertcopying{%
 7251:   \begingroup
 7252:     \parindent = 0pt  % paragraph indentation looks wrong on title page
 7253:     \scanexp\copyingtext
 7254:   \endgroup
 7255: }
 7256: 
 7257: 
 7258: \message{defuns,}
 7259: % @defun etc.
 7260: 
 7261: \newskip\defbodyindent \defbodyindent=.4in
 7262: \newskip\defargsindent \defargsindent=50pt
 7263: \newskip\deflastargmargin \deflastargmargin=18pt
 7264: \newcount\defunpenalty
 7265: 
 7266: % Start the processing of @deffn:
 7267: \def\startdefun{%
 7268:   \ifnum\lastpenalty<10000
 7269:     \medbreak
 7270:     \defunpenalty=10003 % Will keep this @deffn together with the
 7271:                         % following @def command, see below.
 7272:   \else
 7273:     % If there are two @def commands in a row, we'll have a \nobreak,
 7274:     % which is there to keep the function description together with its
 7275:     % header.  But if there's nothing but headers, we need to allow a
 7276:     % break somewhere.  Check specifically for penalty 10002, inserted
 7277:     % by \printdefunline, instead of 10000, since the sectioning
 7278:     % commands also insert a nobreak penalty, and we don't want to allow
 7279:     % a break between a section heading and a defun.
 7280:     %
 7281:     % As a further refinement, we avoid "club" headers by signalling
 7282:     % with penalty of 10003 after the very first @deffn in the
 7283:     % sequence (see above), and penalty of 10002 after any following
 7284:     % @def command.
 7285:     \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi
 7286:     %
 7287:     % Similarly, after a section heading, do not allow a break.
 7288:     % But do insert the glue.
 7289:     \medskip  % preceded by discardable penalty, so not a breakpoint
 7290:   \fi
 7291:   %
 7292:   \parindent=0in
 7293:   \advance\leftskip by \defbodyindent
 7294:   \exdentamount=\defbodyindent
 7295: }
 7296: 
 7297: \def\dodefunx#1{%
 7298:   % First, check whether we are in the right environment:
 7299:   \checkenv#1%
 7300:   %
 7301:   % As above, allow line break if we have multiple x headers in a row.
 7302:   % It's not a great place, though.
 7303:   \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi
 7304:   %
 7305:   % And now, it's time to reuse the body of the original defun:
 7306:   \expandafter\gobbledefun#1%
 7307: }
 7308: \def\gobbledefun#1\startdefun{}
 7309: 
 7310: % \printdefunline \deffnheader{text}
 7311: %
 7312: \def\printdefunline#1#2{%
 7313:   \begingroup
 7314:     % call \deffnheader:
 7315:     #1#2 \endheader
 7316:     % common ending:
 7317:     \interlinepenalty = 10000
 7318:     \advance\rightskip by 0pt plus 1fil\relax
 7319:     \endgraf
 7320:     \nobreak\vskip -\parskip
 7321:     \penalty\defunpenalty  % signal to \startdefun and \dodefunx
 7322:     % Some of the @defun-type tags do not enable magic parentheses,
 7323:     % rendering the following check redundant.  But we don't optimize.
 7324:     \checkparencounts
 7325:   \endgroup
 7326: }
 7327: 
 7328: \def\Edefun{\endgraf\medbreak}
 7329: 
 7330: % \makedefun{deffn} creates \deffn, \deffnx and \Edeffn;
 7331: % the only thing remaining is to define \deffnheader.
 7332: %
 7333: \def\makedefun#1{%
 7334:   \expandafter\let\csname E#1\endcsname = \Edefun
 7335:   \edef\temp{\noexpand\domakedefun
 7336:     \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}%
 7337:   \temp
 7338: }
 7339: 
 7340: % \domakedefun \deffn \deffnx \deffnheader { (defn. of \deffnheader) }
 7341: %
 7342: % Define \deffn and \deffnx, without parameters.
 7343: % \deffnheader has to be defined explicitly.
 7344: %
 7345: \def\domakedefun#1#2#3{%
 7346:   \envdef#1{%
 7347:     \startdefun
 7348:     \doingtypefnfalse    % distinguish typed functions from all else
 7349:     \parseargusing\activeparens{\printdefunline#3}%
 7350:   }%
 7351:   \def#2{\dodefunx#1}%
 7352:   \def#3%
 7353: }
 7354: 
 7355: \newif\ifdoingtypefn       % doing typed function?
 7356: \newif\ifrettypeownline    % typeset return type on its own line?
 7357: 
 7358: % @deftypefnnewline on|off says whether the return type of typed functions
 7359: % are printed on their own line.  This affects @deftypefn, @deftypefun,
 7360: % @deftypeop, and @deftypemethod.
 7361: % 
 7362: \parseargdef\deftypefnnewline{%
 7363:   \def\temp{#1}%
 7364:   \ifx\temp\onword
 7365:     \expandafter\let\csname SETtxideftypefnnl\endcsname
 7366:       = \empty
 7367:   \else\ifx\temp\offword
 7368:     \expandafter\let\csname SETtxideftypefnnl\endcsname
 7369:       = \relax
 7370:   \else
 7371:     \errhelp = \EMsimple
 7372:     \errmessage{Unknown @txideftypefnnl value `\temp',
 7373:                 must be on|off}%
 7374:   \fi\fi
 7375: }
 7376: 
 7377: % Untyped functions:
 7378: 
 7379: % @deffn category name args
 7380: \makedefun{deffn}{\deffngeneral{}}
 7381: 
 7382: % @deffn category class name args
 7383: \makedefun{defop}#1 {\defopon{#1\ \putwordon}}
 7384: 
 7385: % \defopon {category on}class name args
 7386: \def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
 7387: 
 7388: % \deffngeneral {subind}category name args
 7389: %
 7390: \def\deffngeneral#1#2 #3 #4\endheader{%
 7391:   % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}.
 7392:   \dosubind{fn}{\code{#3}}{#1}%
 7393:   \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}%
 7394: }
 7395: 
 7396: % Typed functions:
 7397: 
 7398: % @deftypefn category type name args
 7399: \makedefun{deftypefn}{\deftypefngeneral{}}
 7400: 
 7401: % @deftypeop category class type name args
 7402: \makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}}
 7403: 
 7404: % \deftypeopon {category on}class type name args
 7405: \def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
 7406: 
 7407: % \deftypefngeneral {subind}category type name args
 7408: %
 7409: \def\deftypefngeneral#1#2 #3 #4 #5\endheader{%
 7410:   \dosubind{fn}{\code{#4}}{#1}%
 7411:   \doingtypefntrue
 7412:   \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
 7413: }
 7414: 
 7415: % Typed variables:
 7416: 
 7417: % @deftypevr category type var args
 7418: \makedefun{deftypevr}{\deftypecvgeneral{}}
 7419: 
 7420: % @deftypecv category class type var args
 7421: \makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}}
 7422: 
 7423: % \deftypecvof {category of}class type var args
 7424: \def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} }
 7425: 
 7426: % \deftypecvgeneral {subind}category type var args
 7427: %
 7428: \def\deftypecvgeneral#1#2 #3 #4 #5\endheader{%
 7429:   \dosubind{vr}{\code{#4}}{#1}%
 7430:   \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
 7431: }
 7432: 
 7433: % Untyped variables:
 7434: 
 7435: % @defvr category var args
 7436: \makedefun{defvr}#1 {\deftypevrheader{#1} {} }
 7437: 
 7438: % @defcv category class var args
 7439: \makedefun{defcv}#1 {\defcvof{#1\ \putwordof}}
 7440: 
 7441: % \defcvof {category of}class var args
 7442: \def\defcvof#1#2 {\deftypecvof{#1}#2 {} }
 7443: 
 7444: % Types:
 7445: 
 7446: % @deftp category name args
 7447: \makedefun{deftp}#1 #2 #3\endheader{%
 7448:   \doind{tp}{\code{#2}}%
 7449:   \defname{#1}{}{#2}\defunargs{#3\unskip}%
 7450: }
 7451: 
 7452: % Remaining @defun-like shortcuts:
 7453: \makedefun{defun}{\deffnheader{\putwordDeffunc} }
 7454: \makedefun{defmac}{\deffnheader{\putwordDefmac} }
 7455: \makedefun{defspec}{\deffnheader{\putwordDefspec} }
 7456: \makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} }
 7457: \makedefun{defvar}{\defvrheader{\putwordDefvar} }
 7458: \makedefun{defopt}{\defvrheader{\putwordDefopt} }
 7459: \makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} }
 7460: \makedefun{defmethod}{\defopon\putwordMethodon}
 7461: \makedefun{deftypemethod}{\deftypeopon\putwordMethodon}
 7462: \makedefun{defivar}{\defcvof\putwordInstanceVariableof}
 7463: \makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof}
 7464: 
 7465: % \defname, which formats the name of the @def (not the args).
 7466: % #1 is the category, such as "Function".
 7467: % #2 is the return type, if any.
 7468: % #3 is the function name.
 7469: %
 7470: % We are followed by (but not passed) the arguments, if any.
 7471: %
 7472: \def\defname#1#2#3{%
 7473:   \par
 7474:   % Get the values of \leftskip and \rightskip as they were outside the @def...
 7475:   \advance\leftskip by -\defbodyindent
 7476:   %
 7477:   % Determine if we are typesetting the return type of a typed function
 7478:   % on a line by itself.
 7479:   \rettypeownlinefalse
 7480:   \ifdoingtypefn  % doing a typed function specifically?
 7481:     % then check user option for putting return type on its own line:
 7482:     \expandafter\ifx\csname SETtxideftypefnnl\endcsname\relax \else
 7483:       \rettypeownlinetrue
 7484:     \fi
 7485:   \fi
 7486:   %
 7487:   % How we'll format the category name.  Putting it in brackets helps
 7488:   % distinguish it from the body text that may end up on the next line
 7489:   % just below it.
 7490:   \def\temp{#1}%
 7491:   \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi}
 7492:   %
 7493:   % Figure out line sizes for the paragraph shape.  We'll always have at
 7494:   % least two.
 7495:   \tempnum = 2
 7496:   %
 7497:   % The first line needs space for \box0; but if \rightskip is nonzero,
 7498:   % we need only space for the part of \box0 which exceeds it:
 7499:   \dimen0=\hsize  \advance\dimen0 by -\wd0  \advance\dimen0 by \rightskip
 7500:   %
 7501:   % If doing a return type on its own line, we'll have another line.
 7502:   \ifrettypeownline
 7503:     \advance\tempnum by 1
 7504:     \def\maybeshapeline{0in \hsize}%
 7505:   \else
 7506:     \def\maybeshapeline{}%
 7507:   \fi
 7508:   %
 7509:   % The continuations:
 7510:   \dimen2=\hsize  \advance\dimen2 by -\defargsindent
 7511:   %
 7512:   % The final paragraph shape:
 7513:   \parshape \tempnum  0in \dimen0  \maybeshapeline  \defargsindent \dimen2
 7514:   %
 7515:   % Put the category name at the right margin.
 7516:   \noindent
 7517:   \hbox to 0pt{%
 7518:     \hfil\box0 \kern-\hsize
 7519:     % \hsize has to be shortened this way:
 7520:     \kern\leftskip
 7521:     % Intentionally do not respect \rightskip, since we need the space.
 7522:   }%
 7523:   %
 7524:   % Allow all lines to be underfull without complaint:
 7525:   \tolerance=10000 \hbadness=10000
 7526:   \exdentamount=\defbodyindent
 7527:   {%
 7528:     % defun fonts. We use typewriter by default (used to be bold) because:
 7529:     % . we're printing identifiers, they should be in tt in principle.
 7530:     % . in languages with many accents, such as Czech or French, it's
 7531:     %   common to leave accents off identifiers.  The result looks ok in
 7532:     %   tt, but exceedingly strange in rm.
 7533:     % . we don't want -- and --- to be treated as ligatures.
 7534:     % . this still does not fix the ?` and !` ligatures, but so far no
 7535:     %   one has made identifiers using them :).
 7536:     \df \tt
 7537:     \def\temp{#2}% text of the return type
 7538:     \ifx\temp\empty\else
 7539:       \tclose{\temp}% typeset the return type
 7540:       \ifrettypeownline
 7541:         % put return type on its own line; prohibit line break following:
 7542:         \hfil\vadjust{\nobreak}\break  
 7543:       \else
 7544:         \space  % type on same line, so just followed by a space
 7545:       \fi
 7546:     \fi           % no return type
 7547:     #3% output function name
 7548:   }%
 7549:   {\rm\enskip}% hskip 0.5 em of \tenrm
 7550:   %
 7551:   \boldbrax
 7552:   % arguments will be output next, if any.
 7553: }
 7554: 
 7555: % Print arguments in slanted roman (not ttsl), inconsistently with using
 7556: % tt for the name.  This is because literal text is sometimes needed in
 7557: % the argument list (groff manual), and ttsl and tt are not very
 7558: % distinguishable.  Prevent hyphenation at `-' chars.
 7559: %
 7560: \def\defunargs#1{%
 7561:   % use sl by default (not ttsl),
 7562:   % tt for the names.
 7563:   \df \sl \hyphenchar\font=0
 7564:   %
 7565:   % On the other hand, if an argument has two dashes (for instance), we
 7566:   % want a way to get ttsl.  We used to recommend @var for that, so
 7567:   % leave the code in, but it's strange for @var to lead to typewriter.
 7568:   % Nowadays we recommend @code, since the difference between a ttsl hyphen
 7569:   % and a tt hyphen is pretty tiny.  @code also disables ?` !`.
 7570:   \def\var##1{{\setupmarkupstyle{var}\ttslanted{##1}}}%
 7571:   #1%
 7572:   \sl\hyphenchar\font=45
 7573: }
 7574: 
 7575: % We want ()&[] to print specially on the defun line.
 7576: %
 7577: \def\activeparens{%
 7578:   \catcode`\(=\active \catcode`\)=\active
 7579:   \catcode`\[=\active \catcode`\]=\active
 7580:   \catcode`\&=\active
 7581: }
 7582: 
 7583: % Make control sequences which act like normal parenthesis chars.
 7584: \let\lparen = ( \let\rparen = )
 7585: 
 7586: % Be sure that we always have a definition for `(', etc.  For example,
 7587: % if the fn name has parens in it, \boldbrax will not be in effect yet,
 7588: % so TeX would otherwise complain about undefined control sequence.
 7589: {
 7590:   \activeparens
 7591:   \global\let(=\lparen \global\let)=\rparen
 7592:   \global\let[=\lbrack \global\let]=\rbrack
 7593:   \global\let& = \&
 7594: 
 7595:   \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
 7596:   \gdef\magicamp{\let&=\amprm}
 7597: }
 7598: 
 7599: \newcount\parencount
 7600: 
 7601: % If we encounter &foo, then turn on ()-hacking afterwards
 7602: \newif\ifampseen
 7603: \def\amprm#1 {\ampseentrue{\bf\&#1 }}
 7604: 
 7605: \def\parenfont{%
 7606:   \ifampseen
 7607:     % At the first level, print parens in roman,
 7608:     % otherwise use the default font.
 7609:     \ifnum \parencount=1 \rm \fi
 7610:   \else
 7611:     % The \sf parens (in \boldbrax) actually are a little bolder than
 7612:     % the contained text.  This is especially needed for [ and ] .
 7613:     \sf
 7614:   \fi
 7615: }
 7616: \def\infirstlevel#1{%
 7617:   \ifampseen
 7618:     \ifnum\parencount=1
 7619:       #1%
 7620:     \fi
 7621:   \fi
 7622: }
 7623: \def\bfafterword#1 {#1 \bf}
 7624: 
 7625: \def\opnr{%
 7626:   \global\advance\parencount by 1
 7627:   {\parenfont(}%
 7628:   \infirstlevel \bfafterword
 7629: }
 7630: \def\clnr{%
 7631:   {\parenfont)}%
 7632:   \infirstlevel \sl
 7633:   \global\advance\parencount by -1
 7634: }
 7635: 
 7636: \newcount\brackcount
 7637: \def\lbrb{%
 7638:   \global\advance\brackcount by 1
 7639:   {\bf[}%
 7640: }
 7641: \def\rbrb{%
 7642:   {\bf]}%
 7643:   \global\advance\brackcount by -1
 7644: }
 7645: 
 7646: \def\checkparencounts{%
 7647:   \ifnum\parencount=0 \else \badparencount \fi
 7648:   \ifnum\brackcount=0 \else \badbrackcount \fi
 7649: }
 7650: % these should not use \errmessage; the glibc manual, at least, actually
 7651: % has such constructs (when documenting function pointers).
 7652: \def\badparencount{%
 7653:   \message{Warning: unbalanced parentheses in @def...}%
 7654:   \global\parencount=0
 7655: }
 7656: \def\badbrackcount{%
 7657:   \message{Warning: unbalanced square brackets in @def...}%
 7658:   \global\brackcount=0
 7659: }
 7660: 
 7661: 
 7662: \message{macros,}
 7663: % @macro.
 7664: 
 7665: % To do this right we need a feature of e-TeX, \scantokens,
 7666: % which we arrange to emulate with a temporary file in ordinary TeX.
 7667: \ifx\eTeXversion\thisisundefined
 7668:   \newwrite\macscribble
 7669:   \def\scantokens#1{%
 7670:     \toks0={#1}%
 7671:     \immediate\openout\macscribble=\jobname.tmp
 7672:     \immediate\write\macscribble{\the\toks0}%
 7673:     \immediate\closeout\macscribble
 7674:     \input \jobname.tmp
 7675:   }
 7676: \fi
 7677: 
 7678: \let\aftermacroxxx\relax
 7679: \def\aftermacro{\aftermacroxxx}
 7680: 
 7681: % alias because \c means cedilla in @tex or @math
 7682: \let\texinfoc=\c
 7683: 
 7684: % Used at the time of macro expansion.
 7685: % Argument is macro body with arguments substituted
 7686: \def\scanmacro#1{%
 7687:   \newlinechar`\^^M
 7688:   \def\xprocessmacroarg{\eatspaces}%
 7689:   %
 7690:   % Process the macro body under the current catcode regime.
 7691:   \scantokens{#1\texinfoc}\aftermacro%
 7692:   %
 7693:   % The \c is to remove the \newlinechar added by \scantokens, and
 7694:   % can be noticed by \parsearg.
 7695:   %   The \aftermacro allows a \comment at the end of the macro definition
 7696:   % to duplicate itself past the final \newlinechar added by \scantokens:
 7697:   % this is used in the definition of \group to comment out a newline.  We
 7698:   % don't do the same for \c to support Texinfo files with macros that ended
 7699:   % with a @c, which should no longer be necessary.
 7700:   %   We avoid surrounding the call to \scantokens with \bgroup and \egroup
 7701:   % to allow macros to open or close groups themselves.
 7702: }
 7703: 
 7704: % Used for copying and captions
 7705: \def\scanexp#1{%
 7706:   \bgroup
 7707:   % Undo catcode changes of \startcontents and \printindex
 7708:   % When called from @insertcopying or (short)caption, we need active
 7709:   % backslash to get it printed correctly.
 7710:   % FIXME: This may not be needed.
 7711:   %\catcode`\@=0 \catcode`\\=\active \escapechar=`\@
 7712:   \edef\temp{\noexpand\scanmacro{#1}}%
 7713:   \temp
 7714:   \egroup
 7715: }
 7716: 
 7717: \newcount\paramno   % Count of parameters
 7718: \newtoks\macname    % Macro name
 7719: \newif\ifrecursive  % Is it recursive?
 7720: 
 7721: % List of all defined macros in the form
 7722: %    \definedummyword\macro1\definedummyword\macro2...
 7723: % Currently is also contains all @aliases; the list can be split
 7724: % if there is a need.
 7725: \def\macrolist{}
 7726: 
 7727: % Add the macro to \macrolist
 7728: \def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname}
 7729: \def\addtomacrolistxxx#1{%
 7730:      \toks0 = \expandafter{\macrolist\definedummyword#1}%
 7731:      \xdef\macrolist{\the\toks0}%
 7732: }
 7733: 
 7734: % Utility routines.
 7735: % This does \let #1 = #2, with \csnames; that is,
 7736: %   \let \csname#1\endcsname = \csname#2\endcsname
 7737: % (except of course we have to play expansion games).
 7738: %
 7739: \def\cslet#1#2{%
 7740:   \expandafter\let
 7741:   \csname#1\expandafter\endcsname
 7742:   \csname#2\endcsname
 7743: }
 7744: 
 7745: % Trim leading and trailing spaces off a string.
 7746: % Concepts from aro-bend problem 15 (see CTAN).
 7747: {\catcode`\@=11
 7748: \gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
 7749: \gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
 7750: \gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
 7751: \def\unbrace#1{#1}
 7752: \unbrace{\gdef\trim@@@ #1 } #2@{#1}
 7753: }
 7754: 
 7755: % Trim a single trailing ^^M off a string.
 7756: {\catcode`\^^M=\other \catcode`\Q=3%
 7757: \gdef\eatcr #1{\eatcra #1Q^^MQ}%
 7758: \gdef\eatcra#1^^MQ{\eatcrb#1Q}%
 7759: \gdef\eatcrb#1Q#2Q{#1}%
 7760: }
 7761: 
 7762: % Macro bodies are absorbed as an argument in a context where
 7763: % all characters are catcode 10, 11 or 12, except \ which is active
 7764: % (as in normal texinfo). It is necessary to change the definition of \
 7765: % to recognize macro arguments; this is the job of \mbodybackslash.
 7766: %
 7767: % Non-ASCII encodings make 8-bit characters active, so un-activate
 7768: % them to avoid their expansion.  Must do this non-globally, to
 7769: % confine the change to the current group.
 7770: %
 7771: % It's necessary to have hard CRs when the macro is executed. This is
 7772: % done by making ^^M (\endlinechar) catcode 12 when reading the macro
 7773: % body, and then making it the \newlinechar in \scanmacro.
 7774: %
 7775: \def\scanctxt{% used as subroutine
 7776:   \catcode`\"=\other
 7777:   \catcode`\+=\other
 7778:   \catcode`\<=\other
 7779:   \catcode`\>=\other
 7780:   \catcode`\^=\other
 7781:   \catcode`\_=\other
 7782:   \catcode`\|=\other
 7783:   \catcode`\~=\other
 7784:   \ifx\declaredencoding\ascii \else \setnonasciicharscatcodenonglobal\other \fi
 7785: }
 7786: 
 7787: \def\scanargctxt{% used for copying and captions, not macros.
 7788:   \scanctxt
 7789:   \catcode`\@=\other
 7790:   \catcode`\\=\other
 7791:   \catcode`\^^M=\other
 7792: }
 7793: 
 7794: \def\macrobodyctxt{% used for @macro definitions
 7795:   \scanctxt
 7796:   \catcode`\ =\other
 7797:   \catcode`\@=\other
 7798:   \catcode`\{=\other
 7799:   \catcode`\}=\other
 7800:   \catcode`\^^M=\other
 7801:   \usembodybackslash
 7802: }
 7803: 
 7804: % Used when scanning braced macro arguments.  Note, however, that catcode
 7805: % changes here are ineffectual if the macro invocation was nested inside
 7806: % an argument to another Texinfo command.
 7807: \def\macroargctxt{%
 7808:   \scanctxt
 7809:   \catcode`\ =\active
 7810:   \catcode`\^^M=\other
 7811:   \catcode`\\=\active
 7812: }
 7813: 
 7814: \def\macrolineargctxt{% used for whole-line arguments without braces
 7815:   \scanctxt
 7816:   \catcode`\{=\other
 7817:   \catcode`\}=\other
 7818: }
 7819: 
 7820: % \mbodybackslash is the definition of \ in @macro bodies.
 7821: % It maps \foo\ => \csname macarg.foo\endcsname => #N
 7822: % where N is the macro parameter number.
 7823: % We define \csname macarg.\endcsname to be \realbackslash, so
 7824: % \\ in macro replacement text gets you a backslash.
 7825: %
 7826: {\catcode`@=0 @catcode`@\=@active
 7827:  @gdef@usembodybackslash{@let\=@mbodybackslash}
 7828:  @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
 7829: }
 7830: \expandafter\def\csname macarg.\endcsname{\realbackslash}
 7831: 
 7832: \def\margbackslash#1{\char`\#1 }
 7833: 
 7834: \def\macro{\recursivefalse\parsearg\macroxxx}
 7835: \def\rmacro{\recursivetrue\parsearg\macroxxx}
 7836: 
 7837: \def\macroxxx#1{%
 7838:   \getargs{#1}% now \macname is the macname and \argl the arglist
 7839:   \ifx\argl\empty       % no arguments
 7840:      \paramno=0\relax
 7841:   \else
 7842:      \expandafter\parsemargdef \argl;%
 7843:      \if\paramno>256\relax
 7844:        \ifx\eTeXversion\thisisundefined
 7845:          \errhelp = \EMsimple
 7846:          \errmessage{You need eTeX to compile a file with macros with more than 256 arguments}
 7847:        \fi
 7848:      \fi
 7849:   \fi
 7850:   \if1\csname ismacro.\the\macname\endcsname
 7851:      \message{Warning: redefining \the\macname}%
 7852:   \else
 7853:      \expandafter\ifx\csname \the\macname\endcsname \relax
 7854:      \else \errmessage{Macro name \the\macname\space already defined}\fi
 7855:      \global\cslet{macsave.\the\macname}{\the\macname}%
 7856:      \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
 7857:      \addtomacrolist{\the\macname}%
 7858:   \fi
 7859:   \begingroup \macrobodyctxt
 7860:   \ifrecursive \expandafter\parsermacbody
 7861:   \else \expandafter\parsemacbody
 7862:   \fi}
 7863: 
 7864: \parseargdef\unmacro{%
 7865:   \if1\csname ismacro.#1\endcsname
 7866:     \global\cslet{#1}{macsave.#1}%
 7867:     \global\expandafter\let \csname ismacro.#1\endcsname=0%
 7868:     % Remove the macro name from \macrolist:
 7869:     \begingroup
 7870:       \expandafter\let\csname#1\endcsname \relax
 7871:       \let\definedummyword\unmacrodo
 7872:       \xdef\macrolist{\macrolist}%
 7873:     \endgroup
 7874:   \else
 7875:     \errmessage{Macro #1 not defined}%
 7876:   \fi
 7877: }
 7878: 
 7879: % Called by \do from \dounmacro on each macro.  The idea is to omit any
 7880: % macro definitions that have been changed to \relax.
 7881: %
 7882: \def\unmacrodo#1{%
 7883:   \ifx #1\relax
 7884:     % remove this
 7885:   \else
 7886:     \noexpand\definedummyword \noexpand#1%
 7887:   \fi
 7888: }
 7889: 
 7890: % \getargs -- Parse the arguments to a @macro line.  Set \macname to
 7891: % the name of the macro, and \argl to the braced argument list.
 7892: \def\getargs#1{\getargsxxx#1{}}
 7893: \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
 7894: \def\getmacname#1 #2\relax{\macname={#1}}
 7895: \def\getmacargs#1{\def\argl{#1}}
 7896: % This made use of the feature that if the last token of a
 7897: % <parameter list> is #, then the preceding argument is delimited by
 7898: % an opening brace, and that opening brace is not consumed.
 7899: 
 7900: % Parse the optional {params} list to @macro or @rmacro.
 7901: % Set \paramno to the number of arguments,
 7902: % and \paramlist to a parameter text for the macro (e.g. #1,#2,#3 for a
 7903: % three-param macro.)  Define \macarg.BLAH for each BLAH in the params
 7904: % list to some hook where the argument is to be expanded.  If there are
 7905: % less than 10 arguments that hook is to be replaced by ##N where N
 7906: % is the position in that list, that is to say the macro arguments are to be
 7907: % defined `a la TeX in the macro body.  
 7908: %
 7909: % That gets used by \mbodybackslash (above).
 7910: %
 7911: % If there are 10 or more arguments, a different technique is used: see
 7912: % \parsemmanyargdef.
 7913: %
 7914: \def\parsemargdef#1;{%
 7915:   \paramno=0\def\paramlist{}%
 7916:   \let\hash\relax
 7917:   % \hash is redefined to `#' later to get it into definitions
 7918:   \let\processmacroarg\relax
 7919:   \parsemargdefxxx#1,;,%
 7920:   \ifnum\paramno<10\relax\else
 7921:     \paramno0\relax
 7922:     \parsemmanyargdef@@#1,;,% 10 or more arguments
 7923:   \fi
 7924: }
 7925: \def\parsemargdefxxx#1,{%
 7926:   \if#1;\let\next=\relax
 7927:   \else \let\next=\parsemargdefxxx
 7928:     \advance\paramno by 1
 7929:     \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
 7930:         {\processmacroarg{\hash\the\paramno}}%
 7931:     \edef\paramlist{\paramlist\hash\the\paramno,}%
 7932:   \fi\next}
 7933: 
 7934: % \parsemacbody, \parsermacbody
 7935: %
 7936: % Read recursive and nonrecursive macro bodies. (They're different since
 7937: % rec and nonrec macros end differently.)
 7938: % 
 7939: % We are in \macrobodyctxt, and the \xdef causes backslashshes in the macro 
 7940: % body to be transformed.
 7941: % Set \macrobody to the body of the macro, and call \defmacro.
 7942: %
 7943: {\catcode`\ =\other\long\gdef\parsemacbody#1@end macro{%
 7944: \xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}%
 7945: {\catcode`\ =\other\long\gdef\parsermacbody#1@end rmacro{%
 7946: \xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}%
 7947: 
 7948: % Make @ a letter, so that we can make private-to-Texinfo macro names.
 7949: \edef\texiatcatcode{\the\catcode`\@}
 7950: \catcode `@=11\relax
 7951: 
 7952: %%%%%%%%%%%%%% Code for > 10 arguments only   %%%%%%%%%%%%%%%%%%
 7953: 
 7954: % If there are 10 or more arguments, a different technique is used, where the
 7955: % hook remains in the body, and when macro is to be expanded the body is
 7956: % processed again to replace the arguments.
 7957: %
 7958: % In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the
 7959: % argument N value and then \edef the body (nothing else will expand because of
 7960: % the catcode regime under which the body was input).
 7961: %
 7962: % If you compile with TeX (not eTeX), and you have macros with 10 or more
 7963: % arguments, no macro can have more than 256 arguments (else error).
 7964: %
 7965: % In case that there are 10 or more arguments we parse again the arguments
 7966: % list to set new definitions for the \macarg.BLAH macros corresponding to
 7967: % each BLAH argument. It was anyhow needed to parse already once this list
 7968: % in order to count the arguments, and as macros with at most 9 arguments
 7969: % are by far more frequent than macro with 10 or more arguments, defining
 7970: % twice the \macarg.BLAH macros does not cost too much processing power.
 7971: \def\parsemmanyargdef@@#1,{%
 7972:   \if#1;\let\next=\relax
 7973:   \else 
 7974:     \let\next=\parsemmanyargdef@@
 7975:     \edef\tempb{\eatspaces{#1}}%
 7976:     \expandafter\def\expandafter\tempa
 7977:        \expandafter{\csname macarg.\tempb\endcsname}%
 7978:     % Note that we need some extra \noexpand\noexpand, this is because we
 7979:     % don't want \the  to be expanded in the \parsermacbody  as it uses an
 7980:     % \xdef .
 7981:     \expandafter\edef\tempa
 7982:       {\noexpand\noexpand\noexpand\the\toks\the\paramno}%
 7983:     \advance\paramno by 1\relax
 7984:   \fi\next}
 7985: 
 7986: 
 7987: \let\endargs@\relax
 7988: \let\nil@\relax
 7989: \def\nilm@{\nil@}%
 7990: \long\def\nillm@{\nil@}%
 7991: 
 7992: % This macro is expanded during the Texinfo macro expansion, not during its
 7993: % definition.  It gets all the arguments' values and assigns them to macros
 7994: % macarg.ARGNAME
 7995: %
 7996: % #1 is the macro name
 7997: % #2 is the list of argument names
 7998: % #3 is the list of argument values
 7999: \def\getargvals@#1#2#3{%
 8000:   \def\macargdeflist@{}%
 8001:   \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion.
 8002:   \def\paramlist{#2,\nil@}%
 8003:   \def\macroname{#1}%
 8004:   \begingroup
 8005:   \macroargctxt
 8006:   \def\argvaluelist{#3,\nil@}%
 8007:   \def\@tempa{#3}%
 8008:   \ifx\@tempa\empty
 8009:     \setemptyargvalues@
 8010:   \else
 8011:     \getargvals@@
 8012:   \fi
 8013: }
 8014: \def\getargvals@@{%
 8015:   \ifx\paramlist\nilm@
 8016:       % Some sanity check needed here that \argvaluelist is also empty.
 8017:       \ifx\argvaluelist\nillm@
 8018:       \else
 8019:         \errhelp = \EMsimple
 8020:         \errmessage{Too many arguments in macro `\macroname'!}%
 8021:       \fi
 8022:       \let\next\macargexpandinbody@
 8023:   \else
 8024:     \ifx\argvaluelist\nillm@
 8025:        % No more arguments values passed to macro.  Set remaining named-arg
 8026:        % macros to empty.
 8027:        \let\next\setemptyargvalues@
 8028:     \else
 8029:       % pop current arg name into \@tempb
 8030:       \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}%
 8031:       \expandafter\@tempa\expandafter{\paramlist}%
 8032:        % pop current argument value into \@tempc
 8033:       \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}%
 8034:       \expandafter\@tempa\expandafter{\argvaluelist}%
 8035:        % Here \@tempb is the current arg name and \@tempc is the current arg value.
 8036:        % First place the new argument macro definition into \@tempd
 8037:        \expandafter\macname\expandafter{\@tempc}%
 8038:        \expandafter\let\csname macarg.\@tempb\endcsname\relax
 8039:        \expandafter\def\expandafter\@tempe\expandafter{%
 8040:          \csname macarg.\@tempb\endcsname}%
 8041:        \edef\@tempd{\long\def\@tempe{\the\macname}}%
 8042:        \push@\@tempd\macargdeflist@
 8043:        \let\next\getargvals@@
 8044:     \fi
 8045:   \fi
 8046:   \next
 8047: }
 8048: 
 8049: \def\push@#1#2{%
 8050:   \expandafter\expandafter\expandafter\def
 8051:   \expandafter\expandafter\expandafter#2%
 8052:   \expandafter\expandafter\expandafter{%
 8053:   \expandafter#1#2}%
 8054: }
 8055: 
 8056: % Replace arguments by their values in the macro body, and place the result
 8057: % in macro \@tempa.
 8058: % 
 8059: \def\macvalstoargs@{%
 8060:   %  To do this we use the property that token registers that are \the'ed
 8061:   % within an \edef  expand only once. So we are going to place all argument
 8062:   % values into respective token registers.
 8063:   %
 8064:   % First we save the token context, and initialize argument numbering.
 8065:   \begingroup
 8066:     \paramno0\relax
 8067:     % Then, for each argument number #N, we place the corresponding argument
 8068:     % value into a new token list register \toks#N
 8069:     \expandafter\putargsintokens@\saveparamlist@,;,%
 8070:     % Then, we expand the body so that argument are replaced by their
 8071:     % values. The trick for values not to be expanded themselves is that they
 8072:     % are within tokens and that tokens expand only once in an \edef .
 8073:     \edef\@tempc{\csname mac.\macroname .body\endcsname}%
 8074:     % Now we restore the token stack pointer to free the token list registers
 8075:     % which we have used, but we make sure that expanded body is saved after
 8076:     % group.
 8077:     \expandafter
 8078:   \endgroup
 8079:   \expandafter\def\expandafter\@tempa\expandafter{\@tempc}%
 8080:   }
 8081: 
 8082: % Define the named-macro outside of this group and then close this group. 
 8083: % 
 8084: \def\macargexpandinbody@{% 
 8085:   \expandafter
 8086:   \endgroup
 8087:   \macargdeflist@
 8088:   % First the replace in body the macro arguments by their values, the result
 8089:   % is in \@tempa .
 8090:   \macvalstoargs@
 8091:   % Then we point at the \norecurse or \gobble (for recursive) macro value
 8092:   % with \@tempb .
 8093:   \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname
 8094:   % Depending on whether it is recursive or not, we need some tailing
 8095:   % \egroup .
 8096:   \ifx\@tempb\gobble
 8097:      \let\@tempc\relax
 8098:   \else
 8099:      \let\@tempc\egroup
 8100:   \fi
 8101:   % And now we do the real job:
 8102:   \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}%
 8103:   \@tempd
 8104: }
 8105: 
 8106: \def\putargsintokens@#1,{%
 8107:   \if#1;\let\next\relax
 8108:   \else
 8109:     \let\next\putargsintokens@
 8110:     % First we allocate the new token list register, and give it a temporary
 8111:     % alias \@tempb .
 8112:     \toksdef\@tempb\the\paramno
 8113:     % Then we place the argument value into that token list register.
 8114:     \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname
 8115:     \expandafter\@tempb\expandafter{\@tempa}%
 8116:     \advance\paramno by 1\relax
 8117:   \fi
 8118:   \next
 8119: }
 8120: 
 8121: % Trailing missing arguments are set to empty.
 8122: % 
 8123: \def\setemptyargvalues@{%
 8124:   \ifx\paramlist\nilm@
 8125:     \let\next\macargexpandinbody@
 8126:   \else
 8127:     \expandafter\setemptyargvaluesparser@\paramlist\endargs@
 8128:     \let\next\setemptyargvalues@
 8129:   \fi
 8130:   \next
 8131: }
 8132: 
 8133: \def\setemptyargvaluesparser@#1,#2\endargs@{%
 8134:   \expandafter\def\expandafter\@tempa\expandafter{%
 8135:     \expandafter\def\csname macarg.#1\endcsname{}}%
 8136:   \push@\@tempa\macargdeflist@
 8137:   \def\paramlist{#2}%
 8138: }
 8139: 
 8140: % #1 is the element target macro
 8141: % #2 is the list macro
 8142: % #3,#4\endargs@ is the list value
 8143: \def\pop@#1#2#3,#4\endargs@{%
 8144:    \def#1{#3}%
 8145:    \def#2{#4}%
 8146: }
 8147: \long\def\longpop@#1#2#3,#4\endargs@{%
 8148:    \long\def#1{#3}%
 8149:    \long\def#2{#4}%
 8150: }
 8151: 
 8152: 
 8153: %%%%%%%%%%%%%% End of code for > 10 arguments %%%%%%%%%%%%%%%%%%
 8154: 
 8155: 
 8156: 
 8157: % Remove following spaces at the expansion stage.
 8158: % This works because spaces are discarded before each argument when TeX is 
 8159: % getting the arguments for a macro.
 8160: % This must not be immediately followed by a }.
 8161: \long\def\gobblespaces#1{#1}
 8162: 
 8163: % This defines a Texinfo @macro or @rmacro, called by \parsemacbody.
 8164: %    \macrobody has the body of the macro in it, with placeholders for
 8165: % its parameters, looking like "\processmacroarg{\hash 1}".
 8166: %    \paramno is the number of parameters
 8167: %    \paramlist is a TeX parameter text, e.g. "#1,#2,#3,"
 8168: % There are eight cases: recursive and nonrecursive macros of zero, one,
 8169: % up to nine, and many arguments.
 8170: % \xdef is used so that macro definitions will survive the file
 8171: % they're defined in: @include reads the file inside a group.
 8172: %
 8173: \def\defmacro{%
 8174:   \let\hash=##% convert placeholders to macro parameter chars
 8175:   \ifnum\paramno=1
 8176:     \def\processmacroarg{\gobblespaces}%
 8177:     % This removes the pair of braces around the argument.  We don't
 8178:     % use \eatspaces, because this can cause ends of lines to be lost
 8179:     % when the argument to \eatspaces is read, leading to line-based
 8180:     % commands like "@itemize" not being read correctly.
 8181:   \else
 8182:     \def\processmacroarg{\xprocessmacroarg}%
 8183:     \let\xprocessmacroarg\relax
 8184:   \fi
 8185:   \ifrecursive   %%%%%%%%%%%%%% Recursive %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 8186:     \ifcase\paramno
 8187:     % 0
 8188:       \expandafter\xdef\csname\the\macname\endcsname{%
 8189:         \noexpand\scanmacro{\macrobody}}%
 8190:     \or % 1
 8191:       \expandafter\xdef\csname\the\macname\endcsname{%
 8192:          \bgroup
 8193:          \noexpand\braceorline
 8194:          \expandafter\noexpand\csname\the\macname @@@\endcsname}%
 8195:       \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
 8196:          \expandafter\noexpand\csname\the\macname @@@@\endcsname{%
 8197:            \noexpand\gobblespaces##1\empty}%
 8198:            % The \empty is for \gobblespaces in case #1 is empty
 8199:          }%
 8200:       \expandafter\xdef\csname\the\macname @@@@\endcsname##1{%
 8201:          \egroup\noexpand\scanmacro{\macrobody}}%
 8202:     \else
 8203:       \ifnum\paramno<10\relax % at most 9
 8204:         % See non-recursive section below for comments
 8205:         \expandafter\xdef\csname\the\macname\endcsname{%
 8206:           \bgroup
 8207:           \noexpand\expandafter
 8208:           \noexpand\macroargctxt
 8209:           \noexpand\expandafter
 8210:           \expandafter\noexpand\csname\the\macname @@\endcsname}%
 8211:         \expandafter\xdef\csname\the\macname @@\endcsname##1{%
 8212:             \noexpand\passargtomacro
 8213:             \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}%
 8214:         \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
 8215:             \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}%
 8216:         \expandafter\expandafter
 8217:         \expandafter\xdef
 8218:         \expandafter\expandafter
 8219:           \csname\the\macname @@@@\endcsname\paramlist{%
 8220:             \egroup\noexpand\scanmacro{\macrobody}}%
 8221:       \else % 10 or more
 8222:         \expandafter\xdef\csname\the\macname\endcsname{%
 8223:           \noexpand\getargvals@{\the\macname}{\argl}%
 8224:         }%    
 8225:         \global\expandafter\let\csname mac.\the\macname .body\endcsname\macrobody
 8226:         \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble
 8227:       \fi
 8228:     \fi
 8229:   \else  %%%%%%%%%%%%%%%%%%%%%% Non-recursive %%%%%%%%%%%%%%%%%%%%%%%%%%
 8230:     \ifcase\paramno
 8231:     % 0
 8232:       \expandafter\xdef\csname\the\macname\endcsname{%
 8233:         \noexpand\scanmacro{\macrobody}}%
 8234:     \or % 1
 8235:       \expandafter\xdef\csname\the\macname\endcsname{%
 8236:          \bgroup
 8237:          \noexpand\braceorline
 8238:          \expandafter\noexpand\csname\the\macname @@@\endcsname}%
 8239:       \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
 8240:          \expandafter\noexpand\csname\the\macname @@@@\endcsname{%
 8241:            \noexpand\gobblespaces##1\empty}%
 8242:            % The \empty is for \gobblespaces in case #1 is empty
 8243:          }%
 8244:       \expandafter\xdef\csname\the\macname @@@@\endcsname##1{%
 8245:         \egroup
 8246:         \noexpand\scanmacro{\macrobody}%
 8247:         }%
 8248:     \else % at most 9
 8249:       \ifnum\paramno<10\relax
 8250:         % @MACNAME sets the context for reading the macro argument
 8251:         % @MACNAME@@ gets the argument, processes backslashes and appends a 
 8252:         % comma.
 8253:         % @MACNAME@@@ removes braces surrounding the argument list.
 8254:         % @MACNAME@@@@ scans the macro body with arguments substituted.
 8255:         \expandafter\xdef\csname\the\macname\endcsname{%
 8256:           \bgroup
 8257:           \noexpand\expandafter  % This \expandafter skip any spaces after the
 8258:           \noexpand\macroargctxt % macro before we change the catcode of space.
 8259:           \noexpand\expandafter
 8260:           \expandafter\noexpand\csname\the\macname @@\endcsname}%
 8261:         \expandafter\xdef\csname\the\macname @@\endcsname##1{%
 8262:             \noexpand\passargtomacro
 8263:             \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}%
 8264:         \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
 8265:             \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}%
 8266:         \expandafter\expandafter
 8267:         \expandafter\xdef
 8268:         \expandafter\expandafter
 8269:           \csname\the\macname @@@@\endcsname\paramlist{%
 8270:             \egroup\noexpand\scanmacro{\macrobody}}%
 8271:       \else % 10 or more:
 8272:         \expandafter\xdef\csname\the\macname\endcsname{%
 8273:           \noexpand\getargvals@{\the\macname}{\argl}%
 8274:         }%
 8275:         \global\expandafter\let\csname mac.\the\macname .body\endcsname\macrobody
 8276:         \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\norecurse
 8277:       \fi
 8278:     \fi
 8279:   \fi}
 8280: 
 8281: \catcode `\@\texiatcatcode\relax % end private-to-Texinfo catcodes
 8282: 
 8283: \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
 8284: 
 8285: 
 8286: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 8287: %
 8288: {\catcode`\@=0 \catcode`\\=13  % We need to manipulate \ so use @ as escape
 8289: @catcode`@_=11  % private names
 8290: @catcode`@!=11  % used as argument separator
 8291: 
 8292: % \passargtomacro#1#2 -
 8293: % Call #1 with a list of tokens #2, with any doubled backslashes in #2
 8294: % compressed to one.
 8295: %
 8296: % This implementation works by expansion, and not execution (so we cannot use 
 8297: % \def or similar).  This reduces the risk of this failing in contexts where 
 8298: % complete expansion is done with no execution (for example, in writing out to 
 8299: % an auxiliary file for an index entry).
 8300: % 
 8301: % State is kept in the input stream: the argument passed to
 8302: % @look_ahead, @gobble_and_check_finish and @add_segment is
 8303: %
 8304: % THE_MACRO ARG_RESULT ! {PENDING_BS} NEXT_TOKEN  (... rest of input)
 8305: %
 8306: % where:
 8307: % THE_MACRO - name of the macro we want to call
 8308: % ARG_RESULT - argument list we build to pass to that macro
 8309: % PENDING_BS - either a backslash or nothing
 8310: % NEXT_TOKEN - used to look ahead in the input stream to see what's coming next
 8311: 
 8312: @gdef@passargtomacro#1#2{%
 8313:   @add_segment #1!{}@relax#2\@_finish\%
 8314: }
 8315: @gdef@_finish{@_finishx} @global@let@_finishx@relax
 8316: 
 8317: % #1 - THE_MACRO ARG_RESULT
 8318: % #2 - PENDING_BS
 8319: % #3 - NEXT_TOKEN
 8320: % #4 used to look ahead
 8321: %
 8322: % If the next token is not a backslash, process the rest of the argument; 
 8323: % otherwise, remove the next token.
 8324: @gdef@look_ahead#1!#2#3#4{%
 8325:   @ifx#4\%
 8326:    @expandafter@gobble_and_check_finish 
 8327:   @else
 8328:    @expandafter@add_segment
 8329:   @fi#1!{#2}#4#4%
 8330: }
 8331: 
 8332: % #1 - THE_MACRO ARG_RESULT
 8333: % #2 - PENDING_BS
 8334: % #3 - NEXT_TOKEN
 8335: % #4 should be a backslash, which is gobbled.
 8336: % #5 looks ahead
 8337: %
 8338: % Double backslash found.  Add a single backslash, and look ahead.
 8339: @gdef@gobble_and_check_finish#1!#2#3#4#5{%
 8340:   @add_segment#1\!{}#5#5%
 8341: }
 8342: 
 8343: @gdef@is_fi{@fi}
 8344: 
 8345: % #1 - THE_MACRO ARG_RESULT
 8346: % #2 - PENDING_BS
 8347: % #3 - NEXT_TOKEN
 8348: % #4 is input stream until next backslash
 8349: %
 8350: % Input stream is either at the start of the argument, or just after a 
 8351: % backslash sequence, either a lone backslash, or a doubled backslash.  
 8352: % NEXT_TOKEN contains the first token in the input stream: if it is \finish, 
 8353: % finish; otherwise, append to ARG_RESULT the segment of the argument up until
 8354: % the next backslash.  PENDING_BACKSLASH contains a backslash to represent
 8355: % a backslash just before the start of the input stream that has not been
 8356: % added to ARG_RESULT.
 8357: @gdef@add_segment#1!#2#3#4\{%
 8358: @ifx#3@_finish
 8359:   @call_the_macro#1!%
 8360: @else
 8361:   % append the pending backslash to the result, followed by the next segment
 8362:   @expandafter@is_fi@look_ahead#1#2#4!{\}@fi
 8363:   % this @fi is discarded by @look_ahead.
 8364:   % we can't get rid of it with \expandafter because we don't know how 
 8365:   % long #4 is.
 8366: }
 8367: 
 8368: % #1 - THE_MACRO
 8369: % #2 - ARG_RESULT
 8370: % #3 discards the res of the conditional in @add_segment, and @is_fi ends the 
 8371: % conditional.
 8372: @gdef@call_the_macro#1#2!#3@fi{@is_fi #1{#2}}
 8373: 
 8374: }
 8375: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 8376: 
 8377: % \braceorline MAC is used for a one-argument macro MAC.  It checks
 8378: % whether the next non-whitespace character is a {.  It sets the context
 8379: % for reading the argument (slightly different in the two cases).  Then,
 8380: % to read the argument, in the whole-line case, it then calls the regular
 8381: % \parsearg MAC; in the lbrace case, it calls \passargtomacro MAC.
 8382: % 
 8383: \def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx}
 8384: \def\braceorlinexxx{%
 8385:   \ifx\nchar\bgroup
 8386:     \macroargctxt
 8387:     \expandafter\passargtomacro
 8388:   \else
 8389:     \macrolineargctxt\expandafter\parsearg
 8390:   \fi \macnamexxx}
 8391: 
 8392: 
 8393: % @alias.
 8394: % We need some trickery to remove the optional spaces around the equal
 8395: % sign.  Make them active and then expand them all to nothing.
 8396: %
 8397: \def\alias{\parseargusing\obeyspaces\aliasxxx}
 8398: \def\aliasxxx #1{\aliasyyy#1\relax}
 8399: \def\aliasyyy #1=#2\relax{%
 8400:   {%
 8401:     \expandafter\let\obeyedspace=\empty
 8402:     \addtomacrolist{#1}%
 8403:     \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}%
 8404:   }%
 8405:   \next
 8406: }
 8407: 
 8408: 
 8409: \message{cross references,}
 8410: 
 8411: \newwrite\auxfile
 8412: \newif\ifhavexrefs    % True if xref values are known.
 8413: \newif\ifwarnedxrefs  % True if we warned once that they aren't known.
 8414: 
 8415: % @inforef is relatively simple.
 8416: \def\inforef #1{\inforefzzz #1,,,,**}
 8417: \def\inforefzzz #1,#2,#3,#4**{%
 8418:   \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
 8419:   node \samp{\ignorespaces#1{}}}
 8420: 
 8421: % @node's only job in TeX is to define \lastnode, which is used in
 8422: % cross-references.  The @node line might or might not have commas, and
 8423: % might or might not have spaces before the first comma, like:
 8424: % @node foo , bar , ...
 8425: % We don't want such trailing spaces in the node name.
 8426: %
 8427: \parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse}
 8428: %
 8429: % also remove a trailing comma, in case of something like this:
 8430: % @node Help-Cross,  ,  , Cross-refs
 8431: \def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse}
 8432: \def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}}
 8433: 
 8434: \let\nwnode=\node
 8435: \let\lastnode=\empty
 8436: 
 8437: % Write a cross-reference definition for the current node.  #1 is the
 8438: % type (Ynumbered, Yappendix, Ynothing).
 8439: %
 8440: \def\donoderef#1{%
 8441:   \ifx\lastnode\empty\else
 8442:     \setref{\lastnode}{#1}%
 8443:     \global\let\lastnode=\empty
 8444:   \fi
 8445: }
 8446: 
 8447: % @anchor{NAME} -- define xref target at arbitrary point.
 8448: %
 8449: \newcount\savesfregister
 8450: %
 8451: \def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
 8452: \def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
 8453: \def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
 8454: 
 8455: % \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
 8456: % anchor), which consists of three parts:
 8457: % 1) NAME-title - the current sectioning name taken from \lastsection,
 8458: %                 or the anchor name.
 8459: % 2) NAME-snt   - section number and type, passed as the SNT arg, or
 8460: %                 empty for anchors.
 8461: % 3) NAME-pg    - the page number.
 8462: %
 8463: % This is called from \donoderef, \anchor, and \dofloat.  In the case of
 8464: % floats, there is an additional part, which is not written here:
 8465: % 4) NAME-lof   - the text as it should appear in a @listoffloats.
 8466: %
 8467: \def\setref#1#2{%
 8468:   \pdfmkdest{#1}%
 8469:   \iflinks
 8470:     {%
 8471:       \requireauxfile
 8472:       \atdummies  % preserve commands, but don't expand them
 8473:       \edef\writexrdef##1##2{%
 8474: 	\write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef
 8475: 	  ##1}{##2}}% these are parameters of \writexrdef
 8476:       }%
 8477:       \toks0 = \expandafter{\lastsection}%
 8478:       \immediate \writexrdef{title}{\the\toks0 }%
 8479:       \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
 8480:       \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout
 8481:     }%
 8482:   \fi
 8483: }
 8484: 
 8485: % @xrefautosectiontitle on|off says whether @section(ing) names are used
 8486: % automatically in xrefs, if the third arg is not explicitly specified.
 8487: % This was provided as a "secret" @set xref-automatic-section-title
 8488: % variable, now it's official.
 8489: % 
 8490: \parseargdef\xrefautomaticsectiontitle{%
 8491:   \def\temp{#1}%
 8492:   \ifx\temp\onword
 8493:     \expandafter\let\csname SETxref-automatic-section-title\endcsname
 8494:       = \empty
 8495:   \else\ifx\temp\offword
 8496:     \expandafter\let\csname SETxref-automatic-section-title\endcsname
 8497:       = \relax
 8498:   \else
 8499:     \errhelp = \EMsimple
 8500:     \errmessage{Unknown @xrefautomaticsectiontitle value `\temp',
 8501:                 must be on|off}%
 8502:   \fi\fi
 8503: }
 8504: 
 8505: % 
 8506: % @xref, @pxref, and @ref generate cross-references.  For \xrefX, #1 is
 8507: % the node name, #2 the name of the Info cross-reference, #3 the printed
 8508: % node name, #4 the name of the Info file, #5 the name of the printed
 8509: % manual.  All but the node name can be omitted.
 8510: %
 8511: \def\pxref{\putwordsee{} \xrefXX}
 8512: \def\xref{\putwordSee{} \xrefXX}
 8513: \def\ref{\xrefXX}
 8514: 
 8515: \def\xrefXX#1{\def\xrefXXarg{#1}\futurelet\tokenafterxref\xrefXXX}
 8516: \def\xrefXXX{\expandafter\xrefX\expandafter[\xrefXXarg,,,,,,,]}
 8517: %
 8518: \newbox\toprefbox
 8519: \newbox\printedrefnamebox
 8520: \newbox\infofilenamebox
 8521: \newbox\printedmanualbox
 8522: %
 8523: \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
 8524:   \unsepspaces
 8525:   %
 8526:   % Get args without leading/trailing spaces.
 8527:   \def\printedrefname{\ignorespaces #3}%
 8528:   \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}%
 8529:   %
 8530:   \def\infofilename{\ignorespaces #4}%
 8531:   \setbox\infofilenamebox = \hbox{\infofilename\unskip}%
 8532:   %
 8533:   \def\printedmanual{\ignorespaces #5}%
 8534:   \setbox\printedmanualbox  = \hbox{\printedmanual\unskip}%
 8535:   %
 8536:   % If the printed reference name (arg #3) was not explicitly given in
 8537:   % the @xref, figure out what we want to use.
 8538:   \ifdim \wd\printedrefnamebox = 0pt
 8539:     % No printed node name was explicitly given.
 8540:     \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax
 8541:       % Not auto section-title: use node name inside the square brackets.
 8542:       \def\printedrefname{\ignorespaces #1}%
 8543:     \else
 8544:       % Auto section-title: use chapter/section title inside
 8545:       % the square brackets if we have it.
 8546:       \ifdim \wd\printedmanualbox > 0pt
 8547:         % It is in another manual, so we don't have it; use node name.
 8548:         \def\printedrefname{\ignorespaces #1}%
 8549:       \else
 8550:         \ifhavexrefs
 8551:           % We (should) know the real title if we have the xref values.
 8552:           \def\printedrefname{\refx{#1-title}{}}%
 8553:         \else
 8554:           % Otherwise just copy the Info node name.
 8555:           \def\printedrefname{\ignorespaces #1}%
 8556:         \fi%
 8557:       \fi
 8558:     \fi
 8559:   \fi
 8560:   %
 8561:   % Make link in pdf output.
 8562:   \ifpdf
 8563:     {\indexnofonts
 8564:      \turnoffactive
 8565:      \makevalueexpandable
 8566:      % This expands tokens, so do it after making catcode changes, so _
 8567:      % etc. don't get their TeX definitions.  This ignores all spaces in
 8568:      % #4, including (wrongly) those in the middle of the filename.
 8569:      \getfilename{#4}%
 8570:      %
 8571:      % This (wrongly) does not take account of leading or trailing
 8572:      % spaces in #1, which should be ignored.
 8573:      \edef\pdfxrefdest{#1}%
 8574:      \ifx\pdfxrefdest\empty
 8575:        \def\pdfxrefdest{Top}% no empty targets
 8576:      \else
 8577:        \txiescapepdf\pdfxrefdest  % escape PDF special chars
 8578:      \fi
 8579:      %
 8580:      \leavevmode
 8581:      \startlink attr{/Border [0 0 0]}%
 8582:      \ifnum\filenamelength>0
 8583:        goto file{\the\filename.pdf} name{\pdfxrefdest}%
 8584:      \else
 8585:        goto name{\pdfmkpgn{\pdfxrefdest}}%
 8586:      \fi
 8587:     }%
 8588:     \setcolor{\linkcolor}%
 8589:   \fi
 8590:   {%
 8591:     % Have to otherify everything special to allow the \csname to
 8592:     % include an _ in the xref name, etc.
 8593:     \indexnofonts
 8594:     \turnoffactive
 8595:     \expandafter\global\expandafter\let\expandafter\Xthisreftitle
 8596:       \csname XR#1-title\endcsname
 8597:   }%
 8598:   %
 8599:   % Float references are printed completely differently: "Figure 1.2"
 8600:   % instead of "[somenode], p.3".  \iffloat distinguishes them by
 8601:   % \Xthisreftitle being set to a magic string.
 8602:   \iffloat\Xthisreftitle
 8603:     % If the user specified the print name (third arg) to the ref,
 8604:     % print it instead of our usual "Figure 1.2".
 8605:     \ifdim\wd\printedrefnamebox = 0pt
 8606:       \refx{#1-snt}{}%
 8607:     \else
 8608:       \printedrefname
 8609:     \fi
 8610:     %
 8611:     % If the user also gave the printed manual name (fifth arg), append
 8612:     % "in MANUALNAME".
 8613:     \ifdim \wd\printedmanualbox > 0pt
 8614:       \space \putwordin{} \cite{\printedmanual}%
 8615:     \fi
 8616:   \else
 8617:     % node/anchor (non-float) references.
 8618:     % 
 8619:     % If we use \unhbox to print the node names, TeX does not insert
 8620:     % empty discretionaries after hyphens, which means that it will not
 8621:     % find a line break at a hyphen in a node names.  Since some manuals
 8622:     % are best written with fairly long node names, containing hyphens,
 8623:     % this is a loss.  Therefore, we give the text of the node name
 8624:     % again, so it is as if TeX is seeing it for the first time.
 8625:     % 
 8626:     \ifdim \wd\printedmanualbox > 0pt
 8627:       % Cross-manual reference with a printed manual name.
 8628:       % 
 8629:       \crossmanualxref{\cite{\printedmanual\unskip}}%
 8630:     %
 8631:     \else\ifdim \wd\infofilenamebox > 0pt
 8632:       % Cross-manual reference with only an info filename (arg 4), no
 8633:       % printed manual name (arg 5).  This is essentially the same as
 8634:       % the case above; we output the filename, since we have nothing else.
 8635:       % 
 8636:       \crossmanualxref{\code{\infofilename\unskip}}%
 8637:     %
 8638:     \else
 8639:       % Reference within this manual.
 8640:       %
 8641:       % _ (for example) has to be the character _ for the purposes of the
 8642:       % control sequence corresponding to the node, but it has to expand
 8643:       % into the usual \leavevmode...\vrule stuff for purposes of
 8644:       % printing. So we \turnoffactive for the \refx-snt, back on for the
 8645:       % printing, back off for the \refx-pg.
 8646:       {\turnoffactive
 8647:        % Only output a following space if the -snt ref is nonempty; for
 8648:        % @unnumbered and @anchor, it won't be.
 8649:        \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
 8650:        \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
 8651:       }%
 8652:       % output the `[mynode]' via the macro below so it can be overridden.
 8653:       \xrefprintnodename\printedrefname
 8654:       %
 8655:       % But we always want a comma and a space:
 8656:       ,\space
 8657:       %
 8658:       % output the `page 3'.
 8659:       \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
 8660:       % Add a , if xref followed by a space
 8661:       \if\space\noexpand\tokenafterxref ,%
 8662:       \else\ifx\	\tokenafterxref ,% @TAB
 8663:       \else\ifx\*\tokenafterxref ,%   @*
 8664:       \else\ifx\ \tokenafterxref ,%   @SPACE
 8665:       \else\ifx\
 8666:                 \tokenafterxref ,%    @NL
 8667:       \else\ifx\tie\tokenafterxref ,% @tie
 8668:       \fi\fi\fi\fi\fi\fi
 8669:     \fi\fi
 8670:   \fi
 8671:   \endlink
 8672: \endgroup}
 8673: 
 8674: % Output a cross-manual xref to #1.  Used just above (twice).
 8675: % 
 8676: % Only include the text "Section ``foo'' in" if the foo is neither
 8677: % missing or Top.  Thus, @xref{,,,foo,The Foo Manual} outputs simply
 8678: % "see The Foo Manual", the idea being to refer to the whole manual.
 8679: % 
 8680: % But, this being TeX, we can't easily compare our node name against the
 8681: % string "Top" while ignoring the possible spaces before and after in
 8682: % the input.  By adding the arbitrary 7sp below, we make it much less
 8683: % likely that a real node name would have the same width as "Top" (e.g.,
 8684: % in a monospaced font).  Hopefully it will never happen in practice.
 8685: % 
 8686: % For the same basic reason, we retypeset the "Top" at every
 8687: % reference, since the current font is indeterminate.
 8688: % 
 8689: \def\crossmanualxref#1{%
 8690:   \setbox\toprefbox = \hbox{Top\kern7sp}%
 8691:   \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}%
 8692:   \ifdim \wd2 > 7sp  % nonempty?
 8693:     \ifdim \wd2 = \wd\toprefbox \else  % same as Top?
 8694:       \putwordSection{} ``\printedrefname'' \putwordin{}\space
 8695:     \fi
 8696:   \fi
 8697:   #1%
 8698: }
 8699: 
 8700: % This macro is called from \xrefX for the `[nodename]' part of xref
 8701: % output.  It's a separate macro only so it can be changed more easily,
 8702: % since square brackets don't work well in some documents.  Particularly
 8703: % one that Bob is working on :).
 8704: %
 8705: \def\xrefprintnodename#1{[#1]}
 8706: 
 8707: % Things referred to by \setref.
 8708: %
 8709: \def\Ynothing{}
 8710: \def\Yomitfromtoc{}
 8711: \def\Ynumbered{%
 8712:   \ifnum\secno=0
 8713:     \putwordChapter@tie \the\chapno
 8714:   \else \ifnum\subsecno=0
 8715:     \putwordSection@tie \the\chapno.\the\secno
 8716:   \else \ifnum\subsubsecno=0
 8717:     \putwordSection@tie \the\chapno.\the\secno.\the\subsecno
 8718:   \else
 8719:     \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno
 8720:   \fi\fi\fi
 8721: }
 8722: \def\Yappendix{%
 8723:   \ifnum\secno=0
 8724:      \putwordAppendix@tie @char\the\appendixno{}%
 8725:   \else \ifnum\subsecno=0
 8726:      \putwordSection@tie @char\the\appendixno.\the\secno
 8727:   \else \ifnum\subsubsecno=0
 8728:     \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno
 8729:   \else
 8730:     \putwordSection@tie
 8731:       @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno
 8732:   \fi\fi\fi
 8733: }
 8734: 
 8735: % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
 8736: % If its value is nonempty, SUFFIX is output afterward.
 8737: %
 8738: \def\refx#1#2{%
 8739:   \requireauxfile
 8740:   {%
 8741:     \indexnofonts
 8742:     \otherbackslash
 8743:     \expandafter\global\expandafter\let\expandafter\thisrefX
 8744:       \csname XR#1\endcsname
 8745:   }%
 8746:   \ifx\thisrefX\relax
 8747:     % If not defined, say something at least.
 8748:     \angleleft un\-de\-fined\angleright
 8749:     \iflinks
 8750:       \ifhavexrefs
 8751:         {\toks0 = {#1}% avoid expansion of possibly-complex value
 8752:          \message{\linenumber Undefined cross reference `\the\toks0'.}}%
 8753:       \else
 8754:         \ifwarnedxrefs\else
 8755:           \global\warnedxrefstrue
 8756:           \message{Cross reference values unknown; you must run TeX again.}%
 8757:         \fi
 8758:       \fi
 8759:     \fi
 8760:   \else
 8761:     % It's defined, so just use it.
 8762:     \thisrefX
 8763:   \fi
 8764:   #2% Output the suffix in any case.
 8765: }
 8766: 
 8767: % This is the macro invoked by entries in the aux file.  Usually it's
 8768: % just a \def (we prepend XR to the control sequence name to avoid
 8769: % collisions).  But if this is a float type, we have more work to do.
 8770: %
 8771: \def\xrdef#1#2{%
 8772:   {% The node name might contain 8-bit characters, which in our current
 8773:    % implementation are changed to commands like @'e.  Don't let these
 8774:    % mess up the control sequence name.
 8775:     \indexnofonts
 8776:     \turnoffactive
 8777:     \xdef\safexrefname{#1}%
 8778:   }%
 8779:   %
 8780:   \expandafter\gdef\csname XR\safexrefname\endcsname{#2}% remember this xref
 8781:   %
 8782:   % Was that xref control sequence that we just defined for a float?
 8783:   \expandafter\iffloat\csname XR\safexrefname\endcsname
 8784:     % it was a float, and we have the (safe) float type in \iffloattype.
 8785:     \expandafter\let\expandafter\floatlist
 8786:       \csname floatlist\iffloattype\endcsname
 8787:     %
 8788:     % Is this the first time we've seen this float type?
 8789:     \expandafter\ifx\floatlist\relax
 8790:       \toks0 = {\do}% yes, so just \do
 8791:     \else
 8792:       % had it before, so preserve previous elements in list.
 8793:       \toks0 = \expandafter{\floatlist\do}%
 8794:     \fi
 8795:     %
 8796:     % Remember this xref in the control sequence \floatlistFLOATTYPE,
 8797:     % for later use in \listoffloats.
 8798:     \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0
 8799:       {\safexrefname}}%
 8800:   \fi
 8801: }
 8802: 
 8803: % If working on a large document in chapters, it is convenient to
 8804: % be able to disable indexing, cross-referencing, and contents, for test runs.
 8805: % This is done with @novalidate at the beginning of the file.
 8806: %
 8807: \newif\iflinks \linkstrue % by default we want the aux files.
 8808: \let\novalidate = \linksfalse
 8809: 
 8810: % Used when writing to the aux file, or when using data from it.
 8811: \def\requireauxfile{%
 8812:   \iflinks
 8813:     \tryauxfile
 8814:     % Open the new aux file.  TeX will close it automatically at exit.
 8815:     \immediate\openout\auxfile=\jobname.aux
 8816:   \fi
 8817:   \global\let\requireauxfile=\relax   % Only do this once.
 8818: }
 8819: 
 8820: % Read the last existing aux file, if any.  No error if none exists.
 8821: %
 8822: \def\tryauxfile{%
 8823:   \openin 1 \jobname.aux
 8824:   \ifeof 1 \else
 8825:     \readdatafile{aux}%
 8826:     \global\havexrefstrue
 8827:   \fi
 8828:   \closein 1
 8829: }
 8830: 
 8831: \def\setupdatafile{%
 8832:   \catcode`\^^@=\other
 8833:   \catcode`\^^A=\other
 8834:   \catcode`\^^B=\other
 8835:   \catcode`\^^C=\other
 8836:   \catcode`\^^D=\other
 8837:   \catcode`\^^E=\other
 8838:   \catcode`\^^F=\other
 8839:   \catcode`\^^G=\other
 8840:   \catcode`\^^H=\other
 8841:   \catcode`\^^K=\other
 8842:   \catcode`\^^L=\other
 8843:   \catcode`\^^N=\other
 8844:   \catcode`\^^P=\other
 8845:   \catcode`\^^Q=\other
 8846:   \catcode`\^^R=\other
 8847:   \catcode`\^^S=\other
 8848:   \catcode`\^^T=\other
 8849:   \catcode`\^^U=\other
 8850:   \catcode`\^^V=\other
 8851:   \catcode`\^^W=\other
 8852:   \catcode`\^^X=\other
 8853:   \catcode`\^^Z=\other
 8854:   \catcode`\^^[=\other
 8855:   \catcode`\^^\=\other
 8856:   \catcode`\^^]=\other
 8857:   \catcode`\^^^=\other
 8858:   \catcode`\^^_=\other
 8859:   % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc.
 8860:   % in xref tags, i.e., node names.  But since ^^e4 notation isn't
 8861:   % supported in the main text, it doesn't seem desirable.  Furthermore,
 8862:   % that is not enough: for node names that actually contain a ^
 8863:   % character, we would end up writing a line like this: 'xrdef {'hat
 8864:   % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
 8865:   % argument, and \hat is not an expandable control sequence.  It could
 8866:   % all be worked out, but why?  Either we support ^^ or we don't.
 8867:   %
 8868:   % The other change necessary for this was to define \auxhat:
 8869:   % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
 8870:   % and then to call \auxhat in \setq.
 8871:   %
 8872:   \catcode`\^=\other
 8873:   %
 8874:   % Special characters.  Should be turned off anyway, but...
 8875:   \catcode`\~=\other
 8876:   \catcode`\[=\other
 8877:   \catcode`\]=\other
 8878:   \catcode`\"=\other
 8879:   \catcode`\_=\other
 8880:   \catcode`\|=\other
 8881:   \catcode`\<=\other
 8882:   \catcode`\>=\other
 8883:   \catcode`\$=\other
 8884:   \catcode`\#=\other
 8885:   \catcode`\&=\other
 8886:   \catcode`\%=\other
 8887:   \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
 8888:   %
 8889:   % This is to support \ in node names and titles, since the \
 8890:   % characters end up in a \csname.  It's easier than
 8891:   % leaving it active and making its active definition an actual \
 8892:   % character.  What I don't understand is why it works in the *value*
 8893:   % of the xrdef.  Seems like it should be a catcode12 \, and that
 8894:   % should not typeset properly.  But it works, so I'm moving on for
 8895:   % now.  --karl, 15jan04.
 8896:   \catcode`\\=\other
 8897:   %
 8898:   % Make the characters 128-255 be printing characters.
 8899:   {\setnonasciicharscatcodenonglobal\other}%
 8900:   %
 8901:   % @ is our escape character in .aux files, and we need braces.
 8902:   \catcode`\{=1
 8903:   \catcode`\}=2
 8904:   \catcode`\@=0
 8905: }
 8906: 
 8907: \def\readdatafile#1{%
 8908: \begingroup
 8909:   \setupdatafile
 8910:   \input\jobname.#1
 8911: \endgroup}
 8912: 
 8913: 
 8914: \message{insertions,}
 8915: % including footnotes.
 8916: 
 8917: \newcount \footnoteno
 8918: 
 8919: % The trailing space in the following definition for supereject is
 8920: % vital for proper filling; pages come out unaligned when you do a
 8921: % pagealignmacro call if that space before the closing brace is
 8922: % removed. (Generally, numeric constants should always be followed by a
 8923: % space to prevent strange expansion errors.)
 8924: \def\supereject{\par\penalty -20000\footnoteno =0 }
 8925: 
 8926: % @footnotestyle is meaningful for Info output only.
 8927: \let\footnotestyle=\comment
 8928: 
 8929: {\catcode `\@=11
 8930: %
 8931: % Auto-number footnotes.  Otherwise like plain.
 8932: \gdef\footnote{%
 8933:   \global\advance\footnoteno by \@ne
 8934:   \edef\thisfootno{$^{\the\footnoteno}$}%
 8935:   %
 8936:   % In case the footnote comes at the end of a sentence, preserve the
 8937:   % extra spacing after we do the footnote number.
 8938:   \let\@sf\empty
 8939:   \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi
 8940:   %
 8941:   % Remove inadvertent blank space before typesetting the footnote number.
 8942:   \unskip
 8943:   \thisfootno\@sf
 8944:   \dofootnote
 8945: }%
 8946: 
 8947: % Don't bother with the trickery in plain.tex to not require the
 8948: % footnote text as a parameter.  Our footnotes don't need to be so general.
 8949: %
 8950: % Oh yes, they do; otherwise, @ifset (and anything else that uses
 8951: % \parseargline) fails inside footnotes because the tokens are fixed when
 8952: % the footnote is read.  --karl, 16nov96.
 8953: %
 8954: \gdef\dofootnote{%
 8955:   \insert\footins\bgroup
 8956:   %
 8957:   % Nested footnotes are not supported in TeX, that would take a lot
 8958:   % more work.  (\startsavinginserts does not suffice.)
 8959:   \let\footnote=\errfootnotenest
 8960:   %
 8961:   % We want to typeset this text as a normal paragraph, even if the
 8962:   % footnote reference occurs in (for example) a display environment.
 8963:   % So reset some parameters.
 8964:   \hsize=\pagewidth
 8965:   \interlinepenalty\interfootnotelinepenalty
 8966:   \splittopskip\ht\strutbox % top baseline for broken footnotes
 8967:   \splitmaxdepth\dp\strutbox
 8968:   \floatingpenalty\@MM
 8969:   \leftskip\z@skip
 8970:   \rightskip\z@skip
 8971:   \spaceskip\z@skip
 8972:   \xspaceskip\z@skip
 8973:   \parindent\defaultparindent
 8974:   %
 8975:   \smallfonts \rm
 8976:   %
 8977:   % Because we use hanging indentation in footnotes, a @noindent appears
 8978:   % to exdent this text, so make it be a no-op.  makeinfo does not use
 8979:   % hanging indentation so @noindent can still be needed within footnote
 8980:   % text after an @example or the like (not that this is good style).
 8981:   \let\noindent = \relax
 8982:   %
 8983:   % Hang the footnote text off the number.  Use \everypar in case the
 8984:   % footnote extends for more than one paragraph.
 8985:   \everypar = {\hang}%
 8986:   \textindent{\thisfootno}%
 8987:   %
 8988:   % Don't crash into the line above the footnote text.  Since this
 8989:   % expands into a box, it must come within the paragraph, lest it
 8990:   % provide a place where TeX can split the footnote.
 8991:   \footstrut
 8992:   %
 8993:   % Invoke rest of plain TeX footnote routine.
 8994:   \futurelet\next\fo@t
 8995: }
 8996: }%end \catcode `\@=11
 8997: 
 8998: \def\errfootnotenest{%
 8999:   \errhelp=\EMsimple
 9000:   \errmessage{Nested footnotes not supported in texinfo.tex,
 9001:     even though they work in makeinfo; sorry}
 9002: }
 9003: 
 9004: \def\errfootnoteheading{%
 9005:   \errhelp=\EMsimple
 9006:   \errmessage{Footnotes in chapters, sections, etc., are not supported}
 9007: }
 9008: 
 9009: % In case a @footnote appears in a vbox, save the footnote text and create
 9010: % the real \insert just after the vbox finished.  Otherwise, the insertion
 9011: % would be lost.
 9012: % Similarly, if a @footnote appears inside an alignment, save the footnote
 9013: % text to a box and make the \insert when a row of the table is finished.
 9014: % And the same can be done for other insert classes.  --kasal, 16nov03.
 9015: %
 9016: % Replace the \insert primitive by a cheating macro.
 9017: % Deeper inside, just make sure that the saved insertions are not spilled
 9018: % out prematurely.
 9019: %
 9020: \def\startsavinginserts{%
 9021:   \ifx \insert\ptexinsert
 9022:     \let\insert\saveinsert
 9023:   \else
 9024:     \let\checkinserts\relax
 9025:   \fi
 9026: }
 9027: 
 9028: % This \insert replacement works for both \insert\footins{foo} and
 9029: % \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}.
 9030: %
 9031: \def\saveinsert#1{%
 9032:   \edef\next{\noexpand\savetobox \makeSAVEname#1}%
 9033:   \afterassignment\next
 9034:   % swallow the left brace
 9035:   \let\temp =
 9036: }
 9037: \def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}}
 9038: \def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1}
 9039: 
 9040: \def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi}
 9041: 
 9042: \def\placesaveins#1{%
 9043:   \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname
 9044:     {\box#1}%
 9045: }
 9046: 
 9047: % eat @SAVE -- beware, all of them have catcode \other:
 9048: {
 9049:   \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials  %  ;-)
 9050:   \gdef\gobblesave @SAVE{}
 9051: }
 9052: 
 9053: % initialization:
 9054: \def\newsaveins #1{%
 9055:   \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}%
 9056:   \next
 9057: }
 9058: \def\newsaveinsX #1{%
 9059:   \csname newbox\endcsname #1%
 9060:   \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts
 9061:     \checksaveins #1}%
 9062: }
 9063: 
 9064: % initialize:
 9065: \let\checkinserts\empty
 9066: \newsaveins\footins
 9067: \newsaveins\margin
 9068: 
 9069: 
 9070: % @image.  We use the macros from epsf.tex to support this.
 9071: % If epsf.tex is not installed and @image is used, we complain.
 9072: %
 9073: % Check for and read epsf.tex up front.  If we read it only at @image
 9074: % time, we might be inside a group, and then its definitions would get
 9075: % undone and the next image would fail.
 9076: \openin 1 = epsf.tex
 9077: \ifeof 1 \else
 9078:   % Do not bother showing banner with epsf.tex v2.7k (available in
 9079:   % doc/epsf.tex and on ctan).
 9080:   \def\epsfannounce{\toks0 = }%
 9081:   \input epsf.tex
 9082: \fi
 9083: \closein 1
 9084: %
 9085: % We will only complain once about lack of epsf.tex.
 9086: \newif\ifwarnednoepsf
 9087: \newhelp\noepsfhelp{epsf.tex must be installed for images to
 9088:   work.  It is also included in the Texinfo distribution, or you can get
 9089:   it from ftp://tug.org/tex/epsf.tex.}
 9090: %
 9091: \def\image#1{%
 9092:   \ifx\epsfbox\thisisundefined
 9093:     \ifwarnednoepsf \else
 9094:       \errhelp = \noepsfhelp
 9095:       \errmessage{epsf.tex not found, images will be ignored}%
 9096:       \global\warnednoepsftrue
 9097:     \fi
 9098:   \else
 9099:     \imagexxx #1,,,,,\finish
 9100:   \fi
 9101: }
 9102: %
 9103: % Arguments to @image:
 9104: % #1 is (mandatory) image filename; we tack on .eps extension.
 9105: % #2 is (optional) width, #3 is (optional) height.
 9106: % #4 is (ignored optional) html alt text.
 9107: % #5 is (ignored optional) extension.
 9108: % #6 is just the usual extra ignored arg for parsing stuff.
 9109: \newif\ifimagevmode
 9110: \def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
 9111:   \catcode`\^^M = 5     % in case we're inside an example
 9112:   \normalturnoffactive  % allow _ et al. in names
 9113:   \def\xprocessmacroarg{\eatspaces}% in case we are being used via a macro
 9114:   % If the image is by itself, center it.
 9115:   \ifvmode
 9116:     \imagevmodetrue
 9117:   \else \ifx\centersub\centerV
 9118:     % for @center @image, we need a vbox so we can have our vertical space
 9119:     \imagevmodetrue
 9120:     \vbox\bgroup % vbox has better behavior than vtop herev
 9121:   \fi\fi
 9122:   %
 9123:   \ifimagevmode
 9124:     \nobreak\medskip
 9125:     % Usually we'll have text after the image which will insert
 9126:     % \parskip glue, so insert it here too to equalize the space
 9127:     % above and below.
 9128:     \nobreak\vskip\parskip
 9129:     \nobreak
 9130:   \fi
 9131:   %
 9132:   % Leave vertical mode so that indentation from an enclosing
 9133:   %  environment such as @quotation is respected.
 9134:   % However, if we're at the top level, we don't want the
 9135:   %  normal paragraph indentation.
 9136:   % On the other hand, if we are in the case of @center @image, we don't
 9137:   %  want to start a paragraph, which will create a hsize-width box and
 9138:   %  eradicate the centering.
 9139:   \ifx\centersub\centerV\else \noindent \fi
 9140:   %
 9141:   % Output the image.
 9142:   \ifpdf
 9143:     % For pdfTeX and LuaTeX <= 0.80
 9144:     \dopdfimage{#1}{#2}{#3}%
 9145:   \else
 9146:     \ifx\XeTeXrevision\thisisundefined
 9147:       % For epsf.tex
 9148:       % \epsfbox itself resets \epsf?size at each figure.
 9149:       \setbox0 = \hbox{\ignorespaces #2}%
 9150:         \ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
 9151:       \setbox0 = \hbox{\ignorespaces #3}%
 9152:         \ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
 9153:       \epsfbox{#1.eps}%
 9154:     \else
 9155:       % For XeTeX
 9156:       \doxeteximage{#1}{#2}{#3}%
 9157:     \fi
 9158:   \fi
 9159:   %
 9160:   \ifimagevmode
 9161:     \medskip  % space after a standalone image
 9162:   \fi  
 9163:   \ifx\centersub\centerV \egroup \fi
 9164: \endgroup}
 9165: 
 9166: 
 9167: % @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables,
 9168: % etc.  We don't actually implement floating yet, we always include the
 9169: % float "here".  But it seemed the best name for the future.
 9170: %
 9171: \envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish}
 9172: 
 9173: % There may be a space before second and/or third parameter; delete it.
 9174: \def\eatcommaspace#1, {#1,}
 9175: 
 9176: % #1 is the optional FLOATTYPE, the text label for this float, typically
 9177: % "Figure", "Table", "Example", etc.  Can't contain commas.  If omitted,
 9178: % this float will not be numbered and cannot be referred to.
 9179: %
 9180: % #2 is the optional xref label.  Also must be present for the float to
 9181: % be referable.
 9182: %
 9183: % #3 is the optional positioning argument; for now, it is ignored.  It
 9184: % will somehow specify the positions allowed to float to (here, top, bottom).
 9185: %
 9186: % We keep a separate counter for each FLOATTYPE, which we reset at each
 9187: % chapter-level command.
 9188: \let\resetallfloatnos=\empty
 9189: %
 9190: \def\dofloat#1,#2,#3,#4\finish{%
 9191:   \let\thiscaption=\empty
 9192:   \let\thisshortcaption=\empty
 9193:   %
 9194:   % don't lose footnotes inside @float.
 9195:   %
 9196:   % BEWARE: when the floats start float, we have to issue warning whenever an
 9197:   % insert appears inside a float which could possibly float. --kasal, 26may04
 9198:   %
 9199:   \startsavinginserts
 9200:   %
 9201:   % We can't be used inside a paragraph.
 9202:   \par
 9203:   %
 9204:   \vtop\bgroup
 9205:     \def\floattype{#1}%
 9206:     \def\floatlabel{#2}%
 9207:     \def\floatloc{#3}% we do nothing with this yet.
 9208:     %
 9209:     \ifx\floattype\empty
 9210:       \let\safefloattype=\empty
 9211:     \else
 9212:       {%
 9213:         % the floattype might have accents or other special characters,
 9214:         % but we need to use it in a control sequence name.
 9215:         \indexnofonts
 9216:         \turnoffactive
 9217:         \xdef\safefloattype{\floattype}%
 9218:       }%
 9219:     \fi
 9220:     %
 9221:     % If label is given but no type, we handle that as the empty type.
 9222:     \ifx\floatlabel\empty \else
 9223:       % We want each FLOATTYPE to be numbered separately (Figure 1,
 9224:       % Table 1, Figure 2, ...).  (And if no label, no number.)
 9225:       %
 9226:       \expandafter\getfloatno\csname\safefloattype floatno\endcsname
 9227:       \global\advance\floatno by 1
 9228:       %
 9229:       {%
 9230:         % This magic value for \lastsection is output by \setref as the
 9231:         % XREFLABEL-title value.  \xrefX uses it to distinguish float
 9232:         % labels (which have a completely different output format) from
 9233:         % node and anchor labels.  And \xrdef uses it to construct the
 9234:         % lists of floats.
 9235:         %
 9236:         \edef\lastsection{\floatmagic=\safefloattype}%
 9237:         \setref{\floatlabel}{Yfloat}%
 9238:       }%
 9239:     \fi
 9240:     %
 9241:     % start with \parskip glue, I guess.
 9242:     \vskip\parskip
 9243:     %
 9244:     % Don't suppress indentation if a float happens to start a section.
 9245:     \restorefirstparagraphindent
 9246: }
 9247: 
 9248: % we have these possibilities:
 9249: % @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap
 9250: % @float Foo,lbl & no caption:    Foo 1.1
 9251: % @float Foo & @caption{Cap}:     Foo: Cap
 9252: % @float Foo & no caption:        Foo
 9253: % @float ,lbl & Caption{Cap}:     1.1: Cap
 9254: % @float ,lbl & no caption:       1.1
 9255: % @float & @caption{Cap}:         Cap
 9256: % @float & no caption:
 9257: %
 9258: \def\Efloat{%
 9259:     \let\floatident = \empty
 9260:     %
 9261:     % In all cases, if we have a float type, it comes first.
 9262:     \ifx\floattype\empty \else \def\floatident{\floattype}\fi
 9263:     %
 9264:     % If we have an xref label, the number comes next.
 9265:     \ifx\floatlabel\empty \else
 9266:       \ifx\floattype\empty \else % if also had float type, need tie first.
 9267:         \appendtomacro\floatident{\tie}%
 9268:       \fi
 9269:       % the number.
 9270:       \appendtomacro\floatident{\chaplevelprefix\the\floatno}%
 9271:     \fi
 9272:     %
 9273:     % Start the printed caption with what we've constructed in
 9274:     % \floatident, but keep it separate; we need \floatident again.
 9275:     \let\captionline = \floatident
 9276:     %
 9277:     \ifx\thiscaption\empty \else
 9278:       \ifx\floatident\empty \else
 9279: 	\appendtomacro\captionline{: }% had ident, so need a colon between
 9280:       \fi
 9281:       %
 9282:       % caption text.
 9283:       \appendtomacro\captionline{\scanexp\thiscaption}%
 9284:     \fi
 9285:     %
 9286:     % If we have anything to print, print it, with space before.
 9287:     % Eventually this needs to become an \insert.
 9288:     \ifx\captionline\empty \else
 9289:       \vskip.5\parskip
 9290:       \captionline
 9291:       %
 9292:       % Space below caption.
 9293:       \vskip\parskip
 9294:     \fi
 9295:     %
 9296:     % If have an xref label, write the list of floats info.  Do this
 9297:     % after the caption, to avoid chance of it being a breakpoint.
 9298:     \ifx\floatlabel\empty \else
 9299:       % Write the text that goes in the lof to the aux file as
 9300:       % \floatlabel-lof.  Besides \floatident, we include the short
 9301:       % caption if specified, else the full caption if specified, else nothing.
 9302:       {%
 9303:         \requireauxfile
 9304:         \atdummies
 9305:         %
 9306:         % since we read the caption text in the macro world, where ^^M
 9307:         % is turned into a normal character, we have to scan it back, so
 9308:         % we don't write the literal three characters "^^M" into the aux file.
 9309: 	\scanexp{%
 9310: 	  \xdef\noexpand\gtemp{%
 9311: 	    \ifx\thisshortcaption\empty
 9312: 	      \thiscaption
 9313: 	    \else
 9314: 	      \thisshortcaption
 9315: 	    \fi
 9316: 	  }%
 9317: 	}%
 9318:         \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident
 9319: 	  \ifx\gtemp\empty \else : \gtemp \fi}}%
 9320:       }%
 9321:     \fi
 9322:   \egroup  % end of \vtop
 9323:   %
 9324:   % place the captured inserts
 9325:   %
 9326:   % BEWARE: when the floats start floating, we have to issue warning
 9327:   % whenever an insert appears inside a float which could possibly
 9328:   % float. --kasal, 26may04
 9329:   %
 9330:   \checkinserts
 9331: }
 9332: 
 9333: % Append the tokens #2 to the definition of macro #1, not expanding either.
 9334: %
 9335: \def\appendtomacro#1#2{%
 9336:   \expandafter\def\expandafter#1\expandafter{#1#2}%
 9337: }
 9338: 
 9339: % @caption, @shortcaption
 9340: %
 9341: \def\caption{\docaption\thiscaption}
 9342: \def\shortcaption{\docaption\thisshortcaption}
 9343: \def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption}
 9344: \def\defcaption#1#2{\egroup \def#1{#2}}
 9345: 
 9346: % The parameter is the control sequence identifying the counter we are
 9347: % going to use.  Create it if it doesn't exist and assign it to \floatno.
 9348: \def\getfloatno#1{%
 9349:   \ifx#1\relax
 9350:       % Haven't seen this figure type before.
 9351:       \csname newcount\endcsname #1%
 9352:       %
 9353:       % Remember to reset this floatno at the next chap.
 9354:       \expandafter\gdef\expandafter\resetallfloatnos
 9355:         \expandafter{\resetallfloatnos #1=0 }%
 9356:   \fi
 9357:   \let\floatno#1%
 9358: }
 9359: 
 9360: % \setref calls this to get the XREFLABEL-snt value.  We want an @xref
 9361: % to the FLOATLABEL to expand to "Figure 3.1".  We call \setref when we
 9362: % first read the @float command.
 9363: %
 9364: \def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}%
 9365: 
 9366: % Magic string used for the XREFLABEL-title value, so \xrefX can
 9367: % distinguish floats from other xref types.
 9368: \def\floatmagic{!!float!!}
 9369: 
 9370: % #1 is the control sequence we are passed; we expand into a conditional
 9371: % which is true if #1 represents a float ref.  That is, the magic
 9372: % \lastsection value which we \setref above.
 9373: %
 9374: \def\iffloat#1{\expandafter\doiffloat#1==\finish}
 9375: %
 9376: % #1 is (maybe) the \floatmagic string.  If so, #2 will be the
 9377: % (safe) float type for this float.  We set \iffloattype to #2.
 9378: %
 9379: \def\doiffloat#1=#2=#3\finish{%
 9380:   \def\temp{#1}%
 9381:   \def\iffloattype{#2}%
 9382:   \ifx\temp\floatmagic
 9383: }
 9384: 
 9385: % @listoffloats FLOATTYPE - print a list of floats like a table of contents.
 9386: %
 9387: \parseargdef\listoffloats{%
 9388:   \def\floattype{#1}% floattype
 9389:   {%
 9390:     % the floattype might have accents or other special characters,
 9391:     % but we need to use it in a control sequence name.
 9392:     \indexnofonts
 9393:     \turnoffactive
 9394:     \xdef\safefloattype{\floattype}%
 9395:   }%
 9396:   %
 9397:   % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE.
 9398:   \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax
 9399:     \ifhavexrefs
 9400:       % if the user said @listoffloats foo but never @float foo.
 9401:       \message{\linenumber No `\safefloattype' floats to list.}%
 9402:     \fi
 9403:   \else
 9404:     \begingroup
 9405:       \leftskip=\tocindent  % indent these entries like a toc
 9406:       \let\do=\listoffloatsdo
 9407:       \csname floatlist\safefloattype\endcsname
 9408:     \endgroup
 9409:   \fi
 9410: }
 9411: 
 9412: % This is called on each entry in a list of floats.  We're passed the
 9413: % xref label, in the form LABEL-title, which is how we save it in the
 9414: % aux file.  We strip off the -title and look up \XRLABEL-lof, which
 9415: % has the text we're supposed to typeset here.
 9416: %
 9417: % Figures without xref labels will not be included in the list (since
 9418: % they won't appear in the aux file).
 9419: %
 9420: \def\listoffloatsdo#1{\listoffloatsdoentry#1\finish}
 9421: \def\listoffloatsdoentry#1-title\finish{{%
 9422:   % Can't fully expand XR#1-lof because it can contain anything.  Just
 9423:   % pass the control sequence.  On the other hand, XR#1-pg is just the
 9424:   % page number, and we want to fully expand that so we can get a link
 9425:   % in pdf output.
 9426:   \toksA = \expandafter{\csname XR#1-lof\endcsname}%
 9427:   %
 9428:   % use the same \entry macro we use to generate the TOC and index.
 9429:   \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}%
 9430:   \writeentry
 9431: }}
 9432: 
 9433: 
 9434: \message{localization,}
 9435: 
 9436: % For single-language documents, @documentlanguage is usually given very
 9437: % early, just after @documentencoding.  Single argument is the language
 9438: % (de) or locale (de_DE) abbreviation.
 9439: %
 9440: {
 9441:   \catcode`\_ = \active
 9442:   \globaldefs=1
 9443: \parseargdef\documentlanguage{%
 9444:   \tex % read txi-??.tex file in plain TeX.
 9445:     % Read the file by the name they passed if it exists.
 9446:     \let_ = \normalunderscore  % normal _ character for filename test
 9447:     \openin 1 txi-#1.tex
 9448:     \ifeof 1
 9449:       \documentlanguagetrywithoutunderscore #1_\finish
 9450:     \else
 9451:       \globaldefs = 1  % everything in the txi-LL files needs to persist
 9452:       \input txi-#1.tex
 9453:     \fi
 9454:     \closein 1
 9455:   \endgroup % end raw TeX
 9456: }
 9457: %
 9458: % If they passed de_DE, and txi-de_DE.tex doesn't exist,
 9459: % try txi-de.tex.
 9460: %
 9461: \gdef\documentlanguagetrywithoutunderscore#1_#2\finish{%
 9462:   \openin 1 txi-#1.tex
 9463:   \ifeof 1
 9464:     \errhelp = \nolanghelp
 9465:     \errmessage{Cannot read language file txi-#1.tex}%
 9466:   \else
 9467:     \globaldefs = 1  % everything in the txi-LL files needs to persist
 9468:     \input txi-#1.tex
 9469:   \fi
 9470:   \closein 1
 9471: }
 9472: }% end of special _ catcode
 9473: %
 9474: \newhelp\nolanghelp{The given language definition file cannot be found or
 9475: is empty.  Maybe you need to install it?  Putting it in the current
 9476: directory should work if nowhere else does.}
 9477: 
 9478: % This macro is called from txi-??.tex files; the first argument is the
 9479: % \language name to set (without the "\lang@" prefix), the second and
 9480: % third args are \{left,right}hyphenmin.
 9481: %
 9482: % The language names to pass are determined when the format is built.
 9483: % See the etex.log file created at that time, e.g.,
 9484: % /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log.
 9485: %
 9486: % With TeX Live 2008, etex now includes hyphenation patterns for all
 9487: % available languages.  This means we can support hyphenation in
 9488: % Texinfo, at least to some extent.  (This still doesn't solve the
 9489: % accented characters problem.)
 9490: %
 9491: \catcode`@=11
 9492: \def\txisetlanguage#1#2#3{%
 9493:   % do not set the language if the name is undefined in the current TeX.
 9494:   \expandafter\ifx\csname lang@#1\endcsname \relax
 9495:     \message{no patterns for #1}%
 9496:   \else
 9497:     \global\language = \csname lang@#1\endcsname
 9498:   \fi
 9499:   % but there is no harm in adjusting the hyphenmin values regardless.
 9500:   \global\lefthyphenmin = #2\relax
 9501:   \global\righthyphenmin = #3\relax
 9502: }
 9503: 
 9504: % Get input by bytes instead of by UTF-8 codepoints for XeTeX and LuaTeX, 
 9505: % otherwise the encoding support is completely broken.
 9506: \ifx\XeTeXrevision\thisisundefined
 9507: \else
 9508: \XeTeXdefaultencoding "bytes"  % For subsequent files to be read
 9509: \XeTeXinputencoding "bytes"  % Effective in texinfo.tex only
 9510: % Unfortunately, there seems to be no corresponding XeTeX command for
 9511: % output encoding.  This is a problem for auxiliary index and TOC files.
 9512: % The only solution would be perhaps to write out @U{...} sequences in
 9513: % place of UTF-8 characters.
 9514: \fi
 9515: 
 9516: \ifx\luatexversion\thisisundefined
 9517: \else
 9518: \directlua{
 9519: local utf8_char, byte, gsub = unicode.utf8.char, string.byte, string.gsub
 9520: local function convert_char (char)
 9521:   return utf8_char(byte(char))
 9522: end
 9523: 
 9524: local function convert_line (line)
 9525:   return gsub(line, ".", convert_char)
 9526: end
 9527: 
 9528: callback.register("process_input_buffer", convert_line)
 9529: 
 9530: local function convert_line_out (line)
 9531:   local line_out = ""
 9532:   for c in string.utfvalues(line) do
 9533:      line_out = line_out .. string.char(c)
 9534:   end
 9535:   return line_out
 9536: end
 9537: 
 9538: callback.register("process_output_buffer", convert_line_out)
 9539: }
 9540: \fi
 9541: 
 9542: 
 9543: % Helpers for encodings.
 9544: % Set the catcode of characters 128 through 255 to the specified number.
 9545: %
 9546: \def\setnonasciicharscatcode#1{%
 9547:    \count255=128
 9548:    \loop\ifnum\count255<256
 9549:       \global\catcode\count255=#1\relax
 9550:       \advance\count255 by 1
 9551:    \repeat
 9552: }
 9553: 
 9554: \def\setnonasciicharscatcodenonglobal#1{%
 9555:    \count255=128
 9556:    \loop\ifnum\count255<256
 9557:       \catcode\count255=#1\relax
 9558:       \advance\count255 by 1
 9559:    \repeat
 9560: }
 9561: 
 9562: % @documentencoding sets the definition of non-ASCII characters
 9563: % according to the specified encoding.
 9564: %
 9565: \def\documentencoding{\parseargusing\filenamecatcodes\documentencodingzzz}
 9566: \def\documentencodingzzz#1{%
 9567:   % Get input by bytes instead of by UTF-8 codepoints for XeTeX,
 9568:   % otherwise the encoding support is completely broken.
 9569:   % This settings is for the document root file.
 9570:   \ifx\XeTeXrevision\thisisundefined
 9571:   \else
 9572:     \XeTeXinputencoding "bytes"
 9573:   \fi
 9574:   %
 9575:   % Encoding being declared for the document.
 9576:   \def\declaredencoding{\csname #1.enc\endcsname}%
 9577:   %
 9578:   % Supported encodings: names converted to tokens in order to be able
 9579:   % to compare them with \ifx.
 9580:   \def\ascii{\csname US-ASCII.enc\endcsname}%
 9581:   \def\latnine{\csname ISO-8859-15.enc\endcsname}%
 9582:   \def\latone{\csname ISO-8859-1.enc\endcsname}%
 9583:   \def\lattwo{\csname ISO-8859-2.enc\endcsname}%
 9584:   \def\utfeight{\csname UTF-8.enc\endcsname}%
 9585:   %
 9586:   \ifx \declaredencoding \ascii
 9587:      \asciichardefs
 9588:   %
 9589:   \else \ifx \declaredencoding \lattwo
 9590:      \setnonasciicharscatcode\active
 9591:      \lattwochardefs
 9592:   %
 9593:   \else \ifx \declaredencoding \latone
 9594:      \setnonasciicharscatcode\active
 9595:      \latonechardefs
 9596:   %
 9597:   \else \ifx \declaredencoding \latnine
 9598:      \setnonasciicharscatcode\active
 9599:      \latninechardefs
 9600:   %
 9601:   \else \ifx \declaredencoding \utfeight
 9602:      \setnonasciicharscatcode\active
 9603:      % since we already invoked \utfeightchardefs at the top level
 9604:      % (below), do not re-invoke it, then our check for duplicated
 9605:      % definitions triggers.  Making non-ascii chars active is enough.
 9606:   %
 9607:   \else
 9608:     \message{Ignoring unknown document encoding: #1.}%
 9609:   %
 9610:   \fi % utfeight
 9611:   \fi % latnine
 9612:   \fi % latone
 9613:   \fi % lattwo
 9614:   \fi % ascii
 9615: }
 9616: 
 9617: % emacs-page
 9618: % A message to be logged when using a character that isn't available
 9619: % the default font encoding (OT1).
 9620: %
 9621: \def\missingcharmsg#1{\message{Character missing, sorry: #1.}}
 9622: 
 9623: % Take account of \c (plain) vs. \, (Texinfo) difference.
 9624: \def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi}
 9625: 
 9626: % First, make active non-ASCII characters in order for them to be
 9627: % correctly categorized when TeX reads the replacement text of
 9628: % macros containing the character definitions.
 9629: \setnonasciicharscatcode\active
 9630: %
 9631: % Latin1 (ISO-8859-1) character definitions.
 9632: \def\latonechardefs{%
 9633:   \gdef^^a0{\tie}
 9634:   \gdef^^a1{\exclamdown}
 9635:   \gdef^^a2{{\tcfont \char162}} % cent
 9636:   \gdef^^a3{\pounds}
 9637:   \gdef^^a4{{\tcfont \char164}} % currency
 9638:   \gdef^^a5{{\tcfont \char165}} % yen
 9639:   \gdef^^a6{{\tcfont \char166}} % broken bar
 9640:   \gdef^^a7{\S}
 9641:   \gdef^^a8{\"{}}
 9642:   \gdef^^a9{\copyright}
 9643:   \gdef^^aa{\ordf}
 9644:   \gdef^^ab{\guillemetleft}
 9645:   \gdef^^ac{\ensuremath\lnot}
 9646:   \gdef^^ad{\-}
 9647:   \gdef^^ae{\registeredsymbol}
 9648:   \gdef^^af{\={}}
 9649:   %
 9650:   \gdef^^b0{\textdegree}
 9651:   \gdef^^b1{$\pm$}
 9652:   \gdef^^b2{$^2$}
 9653:   \gdef^^b3{$^3$}
 9654:   \gdef^^b4{\'{}}
 9655:   \gdef^^b5{$\mu$}
 9656:   \gdef^^b6{\P}
 9657:   \gdef^^b7{\ensuremath\cdot}
 9658:   \gdef^^b8{\cedilla\ }
 9659:   \gdef^^b9{$^1$}
 9660:   \gdef^^ba{\ordm}
 9661:   \gdef^^bb{\guillemetright}
 9662:   \gdef^^bc{$1\over4$}
 9663:   \gdef^^bd{$1\over2$}
 9664:   \gdef^^be{$3\over4$}
 9665:   \gdef^^bf{\questiondown}
 9666:   %
 9667:   \gdef^^c0{\`A}
 9668:   \gdef^^c1{\'A}
 9669:   \gdef^^c2{\^A}
 9670:   \gdef^^c3{\~A}
 9671:   \gdef^^c4{\"A}
 9672:   \gdef^^c5{\ringaccent A}
 9673:   \gdef^^c6{\AE}
 9674:   \gdef^^c7{\cedilla C}
 9675:   \gdef^^c8{\`E}
 9676:   \gdef^^c9{\'E}
 9677:   \gdef^^ca{\^E}
 9678:   \gdef^^cb{\"E}
 9679:   \gdef^^cc{\`I}
 9680:   \gdef^^cd{\'I}
 9681:   \gdef^^ce{\^I}
 9682:   \gdef^^cf{\"I}
 9683:   %
 9684:   \gdef^^d0{\DH}
 9685:   \gdef^^d1{\~N}
 9686:   \gdef^^d2{\`O}
 9687:   \gdef^^d3{\'O}
 9688:   \gdef^^d4{\^O}
 9689:   \gdef^^d5{\~O}
 9690:   \gdef^^d6{\"O}
 9691:   \gdef^^d7{$\times$}
 9692:   \gdef^^d8{\O}
 9693:   \gdef^^d9{\`U}
 9694:   \gdef^^da{\'U}
 9695:   \gdef^^db{\^U}
 9696:   \gdef^^dc{\"U}
 9697:   \gdef^^dd{\'Y}
 9698:   \gdef^^de{\TH}
 9699:   \gdef^^df{\ss}
 9700:   %
 9701:   \gdef^^e0{\`a}
 9702:   \gdef^^e1{\'a}
 9703:   \gdef^^e2{\^a}
 9704:   \gdef^^e3{\~a}
 9705:   \gdef^^e4{\"a}
 9706:   \gdef^^e5{\ringaccent a}
 9707:   \gdef^^e6{\ae}
 9708:   \gdef^^e7{\cedilla c}
 9709:   \gdef^^e8{\`e}
 9710:   \gdef^^e9{\'e}
 9711:   \gdef^^ea{\^e}
 9712:   \gdef^^eb{\"e}
 9713:   \gdef^^ec{\`{\dotless i}}
 9714:   \gdef^^ed{\'{\dotless i}}
 9715:   \gdef^^ee{\^{\dotless i}}
 9716:   \gdef^^ef{\"{\dotless i}}
 9717:   %
 9718:   \gdef^^f0{\dh}
 9719:   \gdef^^f1{\~n}
 9720:   \gdef^^f2{\`o}
 9721:   \gdef^^f3{\'o}
 9722:   \gdef^^f4{\^o}
 9723:   \gdef^^f5{\~o}
 9724:   \gdef^^f6{\"o}
 9725:   \gdef^^f7{$\div$}
 9726:   \gdef^^f8{\o}
 9727:   \gdef^^f9{\`u}
 9728:   \gdef^^fa{\'u}
 9729:   \gdef^^fb{\^u}
 9730:   \gdef^^fc{\"u}
 9731:   \gdef^^fd{\'y}
 9732:   \gdef^^fe{\th}
 9733:   \gdef^^ff{\"y}
 9734: }
 9735: 
 9736: % Latin9 (ISO-8859-15) encoding character definitions.
 9737: \def\latninechardefs{%
 9738:   % Encoding is almost identical to Latin1.
 9739:   \latonechardefs
 9740:   %
 9741:   \gdef^^a4{\euro}
 9742:   \gdef^^a6{\v S}
 9743:   \gdef^^a8{\v s}
 9744:   \gdef^^b4{\v Z}
 9745:   \gdef^^b8{\v z}
 9746:   \gdef^^bc{\OE}
 9747:   \gdef^^bd{\oe}
 9748:   \gdef^^be{\"Y}
 9749: }
 9750: 
 9751: % Latin2 (ISO-8859-2) character definitions.
 9752: \def\lattwochardefs{%
 9753:   \gdef^^a0{\tie}
 9754:   \gdef^^a1{\ogonek{A}}
 9755:   \gdef^^a2{\u{}}
 9756:   \gdef^^a3{\L}
 9757:   \gdef^^a4{\missingcharmsg{CURRENCY SIGN}}
 9758:   \gdef^^a5{\v L}
 9759:   \gdef^^a6{\'S}
 9760:   \gdef^^a7{\S}
 9761:   \gdef^^a8{\"{}}
 9762:   \gdef^^a9{\v S}
 9763:   \gdef^^aa{\cedilla S}
 9764:   \gdef^^ab{\v T}
 9765:   \gdef^^ac{\'Z}
 9766:   \gdef^^ad{\-}
 9767:   \gdef^^ae{\v Z}
 9768:   \gdef^^af{\dotaccent Z}
 9769:   %
 9770:   \gdef^^b0{\textdegree}
 9771:   \gdef^^b1{\ogonek{a}}
 9772:   \gdef^^b2{\ogonek{ }}
 9773:   \gdef^^b3{\l}
 9774:   \gdef^^b4{\'{}}
 9775:   \gdef^^b5{\v l}
 9776:   \gdef^^b6{\'s}
 9777:   \gdef^^b7{\v{}}
 9778:   \gdef^^b8{\cedilla\ }
 9779:   \gdef^^b9{\v s}
 9780:   \gdef^^ba{\cedilla s}
 9781:   \gdef^^bb{\v t}
 9782:   \gdef^^bc{\'z}
 9783:   \gdef^^bd{\H{}}
 9784:   \gdef^^be{\v z}
 9785:   \gdef^^bf{\dotaccent z}
 9786:   %
 9787:   \gdef^^c0{\'R}
 9788:   \gdef^^c1{\'A}
 9789:   \gdef^^c2{\^A}
 9790:   \gdef^^c3{\u A}
 9791:   \gdef^^c4{\"A}
 9792:   \gdef^^c5{\'L}
 9793:   \gdef^^c6{\'C}
 9794:   \gdef^^c7{\cedilla C}
 9795:   \gdef^^c8{\v C}
 9796:   \gdef^^c9{\'E}
 9797:   \gdef^^ca{\ogonek{E}}
 9798:   \gdef^^cb{\"E}
 9799:   \gdef^^cc{\v E}
 9800:   \gdef^^cd{\'I}
 9801:   \gdef^^ce{\^I}
 9802:   \gdef^^cf{\v D}
 9803:   %
 9804:   \gdef^^d0{\DH}
 9805:   \gdef^^d1{\'N}
 9806:   \gdef^^d2{\v N}
 9807:   \gdef^^d3{\'O}
 9808:   \gdef^^d4{\^O}
 9809:   \gdef^^d5{\H O}
 9810:   \gdef^^d6{\"O}
 9811:   \gdef^^d7{$\times$}
 9812:   \gdef^^d8{\v R}
 9813:   \gdef^^d9{\ringaccent U}
 9814:   \gdef^^da{\'U}
 9815:   \gdef^^db{\H U}
 9816:   \gdef^^dc{\"U}
 9817:   \gdef^^dd{\'Y}
 9818:   \gdef^^de{\cedilla T}
 9819:   \gdef^^df{\ss}
 9820:   %
 9821:   \gdef^^e0{\'r}
 9822:   \gdef^^e1{\'a}
 9823:   \gdef^^e2{\^a}
 9824:   \gdef^^e3{\u a}
 9825:   \gdef^^e4{\"a}
 9826:   \gdef^^e5{\'l}
 9827:   \gdef^^e6{\'c}
 9828:   \gdef^^e7{\cedilla c}
 9829:   \gdef^^e8{\v c}
 9830:   \gdef^^e9{\'e}
 9831:   \gdef^^ea{\ogonek{e}}
 9832:   \gdef^^eb{\"e}
 9833:   \gdef^^ec{\v e}
 9834:   \gdef^^ed{\'{\dotless{i}}}
 9835:   \gdef^^ee{\^{\dotless{i}}}
 9836:   \gdef^^ef{\v d}
 9837:   %
 9838:   \gdef^^f0{\dh}
 9839:   \gdef^^f1{\'n}
 9840:   \gdef^^f2{\v n}
 9841:   \gdef^^f3{\'o}
 9842:   \gdef^^f4{\^o}
 9843:   \gdef^^f5{\H o}
 9844:   \gdef^^f6{\"o}
 9845:   \gdef^^f7{$\div$}
 9846:   \gdef^^f8{\v r}
 9847:   \gdef^^f9{\ringaccent u}
 9848:   \gdef^^fa{\'u}
 9849:   \gdef^^fb{\H u}
 9850:   \gdef^^fc{\"u}
 9851:   \gdef^^fd{\'y}
 9852:   \gdef^^fe{\cedilla t}
 9853:   \gdef^^ff{\dotaccent{}}
 9854: }
 9855: 
 9856: % UTF-8 character definitions.
 9857: %
 9858: % This code to support UTF-8 is based on LaTeX's utf8.def, with some
 9859: % changes for Texinfo conventions.  It is included here under the GPL by
 9860: % permission from Frank Mittelbach and the LaTeX team.
 9861: %
 9862: \newcount\countUTFx
 9863: \newcount\countUTFy
 9864: \newcount\countUTFz
 9865: 
 9866: \gdef\UTFviiiTwoOctets#1#2{\expandafter
 9867:    \UTFviiiDefined\csname u8:#1\string #2\endcsname}
 9868: %
 9869: \gdef\UTFviiiThreeOctets#1#2#3{\expandafter
 9870:    \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname}
 9871: %
 9872: \gdef\UTFviiiFourOctets#1#2#3#4{\expandafter
 9873:    \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname}
 9874: 
 9875: \gdef\UTFviiiDefined#1{%
 9876:   \ifx #1\relax
 9877:     \message{\linenumber Unicode char \string #1 not defined for Texinfo}%
 9878:   \else
 9879:     \expandafter #1%
 9880:   \fi
 9881: }
 9882: 
 9883: \begingroup
 9884:   \catcode`\~13
 9885:   \catcode`\"12
 9886: 
 9887:   \def\UTFviiiLoop{%
 9888:     \global\catcode\countUTFx\active
 9889:     \uccode`\~\countUTFx
 9890:     \uppercase\expandafter{\UTFviiiTmp}%
 9891:     \advance\countUTFx by 1
 9892:     \ifnum\countUTFx < \countUTFy
 9893:       \expandafter\UTFviiiLoop
 9894:     \fi}
 9895: 
 9896:   \countUTFx = "C2
 9897:   \countUTFy = "E0
 9898:   \def\UTFviiiTmp{%
 9899:     \xdef~{\noexpand\UTFviiiTwoOctets\string~}}
 9900:   \UTFviiiLoop
 9901: 
 9902:   \countUTFx = "E0
 9903:   \countUTFy = "F0
 9904:   \def\UTFviiiTmp{%
 9905:     \xdef~{\noexpand\UTFviiiThreeOctets\string~}}
 9906:   \UTFviiiLoop
 9907: 
 9908:   \countUTFx = "F0
 9909:   \countUTFy = "F4
 9910:   \def\UTFviiiTmp{%
 9911:     \xdef~{\noexpand\UTFviiiFourOctets\string~}}
 9912:   \UTFviiiLoop
 9913: \endgroup
 9914: 
 9915: \def\globallet{\global\let} % save some \expandafter's below
 9916: 
 9917: % @U{xxxx} to produce U+xxxx, if we support it.
 9918: \def\U#1{%
 9919:   \expandafter\ifx\csname uni:#1\endcsname \relax
 9920:     \errhelp = \EMsimple	
 9921:     \errmessage{Unicode character U+#1 not supported, sorry}%
 9922:   \else
 9923:     \csname uni:#1\endcsname
 9924:   \fi
 9925: }
 9926: 
 9927: \begingroup
 9928:   \catcode`\"=12
 9929:   \catcode`\<=12
 9930:   \catcode`\.=12
 9931:   \catcode`\,=12
 9932:   \catcode`\;=12
 9933:   \catcode`\!=12
 9934:   \catcode`\~=13
 9935:   \gdef\DeclareUnicodeCharacter#1#2{%
 9936:     \countUTFz = "#1\relax
 9937:     %\wlog{\space\space defining Unicode char U+#1 (decimal \the\countUTFz)}%
 9938:     \begingroup
 9939:       \parseXMLCharref
 9940:       \def\UTFviiiTwoOctets##1##2{%
 9941:         \csname u8:##1\string ##2\endcsname}%
 9942:       \def\UTFviiiThreeOctets##1##2##3{%
 9943:         \csname u8:##1\string ##2\string ##3\endcsname}%
 9944:       \def\UTFviiiFourOctets##1##2##3##4{%
 9945:         \csname u8:##1\string ##2\string ##3\string ##4\endcsname}%
 9946:       \expandafter\expandafter\expandafter\expandafter
 9947:        \expandafter\expandafter\expandafter
 9948:        \gdef\UTFviiiTmp{#2}%
 9949:       % 
 9950:       \expandafter\ifx\csname uni:#1\endcsname \relax \else
 9951:        \message{Internal error, already defined: #1}%
 9952:       \fi
 9953:       %
 9954:       % define an additional control sequence for this code point.
 9955:       \expandafter\globallet\csname uni:#1\endcsname \UTFviiiTmp
 9956:     \endgroup}
 9957: 
 9958:   \gdef\parseXMLCharref{%
 9959:     \ifnum\countUTFz < "A0\relax
 9960:       \errhelp = \EMsimple
 9961:       \errmessage{Cannot define Unicode char value < 00A0}%
 9962:     \else\ifnum\countUTFz < "800\relax
 9963:       \parseUTFviiiA,%
 9964:       \parseUTFviiiB C\UTFviiiTwoOctets.,%
 9965:     \else\ifnum\countUTFz < "10000\relax
 9966:       \parseUTFviiiA;%
 9967:       \parseUTFviiiA,%
 9968:       \parseUTFviiiB E\UTFviiiThreeOctets.{,;}%
 9969:     \else
 9970:       \parseUTFviiiA;%
 9971:       \parseUTFviiiA,%
 9972:       \parseUTFviiiA!%
 9973:       \parseUTFviiiB F\UTFviiiFourOctets.{!,;}%
 9974:     \fi\fi\fi
 9975:   }
 9976: 
 9977:   \gdef\parseUTFviiiA#1{%
 9978:     \countUTFx = \countUTFz
 9979:     \divide\countUTFz by 64
 9980:     \countUTFy = \countUTFz
 9981:     \multiply\countUTFz by 64
 9982:     \advance\countUTFx by -\countUTFz
 9983:     \advance\countUTFx by 128
 9984:     \uccode `#1\countUTFx
 9985:     \countUTFz = \countUTFy}
 9986: 
 9987:   \gdef\parseUTFviiiB#1#2#3#4{%
 9988:     \advance\countUTFz by "#10\relax
 9989:     \uccode `#3\countUTFz
 9990:     \uppercase{\gdef\UTFviiiTmp{#2#3#4}}}
 9991: \endgroup
 9992: 
 9993: % https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_M
 9994: % U+0000..U+007F = https://en.wikipedia.org/wiki/Basic_Latin_(Unicode_block)
 9995: % U+0080..U+00FF = https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)
 9996: % U+0100..U+017F = https://en.wikipedia.org/wiki/Latin_Extended-A
 9997: % U+0180..U+024F = https://en.wikipedia.org/wiki/Latin_Extended-B
 9998: % 
 9999: % Many of our renditions are less than wonderful, and all the missing
10000: % characters are available somewhere.  Loading the necessary fonts
10001: % awaits user request.  We can't truly support Unicode without
10002: % reimplementing everything that's been done in LaTeX for many years,
10003: % plus probably using luatex or xetex, and who knows what else.
10004: % We won't be doing that here in this simple file.  But we can try to at
10005: % least make most of the characters not bomb out.
10006: %
10007: \def\utfeightchardefs{%
10008:   \DeclareUnicodeCharacter{00A0}{\tie}
10009:   \DeclareUnicodeCharacter{00A1}{\exclamdown}
10010:   \DeclareUnicodeCharacter{00A2}{{\tcfont \char162}}% 0242=cent
10011:   \DeclareUnicodeCharacter{00A3}{\pounds}
10012:   \DeclareUnicodeCharacter{00A4}{{\tcfont \char164}}% 0244=currency
10013:   \DeclareUnicodeCharacter{00A5}{{\tcfont \char165}}% 0245=yen
10014:   \DeclareUnicodeCharacter{00A6}{{\tcfont \char166}}% 0246=brokenbar
10015:   \DeclareUnicodeCharacter{00A7}{\S}
10016:   \DeclareUnicodeCharacter{00A8}{\"{ }}
10017:   \DeclareUnicodeCharacter{00A9}{\copyright}
10018:   \DeclareUnicodeCharacter{00AA}{\ordf}
10019:   \DeclareUnicodeCharacter{00AB}{\guillemetleft}
10020:   \DeclareUnicodeCharacter{00AC}{\ensuremath\lnot}
10021:   \DeclareUnicodeCharacter{00AD}{\-}
10022:   \DeclareUnicodeCharacter{00AE}{\registeredsymbol}
10023:   \DeclareUnicodeCharacter{00AF}{\={ }}
10024:   %
10025:   \DeclareUnicodeCharacter{00B0}{\ringaccent{ }}
10026:   \DeclareUnicodeCharacter{00B1}{\ensuremath\pm}
10027:   \DeclareUnicodeCharacter{00B2}{$^2$}
10028:   \DeclareUnicodeCharacter{00B3}{$^3$}
10029:   \DeclareUnicodeCharacter{00B4}{\'{ }}
10030:   \DeclareUnicodeCharacter{00B5}{$\mu$}
10031:   \DeclareUnicodeCharacter{00B6}{\P}
10032:   \DeclareUnicodeCharacter{00B7}{\ensuremath\cdot}
10033:   \DeclareUnicodeCharacter{00B8}{\cedilla{ }}
10034:   \DeclareUnicodeCharacter{00B9}{$^1$}
10035:   \DeclareUnicodeCharacter{00BA}{\ordm}
10036:   \DeclareUnicodeCharacter{00BB}{\guillemetright}
10037:   \DeclareUnicodeCharacter{00BC}{$1\over4$}
10038:   \DeclareUnicodeCharacter{00BD}{$1\over2$}
10039:   \DeclareUnicodeCharacter{00BE}{$3\over4$}
10040:   \DeclareUnicodeCharacter{00BF}{\questiondown}
10041:   %
10042:   \DeclareUnicodeCharacter{00C0}{\`A}
10043:   \DeclareUnicodeCharacter{00C1}{\'A}
10044:   \DeclareUnicodeCharacter{00C2}{\^A}
10045:   \DeclareUnicodeCharacter{00C3}{\~A}
10046:   \DeclareUnicodeCharacter{00C4}{\"A}
10047:   \DeclareUnicodeCharacter{00C5}{\AA}
10048:   \DeclareUnicodeCharacter{00C6}{\AE}
10049:   \DeclareUnicodeCharacter{00C7}{\cedilla{C}}
10050:   \DeclareUnicodeCharacter{00C8}{\`E}
10051:   \DeclareUnicodeCharacter{00C9}{\'E}
10052:   \DeclareUnicodeCharacter{00CA}{\^E}
10053:   \DeclareUnicodeCharacter{00CB}{\"E}
10054:   \DeclareUnicodeCharacter{00CC}{\`I}
10055:   \DeclareUnicodeCharacter{00CD}{\'I}
10056:   \DeclareUnicodeCharacter{00CE}{\^I}
10057:   \DeclareUnicodeCharacter{00CF}{\"I}
10058:   %
10059:   \DeclareUnicodeCharacter{00D0}{\DH}
10060:   \DeclareUnicodeCharacter{00D1}{\~N}
10061:   \DeclareUnicodeCharacter{00D2}{\`O}
10062:   \DeclareUnicodeCharacter{00D3}{\'O}
10063:   \DeclareUnicodeCharacter{00D4}{\^O}
10064:   \DeclareUnicodeCharacter{00D5}{\~O}
10065:   \DeclareUnicodeCharacter{00D6}{\"O}
10066:   \DeclareUnicodeCharacter{00D7}{\ensuremath\times}
10067:   \DeclareUnicodeCharacter{00D8}{\O}
10068:   \DeclareUnicodeCharacter{00D9}{\`U}
10069:   \DeclareUnicodeCharacter{00DA}{\'U}
10070:   \DeclareUnicodeCharacter{00DB}{\^U}
10071:   \DeclareUnicodeCharacter{00DC}{\"U}
10072:   \DeclareUnicodeCharacter{00DD}{\'Y}
10073:   \DeclareUnicodeCharacter{00DE}{\TH}
10074:   \DeclareUnicodeCharacter{00DF}{\ss}
10075:   %
10076:   \DeclareUnicodeCharacter{00E0}{\`a}
10077:   \DeclareUnicodeCharacter{00E1}{\'a}
10078:   \DeclareUnicodeCharacter{00E2}{\^a}
10079:   \DeclareUnicodeCharacter{00E3}{\~a}
10080:   \DeclareUnicodeCharacter{00E4}{\"a}
10081:   \DeclareUnicodeCharacter{00E5}{\aa}
10082:   \DeclareUnicodeCharacter{00E6}{\ae}
10083:   \DeclareUnicodeCharacter{00E7}{\cedilla{c}}
10084:   \DeclareUnicodeCharacter{00E8}{\`e}
10085:   \DeclareUnicodeCharacter{00E9}{\'e}
10086:   \DeclareUnicodeCharacter{00EA}{\^e}
10087:   \DeclareUnicodeCharacter{00EB}{\"e}
10088:   \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}}
10089:   \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}}
10090:   \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}}
10091:   \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}}
10092:   %
10093:   \DeclareUnicodeCharacter{00F0}{\dh}
10094:   \DeclareUnicodeCharacter{00F1}{\~n}
10095:   \DeclareUnicodeCharacter{00F2}{\`o}
10096:   \DeclareUnicodeCharacter{00F3}{\'o}
10097:   \DeclareUnicodeCharacter{00F4}{\^o}
10098:   \DeclareUnicodeCharacter{00F5}{\~o}
10099:   \DeclareUnicodeCharacter{00F6}{\"o}
10100:   \DeclareUnicodeCharacter{00F7}{\ensuremath\div}
10101:   \DeclareUnicodeCharacter{00F8}{\o}
10102:   \DeclareUnicodeCharacter{00F9}{\`u}
10103:   \DeclareUnicodeCharacter{00FA}{\'u}
10104:   \DeclareUnicodeCharacter{00FB}{\^u}
10105:   \DeclareUnicodeCharacter{00FC}{\"u}
10106:   \DeclareUnicodeCharacter{00FD}{\'y}
10107:   \DeclareUnicodeCharacter{00FE}{\th}
10108:   \DeclareUnicodeCharacter{00FF}{\"y}
10109:   %
10110:   \DeclareUnicodeCharacter{0100}{\=A}
10111:   \DeclareUnicodeCharacter{0101}{\=a}
10112:   \DeclareUnicodeCharacter{0102}{\u{A}}
10113:   \DeclareUnicodeCharacter{0103}{\u{a}}
10114:   \DeclareUnicodeCharacter{0104}{\ogonek{A}}
10115:   \DeclareUnicodeCharacter{0105}{\ogonek{a}}
10116:   \DeclareUnicodeCharacter{0106}{\'C}
10117:   \DeclareUnicodeCharacter{0107}{\'c}
10118:   \DeclareUnicodeCharacter{0108}{\^C}
10119:   \DeclareUnicodeCharacter{0109}{\^c}
10120:   \DeclareUnicodeCharacter{010A}{\dotaccent{C}}
10121:   \DeclareUnicodeCharacter{010B}{\dotaccent{c}}
10122:   \DeclareUnicodeCharacter{010C}{\v{C}}
10123:   \DeclareUnicodeCharacter{010D}{\v{c}}
10124:   \DeclareUnicodeCharacter{010E}{\v{D}}
10125:   \DeclareUnicodeCharacter{010F}{d'}
10126:   %
10127:   \DeclareUnicodeCharacter{0110}{\DH}
10128:   \DeclareUnicodeCharacter{0111}{\dh}
10129:   \DeclareUnicodeCharacter{0112}{\=E}
10130:   \DeclareUnicodeCharacter{0113}{\=e}
10131:   \DeclareUnicodeCharacter{0114}{\u{E}}
10132:   \DeclareUnicodeCharacter{0115}{\u{e}}
10133:   \DeclareUnicodeCharacter{0116}{\dotaccent{E}}
10134:   \DeclareUnicodeCharacter{0117}{\dotaccent{e}}
10135:   \DeclareUnicodeCharacter{0118}{\ogonek{E}}
10136:   \DeclareUnicodeCharacter{0119}{\ogonek{e}}
10137:   \DeclareUnicodeCharacter{011A}{\v{E}}
10138:   \DeclareUnicodeCharacter{011B}{\v{e}}
10139:   \DeclareUnicodeCharacter{011C}{\^G}
10140:   \DeclareUnicodeCharacter{011D}{\^g}
10141:   \DeclareUnicodeCharacter{011E}{\u{G}}
10142:   \DeclareUnicodeCharacter{011F}{\u{g}}
10143:   %
10144:   \DeclareUnicodeCharacter{0120}{\dotaccent{G}}
10145:   \DeclareUnicodeCharacter{0121}{\dotaccent{g}}
10146:   \DeclareUnicodeCharacter{0122}{\cedilla{G}}
10147:   \DeclareUnicodeCharacter{0123}{\cedilla{g}}
10148:   \DeclareUnicodeCharacter{0124}{\^H}
10149:   \DeclareUnicodeCharacter{0125}{\^h}
10150:   \DeclareUnicodeCharacter{0126}{\missingcharmsg{H WITH STROKE}}
10151:   \DeclareUnicodeCharacter{0127}{\missingcharmsg{h WITH STROKE}}
10152:   \DeclareUnicodeCharacter{0128}{\~I}
10153:   \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}}
10154:   \DeclareUnicodeCharacter{012A}{\=I}
10155:   \DeclareUnicodeCharacter{012B}{\={\dotless{i}}}
10156:   \DeclareUnicodeCharacter{012C}{\u{I}}
10157:   \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}}
10158:   \DeclareUnicodeCharacter{012E}{\ogonek{I}}
10159:   \DeclareUnicodeCharacter{012F}{\ogonek{i}}
10160:   %
10161:   \DeclareUnicodeCharacter{0130}{\dotaccent{I}}
10162:   \DeclareUnicodeCharacter{0131}{\dotless{i}}
10163:   \DeclareUnicodeCharacter{0132}{IJ}
10164:   \DeclareUnicodeCharacter{0133}{ij}
10165:   \DeclareUnicodeCharacter{0134}{\^J}
10166:   \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}}
10167:   \DeclareUnicodeCharacter{0136}{\cedilla{K}}
10168:   \DeclareUnicodeCharacter{0137}{\cedilla{k}}
10169:   \DeclareUnicodeCharacter{0138}{\ensuremath\kappa}  
10170:   \DeclareUnicodeCharacter{0139}{\'L}
10171:   \DeclareUnicodeCharacter{013A}{\'l}
10172:   \DeclareUnicodeCharacter{013B}{\cedilla{L}}
10173:   \DeclareUnicodeCharacter{013C}{\cedilla{l}}
10174:   \DeclareUnicodeCharacter{013D}{L'}% should kern
10175:   \DeclareUnicodeCharacter{013E}{l'}% should kern
10176:   \DeclareUnicodeCharacter{013F}{L\U{00B7}}
10177:   %
10178:   \DeclareUnicodeCharacter{0140}{l\U{00B7}}
10179:   \DeclareUnicodeCharacter{0141}{\L}
10180:   \DeclareUnicodeCharacter{0142}{\l}
10181:   \DeclareUnicodeCharacter{0143}{\'N}
10182:   \DeclareUnicodeCharacter{0144}{\'n}
10183:   \DeclareUnicodeCharacter{0145}{\cedilla{N}}
10184:   \DeclareUnicodeCharacter{0146}{\cedilla{n}}
10185:   \DeclareUnicodeCharacter{0147}{\v{N}}
10186:   \DeclareUnicodeCharacter{0148}{\v{n}}
10187:   \DeclareUnicodeCharacter{0149}{'n}
10188:   \DeclareUnicodeCharacter{014A}{\missingcharmsg{ENG}}
10189:   \DeclareUnicodeCharacter{014B}{\missingcharmsg{eng}}
10190:   \DeclareUnicodeCharacter{014C}{\=O}
10191:   \DeclareUnicodeCharacter{014D}{\=o}
10192:   \DeclareUnicodeCharacter{014E}{\u{O}}
10193:   \DeclareUnicodeCharacter{014F}{\u{o}}
10194:   %
10195:   \DeclareUnicodeCharacter{0150}{\H{O}}
10196:   \DeclareUnicodeCharacter{0151}{\H{o}}
10197:   \DeclareUnicodeCharacter{0152}{\OE}
10198:   \DeclareUnicodeCharacter{0153}{\oe}
10199:   \DeclareUnicodeCharacter{0154}{\'R}
10200:   \DeclareUnicodeCharacter{0155}{\'r}
10201:   \DeclareUnicodeCharacter{0156}{\cedilla{R}}
10202:   \DeclareUnicodeCharacter{0157}{\cedilla{r}}
10203:   \DeclareUnicodeCharacter{0158}{\v{R}}
10204:   \DeclareUnicodeCharacter{0159}{\v{r}}
10205:   \DeclareUnicodeCharacter{015A}{\'S}
10206:   \DeclareUnicodeCharacter{015B}{\'s}
10207:   \DeclareUnicodeCharacter{015C}{\^S}
10208:   \DeclareUnicodeCharacter{015D}{\^s}
10209:   \DeclareUnicodeCharacter{015E}{\cedilla{S}}
10210:   \DeclareUnicodeCharacter{015F}{\cedilla{s}}
10211:   %
10212:   \DeclareUnicodeCharacter{0160}{\v{S}}
10213:   \DeclareUnicodeCharacter{0161}{\v{s}}
10214:   \DeclareUnicodeCharacter{0162}{\cedilla{T}}
10215:   \DeclareUnicodeCharacter{0163}{\cedilla{t}}
10216:   \DeclareUnicodeCharacter{0164}{\v{T}}
10217:   \DeclareUnicodeCharacter{0165}{\v{t}}
10218:   \DeclareUnicodeCharacter{0166}{\missingcharmsg{H WITH STROKE}}
10219:   \DeclareUnicodeCharacter{0167}{\missingcharmsg{h WITH STROKE}}
10220:   \DeclareUnicodeCharacter{0168}{\~U}
10221:   \DeclareUnicodeCharacter{0169}{\~u}
10222:   \DeclareUnicodeCharacter{016A}{\=U}
10223:   \DeclareUnicodeCharacter{016B}{\=u}
10224:   \DeclareUnicodeCharacter{016C}{\u{U}}
10225:   \DeclareUnicodeCharacter{016D}{\u{u}}
10226:   \DeclareUnicodeCharacter{016E}{\ringaccent{U}}
10227:   \DeclareUnicodeCharacter{016F}{\ringaccent{u}}
10228:   %
10229:   \DeclareUnicodeCharacter{0170}{\H{U}}
10230:   \DeclareUnicodeCharacter{0171}{\H{u}}
10231:   \DeclareUnicodeCharacter{0172}{\ogonek{U}}
10232:   \DeclareUnicodeCharacter{0173}{\ogonek{u}}
10233:   \DeclareUnicodeCharacter{0174}{\^W}
10234:   \DeclareUnicodeCharacter{0175}{\^w}
10235:   \DeclareUnicodeCharacter{0176}{\^Y}
10236:   \DeclareUnicodeCharacter{0177}{\^y}
10237:   \DeclareUnicodeCharacter{0178}{\"Y}
10238:   \DeclareUnicodeCharacter{0179}{\'Z}
10239:   \DeclareUnicodeCharacter{017A}{\'z}
10240:   \DeclareUnicodeCharacter{017B}{\dotaccent{Z}}
10241:   \DeclareUnicodeCharacter{017C}{\dotaccent{z}}
10242:   \DeclareUnicodeCharacter{017D}{\v{Z}}
10243:   \DeclareUnicodeCharacter{017E}{\v{z}}
10244:   \DeclareUnicodeCharacter{017F}{\missingcharmsg{LONG S}}
10245:   %
10246:   \DeclareUnicodeCharacter{01C4}{D\v{Z}}
10247:   \DeclareUnicodeCharacter{01C5}{D\v{z}}
10248:   \DeclareUnicodeCharacter{01C6}{d\v{z}}
10249:   \DeclareUnicodeCharacter{01C7}{LJ}
10250:   \DeclareUnicodeCharacter{01C8}{Lj}
10251:   \DeclareUnicodeCharacter{01C9}{lj}
10252:   \DeclareUnicodeCharacter{01CA}{NJ}
10253:   \DeclareUnicodeCharacter{01CB}{Nj}
10254:   \DeclareUnicodeCharacter{01CC}{nj}
10255:   \DeclareUnicodeCharacter{01CD}{\v{A}}
10256:   \DeclareUnicodeCharacter{01CE}{\v{a}}
10257:   \DeclareUnicodeCharacter{01CF}{\v{I}}
10258:   %
10259:   \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}}
10260:   \DeclareUnicodeCharacter{01D1}{\v{O}}
10261:   \DeclareUnicodeCharacter{01D2}{\v{o}}
10262:   \DeclareUnicodeCharacter{01D3}{\v{U}}
10263:   \DeclareUnicodeCharacter{01D4}{\v{u}}
10264:   %
10265:   \DeclareUnicodeCharacter{01E2}{\={\AE}}
10266:   \DeclareUnicodeCharacter{01E3}{\={\ae}}
10267:   \DeclareUnicodeCharacter{01E6}{\v{G}}
10268:   \DeclareUnicodeCharacter{01E7}{\v{g}}
10269:   \DeclareUnicodeCharacter{01E8}{\v{K}}
10270:   \DeclareUnicodeCharacter{01E9}{\v{k}}
10271:   %
10272:   \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}}
10273:   \DeclareUnicodeCharacter{01F1}{DZ}
10274:   \DeclareUnicodeCharacter{01F2}{Dz}
10275:   \DeclareUnicodeCharacter{01F3}{dz}
10276:   \DeclareUnicodeCharacter{01F4}{\'G}
10277:   \DeclareUnicodeCharacter{01F5}{\'g}
10278:   \DeclareUnicodeCharacter{01F8}{\`N}
10279:   \DeclareUnicodeCharacter{01F9}{\`n}
10280:   \DeclareUnicodeCharacter{01FC}{\'{\AE}}
10281:   \DeclareUnicodeCharacter{01FD}{\'{\ae}}
10282:   \DeclareUnicodeCharacter{01FE}{\'{\O}}
10283:   \DeclareUnicodeCharacter{01FF}{\'{\o}}
10284:   %
10285:   \DeclareUnicodeCharacter{021E}{\v{H}}
10286:   \DeclareUnicodeCharacter{021F}{\v{h}}
10287:   %
10288:   \DeclareUnicodeCharacter{0226}{\dotaccent{A}}
10289:   \DeclareUnicodeCharacter{0227}{\dotaccent{a}}
10290:   \DeclareUnicodeCharacter{0228}{\cedilla{E}}
10291:   \DeclareUnicodeCharacter{0229}{\cedilla{e}}
10292:   \DeclareUnicodeCharacter{022E}{\dotaccent{O}}
10293:   \DeclareUnicodeCharacter{022F}{\dotaccent{o}}
10294:   %
10295:   \DeclareUnicodeCharacter{0232}{\=Y}
10296:   \DeclareUnicodeCharacter{0233}{\=y}
10297:   \DeclareUnicodeCharacter{0237}{\dotless{j}}
10298:   %
10299:   \DeclareUnicodeCharacter{02DB}{\ogonek{ }}
10300:   %
10301:   % Greek letters upper case
10302:   \DeclareUnicodeCharacter{0391}{{\it A}}
10303:   \DeclareUnicodeCharacter{0392}{{\it B}}
10304:   \DeclareUnicodeCharacter{0393}{\ensuremath{\mit\Gamma}}
10305:   \DeclareUnicodeCharacter{0394}{\ensuremath{\mit\Delta}}
10306:   \DeclareUnicodeCharacter{0395}{{\it E}}
10307:   \DeclareUnicodeCharacter{0396}{{\it Z}}
10308:   \DeclareUnicodeCharacter{0397}{{\it H}}
10309:   \DeclareUnicodeCharacter{0398}{\ensuremath{\mit\Theta}}
10310:   \DeclareUnicodeCharacter{0399}{{\it I}}
10311:   \DeclareUnicodeCharacter{039A}{{\it K}}
10312:   \DeclareUnicodeCharacter{039B}{\ensuremath{\mit\Lambda}}
10313:   \DeclareUnicodeCharacter{039C}{{\it M}}
10314:   \DeclareUnicodeCharacter{039D}{{\it N}}
10315:   \DeclareUnicodeCharacter{039E}{\ensuremath{\mit\Xi}}
10316:   \DeclareUnicodeCharacter{039F}{{\it O}}
10317:   \DeclareUnicodeCharacter{03A0}{\ensuremath{\mit\Pi}}
10318:   \DeclareUnicodeCharacter{03A1}{{\it P}}
10319:   %\DeclareUnicodeCharacter{03A2}{} % none - corresponds to final sigma
10320:   \DeclareUnicodeCharacter{03A3}{\ensuremath{\mit\Sigma}}
10321:   \DeclareUnicodeCharacter{03A4}{{\it T}}
10322:   \DeclareUnicodeCharacter{03A5}{\ensuremath{\mit\Upsilon}}
10323:   \DeclareUnicodeCharacter{03A6}{\ensuremath{\mit\Phi}}
10324:   \DeclareUnicodeCharacter{03A7}{{\it X}}
10325:   \DeclareUnicodeCharacter{03A8}{\ensuremath{\mit\Psi}}
10326:   \DeclareUnicodeCharacter{03A9}{\ensuremath{\mit\Omega}}
10327:   %
10328:   % Vowels with accents
10329:   \DeclareUnicodeCharacter{0390}{\ensuremath{\ddot{\acute\iota}}}
10330:   \DeclareUnicodeCharacter{03AC}{\ensuremath{\acute\alpha}}
10331:   \DeclareUnicodeCharacter{03AD}{\ensuremath{\acute\epsilon}}
10332:   \DeclareUnicodeCharacter{03AE}{\ensuremath{\acute\eta}}
10333:   \DeclareUnicodeCharacter{03AF}{\ensuremath{\acute\iota}}
10334:   \DeclareUnicodeCharacter{03B0}{\ensuremath{\acute{\ddot\upsilon}}}
10335:   %
10336:   % Standalone accent
10337:   \DeclareUnicodeCharacter{0384}{\ensuremath{\acute{\ }}}
10338:   %
10339:   % Greek letters lower case
10340:   \DeclareUnicodeCharacter{03B1}{\ensuremath\alpha}
10341:   \DeclareUnicodeCharacter{03B2}{\ensuremath\beta}
10342:   \DeclareUnicodeCharacter{03B3}{\ensuremath\gamma}
10343:   \DeclareUnicodeCharacter{03B4}{\ensuremath\delta}
10344:   \DeclareUnicodeCharacter{03B5}{\ensuremath\epsilon}
10345:   \DeclareUnicodeCharacter{03B6}{\ensuremath\zeta}
10346:   \DeclareUnicodeCharacter{03B7}{\ensuremath\eta}
10347:   \DeclareUnicodeCharacter{03B8}{\ensuremath\theta}
10348:   \DeclareUnicodeCharacter{03B9}{\ensuremath\iota}
10349:   \DeclareUnicodeCharacter{03BA}{\ensuremath\kappa}
10350:   \DeclareUnicodeCharacter{03BB}{\ensuremath\lambda}
10351:   \DeclareUnicodeCharacter{03BC}{\ensuremath\mu}
10352:   \DeclareUnicodeCharacter{03BD}{\ensuremath\nu}
10353:   \DeclareUnicodeCharacter{03BE}{\ensuremath\xi}
10354:   \DeclareUnicodeCharacter{03BF}{{\it o}} % omicron
10355:   \DeclareUnicodeCharacter{03C0}{\ensuremath\pi}
10356:   \DeclareUnicodeCharacter{03C1}{\ensuremath\rho}
10357:   \DeclareUnicodeCharacter{03C2}{\ensuremath\varsigma}
10358:   \DeclareUnicodeCharacter{03C3}{\ensuremath\sigma}
10359:   \DeclareUnicodeCharacter{03C4}{\ensuremath\tau}
10360:   \DeclareUnicodeCharacter{03C5}{\ensuremath\upsilon}
10361:   \DeclareUnicodeCharacter{03C6}{\ensuremath\phi}
10362:   \DeclareUnicodeCharacter{03C7}{\ensuremath\chi}
10363:   \DeclareUnicodeCharacter{03C8}{\ensuremath\psi}
10364:   \DeclareUnicodeCharacter{03C9}{\ensuremath\omega}
10365:   %
10366:   % More Greek vowels with accents
10367:   \DeclareUnicodeCharacter{03CA}{\ensuremath{\ddot\iota}}
10368:   \DeclareUnicodeCharacter{03CB}{\ensuremath{\ddot\upsilon}}
10369:   \DeclareUnicodeCharacter{03CC}{\ensuremath{\acute o}}
10370:   \DeclareUnicodeCharacter{03CD}{\ensuremath{\acute\upsilon}}
10371:   \DeclareUnicodeCharacter{03CE}{\ensuremath{\acute\omega}}
10372:   %
10373:   % Variant Greek letters
10374:   \DeclareUnicodeCharacter{03D1}{\ensuremath\vartheta}
10375:   \DeclareUnicodeCharacter{03D6}{\ensuremath\varpi}
10376:   \DeclareUnicodeCharacter{03F1}{\ensuremath\varrho}
10377:   %
10378:   \DeclareUnicodeCharacter{1E02}{\dotaccent{B}}
10379:   \DeclareUnicodeCharacter{1E03}{\dotaccent{b}}
10380:   \DeclareUnicodeCharacter{1E04}{\udotaccent{B}}
10381:   \DeclareUnicodeCharacter{1E05}{\udotaccent{b}}
10382:   \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}}
10383:   \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}}
10384:   \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}}
10385:   \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}}
10386:   \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}}
10387:   \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}}
10388:   \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}}
10389:   \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}}
10390:   %
10391:   \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}}
10392:   \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}}
10393:   %
10394:   \DeclareUnicodeCharacter{1E20}{\=G}
10395:   \DeclareUnicodeCharacter{1E21}{\=g}
10396:   \DeclareUnicodeCharacter{1E22}{\dotaccent{H}}
10397:   \DeclareUnicodeCharacter{1E23}{\dotaccent{h}}
10398:   \DeclareUnicodeCharacter{1E24}{\udotaccent{H}}
10399:   \DeclareUnicodeCharacter{1E25}{\udotaccent{h}}
10400:   \DeclareUnicodeCharacter{1E26}{\"H}
10401:   \DeclareUnicodeCharacter{1E27}{\"h}
10402:   %
10403:   \DeclareUnicodeCharacter{1E30}{\'K}
10404:   \DeclareUnicodeCharacter{1E31}{\'k}
10405:   \DeclareUnicodeCharacter{1E32}{\udotaccent{K}}
10406:   \DeclareUnicodeCharacter{1E33}{\udotaccent{k}}
10407:   \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}}
10408:   \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}}
10409:   \DeclareUnicodeCharacter{1E36}{\udotaccent{L}}
10410:   \DeclareUnicodeCharacter{1E37}{\udotaccent{l}}
10411:   \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}}
10412:   \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}}
10413:   \DeclareUnicodeCharacter{1E3E}{\'M}
10414:   \DeclareUnicodeCharacter{1E3F}{\'m}
10415:   %
10416:   \DeclareUnicodeCharacter{1E40}{\dotaccent{M}}
10417:   \DeclareUnicodeCharacter{1E41}{\dotaccent{m}}
10418:   \DeclareUnicodeCharacter{1E42}{\udotaccent{M}}
10419:   \DeclareUnicodeCharacter{1E43}{\udotaccent{m}}
10420:   \DeclareUnicodeCharacter{1E44}{\dotaccent{N}}
10421:   \DeclareUnicodeCharacter{1E45}{\dotaccent{n}}
10422:   \DeclareUnicodeCharacter{1E46}{\udotaccent{N}}
10423:   \DeclareUnicodeCharacter{1E47}{\udotaccent{n}}
10424:   \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}}
10425:   \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}}
10426:   %
10427:   \DeclareUnicodeCharacter{1E54}{\'P}
10428:   \DeclareUnicodeCharacter{1E55}{\'p}
10429:   \DeclareUnicodeCharacter{1E56}{\dotaccent{P}}
10430:   \DeclareUnicodeCharacter{1E57}{\dotaccent{p}}
10431:   \DeclareUnicodeCharacter{1E58}{\dotaccent{R}}
10432:   \DeclareUnicodeCharacter{1E59}{\dotaccent{r}}
10433:   \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}}
10434:   \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}}
10435:   \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}}
10436:   \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}}
10437:   %
10438:   \DeclareUnicodeCharacter{1E60}{\dotaccent{S}}
10439:   \DeclareUnicodeCharacter{1E61}{\dotaccent{s}}
10440:   \DeclareUnicodeCharacter{1E62}{\udotaccent{S}}
10441:   \DeclareUnicodeCharacter{1E63}{\udotaccent{s}}
10442:   \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}}
10443:   \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}}
10444:   \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}}
10445:   \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}}
10446:   \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}}
10447:   \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}}
10448:   %
10449:   \DeclareUnicodeCharacter{1E7C}{\~V}
10450:   \DeclareUnicodeCharacter{1E7D}{\~v}
10451:   \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}}
10452:   \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}}
10453:   %
10454:   \DeclareUnicodeCharacter{1E80}{\`W}
10455:   \DeclareUnicodeCharacter{1E81}{\`w}
10456:   \DeclareUnicodeCharacter{1E82}{\'W}
10457:   \DeclareUnicodeCharacter{1E83}{\'w}
10458:   \DeclareUnicodeCharacter{1E84}{\"W}
10459:   \DeclareUnicodeCharacter{1E85}{\"w}
10460:   \DeclareUnicodeCharacter{1E86}{\dotaccent{W}}
10461:   \DeclareUnicodeCharacter{1E87}{\dotaccent{w}}
10462:   \DeclareUnicodeCharacter{1E88}{\udotaccent{W}}
10463:   \DeclareUnicodeCharacter{1E89}{\udotaccent{w}}
10464:   \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}}
10465:   \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}}
10466:   \DeclareUnicodeCharacter{1E8C}{\"X}
10467:   \DeclareUnicodeCharacter{1E8D}{\"x}
10468:   \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}}
10469:   \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}}
10470:   %
10471:   \DeclareUnicodeCharacter{1E90}{\^Z}
10472:   \DeclareUnicodeCharacter{1E91}{\^z}
10473:   \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}}
10474:   \DeclareUnicodeCharacter{1E93}{\udotaccent{z}}
10475:   \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}}
10476:   \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}}
10477:   \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}}
10478:   \DeclareUnicodeCharacter{1E97}{\"t}
10479:   \DeclareUnicodeCharacter{1E98}{\ringaccent{w}}
10480:   \DeclareUnicodeCharacter{1E99}{\ringaccent{y}}
10481:   %
10482:   \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}}
10483:   \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}}
10484:   %
10485:   \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}}
10486:   \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}}
10487:   \DeclareUnicodeCharacter{1EBC}{\~E}
10488:   \DeclareUnicodeCharacter{1EBD}{\~e}
10489:   %
10490:   \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}}
10491:   \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}}
10492:   \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}}
10493:   \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}}
10494:   %
10495:   \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}}
10496:   \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}}
10497:   %
10498:   \DeclareUnicodeCharacter{1EF2}{\`Y}
10499:   \DeclareUnicodeCharacter{1EF3}{\`y}
10500:   \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}}
10501:   %
10502:   \DeclareUnicodeCharacter{1EF8}{\~Y}
10503:   \DeclareUnicodeCharacter{1EF9}{\~y}
10504:   %
10505:   % Punctuation
10506:   \DeclareUnicodeCharacter{2013}{--}
10507:   \DeclareUnicodeCharacter{2014}{---}
10508:   \DeclareUnicodeCharacter{2018}{\quoteleft}
10509:   \DeclareUnicodeCharacter{2019}{\quoteright}
10510:   \DeclareUnicodeCharacter{201A}{\quotesinglbase}
10511:   \DeclareUnicodeCharacter{201C}{\quotedblleft}
10512:   \DeclareUnicodeCharacter{201D}{\quotedblright}
10513:   \DeclareUnicodeCharacter{201E}{\quotedblbase}
10514:   \DeclareUnicodeCharacter{2020}{\ensuremath\dagger}
10515:   \DeclareUnicodeCharacter{2021}{\ensuremath\ddagger}
10516:   \DeclareUnicodeCharacter{2022}{\bullet}
10517:   \DeclareUnicodeCharacter{202F}{\thinspace}
10518:   \DeclareUnicodeCharacter{2026}{\dots}
10519:   \DeclareUnicodeCharacter{2039}{\guilsinglleft}
10520:   \DeclareUnicodeCharacter{203A}{\guilsinglright}
10521:   %
10522:   \DeclareUnicodeCharacter{20AC}{\euro}
10523:   %
10524:   \DeclareUnicodeCharacter{2192}{\expansion}
10525:   \DeclareUnicodeCharacter{21D2}{\result}
10526:   %
10527:   % Mathematical symbols
10528:   \DeclareUnicodeCharacter{2200}{\ensuremath\forall}
10529:   \DeclareUnicodeCharacter{2203}{\ensuremath\exists}
10530:   \DeclareUnicodeCharacter{2208}{\ensuremath\in}
10531:   \DeclareUnicodeCharacter{2212}{\minus}
10532:   \DeclareUnicodeCharacter{2217}{\ast}
10533:   \DeclareUnicodeCharacter{221E}{\ensuremath\infty}
10534:   \DeclareUnicodeCharacter{2225}{\ensuremath\parallel}
10535:   \DeclareUnicodeCharacter{2227}{\ensuremath\wedge}
10536:   \DeclareUnicodeCharacter{2229}{\ensuremath\cap}
10537:   \DeclareUnicodeCharacter{2261}{\equiv}
10538:   \DeclareUnicodeCharacter{2264}{\ensuremath\leq}
10539:   \DeclareUnicodeCharacter{2265}{\ensuremath\geq}
10540:   \DeclareUnicodeCharacter{2282}{\ensuremath\subset}
10541:   \DeclareUnicodeCharacter{2287}{\ensuremath\supseteq}
10542:   %
10543:   \DeclareUnicodeCharacter{2016}{\ensuremath\Vert}
10544:   \DeclareUnicodeCharacter{2032}{\ensuremath\prime}
10545:   \DeclareUnicodeCharacter{210F}{\ensuremath\hbar}
10546:   \DeclareUnicodeCharacter{2111}{\ensuremath\Im}
10547:   \DeclareUnicodeCharacter{2113}{\ensuremath\ell}
10548:   \DeclareUnicodeCharacter{2118}{\ensuremath\wp}
10549:   \DeclareUnicodeCharacter{211C}{\ensuremath\Re}
10550:   \DeclareUnicodeCharacter{2127}{\ensuremath\mho}
10551:   \DeclareUnicodeCharacter{2135}{\ensuremath\aleph}
10552:   \DeclareUnicodeCharacter{2190}{\ensuremath\leftarrow}
10553:   \DeclareUnicodeCharacter{2191}{\ensuremath\uparrow}
10554:   \DeclareUnicodeCharacter{2193}{\ensuremath\downarrow}
10555:   \DeclareUnicodeCharacter{2194}{\ensuremath\leftrightarrow}
10556:   \DeclareUnicodeCharacter{2195}{\ensuremath\updownarrow}
10557:   \DeclareUnicodeCharacter{2196}{\ensuremath\nwarrow}
10558:   \DeclareUnicodeCharacter{2197}{\ensuremath\nearrow}
10559:   \DeclareUnicodeCharacter{2198}{\ensuremath\searrow}
10560:   \DeclareUnicodeCharacter{2199}{\ensuremath\swarrow}
10561:   \DeclareUnicodeCharacter{21A6}{\ensuremath\mapsto}
10562:   \DeclareUnicodeCharacter{21A9}{\ensuremath\hookleftarrow}
10563:   \DeclareUnicodeCharacter{21AA}{\ensuremath\hookrightarrow}
10564:   \DeclareUnicodeCharacter{21BC}{\ensuremath\leftharpoonup}
10565:   \DeclareUnicodeCharacter{21BD}{\ensuremath\leftharpoondown}
10566:   \DeclareUnicodeCharacter{21BE}{\ensuremath\upharpoonright}
10567:   \DeclareUnicodeCharacter{21C0}{\ensuremath\rightharpoonup}
10568:   \DeclareUnicodeCharacter{21C1}{\ensuremath\rightharpoondown}
10569:   \DeclareUnicodeCharacter{21CC}{\ensuremath\rightleftharpoons}
10570:   \DeclareUnicodeCharacter{21D0}{\ensuremath\Leftarrow}
10571:   \DeclareUnicodeCharacter{21D1}{\ensuremath\Uparrow}
10572:   \DeclareUnicodeCharacter{21D3}{\ensuremath\Downarrow}
10573:   \DeclareUnicodeCharacter{21D4}{\ensuremath\Leftrightarrow}
10574:   \DeclareUnicodeCharacter{21D5}{\ensuremath\Updownarrow}
10575:   \DeclareUnicodeCharacter{21DD}{\ensuremath\leadsto}
10576:   \DeclareUnicodeCharacter{2201}{\ensuremath\complement}
10577:   \DeclareUnicodeCharacter{2202}{\ensuremath\partial}
10578:   \DeclareUnicodeCharacter{2205}{\ensuremath\emptyset}
10579:   \DeclareUnicodeCharacter{2207}{\ensuremath\nabla}
10580:   \DeclareUnicodeCharacter{2209}{\ensuremath\notin}
10581:   \DeclareUnicodeCharacter{220B}{\ensuremath\owns}
10582:   \DeclareUnicodeCharacter{220F}{\ensuremath\prod}
10583:   \DeclareUnicodeCharacter{2210}{\ensuremath\coprod}
10584:   \DeclareUnicodeCharacter{2211}{\ensuremath\sum}
10585:   \DeclareUnicodeCharacter{2213}{\ensuremath\mp}
10586:   \DeclareUnicodeCharacter{2218}{\ensuremath\circ}
10587:   \DeclareUnicodeCharacter{221A}{\ensuremath\surd}
10588:   \DeclareUnicodeCharacter{221D}{\ensuremath\propto}
10589:   \DeclareUnicodeCharacter{2220}{\ensuremath\angle}
10590:   \DeclareUnicodeCharacter{2223}{\ensuremath\mid}
10591:   \DeclareUnicodeCharacter{2228}{\ensuremath\vee}
10592:   \DeclareUnicodeCharacter{222A}{\ensuremath\cup}
10593:   \DeclareUnicodeCharacter{222B}{\ensuremath\smallint}
10594:   \DeclareUnicodeCharacter{222E}{\ensuremath\oint}
10595:   \DeclareUnicodeCharacter{223C}{\ensuremath\sim}
10596:   \DeclareUnicodeCharacter{2240}{\ensuremath\wr}
10597:   \DeclareUnicodeCharacter{2243}{\ensuremath\simeq}
10598:   \DeclareUnicodeCharacter{2245}{\ensuremath\cong}
10599:   \DeclareUnicodeCharacter{2248}{\ensuremath\approx}
10600:   \DeclareUnicodeCharacter{224D}{\ensuremath\asymp}
10601:   \DeclareUnicodeCharacter{2250}{\ensuremath\doteq}
10602:   \DeclareUnicodeCharacter{2260}{\ensuremath\neq}
10603:   \DeclareUnicodeCharacter{226A}{\ensuremath\ll}
10604:   \DeclareUnicodeCharacter{226B}{\ensuremath\gg}
10605:   \DeclareUnicodeCharacter{227A}{\ensuremath\prec}
10606:   \DeclareUnicodeCharacter{227B}{\ensuremath\succ}
10607:   \DeclareUnicodeCharacter{2283}{\ensuremath\supset}
10608:   \DeclareUnicodeCharacter{2286}{\ensuremath\subseteq}
10609:   \DeclareUnicodeCharacter{228E}{\ensuremath\uplus}
10610:   \DeclareUnicodeCharacter{228F}{\ensuremath\sqsubset}
10611:   \DeclareUnicodeCharacter{2290}{\ensuremath\sqsupset}
10612:   \DeclareUnicodeCharacter{2291}{\ensuremath\sqsubseteq}
10613:   \DeclareUnicodeCharacter{2292}{\ensuremath\sqsupseteq}
10614:   \DeclareUnicodeCharacter{2293}{\ensuremath\sqcap}
10615:   \DeclareUnicodeCharacter{2294}{\ensuremath\sqcup}
10616:   \DeclareUnicodeCharacter{2295}{\ensuremath\oplus}
10617:   \DeclareUnicodeCharacter{2296}{\ensuremath\ominus}
10618:   \DeclareUnicodeCharacter{2297}{\ensuremath\otimes}
10619:   \DeclareUnicodeCharacter{2298}{\ensuremath\oslash}
10620:   \DeclareUnicodeCharacter{2299}{\ensuremath\odot}
10621:   \DeclareUnicodeCharacter{22A2}{\ensuremath\vdash}
10622:   \DeclareUnicodeCharacter{22A3}{\ensuremath\dashv}
10623:   \DeclareUnicodeCharacter{22A4}{\ensuremath\ptextop}
10624:   \DeclareUnicodeCharacter{22A5}{\ensuremath\bot}
10625:   \DeclareUnicodeCharacter{22A8}{\ensuremath\models}
10626:   \DeclareUnicodeCharacter{22B4}{\ensuremath\unlhd}
10627:   \DeclareUnicodeCharacter{22B5}{\ensuremath\unrhd}
10628:   \DeclareUnicodeCharacter{22C0}{\ensuremath\bigwedge}
10629:   \DeclareUnicodeCharacter{22C1}{\ensuremath\bigvee}
10630:   \DeclareUnicodeCharacter{22C2}{\ensuremath\bigcap}
10631:   \DeclareUnicodeCharacter{22C3}{\ensuremath\bigcup}
10632:   \DeclareUnicodeCharacter{22C4}{\ensuremath\diamond}
10633:   \DeclareUnicodeCharacter{22C5}{\ensuremath\cdot}
10634:   \DeclareUnicodeCharacter{22C6}{\ensuremath\star}
10635:   \DeclareUnicodeCharacter{22C8}{\ensuremath\bowtie}
10636:   \DeclareUnicodeCharacter{2308}{\ensuremath\lceil}
10637:   \DeclareUnicodeCharacter{2309}{\ensuremath\rceil}
10638:   \DeclareUnicodeCharacter{230A}{\ensuremath\lfloor}
10639:   \DeclareUnicodeCharacter{230B}{\ensuremath\rfloor}
10640:   \DeclareUnicodeCharacter{2322}{\ensuremath\frown}
10641:   \DeclareUnicodeCharacter{2323}{\ensuremath\smile}
10642:   %
10643:   \DeclareUnicodeCharacter{25A1}{\ensuremath\Box}
10644:   \DeclareUnicodeCharacter{25B3}{\ensuremath\triangle}
10645:   \DeclareUnicodeCharacter{25B7}{\ensuremath\triangleright}
10646:   \DeclareUnicodeCharacter{25BD}{\ensuremath\bigtriangledown}
10647:   \DeclareUnicodeCharacter{25C1}{\ensuremath\triangleleft}
10648:   \DeclareUnicodeCharacter{25C7}{\ensuremath\Diamond}
10649:   \DeclareUnicodeCharacter{2660}{\ensuremath\spadesuit}
10650:   \DeclareUnicodeCharacter{2661}{\ensuremath\heartsuit}
10651:   \DeclareUnicodeCharacter{2662}{\ensuremath\diamondsuit}
10652:   \DeclareUnicodeCharacter{2663}{\ensuremath\clubsuit}
10653:   \DeclareUnicodeCharacter{266D}{\ensuremath\flat}
10654:   \DeclareUnicodeCharacter{266E}{\ensuremath\natural}
10655:   \DeclareUnicodeCharacter{266F}{\ensuremath\sharp}
10656:   \DeclareUnicodeCharacter{26AA}{\ensuremath\bigcirc}
10657:   \DeclareUnicodeCharacter{27B9}{\ensuremath\rangle}
10658:   \DeclareUnicodeCharacter{27C2}{\ensuremath\perp}
10659:   \DeclareUnicodeCharacter{27E8}{\ensuremath\langle}
10660:   \DeclareUnicodeCharacter{27F5}{\ensuremath\longleftarrow}
10661:   \DeclareUnicodeCharacter{27F6}{\ensuremath\longrightarrow}
10662:   \DeclareUnicodeCharacter{27F7}{\ensuremath\longleftrightarrow}
10663:   \DeclareUnicodeCharacter{27FC}{\ensuremath\longmapsto}
10664:   \DeclareUnicodeCharacter{29F5}{\ensuremath\setminus}
10665:   \DeclareUnicodeCharacter{2A00}{\ensuremath\bigodot}
10666:   \DeclareUnicodeCharacter{2A01}{\ensuremath\bigoplus}
10667:   \DeclareUnicodeCharacter{2A02}{\ensuremath\bigotimes}
10668:   \DeclareUnicodeCharacter{2A04}{\ensuremath\biguplus}
10669:   \DeclareUnicodeCharacter{2A06}{\ensuremath\bigsqcup}
10670:   \DeclareUnicodeCharacter{2A1D}{\ensuremath\Join}
10671:   \DeclareUnicodeCharacter{2A3F}{\ensuremath\amalg}
10672:   \DeclareUnicodeCharacter{2AAF}{\ensuremath\preceq}
10673:   \DeclareUnicodeCharacter{2AB0}{\ensuremath\succeq}
10674:   %
10675:   \global\mathchardef\checkmark="1370 % actually the square root sign
10676:   \DeclareUnicodeCharacter{2713}{\ensuremath\checkmark}
10677: }% end of \utfeightchardefs
10678: 
10679: % US-ASCII character definitions.
10680: \def\asciichardefs{% nothing need be done
10681:    \relax
10682: }
10683: 
10684: % Latin1 (ISO-8859-1) character definitions.
10685: \def\nonasciistringdefs{%
10686:   \setnonasciicharscatcode\active
10687:   \def\defstringchar##1{\def##1{\string##1}}%
10688:   %
10689:   \defstringchar^^80\defstringchar^^81\defstringchar^^82\defstringchar^^83%
10690:   \defstringchar^^84\defstringchar^^85\defstringchar^^86\defstringchar^^87%
10691:   \defstringchar^^88\defstringchar^^89\defstringchar^^8a\defstringchar^^8b%
10692:   \defstringchar^^8c\defstringchar^^8d\defstringchar^^8e\defstringchar^^8f%
10693:   %
10694:   \defstringchar^^90\defstringchar^^91\defstringchar^^92\defstringchar^^93%
10695:   \defstringchar^^94\defstringchar^^95\defstringchar^^96\defstringchar^^97%
10696:   \defstringchar^^98\defstringchar^^99\defstringchar^^9a\defstringchar^^9b%
10697:   \defstringchar^^9c\defstringchar^^9d\defstringchar^^9e\defstringchar^^9f%
10698:   %
10699:   \defstringchar^^a0\defstringchar^^a1\defstringchar^^a2\defstringchar^^a3%
10700:   \defstringchar^^a4\defstringchar^^a5\defstringchar^^a6\defstringchar^^a7%
10701:   \defstringchar^^a8\defstringchar^^a9\defstringchar^^aa\defstringchar^^ab%
10702:   \defstringchar^^ac\defstringchar^^ad\defstringchar^^ae\defstringchar^^af%
10703:   %
10704:   \defstringchar^^b0\defstringchar^^b1\defstringchar^^b2\defstringchar^^b3%
10705:   \defstringchar^^b4\defstringchar^^b5\defstringchar^^b6\defstringchar^^b7%
10706:   \defstringchar^^b8\defstringchar^^b9\defstringchar^^ba\defstringchar^^bb%
10707:   \defstringchar^^bc\defstringchar^^bd\defstringchar^^be\defstringchar^^bf%
10708:   %
10709:   \defstringchar^^c0\defstringchar^^c1\defstringchar^^c2\defstringchar^^c3%
10710:   \defstringchar^^c4\defstringchar^^c5\defstringchar^^c6\defstringchar^^c7%
10711:   \defstringchar^^c8\defstringchar^^c9\defstringchar^^ca\defstringchar^^cb%
10712:   \defstringchar^^cc\defstringchar^^cd\defstringchar^^ce\defstringchar^^cf%
10713:   %
10714:   \defstringchar^^d0\defstringchar^^d1\defstringchar^^d2\defstringchar^^d3%
10715:   \defstringchar^^d4\defstringchar^^d5\defstringchar^^d6\defstringchar^^d7%
10716:   \defstringchar^^d8\defstringchar^^d9\defstringchar^^da\defstringchar^^db%
10717:   \defstringchar^^dc\defstringchar^^dd\defstringchar^^de\defstringchar^^df%
10718:   %
10719:   \defstringchar^^e0\defstringchar^^e1\defstringchar^^e2\defstringchar^^e3%
10720:   \defstringchar^^e4\defstringchar^^e5\defstringchar^^e6\defstringchar^^e7%
10721:   \defstringchar^^e8\defstringchar^^e9\defstringchar^^ea\defstringchar^^eb%
10722:   \defstringchar^^ec\defstringchar^^ed\defstringchar^^ee\defstringchar^^ef%
10723:   %
10724:   \defstringchar^^f0\defstringchar^^f1\defstringchar^^f2\defstringchar^^f3%
10725:   \defstringchar^^f4\defstringchar^^f5\defstringchar^^f6\defstringchar^^f7%
10726:   \defstringchar^^f8\defstringchar^^f9\defstringchar^^fa\defstringchar^^fb%
10727:   \defstringchar^^fc\defstringchar^^fd\defstringchar^^fe\defstringchar^^ff%
10728: }
10729: 
10730: 
10731: % define all the unicode characters we know about, for the sake of @U.
10732: \utfeightchardefs
10733: 
10734: 
10735: % Make non-ASCII characters printable again for compatibility with
10736: % existing Texinfo documents that may use them, even without declaring a
10737: % document encoding.
10738: %
10739: \setnonasciicharscatcode \other
10740: 
10741: 
10742: \message{formatting,}
10743: 
10744: \newdimen\defaultparindent \defaultparindent = 15pt
10745: 
10746: \chapheadingskip = 15pt plus 4pt minus 2pt
10747: \secheadingskip = 12pt plus 3pt minus 2pt
10748: \subsecheadingskip = 9pt plus 2pt minus 2pt
10749: 
10750: % Prevent underfull vbox error messages.
10751: \vbadness = 10000
10752: 
10753: % Don't be very finicky about underfull hboxes, either.
10754: \hbadness = 6666
10755: 
10756: % Following George Bush, get rid of widows and orphans.
10757: \widowpenalty=10000
10758: \clubpenalty=10000
10759: 
10760: % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
10761: % using an old version of TeX, don't do anything.  We want the amount of
10762: % stretch added to depend on the line length, hence the dependence on
10763: % \hsize.  We call this whenever the paper size is set.
10764: %
10765: \def\setemergencystretch{%
10766:   \ifx\emergencystretch\thisisundefined
10767:     % Allow us to assign to \emergencystretch anyway.
10768:     \def\emergencystretch{\dimen0}%
10769:   \else
10770:     \emergencystretch = .15\hsize
10771:   \fi
10772: }
10773: 
10774: % Parameters in order: 1) textheight; 2) textwidth;
10775: % 3) voffset; 4) hoffset; 5) binding offset; 6) topskip;
10776: % 7) physical page height; 8) physical page width.
10777: %
10778: % We also call \setleading{\textleading}, so the caller should define
10779: % \textleading.  The caller should also set \parskip.
10780: %
10781: \def\internalpagesizes#1#2#3#4#5#6#7#8{%
10782:   \voffset = #3\relax
10783:   \topskip = #6\relax
10784:   \splittopskip = \topskip
10785:   %
10786:   \vsize = #1\relax
10787:   \advance\vsize by \topskip
10788:   \outervsize = \vsize
10789:   \advance\outervsize by 2\topandbottommargin
10790:   \pageheight = \vsize
10791:   %
10792:   \hsize = #2\relax
10793:   \outerhsize = \hsize
10794:   \advance\outerhsize by 0.5in
10795:   \pagewidth = \hsize
10796:   %
10797:   \normaloffset = #4\relax
10798:   \bindingoffset = #5\relax
10799:   %
10800:   \ifpdf
10801:     \pdfpageheight #7\relax
10802:     \pdfpagewidth #8\relax
10803:     % if we don't reset these, they will remain at "1 true in" of
10804:     % whatever layout pdftex was dumped with.
10805:     \pdfhorigin = 1 true in
10806:     \pdfvorigin = 1 true in
10807:   \fi
10808:   %
10809:   \setleading{\textleading}
10810:   %
10811:   \parindent = \defaultparindent
10812:   \setemergencystretch
10813: }
10814: 
10815: % @letterpaper (the default).
10816: \def\letterpaper{{\globaldefs = 1
10817:   \parskip = 3pt plus 2pt minus 1pt
10818:   \textleading = 13.2pt
10819:   %
10820:   % If page is nothing but text, make it come out even.
10821:   \internalpagesizes{607.2pt}{6in}% that's 46 lines
10822:                     {\voffset}{.25in}%
10823:                     {\bindingoffset}{36pt}%
10824:                     {11in}{8.5in}%
10825: }}
10826: 
10827: % Use @smallbook to reset parameters for 7x9.25 trim size.
10828: \def\smallbook{{\globaldefs = 1
10829:   \parskip = 2pt plus 1pt
10830:   \textleading = 12pt
10831:   %
10832:   \internalpagesizes{7.5in}{5in}%
10833:                     {-.2in}{0in}%
10834:                     {\bindingoffset}{16pt}%
10835:                     {9.25in}{7in}%
10836:   %
10837:   \lispnarrowing = 0.3in
10838:   \tolerance = 700
10839:   \hfuzz = 1pt
10840:   \contentsrightmargin = 0pt
10841:   \defbodyindent = .5cm
10842: }}
10843: 
10844: % Use @smallerbook to reset parameters for 6x9 trim size.
10845: % (Just testing, parameters still in flux.)
10846: \def\smallerbook{{\globaldefs = 1
10847:   \parskip = 1.5pt plus 1pt
10848:   \textleading = 12pt
10849:   %
10850:   \internalpagesizes{7.4in}{4.8in}%
10851:                     {-.2in}{-.4in}%
10852:                     {0pt}{14pt}%
10853:                     {9in}{6in}%
10854:   %
10855:   \lispnarrowing = 0.25in
10856:   \tolerance = 700
10857:   \hfuzz = 1pt
10858:   \contentsrightmargin = 0pt
10859:   \defbodyindent = .4cm
10860: }}
10861: 
10862: % Use @afourpaper to print on European A4 paper.
10863: \def\afourpaper{{\globaldefs = 1
10864:   \parskip = 3pt plus 2pt minus 1pt
10865:   \textleading = 13.2pt
10866:   %
10867:   % Double-side printing via postscript on Laserjet 4050
10868:   % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm.
10869:   % To change the settings for a different printer or situation, adjust
10870:   % \normaloffset until the front-side and back-side texts align.  Then
10871:   % do the same for \bindingoffset.  You can set these for testing in
10872:   % your texinfo source file like this:
10873:   % @tex
10874:   % \global\normaloffset = -6mm
10875:   % \global\bindingoffset = 10mm
10876:   % @end tex
10877:   \internalpagesizes{673.2pt}{160mm}% that's 51 lines
10878:                     {\voffset}{\hoffset}%
10879:                     {\bindingoffset}{44pt}%
10880:                     {297mm}{210mm}%
10881:   %
10882:   \tolerance = 700
10883:   \hfuzz = 1pt
10884:   \contentsrightmargin = 0pt
10885:   \defbodyindent = 5mm
10886: }}
10887: 
10888: % Use @afivepaper to print on European A5 paper.
10889: % From romildo@urano.iceb.ufop.br, 2 July 2000.
10890: % He also recommends making @example and @lisp be small.
10891: \def\afivepaper{{\globaldefs = 1
10892:   \parskip = 2pt plus 1pt minus 0.1pt
10893:   \textleading = 12.5pt
10894:   %
10895:   \internalpagesizes{160mm}{120mm}%
10896:                     {\voffset}{\hoffset}%
10897:                     {\bindingoffset}{8pt}%
10898:                     {210mm}{148mm}%
10899:   %
10900:   \lispnarrowing = 0.2in
10901:   \tolerance = 800
10902:   \hfuzz = 1.2pt
10903:   \contentsrightmargin = 0pt
10904:   \defbodyindent = 2mm
10905:   \tableindent = 12mm
10906: }}
10907: 
10908: % A specific text layout, 24x15cm overall, intended for A4 paper.
10909: \def\afourlatex{{\globaldefs = 1
10910:   \afourpaper
10911:   \internalpagesizes{237mm}{150mm}%
10912:                     {\voffset}{4.6mm}%
10913:                     {\bindingoffset}{7mm}%
10914:                     {297mm}{210mm}%
10915:   %
10916:   % Must explicitly reset to 0 because we call \afourpaper.
10917:   \globaldefs = 0
10918: }}
10919: 
10920: % Use @afourwide to print on A4 paper in landscape format.
10921: \def\afourwide{{\globaldefs = 1
10922:   \afourpaper
10923:   \internalpagesizes{241mm}{165mm}%
10924:                     {\voffset}{-2.95mm}%
10925:                     {\bindingoffset}{7mm}%
10926:                     {297mm}{210mm}%
10927:   \globaldefs = 0
10928: }}
10929: 
10930: % @pagesizes TEXTHEIGHT[,TEXTWIDTH]
10931: % Perhaps we should allow setting the margins, \topskip, \parskip,
10932: % and/or leading, also. Or perhaps we should compute them somehow.
10933: %
10934: \parseargdef\pagesizes{\pagesizesyyy #1,,\finish}
10935: \def\pagesizesyyy#1,#2,#3\finish{{%
10936:   \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
10937:   \globaldefs = 1
10938:   %
10939:   \parskip = 3pt plus 2pt minus 1pt
10940:   \setleading{\textleading}%
10941:   %
10942:   \dimen0 = #1\relax
10943:   \advance\dimen0 by \voffset
10944:   %
10945:   \dimen2 = \hsize
10946:   \advance\dimen2 by \normaloffset
10947:   %
10948:   \internalpagesizes{#1}{\hsize}%
10949:                     {\voffset}{\normaloffset}%
10950:                     {\bindingoffset}{44pt}%
10951:                     {\dimen0}{\dimen2}%
10952: }}
10953: 
10954: % Set default to letter.
10955: %
10956: \letterpaper
10957: 
10958: 
10959: \message{and turning on texinfo input format.}
10960: 
10961: \def^^L{\par} % remove \outer, so ^L can appear in an @comment
10962: 
10963: % DEL is a comment character, in case @c does not suffice.
10964: \catcode`\^^? = 14
10965: 
10966: % Define macros to output various characters with catcode for normal text.
10967: \catcode`\"=\other \def\normaldoublequote{"}
10968: \catcode`\$=\other \def\normaldollar{$}%$ font-lock fix
10969: \catcode`\+=\other \def\normalplus{+}
10970: \catcode`\<=\other \def\normalless{<}
10971: \catcode`\>=\other \def\normalgreater{>}
10972: \catcode`\^=\other \def\normalcaret{^}
10973: \catcode`\_=\other \def\normalunderscore{_}
10974: \catcode`\|=\other \def\normalverticalbar{|}
10975: \catcode`\~=\other \def\normaltilde{~}
10976: 
10977: % This macro is used to make a character print one way in \tt
10978: % (where it can probably be output as-is), and another way in other fonts,
10979: % where something hairier probably needs to be done.
10980: %
10981: % #1 is what to print if we are indeed using \tt; #2 is what to print
10982: % otherwise.  Since all the Computer Modern typewriter fonts have zero
10983: % interword stretch (and shrink), and it is reasonable to expect all
10984: % typewriter fonts to have this, we can check that font parameter.
10985: %
10986: \def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
10987: 
10988: % Same as above, but check for italic font.  Actually this also catches
10989: % non-italic slanted fonts since it is impossible to distinguish them from
10990: % italic fonts.  But since this is only used by $ and it uses \sl anyway
10991: % this is not a problem.
10992: \def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
10993: 
10994: % Set catcodes for Texinfo file
10995: 
10996: % Active characters for printing the wanted glyph.
10997: % Most of these we simply print from the \tt font, but for some, we can
10998: % use math or other variants that look better in normal text.
10999: %
11000: \catcode`\"=\active
11001: \def\activedoublequote{{\tt\char34}}
11002: \let"=\activedoublequote
11003: \catcode`\~=\active \def\activetilde{{\tt\char126}} \let~ = \activetilde
11004: \chardef\hatchar=`\^
11005: \catcode`\^=\active \def\activehat{{\tt \hatchar}} \let^ = \activehat
11006: 
11007: \catcode`\_=\active
11008: \def_{\ifusingtt\normalunderscore\_}
11009: \def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }
11010: \let\realunder=_
11011: 
11012: \catcode`\|=\active \def|{{\tt\char124}}
11013: 
11014: \chardef \less=`\<
11015: \catcode`\<=\active \def\activeless{{\tt \less}}\let< = \activeless
11016: \chardef \gtr=`\>
11017: \catcode`\>=\active \def\activegtr{{\tt \gtr}}\let> = \activegtr
11018: \catcode`\+=\active \def+{{\tt \char 43}}
11019: \catcode`\$=\active \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
11020: \catcode`\-=\active \let-=\normaldash
11021: 
11022: 
11023: % used for headline/footline in the output routine, in case the page
11024: % breaks in the middle of an @tex block.
11025: \def\texinfochars{%
11026:   \let< = \activeless
11027:   \let> = \activegtr
11028:   \let~ = \activetilde 
11029:   \let^ = \activehat
11030:   \markupsetuplqdefault \markupsetuprqdefault 
11031:   \let\b = \strong
11032:   \let\i = \smartitalic
11033:   % in principle, all other definitions in \tex have to be undone too.
11034: }
11035: 
11036: % Used sometimes to turn off (effectively) the active characters even after
11037: % parsing them.
11038: \def\turnoffactive{%
11039:   \normalturnoffactive
11040:   \otherbackslash
11041: }
11042: 
11043: \catcode`\@=0
11044: 
11045: % \backslashcurfont outputs one backslash character in current font,
11046: % as in \char`\\.
11047: \global\chardef\backslashcurfont=`\\
11048: \global\let\rawbackslashxx=\backslashcurfont  % let existing .??s files work
11049: 
11050: % \realbackslash is an actual character `\' with catcode other, and
11051: % \doublebackslash is two of them (for the pdf outlines).
11052: {\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}}
11053: 
11054: % In Texinfo, backslash is an active character; it prints the backslash
11055: % in fixed width font.
11056: \catcode`\\=\active  % @ for escape char from now on.
11057: 
11058: % Print a typewriter backslash.  For math mode, we can't simply use
11059: % \backslashcurfont: the story here is that in math mode, the \char
11060: % of \backslashcurfont ends up printing the roman \ from the math symbol
11061: % font (because \char in math mode uses the \mathcode, and plain.tex
11062: % sets \mathcode`\\="026E).  Hence we use an explicit \mathchar,
11063: % which is the decimal equivalent of "715c (class 7, e.g., use \fam;
11064: % ignored family value; char position "5C).  We can't use " for the
11065: % usual hex value because it has already been made active.
11066: 
11067: @def@ttbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}}
11068: @let@backslashchar = @ttbackslash % @backslashchar{} is for user documents.
11069: 
11070: % \rawbackslash defines an active \ to do \backslashcurfont.
11071: % \otherbackslash defines an active \ to be a literal `\' character with
11072: % catcode other.  We switch back and forth between these.
11073: @gdef@rawbackslash{@let\=@backslashcurfont}
11074: @gdef@otherbackslash{@let\=@realbackslash}
11075: 
11076: % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
11077: % the literal character `\'.
11078: %
11079: {@catcode`- = @active
11080:  @gdef@normalturnoffactive{%
11081:    @nonasciistringdefs
11082:    @let-=@normaldash
11083:    @let"=@normaldoublequote
11084:    @let$=@normaldollar %$ font-lock fix
11085:    @let+=@normalplus
11086:    @let<=@normalless
11087:    @let>=@normalgreater
11088:    @let^=@normalcaret
11089:    @let_=@normalunderscore
11090:    @let|=@normalverticalbar
11091:    @let~=@normaltilde
11092:    @let\=@ttbackslash
11093:    @markupsetuplqdefault
11094:    @markupsetuprqdefault
11095:    @unsepspaces
11096:  }
11097: }
11098: 
11099: % If a .fmt file is being used, characters that might appear in a file
11100: % name cannot be active until we have parsed the command line.
11101: % So turn them off again, and have @fixbackslash turn them back on.
11102: @catcode`+=@other @catcode`@_=@other
11103: 
11104: % \enablebackslashhack - allow file to begin `\input texinfo'
11105: %
11106: % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
11107: % That is what \eatinput is for; after that, the `\' should revert to printing
11108: % a backslash.
11109: % If the file did not have a `\input texinfo', then it is turned off after
11110: % the first line; otherwise the first `\' in the file would cause an error.
11111: % This is used on the very last line of this file, texinfo.tex.
11112: % We also use @c to call @fixbackslash, in case ends of lines are hidden.
11113: {
11114: @catcode`@^=7
11115: @catcode`@^^M=13@gdef@enablebackslashhack{%
11116:   @global@let\ = @eatinput%
11117:   @catcode`@^^M=13%
11118:   @def@c{@fixbackslash@c}%
11119:   @def ^^M{@let^^M@secondlinenl}%
11120:   @gdef @secondlinenl{@let^^M@thirdlinenl}%
11121:   @gdef @thirdlinenl{@fixbackslash}%
11122: }}
11123: 
11124: {@catcode`@^=7 @catcode`@^^M=13%
11125: @gdef@eatinput input texinfo#1^^M{@fixbackslash}}
11126: 
11127: % Emergency active definition of newline, in case an active newline token
11128: % appears by mistake.
11129: {@catcode`@^=7 @catcode13=13%
11130: @gdef@enableemergencynewline{%
11131:   @gdef^^M{%
11132:     @par%
11133:     %<warning: active newline>@par%
11134: }}}
11135: 
11136: 
11137: @gdef@fixbackslash{%
11138:   @ifx\@eatinput @let\ = @ttbackslash @fi
11139:   @catcode13=5 % regular end of line
11140:   @enableemergencynewline
11141:   @let@c=@texinfoc
11142:   % Also turn back on active characters that might appear in the input
11143:   % file name, in case not using a pre-dumped format.
11144:   @catcode`+=@active
11145:   @catcode`@_=@active
11146:   %
11147:   % If texinfo.cnf is present on the system, read it.
11148:   % Useful for site-wide @afourpaper, etc.  This macro, @fixbackslash, gets
11149:   % called at the beginning of every Texinfo file.  Not opening texinfo.cnf
11150:   % directly in this file, texinfo.tex, makes it possible to make a format
11151:   % file for Texinfo.
11152:   %
11153:   @openin 1 texinfo.cnf
11154:   @ifeof 1 @else @input texinfo.cnf @fi
11155:   @closein 1
11156: }
11157: 
11158: 
11159: % Say @foo, not \foo, in error messages.
11160: @escapechar = `@@
11161: 
11162: % These (along with & and #) are made active for url-breaking, so need
11163: % active definitions as the normal characters.
11164: @def@normaldot{.}
11165: @def@normalquest{?}
11166: @def@normalslash{/}
11167: 
11168: % These look ok in all fonts, so just make them not special.
11169: % @hashchar{} gets its own user-level command, because of #line.
11170: @catcode`@& = @other @def@normalamp{&}
11171: @catcode`@# = @other @def@normalhash{#}
11172: @catcode`@% = @other @def@normalpercent{%}
11173: 
11174: @let @hashchar = @normalhash
11175: 
11176: @c Finally, make ` and ' active, so that txicodequoteundirected and
11177: @c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}.  If we
11178: @c don't make ` and ' active, @code will not get them as active chars.
11179: @c Do this last of all since we use ` in the previous @catcode assignments.
11180: @catcode`@'=@active
11181: @catcode`@`=@active
11182: @markupsetuplqdefault
11183: @markupsetuprqdefault
11184: 
11185: @c Local variables:
11186: @c eval: (add-hook 'write-file-hooks 'time-stamp)
11187: @c page-delimiter: "^\\\\message\\|emacs-page"
11188: @c time-stamp-start: "def\\\\texinfoversion{"
11189: @c time-stamp-format: "%:y-%02m-%02d.%02H"
11190: @c time-stamp-end: "}"
11191: @c End:
11192: 
11193: @c vim:sw=2:
11194: 
11195: @ignore
11196:    arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115
11197: @end ignore
11198: @enablebackslashhack

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