PageRenderTime 76ms CodeModel.GetById 32ms app.highlight 19ms RepoModel.GetById 1ms app.codeStats 2ms

/contrib/groff/doc/texinfo.tex

https://bitbucket.org/freebsd/freebsd-head/
TeX | 7086 lines | 4032 code | 590 blank | 2464 comment | 6 complexity | 134d44e7458e72b57c3cd4812ecd6b98 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

   1% texinfo.tex -- TeX macros to handle Texinfo files.
   2%
   3% Load plain if necessary, i.e., if running under initex.
   4\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
   5%
   6\def\texinfoversion{2004-11-25.16}
   7%
   8% Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
   9% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
  10% Foundation, Inc.
  11%
  12% This texinfo.tex file is free software; you can redistribute it and/or
  13% modify it under the terms of the GNU General Public License as
  14% published by the Free Software Foundation; either version 2, or (at
  15% your option) any later version.
  16%
  17% This texinfo.tex file is distributed in the hope that it will be
  18% useful, but WITHOUT ANY WARRANTY; without even the implied warranty
  19% of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  20% General Public License for more details.
  21%
  22% You should have received a copy of the GNU General Public License
  23% along with this texinfo.tex file; see the file COPYING.  If not, write
  24% to the Free Software Foundation, Inc., 51 Franklin St - Fifth Floor,
  25% Boston, MA 02110-1301, USA.
  26%
  27% As a special exception, when this file is read by TeX when processing
  28% a Texinfo source document, you may use the result without
  29% restriction.  (This has been our intent since Texinfo was invented.)
  30%
  31% Please try the latest version of texinfo.tex before submitting bug
  32% reports; you can get the latest version from:
  33%   http://www.gnu.org/software/texinfo/ (the Texinfo home page), or
  34%   ftp://tug.org/tex/texinfo.tex
  35%     (and all CTAN mirrors, see http://www.ctan.org).
  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\message{Basics,}
  71\chardef\other=12
  72
  73% We never want plain's \outer definition of \+ in Texinfo.
  74% For @tex, we can use \tabalign.
  75\let\+ = \relax
  76
  77% Save some plain tex macros whose names we will redefine.
  78\let\ptexb=\b
  79\let\ptexbullet=\bullet
  80\let\ptexc=\c
  81\let\ptexcomma=\,
  82\let\ptexdot=\.
  83\let\ptexdots=\dots
  84\let\ptexend=\end
  85\let\ptexequiv=\equiv
  86\let\ptexexclam=\!
  87\let\ptexfootnote=\footnote
  88\let\ptexgtr=>
  89\let\ptexhat=^
  90\let\ptexi=\i
  91\let\ptexindent=\indent
  92\let\ptexinsert=\insert
  93\let\ptexlbrace=\{
  94\let\ptexless=<
  95\let\ptexnewwrite\newwrite
  96\let\ptexnoindent=\noindent
  97\let\ptexplus=+
  98\let\ptexrbrace=\}
  99\let\ptexslash=\/
 100\let\ptexstar=\*
 101\let\ptext=\t
 102
 103% If this character appears in an error message or help string, it
 104% starts a new line in the output.
 105\newlinechar = `^^J
 106
 107% Use TeX 3.0's \inputlineno to get the line number, for better error
 108% messages, but if we're using an old version of TeX, don't do anything.
 109%
 110\ifx\inputlineno\thisisundefined
 111  \let\linenumber = \empty % Pre-3.0.
 112\else
 113  \def\linenumber{l.\the\inputlineno:\space}
 114\fi
 115
 116% Set up fixed words for English if not already set.
 117\ifx\putwordAppendix\undefined  \gdef\putwordAppendix{Appendix}\fi
 118\ifx\putwordChapter\undefined   \gdef\putwordChapter{Chapter}\fi
 119\ifx\putwordfile\undefined      \gdef\putwordfile{file}\fi
 120\ifx\putwordin\undefined        \gdef\putwordin{in}\fi
 121\ifx\putwordIndexIsEmpty\undefined     \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
 122\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
 123\ifx\putwordInfo\undefined      \gdef\putwordInfo{Info}\fi
 124\ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
 125\ifx\putwordMethodon\undefined  \gdef\putwordMethodon{Method on}\fi
 126\ifx\putwordNoTitle\undefined   \gdef\putwordNoTitle{No Title}\fi
 127\ifx\putwordof\undefined        \gdef\putwordof{of}\fi
 128\ifx\putwordon\undefined        \gdef\putwordon{on}\fi
 129\ifx\putwordpage\undefined      \gdef\putwordpage{page}\fi
 130\ifx\putwordsection\undefined   \gdef\putwordsection{section}\fi
 131\ifx\putwordSection\undefined   \gdef\putwordSection{Section}\fi
 132\ifx\putwordsee\undefined       \gdef\putwordsee{see}\fi
 133\ifx\putwordSee\undefined       \gdef\putwordSee{See}\fi
 134\ifx\putwordShortTOC\undefined  \gdef\putwordShortTOC{Short Contents}\fi
 135\ifx\putwordTOC\undefined       \gdef\putwordTOC{Table of Contents}\fi
 136%
 137\ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
 138\ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
 139\ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
 140\ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
 141\ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
 142\ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
 143\ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
 144\ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
 145\ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
 146\ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
 147\ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
 148\ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
 149%
 150\ifx\putwordDefmac\undefined    \gdef\putwordDefmac{Macro}\fi
 151\ifx\putwordDefspec\undefined   \gdef\putwordDefspec{Special Form}\fi
 152\ifx\putwordDefvar\undefined    \gdef\putwordDefvar{Variable}\fi
 153\ifx\putwordDefopt\undefined    \gdef\putwordDefopt{User Option}\fi
 154\ifx\putwordDeffunc\undefined   \gdef\putwordDeffunc{Function}\fi
 155
 156% In some macros, we cannot use the `\? notation---the left quote is
 157% in some cases the escape char.
 158\chardef\colonChar = `\:
 159\chardef\commaChar = `\,
 160\chardef\dotChar   = `\.
 161\chardef\exclamChar= `\!
 162\chardef\questChar = `\?
 163\chardef\semiChar  = `\;
 164\chardef\underChar = `\_
 165
 166\chardef\spaceChar = `\ %
 167\chardef\spacecat = 10
 168\def\spaceisspace{\catcode\spaceChar=\spacecat}
 169
 170% Ignore a token.
 171%
 172\def\gobble#1{}
 173
 174% The following is used inside several \edef's.
 175\def\makecsname#1{\expandafter\noexpand\csname#1\endcsname}
 176
 177% Hyphenation fixes.
 178\hyphenation{
 179  Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script
 180  ap-pen-dix bit-map bit-maps
 181  data-base data-bases eshell fall-ing half-way long-est man-u-script
 182  man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm
 183  par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces
 184  spell-ing spell-ings
 185  stand-alone strong-est time-stamp time-stamps which-ever white-space
 186  wide-spread wrap-around
 187}
 188
 189% Margin to add to right of even pages, to left of odd pages.
 190\newdimen\bindingoffset
 191\newdimen\normaloffset
 192\newdimen\pagewidth \newdimen\pageheight
 193
 194% For a final copy, take out the rectangles
 195% that mark overfull boxes (in case you have decided
 196% that the text looks ok even though it passes the margin).
 197%
 198\def\finalout{\overfullrule=0pt}
 199
 200% @| inserts a changebar to the left of the current line.  It should
 201% surround any changed text.  This approach does *not* work if the
 202% change spans more than two lines of output.  To handle that, we would
 203% have adopt a much more difficult approach (putting marks into the main
 204% vertical list for the beginning and end of each change).
 205%
 206\def\|{%
 207  % \vadjust can only be used in horizontal mode.
 208  \leavevmode
 209  %
 210  % Append this vertical mode material after the current line in the output.
 211  \vadjust{%
 212    % We want to insert a rule with the height and depth of the current
 213    % leading; that is exactly what \strutbox is supposed to record.
 214    \vskip-\baselineskip
 215    %
 216    % \vadjust-items are inserted at the left edge of the type.  So
 217    % the \llap here moves out into the left-hand margin.
 218    \llap{%
 219      %
 220      % For a thicker or thinner bar, change the `1pt'.
 221      \vrule height\baselineskip width1pt
 222      %
 223      % This is the space between the bar and the text.
 224      \hskip 12pt
 225    }%
 226  }%
 227}
 228
 229% Sometimes it is convenient to have everything in the transcript file
 230% and nothing on the terminal.  We don't just call \tracingall here,
 231% since that produces some useless output on the terminal.  We also make
 232% some effort to order the tracing commands to reduce output in the log
 233% file; cf. trace.sty in LaTeX.
 234%
 235\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
 236\def\loggingall{%
 237  \tracingstats2
 238  \tracingpages1
 239  \tracinglostchars2  % 2 gives us more in etex
 240  \tracingparagraphs1
 241  \tracingoutput1
 242  \tracingmacros2
 243  \tracingrestores1
 244  \showboxbreadth\maxdimen \showboxdepth\maxdimen
 245  \ifx\eTeXversion\undefined\else % etex gives us more logging
 246    \tracingscantokens1
 247    \tracingifs1
 248    \tracinggroups1
 249    \tracingnesting2
 250    \tracingassigns1
 251  \fi
 252  \tracingcommands3  % 3 gives us more in etex
 253  \errorcontextlines16
 254}%
 255
 256% add check for \lastpenalty to plain's definitions.  If the last thing
 257% we did was a \nobreak, we don't want to insert more space.
 258%
 259\def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount
 260  \removelastskip\penalty-50\smallskip\fi\fi}
 261\def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount
 262  \removelastskip\penalty-100\medskip\fi\fi}
 263\def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
 264  \removelastskip\penalty-200\bigskip\fi\fi}
 265
 266% For @cropmarks command.
 267% Do @cropmarks to get crop marks.
 268%
 269\newif\ifcropmarks
 270\let\cropmarks = \cropmarkstrue
 271%
 272% Dimensions to add cropmarks at corners.
 273% Added by P. A. MacKay, 12 Nov. 1986
 274%
 275\newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
 276\newdimen\cornerlong  \cornerlong=1pc
 277\newdimen\cornerthick \cornerthick=.3pt
 278\newdimen\topandbottommargin \topandbottommargin=.75in
 279
 280% Main output routine.
 281\chardef\PAGE = 255
 282\output = {\onepageout{\pagecontents\PAGE}}
 283
 284\newbox\headlinebox
 285\newbox\footlinebox
 286
 287% \onepageout takes a vbox as an argument.  Note that \pagecontents
 288% does insertions, but you have to call it yourself.
 289\def\onepageout#1{%
 290  \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
 291  %
 292  \ifodd\pageno  \advance\hoffset by \bindingoffset
 293  \else \advance\hoffset by -\bindingoffset\fi
 294  %
 295  % Do this outside of the \shipout so @code etc. will be expanded in
 296  % the headline as they should be, not taken literally (outputting ''code).
 297  \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}%
 298  \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}%
 299  %
 300  {%
 301    % Have to do this stuff outside the \shipout because we want it to
 302    % take effect in \write's, yet the group defined by the \vbox ends
 303    % before the \shipout runs.
 304    %
 305    \escapechar = `\\     % use backslash in output files.
 306    \indexdummies         % don't expand commands in the output.
 307    \normalturnoffactive  % \ in index entries must not stay \, e.g., if
 308                   % the page break happens to be in the middle of an example.
 309    \shipout\vbox{%
 310      % Do this early so pdf references go to the beginning of the page.
 311      \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi
 312      %
 313      \ifcropmarks \vbox to \outervsize\bgroup
 314        \hsize = \outerhsize
 315        \vskip-\topandbottommargin
 316        \vtop to0pt{%
 317          \line{\ewtop\hfil\ewtop}%
 318          \nointerlineskip
 319          \line{%
 320            \vbox{\moveleft\cornerthick\nstop}%
 321            \hfill
 322            \vbox{\moveright\cornerthick\nstop}%
 323          }%
 324          \vss}%
 325        \vskip\topandbottommargin
 326        \line\bgroup
 327          \hfil % center the page within the outer (page) hsize.
 328          \ifodd\pageno\hskip\bindingoffset\fi
 329          \vbox\bgroup
 330      \fi
 331      %
 332      \unvbox\headlinebox
 333      \pagebody{#1}%
 334      \ifdim\ht\footlinebox > 0pt
 335        % Only leave this space if the footline is nonempty.
 336        % (We lessened \vsize for it in \oddfootingxxx.)
 337        % The \baselineskip=24pt in plain's \makefootline has no effect.
 338        \vskip 2\baselineskip
 339        \unvbox\footlinebox
 340      \fi
 341      %
 342      \ifcropmarks
 343          \egroup % end of \vbox\bgroup
 344        \hfil\egroup % end of (centering) \line\bgroup
 345        \vskip\topandbottommargin plus1fill minus1fill
 346        \boxmaxdepth = \cornerthick
 347        \vbox to0pt{\vss
 348          \line{%
 349            \vbox{\moveleft\cornerthick\nsbot}%
 350            \hfill
 351            \vbox{\moveright\cornerthick\nsbot}%
 352          }%
 353          \nointerlineskip
 354          \line{\ewbot\hfil\ewbot}%
 355        }%
 356      \egroup % \vbox from first cropmarks clause
 357      \fi
 358    }% end of \shipout\vbox
 359  }% end of group with \normalturnoffactive
 360  \advancepageno
 361  \ifnum\outputpenalty>-20000 \else\dosupereject\fi
 362}
 363
 364\newinsert\margin \dimen\margin=\maxdimen
 365
 366\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
 367{\catcode`\@ =11
 368\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
 369% marginal hacks, juha@viisa.uucp (Juha Takala)
 370\ifvoid\margin\else % marginal info is present
 371  \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
 372\dimen@=\dp#1 \unvbox#1
 373\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
 374\ifr@ggedbottom \kern-\dimen@ \vfil \fi}
 375}
 376
 377% Here are the rules for the cropmarks.  Note that they are
 378% offset so that the space between them is truly \outerhsize or \outervsize
 379% (P. A. MacKay, 12 November, 1986)
 380%
 381\def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
 382\def\nstop{\vbox
 383  {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
 384\def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
 385\def\nsbot{\vbox
 386  {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
 387
 388% Parse an argument, then pass it to #1.  The argument is the rest of
 389% the input line (except we remove a trailing comment).  #1 should be a
 390% macro which expects an ordinary undelimited TeX argument.
 391%
 392\def\parsearg{\parseargusing{}}
 393\def\parseargusing#1#2{%
 394  \def\next{#2}%
 395  \begingroup
 396    \obeylines
 397    \spaceisspace
 398    #1%
 399    \parseargline\empty% Insert the \empty token, see \finishparsearg below.
 400}
 401
 402{\obeylines %
 403  \gdef\parseargline#1^^M{%
 404    \endgroup % End of the group started in \parsearg.
 405    \argremovecomment #1\comment\ArgTerm%
 406  }%
 407}
 408
 409% First remove any @comment, then any @c comment.
 410\def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
 411\def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
 412
 413% Each occurence of `\^^M' or `<space>\^^M' is replaced by a single space.
 414%
 415% \argremovec might leave us with trailing space, e.g.,
 416%    @end itemize  @c foo
 417% This space token undergoes the same procedure and is eventually removed
 418% by \finishparsearg.
 419%
 420\def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M}
 421\def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M}
 422\def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{%
 423  \def\temp{#3}%
 424  \ifx\temp\empty
 425    % We cannot use \next here, as it holds the macro to run;
 426    % thus we reuse \temp.
 427    \let\temp\finishparsearg
 428  \else
 429    \let\temp\argcheckspaces
 430  \fi
 431  % Put the space token in:
 432  \temp#1 #3\ArgTerm
 433}
 434
 435% If a _delimited_ argument is enclosed in braces, they get stripped; so
 436% to get _exactly_ the rest of the line, we had to prevent such situation.
 437% We prepended an \empty token at the very beginning and we expand it now,
 438% just before passing the control to \next.
 439% (Similarily, we have to think about #3 of \argcheckspacesY above: it is
 440% either the null string, or it ends with \^^M---thus there is no danger
 441% that a pair of braces would be stripped.
 442%
 443% But first, we have to remove the trailing space token.
 444%
 445\def\finishparsearg#1 \ArgTerm{\expandafter\next\expandafter{#1}}
 446
 447% \parseargdef\foo{...}
 448%	is roughly equivalent to
 449% \def\foo{\parsearg\Xfoo}
 450% \def\Xfoo#1{...}
 451%
 452% Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my
 453% favourite TeX trick.  --kasal, 16nov03
 454
 455\def\parseargdef#1{%
 456  \expandafter \doparseargdef \csname\string#1\endcsname #1%
 457}
 458\def\doparseargdef#1#2{%
 459  \def#2{\parsearg#1}%
 460  \def#1##1%
 461}
 462
 463% Several utility definitions with active space:
 464{
 465  \obeyspaces
 466  \gdef\obeyedspace{ }
 467
 468  % Make each space character in the input produce a normal interword
 469  % space in the output.  Don't allow a line break at this space, as this
 470  % is used only in environments like @example, where each line of input
 471  % should produce a line of output anyway.
 472  %
 473  \gdef\sepspaces{\obeyspaces\let =\tie}
 474
 475  % If an index command is used in an @example environment, any spaces
 476  % therein should become regular spaces in the raw index file, not the
 477  % expansion of \tie (\leavevmode \penalty \@M \ ).
 478  \gdef\unsepspaces{\let =\space}
 479}
 480
 481
 482\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
 483
 484% Define the framework for environments in texinfo.tex.  It's used like this:
 485%
 486%   \envdef\foo{...}
 487%   \def\Efoo{...}
 488%
 489% It's the responsibility of \envdef to insert \begingroup before the
 490% actual body; @end closes the group after calling \Efoo.  \envdef also
 491% defines \thisenv, so the current environment is known; @end checks
 492% whether the environment name matches.  The \checkenv macro can also be
 493% used to check whether the current environment is the one expected.
 494%
 495% Non-false conditionals (@iftex, @ifset) don't fit into this, so they
 496% are not treated as enviroments; they don't open a group.  (The
 497% implementation of @end takes care not to call \endgroup in this
 498% special case.)
 499
 500
 501% At runtime, environments start with this:
 502\def\startenvironment#1{\begingroup\def\thisenv{#1}}
 503% initialize
 504\let\thisenv\empty
 505
 506% ... but they get defined via ``\envdef\foo{...}'':
 507\long\def\envdef#1#2{\def#1{\startenvironment#1#2}}
 508\def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}}
 509
 510% Check whether we're in the right environment:
 511\def\checkenv#1{%
 512  \def\temp{#1}%
 513  \ifx\thisenv\temp
 514  \else
 515    \badenverr
 516  \fi
 517}
 518
 519% Evironment mismatch, #1 expected:
 520\def\badenverr{%
 521  \errhelp = \EMsimple
 522  \errmessage{This command can appear only \inenvironment\temp,
 523    not \inenvironment\thisenv}%
 524}
 525\def\inenvironment#1{%
 526  \ifx#1\empty
 527    out of any environment%
 528  \else
 529    in environment \expandafter\string#1%
 530  \fi
 531}
 532
 533% @end foo executes the definition of \Efoo.
 534% But first, it executes a specialized version of \checkenv
 535%
 536\parseargdef\end{%
 537  \if 1\csname iscond.#1\endcsname
 538  \else
 539    % The general wording of \badenverr may not be ideal, but... --kasal, 06nov03
 540    \expandafter\checkenv\csname#1\endcsname
 541    \csname E#1\endcsname
 542    \endgroup
 543  \fi
 544}
 545
 546\newhelp\EMsimple{Press RETURN to continue.}
 547
 548
 549%% Simple single-character @ commands
 550
 551% @@ prints an @
 552% Kludge this until the fonts are right (grr).
 553\def\@{{\tt\char64}}
 554
 555% This is turned off because it was never documented
 556% and you can use @w{...} around a quote to suppress ligatures.
 557%% Define @` and @' to be the same as ` and '
 558%% but suppressing ligatures.
 559%\def\`{{`}}
 560%\def\'{{'}}
 561
 562% Used to generate quoted braces.
 563\def\mylbrace {{\tt\char123}}
 564\def\myrbrace {{\tt\char125}}
 565\let\{=\mylbrace
 566\let\}=\myrbrace
 567\begingroup
 568  % Definitions to produce \{ and \} commands for indices,
 569  % and @{ and @} for the aux file.
 570  \catcode`\{ = \other \catcode`\} = \other
 571  \catcode`\[ = 1 \catcode`\] = 2
 572  \catcode`\! = 0 \catcode`\\ = \other
 573  !gdef!lbracecmd[\{]%
 574  !gdef!rbracecmd[\}]%
 575  !gdef!lbraceatcmd[@{]%
 576  !gdef!rbraceatcmd[@}]%
 577!endgroup
 578
 579% @comma{} to avoid , parsing problems.
 580\let\comma = ,
 581
 582% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
 583% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
 584\let\, = \c
 585\let\dotaccent = \.
 586\def\ringaccent#1{{\accent23 #1}}
 587\let\tieaccent = \t
 588\let\ubaraccent = \b
 589\let\udotaccent = \d
 590
 591% Other special characters: @questiondown @exclamdown @ordf @ordm
 592% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
 593\def\questiondown{?`}
 594\def\exclamdown{!`}
 595\def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}}
 596\def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}}
 597
 598% Dotless i and dotless j, used for accents.
 599\def\imacro{i}
 600\def\jmacro{j}
 601\def\dotless#1{%
 602  \def\temp{#1}%
 603  \ifx\temp\imacro \ptexi
 604  \else\ifx\temp\jmacro \j
 605  \else \errmessage{@dotless can be used only with i or j}%
 606  \fi\fi
 607}
 608
 609% The \TeX{} logo, as in plain, but resetting the spacing so that a
 610% period following counts as ending a sentence.  (Idea found in latex.)
 611%
 612\edef\TeX{\TeX \spacefactor=1000 }
 613
 614% @LaTeX{} logo.  Not quite the same results as the definition in
 615% latex.ltx, since we use a different font for the raised A; it's most
 616% convenient for us to use an explicitly smaller font, rather than using
 617% the \scriptstyle font (since we don't reset \scriptstyle and
 618% \scriptscriptstyle).
 619%
 620\def\LaTeX{%
 621  L\kern-.36em
 622  {\setbox0=\hbox{T}%
 623   \vbox to \ht0{\hbox{\selectfonts\lllsize A}\vss}}%
 624  \kern-.15em
 625  \TeX
 626}
 627
 628% Be sure we're in horizontal mode when doing a tie, since we make space
 629% equivalent to this in @example-like environments. Otherwise, a space
 630% at the beginning of a line will start with \penalty -- and
 631% since \penalty is valid in vertical mode, we'd end up putting the
 632% penalty on the vertical list instead of in the new paragraph.
 633{\catcode`@ = 11
 634 % Avoid using \@M directly, because that causes trouble
 635 % if the definition is written into an index file.
 636 \global\let\tiepenalty = \@M
 637 \gdef\tie{\leavevmode\penalty\tiepenalty\ }
 638}
 639
 640% @: forces normal size whitespace following.
 641\def\:{\spacefactor=1000 }
 642
 643% @* forces a line break.
 644\def\*{\hfil\break\hbox{}\ignorespaces}
 645
 646% @/ allows a line break.
 647\let\/=\allowbreak
 648
 649% @. is an end-of-sentence period.
 650\def\.{.\spacefactor=3000 }
 651
 652% @! is an end-of-sentence bang.
 653\def\!{!\spacefactor=3000 }
 654
 655% @? is an end-of-sentence query.
 656\def\?{?\spacefactor=3000 }
 657
 658% @w prevents a word break.  Without the \leavevmode, @w at the
 659% beginning of a paragraph, when TeX is still in vertical mode, would
 660% produce a whole line of output instead of starting the paragraph.
 661\def\w#1{\leavevmode\hbox{#1}}
 662
 663% @group ... @end group forces ... to be all on one page, by enclosing
 664% it in a TeX vbox.  We use \vtop instead of \vbox to construct the box
 665% to keep its height that of a normal line.  According to the rules for
 666% \topskip (p.114 of the TeXbook), the glue inserted is
 667% max (\topskip - \ht (first item), 0).  If that height is large,
 668% therefore, no glue is inserted, and the space between the headline and
 669% the text is small, which looks bad.
 670%
 671% Another complication is that the group might be very large.  This can
 672% cause the glue on the previous page to be unduly stretched, because it
 673% does not have much material.  In this case, it's better to add an
 674% explicit \vfill so that the extra space is at the bottom.  The
 675% threshold for doing this is if the group is more than \vfilllimit
 676% percent of a page (\vfilllimit can be changed inside of @tex).
 677%
 678\newbox\groupbox
 679\def\vfilllimit{0.7}
 680%
 681\envdef\group{%
 682  \ifnum\catcode`\^^M=\active \else
 683    \errhelp = \groupinvalidhelp
 684    \errmessage{@group invalid in context where filling is enabled}%
 685  \fi
 686  \startsavinginserts
 687  %
 688  \setbox\groupbox = \vtop\bgroup
 689    % Do @comment since we are called inside an environment such as
 690    % @example, where each end-of-line in the input causes an
 691    % end-of-line in the output.  We don't want the end-of-line after
 692    % the `@group' to put extra space in the output.  Since @group
 693    % should appear on a line by itself (according to the Texinfo
 694    % manual), we don't worry about eating any user text.
 695    \comment
 696}
 697%
 698% The \vtop produces a box with normal height and large depth; thus, TeX puts
 699% \baselineskip glue before it, and (when the next line of text is done)
 700% \lineskip glue after it.  Thus, space below is not quite equal to space
 701% above.  But it's pretty close.
 702\def\Egroup{%
 703    % To get correct interline space between the last line of the group
 704    % and the first line afterwards, we have to propagate \prevdepth.
 705    \endgraf % Not \par, as it may have been set to \lisppar.
 706    \global\dimen1 = \prevdepth
 707  \egroup           % End the \vtop.
 708  % \dimen0 is the vertical size of the group's box.
 709  \dimen0 = \ht\groupbox  \advance\dimen0 by \dp\groupbox
 710  % \dimen2 is how much space is left on the page (more or less).
 711  \dimen2 = \pageheight   \advance\dimen2 by -\pagetotal
 712  % if the group doesn't fit on the current page, and it's a big big
 713  % group, force a page break.
 714  \ifdim \dimen0 > \dimen2
 715    \ifdim \pagetotal < \vfilllimit\pageheight
 716      \page
 717    \fi
 718  \fi
 719  \box\groupbox
 720  \prevdepth = \dimen1
 721  \checkinserts
 722}
 723%
 724% TeX puts in an \escapechar (i.e., `@') at the beginning of the help
 725% message, so this ends up printing `@group can only ...'.
 726%
 727\newhelp\groupinvalidhelp{%
 728group can only be used in environments such as @example,^^J%
 729where each line of input produces a line of output.}
 730
 731% @need space-in-mils
 732% forces a page break if there is not space-in-mils remaining.
 733
 734\newdimen\mil  \mil=0.001in
 735
 736% Old definition--didn't work.
 737%\parseargdef\need{\par %
 738%% This method tries to make TeX break the page naturally
 739%% if the depth of the box does not fit.
 740%{\baselineskip=0pt%
 741%\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak
 742%\prevdepth=-1000pt
 743%}}
 744
 745\parseargdef\need{%
 746  % Ensure vertical mode, so we don't make a big box in the middle of a
 747  % paragraph.
 748  \par
 749  %
 750  % If the @need value is less than one line space, it's useless.
 751  \dimen0 = #1\mil
 752  \dimen2 = \ht\strutbox
 753  \advance\dimen2 by \dp\strutbox
 754  \ifdim\dimen0 > \dimen2
 755    %
 756    % Do a \strut just to make the height of this box be normal, so the
 757    % normal leading is inserted relative to the preceding line.
 758    % And a page break here is fine.
 759    \vtop to #1\mil{\strut\vfil}%
 760    %
 761    % TeX does not even consider page breaks if a penalty added to the
 762    % main vertical list is 10000 or more.  But in order to see if the
 763    % empty box we just added fits on the page, we must make it consider
 764    % page breaks.  On the other hand, we don't want to actually break the
 765    % page after the empty box.  So we use a penalty of 9999.
 766    %
 767    % There is an extremely small chance that TeX will actually break the
 768    % page at this \penalty, if there are no other feasible breakpoints in
 769    % sight.  (If the user is using lots of big @group commands, which
 770    % almost-but-not-quite fill up a page, TeX will have a hard time doing
 771    % good page breaking, for example.)  However, I could not construct an
 772    % example where a page broke at this \penalty; if it happens in a real
 773    % document, then we can reconsider our strategy.
 774    \penalty9999
 775    %
 776    % Back up by the size of the box, whether we did a page break or not.
 777    \kern -#1\mil
 778    %
 779    % Do not allow a page break right after this kern.
 780    \nobreak
 781  \fi
 782}
 783
 784% @br   forces paragraph break (and is undocumented).
 785
 786\let\br = \par
 787
 788% @page forces the start of a new page.
 789%
 790\def\page{\par\vfill\supereject}
 791
 792% @exdent text....
 793% outputs text on separate line in roman font, starting at standard page margin
 794
 795% This records the amount of indent in the innermost environment.
 796% That's how much \exdent should take out.
 797\newskip\exdentamount
 798
 799% This defn is used inside fill environments such as @defun.
 800\parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}
 801
 802% This defn is used inside nofill environments such as @example.
 803\parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount
 804  \leftline{\hskip\leftskip{\rm#1}}}}
 805
 806% @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
 807% paragraph.  For more general purposes, use the \margin insertion
 808% class.  WHICH is `l' or `r'.
 809%
 810\newskip\inmarginspacing \inmarginspacing=1cm
 811\def\strutdepth{\dp\strutbox}
 812%
 813\def\doinmargin#1#2{\strut\vadjust{%
 814  \nobreak
 815  \kern-\strutdepth
 816  \vtop to \strutdepth{%
 817    \baselineskip=\strutdepth
 818    \vss
 819    % if you have multiple lines of stuff to put here, you'll need to
 820    % make the vbox yourself of the appropriate size.
 821    \ifx#1l%
 822      \llap{\ignorespaces #2\hskip\inmarginspacing}%
 823    \else
 824      \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
 825    \fi
 826    \null
 827  }%
 828}}
 829\def\inleftmargin{\doinmargin l}
 830\def\inrightmargin{\doinmargin r}
 831%
 832% @inmargin{TEXT [, RIGHT-TEXT]}
 833% (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
 834% else use TEXT for both).
 835%
 836\def\inmargin#1{\parseinmargin #1,,\finish}
 837\def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
 838  \setbox0 = \hbox{\ignorespaces #2}%
 839  \ifdim\wd0 > 0pt
 840    \def\lefttext{#1}%  have both texts
 841    \def\righttext{#2}%
 842  \else
 843    \def\lefttext{#1}%  have only one text
 844    \def\righttext{#1}%
 845  \fi
 846  %
 847  \ifodd\pageno
 848    \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
 849  \else
 850    \def\temp{\inleftmargin\lefttext}%
 851  \fi
 852  \temp
 853}
 854
 855% @include file    insert text of that file as input.
 856%
 857\def\include{\parseargusing\filenamecatcodes\includezzz}
 858\def\includezzz#1{%
 859  \pushthisfilestack
 860  \def\thisfile{#1}%
 861  {%
 862    \makevalueexpandable
 863    \def\temp{\input #1 }%
 864    \expandafter
 865  }\temp
 866  \popthisfilestack
 867}
 868\def\filenamecatcodes{%
 869  \catcode`\\=\other
 870  \catcode`~=\other
 871  \catcode`^=\other
 872  \catcode`_=\other
 873  \catcode`|=\other
 874  \catcode`<=\other
 875  \catcode`>=\other
 876  \catcode`+=\other
 877  \catcode`-=\other
 878}
 879
 880\def\pushthisfilestack{%
 881  \expandafter\pushthisfilestackX\popthisfilestack\StackTerm
 882}
 883\def\pushthisfilestackX{%
 884  \expandafter\pushthisfilestackY\thisfile\StackTerm
 885}
 886\def\pushthisfilestackY #1\StackTerm #2\StackTerm {%
 887  \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}%
 888}
 889
 890\def\popthisfilestack{\errthisfilestackempty}
 891\def\errthisfilestackempty{\errmessage{Internal error:
 892  the stack of filenames is empty.}}
 893
 894\def\thisfile{}
 895
 896% @center line
 897% outputs that line, centered.
 898%
 899\parseargdef\center{%
 900  \ifhmode
 901    \let\next\centerH
 902  \else
 903    \let\next\centerV
 904  \fi
 905  \next{\hfil \ignorespaces#1\unskip \hfil}%
 906}
 907\def\centerH#1{%
 908  {%
 909    \hfil\break
 910    \advance\hsize by -\leftskip
 911    \advance\hsize by -\rightskip
 912    \line{#1}%
 913    \break
 914  }%
 915}
 916\def\centerV#1{\line{\kern\leftskip #1\kern\rightskip}}
 917
 918% @sp n   outputs n lines of vertical space
 919
 920\parseargdef\sp{\vskip #1\baselineskip}
 921
 922% @comment ...line which is ignored...
 923% @c is the same as @comment
 924% @ignore ... @end ignore  is another way to write a comment
 925
 926\def\comment{\begingroup \catcode`\^^M=\other%
 927\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
 928\commentxxx}
 929{\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}}
 930
 931\let\c=\comment
 932
 933% @paragraphindent NCHARS
 934% We'll use ems for NCHARS, close enough.
 935% NCHARS can also be the word `asis' or `none'.
 936% We cannot feasibly implement @paragraphindent asis, though.
 937%
 938\def\asisword{asis} % no translation, these are keywords
 939\def\noneword{none}
 940%
 941\parseargdef\paragraphindent{%
 942  \def\temp{#1}%
 943  \ifx\temp\asisword
 944  \else
 945    \ifx\temp\noneword
 946      \defaultparindent = 0pt
 947    \else
 948      \defaultparindent = #1em
 949    \fi
 950  \fi
 951  \parindent = \defaultparindent
 952}
 953
 954% @exampleindent NCHARS
 955% We'll use ems for NCHARS like @paragraphindent.
 956% It seems @exampleindent asis isn't necessary, but
 957% I preserve it to make it similar to @paragraphindent.
 958\parseargdef\exampleindent{%
 959  \def\temp{#1}%
 960  \ifx\temp\asisword
 961  \else
 962    \ifx\temp\noneword
 963      \lispnarrowing = 0pt
 964    \else
 965      \lispnarrowing = #1em
 966    \fi
 967  \fi
 968}
 969
 970% @firstparagraphindent WORD
 971% If WORD is `none', then suppress indentation of the first paragraph
 972% after a section heading.  If WORD is `insert', then do indent at such
 973% paragraphs.
 974%
 975% The paragraph indentation is suppressed or not by calling
 976% \suppressfirstparagraphindent, which the sectioning commands do.
 977% We switch the definition of this back and forth according to WORD.
 978% By default, we suppress indentation.
 979%
 980\def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
 981\def\insertword{insert}
 982%
 983\parseargdef\firstparagraphindent{%
 984  \def\temp{#1}%
 985  \ifx\temp\noneword
 986    \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
 987  \else\ifx\temp\insertword
 988    \let\suppressfirstparagraphindent = \relax
 989  \else
 990    \errhelp = \EMsimple
 991    \errmessage{Unknown @firstparagraphindent option `\temp'}%
 992  \fi\fi
 993}
 994
 995% Here is how we actually suppress indentation.  Redefine \everypar to
 996% \kern backwards by \parindent, and then reset itself to empty.
 997%
 998% We also make \indent itself not actually do anything until the next
 999% paragraph.
1000%
1001\gdef\dosuppressfirstparagraphindent{%
1002  \gdef\indent{%
1003    \restorefirstparagraphindent
1004    \indent
1005  }%
1006  \gdef\noindent{%
1007    \restorefirstparagraphindent
1008    \noindent
1009  }%
1010  \global\everypar = {%
1011    \kern -\parindent
1012    \restorefirstparagraphindent
1013  }%
1014}
1015
1016\gdef\restorefirstparagraphindent{%
1017  \global \let \indent = \ptexindent
1018  \global \let \noindent = \ptexnoindent
1019  \global \everypar = {}%
1020}
1021
1022
1023% @asis just yields its argument.  Used with @table, for example.
1024%
1025\def\asis#1{#1}
1026
1027% @math outputs its argument in math mode.
1028%
1029% One complication: _ usually means subscripts, but it could also mean
1030% an actual _ character, as in @math{@var{some_variable} + 1}.  So make
1031% _ active, and distinguish by seeing if the current family is \slfam,
1032% which is what @var uses.
1033{
1034  \catcode\underChar = \active
1035  \gdef\mathunderscore{%
1036    \catcode\underChar=\active
1037    \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
1038  }
1039}
1040% Another complication: we want \\ (and @\) to output a \ character.
1041% FYI, plain.tex uses \\ as a temporary control sequence (why?), but
1042% this is not advertised and we don't care.  Texinfo does not
1043% otherwise define @\.
1044%
1045% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
1046\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
1047%
1048\def\math{%
1049  \tex
1050  \mathunderscore
1051  \let\\ = \mathbackslash
1052  \mathactive
1053  $\finishmath
1054}
1055\def\finishmath#1{#1$\endgroup}  % Close the group opened by \tex.
1056
1057% Some active characters (such as <) are spaced differently in math.
1058% We have to reset their definitions in case the @math was an argument
1059% to a command which sets the catcodes (such as @item or @section).
1060%
1061{
1062  \catcode`^ = \active
1063  \catcode`< = \active
1064  \catcode`> = \active
1065  \catcode`+ = \active
1066  \gdef\mathactive{%
1067    \let^ = \ptexhat
1068    \let< = \ptexless
1069    \let> = \ptexgtr
1070    \let+ = \ptexplus
1071  }
1072}
1073
1074% @bullet and @minus need the same treatment as @math, just above.
1075\def\bullet{$\ptexbullet$}
1076\def\minus{$-$}
1077
1078% @dots{} outputs an ellipsis using the current font.
1079% We do .5em per period so that it has the same spacing in a typewriter
1080% font as three actual period characters.
1081%
1082\def\dots{%
1083  \leavevmode
1084  \hbox to 1.5em{%
1085    \hskip 0pt plus 0.25fil
1086    .\hfil.\hfil.%
1087    \hskip 0pt plus 0.5fil
1088  }%
1089}
1090
1091% @enddots{} is an end-of-sentence ellipsis.
1092%
1093\def\enddots{%
1094  \dots
1095  \spacefactor=3000
1096}
1097
1098% @comma{} is so commas can be inserted into text without messing up
1099% Texinfo's parsing.
1100%
1101\let\comma = ,
1102
1103% @refill is a no-op.
1104\let\refill=\relax
1105
1106% If working on a large document in chapters, it is convenient to
1107% be able to disable indexing, cross-referencing, and contents, for test runs.
1108% This is done with @novalidate (before @setfilename).
1109%
1110\newif\iflinks \linkstrue % by default we want the aux files.
1111\let\novalidate = \linksfalse
1112
1113% @setfilename is done at the beginning of every texinfo file.
1114% So open here the files we need to have open while reading the input.
1115% This makes it possible to make a .fmt file for texinfo.
1116\def\setfilename{%
1117   \fixbackslash  % Turn off hack to swallow `\input texinfo'.
1118   \iflinks
1119     \tryauxfile
1120     % Open the new aux file.  TeX will close it automatically at exit.
1121     \immediate\openout\auxfile=\jobname.aux
1122   \fi % \openindices needs to do some work in any case.
1123   \openindices
1124   \let\setfilename=\comment % Ignore extra @setfilename cmds.
1125   %
1126   % If texinfo.cnf is present on the system, read it.
1127   % Useful for site-wide @afourpaper, etc.
1128   \openin 1 texinfo.cnf
1129   \ifeof 1 \else \input texinfo.cnf \fi
1130   \closein 1
1131   %
1132   \comment % Ignore the actual filename.
1133}
1134
1135% Called from \setfilename.
1136%
1137\def\openindices{%
1138  \newindex{cp}%
1139  \newcodeindex{fn}%
1140  \newcodeindex{vr}%
1141  \newcodeindex{tp}%
1142  \newcodeindex{ky}%
1143  \newcodeindex{pg}%
1144}
1145
1146% @bye.
1147\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
1148
1149
1150\message{pdf,}
1151% adobe `portable' document format
1152\newcount\tempnum
1153\newcount\lnkcount
1154\newtoks\filename
1155\newcount\filenamelength
1156\newcount\pgn
1157\newtoks\toksA
1158\newtoks\toksB
1159\newtoks\toksC
1160\newtoks\toksD
1161\newbox\boxA
1162\newcount\countA
1163\newif\ifpdf
1164\newif\ifpdfmakepagedest
1165
1166% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
1167% can be set).  So we test for \relax and 0 as well as \undefined,
1168% borrowed from ifpdf.sty.
1169\ifx\pdfoutput\undefined
1170\else
1171  \ifx\pdfoutput\relax
1172  \else
1173    \ifcase\pdfoutput
1174    \else
1175      \pdftrue
1176    \fi
1177  \fi
1178\fi
1179%
1180\ifpdf
1181  \input pdfcolor
1182  \pdfcatalog{/PageMode /UseOutlines}%
1183  \def\dopdfimage#1#2#3{%
1184    \def\imagewidth{#2}%
1185    \def\imageheight{#3}%
1186    % without \immediate, pdftex seg faults when the same image is
1187    % included twice.  (Version 3.14159-pre-1.0-unofficial-20010704.)
1188    \ifnum\pdftexversion < 14
1189      \immediate\pdfimage
1190    \else
1191      \immediate\pdfximage
1192    \fi
1193      \ifx\empty\imagewidth\else width \imagewidth \fi
1194      \ifx\empty\imageheight\else height \imageheight \fi
1195      \ifnum\pdftexversion<13
1196         #1.pdf%
1197       \else
1198         {#1.pdf}%
1199       \fi
1200    \ifnum\pdftexversion < 14 \else
1201      \pdfrefximage \pdflastximage
1202    \fi}
1203  \def\pdfmkdest#1{{%
1204    % We have to set dummies so commands such as @code in a section title
1205    % aren't expanded.
1206    \atdummies
1207    \normalturnoffactive
1208    \pdfdest name{#1} xyz%
1209  }}
1210  \def\pdfmkpgn#1{#1}
1211  \let\linkcolor = \Blue  % was Cyan, but that seems light?
1212  \def\endlink{\Black\pdfendlink}
1213  % Adding outlines to PDF; macros for calculating structure of outlines
1214  % come from Petr Olsak
1215  \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
1216    \else \csname#1\endcsname \fi}
1217  \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
1218    \advance\tempnum by 1
1219    \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
1220  %
1221  % #1 is the section text.  #2 is the pdf expression for the number
1222  % of subentries (or empty, for subsubsections).  #3 is the node
1223  % text, which might be empty if this toc entry had no
1224  % corresponding node.  #4 is the page number.
1225  %
1226  \def\dopdfoutline#1#2#3#4{%
1227    % Generate a link to the node text if that exists; else, use the
1228    % page number.  We could generate a destination for the section
1229    % text in the case where a section has no node, but it doesn't
1230    % seem worthwhile, since most documents are normally structured.
1231    \def\pdfoutlinedest{#3}%
1232    \ifx\pdfoutlinedest\empty \def\pdfoutlinedest{#4}\fi
1233    %
1234    \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{#1}%
1235  }
1236  %
1237  \def\pdfmakeoutlines{%
1238    \begingroup
1239      % Thanh's hack / proper braces in bookmarks
1240      \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace
1241      \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace
1242      %
1243      % Read toc silently, to get counts of subentries for \pdfoutline.
1244      \def\numchapentry##1##2##3##4{%
1245	\def\thischapnum{##2}%
1246	\def\thissecnum{0}%
1247	\def\thissubsecnum{0}%
1248      }%
1249      \def\numsecentry##1##2##3##4{%
1250	\advancenumber{chap\thischapnum}%
1251	\def\thissecnum{##2}%
1252	\def\thissubsecnum{0}%
1253      }%
1254      \def\numsubsecentry##1##2##3##4{%
1255	\advancenumber{sec\thissecnum}%
1256	\def\thissubsecnum{##2}%
1257      }%
1258      \def\numsubsubsecentry##1##2##3##4{%
1259	\advancenumber{subsec\thissubsecnum}%
1260      }%
1261      \def\thischapnum{0}%
1262      \def\thissecnum{0}%
1263      \def\thissubsecnum{0}%
1264      %
1265      % use \def rather than \let here because we redefine \chapentry et
1266      % al. a second time, below.
1267      \def\appentry{\numchapentry}%
1268      \def\appsecentry{\numsecentry}%
1269      \def\appsubsecentry{\numsubsecentry}%
1270      \def\appsubsubsecentry{\numsubsubsecentry}%
1271      \def\unnchapentry{\numchapentry}%
1272      \def\unnsecentry{\numsecentry}%
1273      \def\unnsubsecentry{\numsubsecentry}%
1274      \def\unnsubsubsecentry{\numsubsubsecentry}%
1275      \input \jobname.toc
1276      %
1277      % Read toc second time, this time actually producing the outlines.
1278      % The `-' means take the \expnumber as the absolute number of
1279      % subentries, which we calculated on our first read of the .toc above.
1280      %
1281      % We use the node names as the destinations.
1282      \def\numchapentry##1##2##3##4{%
1283        \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}%
1284      \def\numsecentry##1##2##3##4{%
1285        \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}%
1286      \def\numsubsecentry##1##2##3##4{%
1287        \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}%
1288      \def\numsubsubsecentry##1##2##3##4{% count is always zero
1289        \dopdfoutline{##1}{}{##3}{##4}}%
1290      %
1291      % PDF outlines are displayed using system fonts, instead of
1292      % document fonts.  Therefore we cannot use special characters,
1293      % since the encoding is unknown.  For example, the eogonek from
1294      % Latin 2 (0xea) gets translated to a | character.  Info from
1295      % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
1296      %
1297      % xx to do this right, we have to translate 8-bit characters to
1298      % their "best" equivalent, based on the @documentencoding.  Right
1299      % now, I guess we'll just let the pdf reader have its way.
1300      \indexnofonts
1301      \turnoffactive
1302      \input \jobname.toc
1303    \endgroup
1304  }
1305  %
1306  \def\makelinks #1,{%
1307    \def\params{#1}\def\E{END}%
1308    \ifx\params\E
1309      \let\nextmakelinks=\relax
1310    \else
1311      \let\nextmakelinks=\makelinks
1312      \ifnum\lnkcount>0,\fi
1313      \picknum{#1}%
1314      \startlink attr{/Border [0 0 0]}
1315        goto name{\pdfmkpgn{\the\pgn}}%
1316      \linkcolor #1%
1317      \advance\lnkcount by 1%
1318      \endlink
1319    \fi
1320    \nextmakelinks
1321  }
1322  \def\picknum#1{\expandafter\pn#1}
1323  \def\pn#1{%
1324    \def\p{#1}%
1325    \ifx\p\lbrace
1326      \let\nextpn=\ppn
1327    \else
1328      \let\nextpn=\ppnn
1329      \def\first{#1}
1330    \fi
1331    \nextpn
1332  }
1333  \def\ppn#1{\pgn=#1\gobble}
1334  \def\ppnn{\pgn=\first}
1335  \def\pdfmklnk#1{\lnkcount=0\makelinks #1,END,}
1336  \def\skipspaces#1{\def\PP{#1}\def\D{|}%
1337    \ifx\PP\D\let\nextsp\relax
1338    \else\let\nextsp\skipspaces
1339      \ifx\p\space\else\addtokens{\filename}{\PP}%
1340        \advance\filenamelength by 1
1341      \fi
1342    \fi
1343    \nextsp}
1344  \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax}
1345  \ifnum\pdftexversion < 14
1346    \let \startlink \pdfannotlink
1347  \else
1348    \let \startlink \pdfstartlink
1349  \fi
1350  \def\pdfurl#1{%
1351    \begingroup
1352      \normalturnoffactive\def\@{@}%
1353      \makevalueexpandable
1354      \leavevmode\Red
1355      \startlink attr{/Border [0 0 0]}%
1356        user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
1357    \endgroup}
1358  \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
1359  \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
1360  \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
1361  \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
1362  \def\maketoks{%
1363    \expandafter\poptoks\the\toksA|ENDTOKS|\relax
1364    \ifx\first0\adn0
1365    \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
1366    \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
1367    \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
1368    \else
1369      \ifnum0=\countA\else\makelink\fi
1370      \ifx\first.\let\next=\done\else
1371        \let\next=\maketoks
1372        \addtokens{\toksB}{\the\toksD}
1373        \ifx\first,\addtokens{\toksB}{\space}\fi
1374      \fi
1375    \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
1376    \next}
1377  \def\makelink{\addtokens{\toksB}%
1378    {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
1379  \def\pdflink#1{%
1380    \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
1381    \linkcolor #1\endlink}
1382  \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
1383\else
1384  \let\pdfmkdest = \gobble
1385  \let\pdfurl = \gobble
1386  \let\endlink = \relax
1387  \let\linkcolor = \relax
1388  \let\pdfmakeoutlines = \relax
1389\fi  % \ifx\pdfoutput
1390
1391
1392\message{fonts,}
1393
1394% Change the current font style to #1, remembering it in \curfontstyle.
1395% For now, we do not accumulate font styles: @b{@i{foo}} prints foo in
1396% italics, not bold italics.
1397%
1398\def\setfontstyle#1{%
1399  \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd.
1400  \csname ten#1\endcsname  % change the current font
1401}
1402
1403% Select #1 fonts with the current style.
1404%
1405\def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname}
1406
1407\def\rm{\fam=0 \setfontstyle{rm}}
1408\def\it{\fam=\itfam \setfontstyle{it}}
1409\def\sl{\fam=\slfam \setfontstyle{sl}}
1410\def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
1411\def\tt{\fam=\ttfam \setfontstyle{tt}}
1412
1413% Texinfo sort of supports the sans serif font style, which plain TeX does not.
1414% So we set up a \sf.
1415\newfam\sffam
1416\def\sf{\fam=\sffam \setfontstyle{sf}}
1417\let\li = \sf % Sometimes we call it \li, not \sf.
1418
1419% We don't need math for this font style.
1420\def\ttsl{\setfontstyle{ttsl}}
1421
1422% Default leading.
1423\newdimen\textleading  \textleading = 13.2pt
1424
1425% Set the baselineskip to #1, and the lineskip and strut size
1426% correspondingly.  There is no deep meaning behind these magic numbers
1427% used as factors; they just match (closely enough) what Knuth defined.
1428%
1429\def\lineskipfactor{.08333}
1430\def\strutheightpercent{.70833}
1431\def\strutdepthpercent {.29167}
1432%
1433\def\setleading#1{%
1434  \normalbaselineskip = #1\relax
1435  \normallineskip = \lineskipfactor\normalbaselineskip
1436  \normalbaselines
1437  \setbox\strutbox =\hbox{%
1438    \vrule width0pt height\strutheightpercent\baselineskip
1439                    depth \strutdepthpercent \baselineskip
1440  }%
1441}
1442
1443% Set the font macro #1 to the font named #2, adding on the
1444% specified font prefix (normally `cm').
1445% #3 is the font's design size, #4 is a scale factor
1446\def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4}
1447
1448% Use cm as the default font prefix.
1449% To specify the font prefix, you must define \fontprefix
1450% before you read in texinfo.tex.
1451\ifx\fontprefix\undefined
1452\def\fontprefix{cm}
1453\fi
1454% Support font families that don't use the same naming scheme as CM.
1455\def\rmshape{r}
1456\def\rmbshape{bx}               %where the normal face is bold
1457\def\bfshape{b}
1458\def\bxshape{bx}
1459\def\ttshape{tt}
1460\def\ttbshape{tt}
1461\def\ttslshape{sltt}
1462\def\itshape{ti}
1463\def\itbshape{bxti}
1464\def\slshape{sl}
1465\def\slbshape{bxsl}
1466\def\sfshape{ss}
1467\def\sfbshape{ss}
1468\def\scshape{csc}
1469\def\scbshape{csc}
1470
1471% Text fonts (11.2pt, magstep1).
1472\def\textnominalsize{11pt}
1473\edef\mainmagstep{\magstephalf}
1474\setfont\textrm\rmshape{10}{\mainmagstep}
1475\setfont\texttt\ttshape{10}{\mainmagstep}
1476\setfont\textbf\bfshape{10}{\mainmagstep}
1477\setfont\textit\itshape{10}{\mainmagstep}
1478\setfont\textsl\slshape{10}{\mainmagstep}
1479\setfont\textsf\sfshape{10}{\mainmagstep}
1480\setfont\textsc\scshape{10}{\mainmagstep}
1481\setfont\textttsl\ttslshape{10}{\mainmagstep}
1482\font\texti=cmmi10 scaled \mainmagstep
1483\font\textsy=cmsy10 scaled \mainmagstep
1484
1485% A few fonts for @defun names and args.
1486\setfont\defbf\bfshape{10}{\magstep1}
1487\setfont\deftt\ttshape{10}{\magstep1}
1488\setfont\defttsl\ttslshape{10}{\magstep1}
1489\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf}
1490
1491% Fonts for indices, footnotes, small examples (9pt).
1492\def\smallnominalsize{9pt}
1493\setfont\smallrm\rmshape{9}{1000}
1494\setfont\smalltt\ttshape{9}{1000}
1495\setfont\smallbf\bfshape{10}{900}
1496\setfont\smallit\itshape{9}{1000}
1497\setfont\smallsl\slshape{9}{1000}
1498\setfont\smallsf\sfshape{9}{1000}
1499\setfont\smallsc\scshape{10}{900}
1500\setfont\smallttsl\ttslshape{10}{900}
1501\font\smalli=cmmi9
1502\font\smallsy=cmsy9
1503
1504% Fonts for small examples (8pt).
1505\def\smallernominalsize{8pt}
1506\setfont\smallerrm\rmshape{8}{1000}
1507\setfont\smallertt\ttshape{8}{1000}
1508\setfont\smallerbf\bfshape{10}{800}
1509\setfont\smallerit\itshape{8}{1000}
1510\setfont\smallersl\slshape{8}{1000}
1511\setfont\smallersf\sfshape{8}{1000}
1512\setfont\smallersc\scshape{10}{800}
1513\setfont\smallerttsl\ttslshape{10}{800}
1514\font\smalleri=cmmi8
1515\font\smallersy=cmsy8
1516
1517% Fonts for title page (20.4pt):
1518\def\titlenominalsize{20pt}
1519\setfont\titlerm\rmbshape{12}{\magstep3}
1520\setfont\titleit\itbshape{10}{\magstep4}
1521\setfont\titlesl\slbshape{10}{\magstep4}
1522\setfont\titlett\ttbshape{12}{\magstep3}
1523\setfont\titlettsl\ttslshape{10}{\magstep4}
1524\setfont\titlesf\sfbshape{17}{\magstep1}
1525\let\titlebf=\titlerm
1526\setfont\titlesc\scbshape{10}{\magstep4}
1527\font\titlei=cmmi12 scaled \magstep3
1528\font\titlesy=cmsy10 scaled \magstep4
1529\def\authorrm{\secrm}
1530\def\authortt{\sectt}
1531
1532% Chapter (and unnumbered) fonts (17.28pt).
1533\def\chapnominalsize{17pt}
1534\setfont\chaprm\rmbshape{12}{\magstep2}
1535\setfont\chapit\itbshape{10}{\magstep3}
1536\setfont\chapsl\slbshape{10}{\magstep3}
1537\setfont\chaptt\ttbshape{12}{\magstep2}
1538\setfont\chapttsl\ttslshape{10}{\magstep3}
1539\setfont\chapsf\sfbshape{17}{1000}
1540\let\chapbf=\chaprm
1541\setfont\chapsc\scbshape{10}{\magstep3}
1542\font\chapi=cmmi12 scaled \magstep2
1543\font\chapsy=cmsy10 scaled \magstep3
1544
1545% Section fonts (14.4pt).
1546\def\secnominalsize{14pt}
1547\setfont\secrm\rmbshape{12}{\magstep1}
1548\setfont\secit\itbshape{10}{\magstep2}
1549\setfont\secsl\slbshape{10}{\magstep2}
1550\setfont\sectt\ttbshape{12}{\magstep1}
1551\setfont\secttsl\ttslshape{10}{\magstep2}
1552\setfont\secsf\sfbshape{12}{\magstep1}
1553\let\secbf\secrm
1554\setfont\secsc\scbshape{10}{\magstep2}
1555\font\seci=cmmi12 scaled \magste

Large files files are truncated, but you can click here to view the full file