| 
alpar@18
 | 
     1  | 
% texinfo.tex -- TeX macros to handle Texinfo files.
  | 
| 
alpar@18
 | 
     2  | 
%
  | 
| 
alpar@18
 | 
     3  | 
% Load plain if necessary, i.e., if running under initex.
  | 
| 
alpar@18
 | 
     4  | 
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
  | 
| 
alpar@18
 | 
     5  | 
%
  | 
| 
alpar@18
 | 
     6  | 
\def\texinfoversion{2003-07-28.08}
 | 
| 
alpar@18
 | 
     7  | 
%
  | 
| 
alpar@18
 | 
     8  | 
% Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
  | 
| 
alpar@18
 | 
     9  | 
% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
  | 
| 
alpar@18
 | 
    10  | 
%
  | 
| 
alpar@18
 | 
    11  | 
% This texinfo.tex file is free software; you can redistribute it and/or
  | 
| 
alpar@18
 | 
    12  | 
% modify it under the terms of the GNU General Public License as
  | 
| 
alpar@18
 | 
    13  | 
% published by the Free Software Foundation; either version 2, or (at
  | 
| 
alpar@18
 | 
    14  | 
% your option) any later version.
  | 
| 
alpar@18
 | 
    15  | 
%
  | 
| 
alpar@18
 | 
    16  | 
% This texinfo.tex file is distributed in the hope that it will be
  | 
| 
alpar@18
 | 
    17  | 
% useful, but WITHOUT ANY WARRANTY; without even the implied warranty
  | 
| 
alpar@18
 | 
    18  | 
% of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  | 
| 
alpar@18
 | 
    19  | 
% General Public License for more details.
  | 
| 
alpar@18
 | 
    20  | 
%
  | 
| 
alpar@18
 | 
    21  | 
% You should have received a copy of the GNU General Public License
  | 
| 
alpar@18
 | 
    22  | 
% along with this texinfo.tex file; see the file COPYING.  If not, write
  | 
| 
alpar@18
 | 
    23  | 
% to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  | 
| 
alpar@18
 | 
    24  | 
% Boston, MA 02111-1307, USA.
  | 
| 
alpar@18
 | 
    25  | 
%
  | 
| 
alpar@18
 | 
    26  | 
% In other words, you are welcome to use, share and improve this program.
  | 
| 
alpar@18
 | 
    27  | 
% You are forbidden to forbid anyone else to use, share and improve
  | 
| 
alpar@18
 | 
    28  | 
% what you give them.   Help stamp out software-hoarding!
  | 
| 
alpar@18
 | 
    29  | 
%
  | 
| 
alpar@18
 | 
    30  | 
% Please try the latest version of texinfo.tex before submitting bug
  | 
| 
alpar@18
 | 
    31  | 
% reports; you can get the latest version from:
  | 
| 
alpar@18
 | 
    32  | 
%   ftp://ftp.gnu.org/gnu/texinfo/texinfo.tex
  | 
| 
alpar@18
 | 
    33  | 
%     (and all GNU mirrors, see http://www.gnu.org/order/ftp.html)
  | 
| 
alpar@18
 | 
    34  | 
%   ftp://tug.org/tex/texinfo.tex
  | 
| 
alpar@18
 | 
    35  | 
%     (and all CTAN mirrors, see http://www.ctan.org),
  | 
| 
alpar@18
 | 
    36  | 
%   and /home/gd/gnu/doc/texinfo.tex on the GNU machines.
  | 
| 
alpar@18
 | 
    37  | 
%
  | 
| 
alpar@18
 | 
    38  | 
% The GNU Texinfo home page is http://www.gnu.org/software/texinfo.
  | 
| 
alpar@18
 | 
    39  | 
%
  | 
| 
alpar@18
 | 
    40  | 
% The texinfo.tex in any given Texinfo distribution could well be out
  | 
| 
alpar@18
 | 
    41  | 
% of date, so if that's what you're using, please check.
  | 
| 
alpar@18
 | 
    42  | 
%
  | 
| 
alpar@18
 | 
    43  | 
% Send bug reports to bug-texinfo@gnu.org.  Please include including a
  | 
| 
alpar@18
 | 
    44  | 
% complete document in each bug report with which we can reproduce the
  | 
| 
alpar@18
 | 
    45  | 
% problem.  Patches are, of course, greatly appreciated.
  | 
| 
alpar@18
 | 
    46  | 
%
  | 
| 
alpar@18
 | 
    47  | 
% To process a Texinfo manual with TeX, it's most reliable to use the
  | 
| 
alpar@18
 | 
    48  | 
% texi2dvi shell script that comes with the distribution.  For a simple
  | 
| 
alpar@18
 | 
    49  | 
% manual foo.texi, however, you can get away with this:
  | 
| 
alpar@18
 | 
    50  | 
%   tex foo.texi
  | 
| 
alpar@18
 | 
    51  | 
%   texindex foo.??
  | 
| 
alpar@18
 | 
    52  | 
%   tex foo.texi
  | 
| 
alpar@18
 | 
    53  | 
%   tex foo.texi
  | 
| 
alpar@18
 | 
    54  | 
%   dvips foo.dvi -o  # or whatever; this makes foo.ps.
  | 
| 
alpar@18
 | 
    55  | 
% The extra TeX runs get the cross-reference information correct.
  | 
| 
alpar@18
 | 
    56  | 
% Sometimes one run after texindex suffices, and sometimes you need more
  | 
| 
alpar@18
 | 
    57  | 
% than two; texi2dvi does it as many times as necessary.
  | 
| 
alpar@18
 | 
    58  | 
%
  | 
| 
alpar@18
 | 
    59  | 
% It is possible to adapt texinfo.tex for other languages, to some
  | 
| 
alpar@18
 | 
    60  | 
% extent.  You can get the existing language-specific files from the
  | 
| 
alpar@18
 | 
    61  | 
% full Texinfo distribution.
  | 
| 
alpar@18
 | 
    62  | 
  | 
| 
alpar@18
 | 
    63  | 
\message{Loading texinfo [version \texinfoversion]:}
 | 
| 
alpar@18
 | 
    64  | 
  | 
| 
alpar@18
 | 
    65  | 
% If in a .fmt file, print the version number
  | 
| 
alpar@18
 | 
    66  | 
% and turn on active characters that we couldn't do earlier because
  | 
| 
alpar@18
 | 
    67  | 
% they might have appeared in the input file name.
  | 
| 
alpar@18
 | 
    68  | 
\everyjob{\message{[Texinfo version \texinfoversion]}%
 | 
| 
alpar@18
 | 
    69  | 
  \catcode`+=\active \catcode`\_=\active}
  | 
| 
alpar@18
 | 
    70  | 
  | 
| 
alpar@18
 | 
    71  | 
\message{Basics,}
 | 
| 
alpar@18
 | 
    72  | 
\chardef\other=12
  | 
| 
alpar@18
 | 
    73  | 
  | 
| 
alpar@18
 | 
    74  | 
% We never want plain's \outer definition of \+ in Texinfo.
  | 
| 
alpar@18
 | 
    75  | 
% For @tex, we can use \tabalign.
  | 
| 
alpar@18
 | 
    76  | 
\let\+ = \relax
  | 
| 
alpar@18
 | 
    77  | 
  | 
| 
alpar@18
 | 
    78  | 
% Save some plain tex macros whose names we will redefine.
  | 
| 
alpar@18
 | 
    79  | 
\let\ptexb=\b
  | 
| 
alpar@18
 | 
    80  | 
\let\ptexbullet=\bullet
  | 
| 
alpar@18
 | 
    81  | 
\let\ptexc=\c
  | 
| 
alpar@18
 | 
    82  | 
\let\ptexcomma=\,
  | 
| 
alpar@18
 | 
    83  | 
\let\ptexdot=\.
  | 
| 
alpar@18
 | 
    84  | 
\let\ptexdots=\dots
  | 
| 
alpar@18
 | 
    85  | 
\let\ptexend=\end
  | 
| 
alpar@18
 | 
    86  | 
\let\ptexequiv=\equiv
  | 
| 
alpar@18
 | 
    87  | 
\let\ptexexclam=\!
  | 
| 
alpar@18
 | 
    88  | 
\let\ptexgtr=>
  | 
| 
alpar@18
 | 
    89  | 
\let\ptexhat=^
  | 
| 
alpar@18
 | 
    90  | 
\let\ptexi=\i
  | 
| 
alpar@18
 | 
    91  | 
\let\ptexindent=\indent
  | 
| 
alpar@18
 | 
    92  | 
\let\ptexlbrace=\{
 | 
| 
alpar@18
 | 
    93  | 
\let\ptexless=<
  | 
| 
alpar@18
 | 
    94  | 
\let\ptexplus=+
  | 
| 
alpar@18
 | 
    95  | 
\let\ptexrbrace=\}
  | 
| 
alpar@18
 | 
    96  | 
\let\ptexslash=\/
  | 
| 
alpar@18
 | 
    97  | 
\let\ptexstar=\*
  | 
| 
alpar@18
 | 
    98  | 
\let\ptext=\t
  | 
| 
alpar@18
 | 
    99  | 
  | 
| 
alpar@18
 | 
   100  | 
% If this character appears in an error message or help string, it
  | 
| 
alpar@18
 | 
   101  | 
% starts a new line in the output.
  | 
| 
alpar@18
 | 
   102  | 
\newlinechar = `^^J
  | 
| 
alpar@18
 | 
   103  | 
  | 
| 
alpar@18
 | 
   104  | 
% Set up fixed words for English if not already set.
  | 
| 
alpar@18
 | 
   105  | 
\ifx\putwordAppendix\undefined  \gdef\putwordAppendix{Appendix}\fi
 | 
| 
alpar@18
 | 
   106  | 
\ifx\putwordChapter\undefined   \gdef\putwordChapter{Chapter}\fi
 | 
| 
alpar@18
 | 
   107  | 
\ifx\putwordfile\undefined      \gdef\putwordfile{file}\fi
 | 
| 
alpar@18
 | 
   108  | 
\ifx\putwordin\undefined        \gdef\putwordin{in}\fi
 | 
| 
alpar@18
 | 
   109  | 
\ifx\putwordIndexIsEmpty\undefined     \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
 | 
| 
alpar@18
 | 
   110  | 
\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
 | 
| 
alpar@18
 | 
   111  | 
\ifx\putwordInfo\undefined      \gdef\putwordInfo{Info}\fi
 | 
| 
alpar@18
 | 
   112  | 
\ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
 | 
| 
alpar@18
 | 
   113  | 
\ifx\putwordMethodon\undefined  \gdef\putwordMethodon{Method on}\fi
 | 
| 
alpar@18
 | 
   114  | 
\ifx\putwordNoTitle\undefined   \gdef\putwordNoTitle{No Title}\fi
 | 
| 
alpar@18
 | 
   115  | 
\ifx\putwordof\undefined        \gdef\putwordof{of}\fi
 | 
| 
alpar@18
 | 
   116  | 
\ifx\putwordon\undefined        \gdef\putwordon{on}\fi
 | 
| 
alpar@18
 | 
   117  | 
\ifx\putwordpage\undefined      \gdef\putwordpage{page}\fi
 | 
| 
alpar@18
 | 
   118  | 
\ifx\putwordsection\undefined   \gdef\putwordsection{section}\fi
 | 
| 
alpar@18
 | 
   119  | 
\ifx\putwordSection\undefined   \gdef\putwordSection{Section}\fi
 | 
| 
alpar@18
 | 
   120  | 
\ifx\putwordsee\undefined       \gdef\putwordsee{see}\fi
 | 
| 
alpar@18
 | 
   121  | 
\ifx\putwordSee\undefined       \gdef\putwordSee{See}\fi
 | 
| 
alpar@18
 | 
   122  | 
\ifx\putwordShortTOC\undefined  \gdef\putwordShortTOC{Short Contents}\fi
 | 
| 
alpar@18
 | 
   123  | 
\ifx\putwordTOC\undefined       \gdef\putwordTOC{Table of Contents}\fi
 | 
| 
alpar@18
 | 
   124  | 
%
  | 
| 
alpar@18
 | 
   125  | 
\ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
 | 
| 
alpar@18
 | 
   126  | 
\ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
 | 
| 
alpar@18
 | 
   127  | 
\ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
 | 
| 
alpar@18
 | 
   128  | 
\ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
 | 
| 
alpar@18
 | 
   129  | 
\ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
 | 
| 
alpar@18
 | 
   130  | 
\ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
 | 
| 
alpar@18
 | 
   131  | 
\ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
 | 
| 
alpar@18
 | 
   132  | 
\ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
 | 
| 
alpar@18
 | 
   133  | 
\ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
 | 
| 
alpar@18
 | 
   134  | 
\ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
 | 
| 
alpar@18
 | 
   135  | 
\ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
 | 
| 
alpar@18
 | 
   136  | 
\ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
 | 
| 
alpar@18
 | 
   137  | 
%
  | 
| 
alpar@18
 | 
   138  | 
\ifx\putwordDefmac\undefined    \gdef\putwordDefmac{Macro}\fi
 | 
| 
alpar@18
 | 
   139  | 
\ifx\putwordDefspec\undefined   \gdef\putwordDefspec{Special Form}\fi
 | 
| 
alpar@18
 | 
   140  | 
\ifx\putwordDefvar\undefined    \gdef\putwordDefvar{Variable}\fi
 | 
| 
alpar@18
 | 
   141  | 
\ifx\putwordDefopt\undefined    \gdef\putwordDefopt{User Option}\fi
 | 
| 
alpar@18
 | 
   142  | 
\ifx\putwordDeftypevar\undefined\gdef\putwordDeftypevar{Variable}\fi
 | 
| 
alpar@18
 | 
   143  | 
\ifx\putwordDeffunc\undefined   \gdef\putwordDeffunc{Function}\fi
 | 
| 
alpar@18
 | 
   144  | 
\ifx\putwordDeftypefun\undefined\gdef\putwordDeftypefun{Function}\fi
 | 
| 
alpar@18
 | 
   145  | 
  | 
| 
alpar@18
 | 
   146  | 
% In some macros, we cannot use the `\? notation---the left quote is
  | 
| 
alpar@18
 | 
   147  | 
% in some cases the escape char.
  | 
| 
alpar@18
 | 
   148  | 
\chardef\colonChar = `\:
  | 
| 
alpar@18
 | 
   149  | 
\chardef\commaChar = `\,
  | 
| 
alpar@18
 | 
   150  | 
\chardef\dotChar   = `\.
  | 
| 
alpar@18
 | 
   151  | 
\chardef\equalChar = `\=
  | 
| 
alpar@18
 | 
   152  | 
\chardef\exclamChar= `\!
  | 
| 
alpar@18
 | 
   153  | 
\chardef\questChar = `\?
  | 
| 
alpar@18
 | 
   154  | 
\chardef\semiChar  = `\;
  | 
| 
alpar@18
 | 
   155  | 
\chardef\spaceChar = `\ %
  | 
| 
alpar@18
 | 
   156  | 
\chardef\underChar = `\_
  | 
| 
alpar@18
 | 
   157  | 
  | 
| 
alpar@18
 | 
   158  | 
% Ignore a token.
  | 
| 
alpar@18
 | 
   159  | 
%
  | 
| 
alpar@18
 | 
   160  | 
\def\gobble#1{}
 | 
| 
alpar@18
 | 
   161  | 
  | 
| 
alpar@18
 | 
   162  | 
% True if #1 is the empty string, i.e., called like `\ifempty{}'.
 | 
| 
alpar@18
 | 
   163  | 
%
  | 
| 
alpar@18
 | 
   164  | 
\def\ifempty#1{\ifemptyx #1\emptymarkA\emptymarkB}%
 | 
| 
alpar@18
 | 
   165  | 
\def\ifemptyx#1#2\emptymarkB{\ifx #1\emptymarkA}%
 | 
| 
alpar@18
 | 
   166  | 
  | 
| 
alpar@18
 | 
   167  | 
% Hyphenation fixes.
  | 
| 
alpar@18
 | 
   168  | 
\hyphenation{ap-pen-dix}
 | 
| 
alpar@18
 | 
   169  | 
\hyphenation{eshell}
 | 
| 
alpar@18
 | 
   170  | 
\hyphenation{mini-buf-fer mini-buf-fers}
 | 
| 
alpar@18
 | 
   171  | 
\hyphenation{time-stamp}
 | 
| 
alpar@18
 | 
   172  | 
\hyphenation{white-space}
 | 
| 
alpar@18
 | 
   173  | 
  | 
| 
alpar@18
 | 
   174  | 
% Margin to add to right of even pages, to left of odd pages.
  | 
| 
alpar@18
 | 
   175  | 
\newdimen\bindingoffset
  | 
| 
alpar@18
 | 
   176  | 
\newdimen\normaloffset
  | 
| 
alpar@18
 | 
   177  | 
\newdimen\pagewidth \newdimen\pageheight
  | 
| 
alpar@18
 | 
   178  | 
  | 
| 
alpar@18
 | 
   179  | 
% Sometimes it is convenient to have everything in the transcript file
  | 
| 
alpar@18
 | 
   180  | 
% and nothing on the terminal.  We don't just call \tracingall here,
  | 
| 
alpar@18
 | 
   181  | 
% since that produces some useless output on the terminal.  We also make
  | 
| 
alpar@18
 | 
   182  | 
% some effort to order the tracing commands to reduce output in the log
  | 
| 
alpar@18
 | 
   183  | 
% file; cf. trace.sty in LaTeX.
  | 
| 
alpar@18
 | 
   184  | 
%
  | 
| 
alpar@18
 | 
   185  | 
\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
 | 
| 
alpar@18
 | 
   186  | 
\def\loggingall{%
 | 
| 
alpar@18
 | 
   187  | 
  \tracingstats2
  | 
| 
alpar@18
 | 
   188  | 
  \tracingpages1
  | 
| 
alpar@18
 | 
   189  | 
  \tracinglostchars2  % 2 gives us more in etex
  | 
| 
alpar@18
 | 
   190  | 
  \tracingparagraphs1
  | 
| 
alpar@18
 | 
   191  | 
  \tracingoutput1
  | 
| 
alpar@18
 | 
   192  | 
  \tracingmacros2
  | 
| 
alpar@18
 | 
   193  | 
  \tracingrestores1
  | 
| 
alpar@18
 | 
   194  | 
  \showboxbreadth\maxdimen \showboxdepth\maxdimen
  | 
| 
alpar@18
 | 
   195  | 
  \ifx\eTeXversion\undefined\else % etex gives us more logging
  | 
| 
alpar@18
 | 
   196  | 
    \tracingscantokens1
  | 
| 
alpar@18
 | 
   197  | 
    \tracingifs1
  | 
| 
alpar@18
 | 
   198  | 
    \tracinggroups1
  | 
| 
alpar@18
 | 
   199  | 
    \tracingnesting2
  | 
| 
alpar@18
 | 
   200  | 
    \tracingassigns1
  | 
| 
alpar@18
 | 
   201  | 
  \fi
  | 
| 
alpar@18
 | 
   202  | 
  \tracingcommands3  % 3 gives us more in etex
  | 
| 
alpar@18
 | 
   203  | 
  \errorcontextlines\maxdimen
  | 
| 
alpar@18
 | 
   204  | 
}%
  | 
| 
alpar@18
 | 
   205  | 
  | 
| 
alpar@18
 | 
   206  | 
% add check for \lastpenalty to plain's definitions.  If the last thing
  | 
| 
alpar@18
 | 
   207  | 
% we did was a \nobreak, we don't want to insert more space.
  | 
| 
alpar@18
 | 
   208  | 
%
  | 
| 
alpar@18
 | 
   209  | 
\def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount
 | 
| 
alpar@18
 | 
   210  | 
  \removelastskip\penalty-50\smallskip\fi\fi}
  | 
| 
alpar@18
 | 
   211  | 
\def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount
 | 
| 
alpar@18
 | 
   212  | 
  \removelastskip\penalty-100\medskip\fi\fi}
  | 
| 
alpar@18
 | 
   213  | 
\def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
 | 
| 
alpar@18
 | 
   214  | 
  \removelastskip\penalty-200\bigskip\fi\fi}
  | 
| 
alpar@18
 | 
   215  | 
  | 
| 
alpar@18
 | 
   216  | 
% For @cropmarks command.
  | 
| 
alpar@18
 | 
   217  | 
% Do @cropmarks to get crop marks.
  | 
| 
alpar@18
 | 
   218  | 
%
  | 
| 
alpar@18
 | 
   219  | 
\newif\ifcropmarks
  | 
| 
alpar@18
 | 
   220  | 
\let\cropmarks = \cropmarkstrue
  | 
| 
alpar@18
 | 
   221  | 
%
  | 
| 
alpar@18
 | 
   222  | 
% Dimensions to add cropmarks at corners.
  | 
| 
alpar@18
 | 
   223  | 
% Added by P. A. MacKay, 12 Nov. 1986
  | 
| 
alpar@18
 | 
   224  | 
%
  | 
| 
alpar@18
 | 
   225  | 
\newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
  | 
| 
alpar@18
 | 
   226  | 
\newdimen\cornerlong  \cornerlong=1pc
  | 
| 
alpar@18
 | 
   227  | 
\newdimen\cornerthick \cornerthick=.3pt
  | 
| 
alpar@18
 | 
   228  | 
\newdimen\topandbottommargin \topandbottommargin=.75in
  | 
| 
alpar@18
 | 
   229  | 
  | 
| 
alpar@18
 | 
   230  | 
% Main output routine.
  | 
| 
alpar@18
 | 
   231  | 
\chardef\PAGE = 255
  | 
| 
alpar@18
 | 
   232  | 
\output = {\onepageout{\pagecontents\PAGE}}
 | 
| 
alpar@18
 | 
   233  | 
  | 
| 
alpar@18
 | 
   234  | 
\newbox\headlinebox
  | 
| 
alpar@18
 | 
   235  | 
\newbox\footlinebox
  | 
| 
alpar@18
 | 
   236  | 
  | 
| 
alpar@18
 | 
   237  | 
% \onepageout takes a vbox as an argument.  Note that \pagecontents
  | 
| 
alpar@18
 | 
   238  | 
% does insertions, but you have to call it yourself.
  | 
| 
alpar@18
 | 
   239  | 
\def\onepageout#1{%
 | 
| 
alpar@18
 | 
   240  | 
  \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
  | 
| 
alpar@18
 | 
   241  | 
  %
  | 
| 
alpar@18
 | 
   242  | 
  \ifodd\pageno  \advance\hoffset by \bindingoffset
  | 
| 
alpar@18
 | 
   243  | 
  \else \advance\hoffset by -\bindingoffset\fi
  | 
| 
alpar@18
 | 
   244  | 
  %
  | 
| 
alpar@18
 | 
   245  | 
  % Do this outside of the \shipout so @code etc. will be expanded in
  | 
| 
alpar@18
 | 
   246  | 
  % the headline as they should be, not taken literally (outputting ''code).
  | 
| 
alpar@18
 | 
   247  | 
  \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}%
 | 
| 
alpar@18
 | 
   248  | 
  \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}%
 | 
| 
alpar@18
 | 
   249  | 
  %
  | 
| 
alpar@18
 | 
   250  | 
  {%
 | 
| 
alpar@18
 | 
   251  | 
    % Have to do this stuff outside the \shipout because we want it to
  | 
| 
alpar@18
 | 
   252  | 
    % take effect in \write's, yet the group defined by the \vbox ends
  | 
| 
alpar@18
 | 
   253  | 
    % before the \shipout runs.
  | 
| 
alpar@18
 | 
   254  | 
    %
  | 
| 
alpar@18
 | 
   255  | 
    \escapechar = `\\     % use backslash in output files.
  | 
| 
alpar@18
 | 
   256  | 
    \indexdummies         % don't expand commands in the output.
  | 
| 
alpar@18
 | 
   257  | 
    \normalturnoffactive  % \ in index entries must not stay \, e.g., if
  | 
| 
alpar@18
 | 
   258  | 
                   % the page break happens to be in the middle of an example.
  | 
| 
alpar@18
 | 
   259  | 
    \shipout\vbox{%
 | 
| 
alpar@18
 | 
   260  | 
      % Do this early so pdf references go to the beginning of the page.
  | 
| 
alpar@18
 | 
   261  | 
      \ifpdfmakepagedest \pdfmkdest{\the\pageno} \fi
 | 
| 
alpar@18
 | 
   262  | 
      %
  | 
| 
alpar@18
 | 
   263  | 
      \ifcropmarks \vbox to \outervsize\bgroup
  | 
| 
alpar@18
 | 
   264  | 
        \hsize = \outerhsize
  | 
| 
alpar@18
 | 
   265  | 
        \vskip-\topandbottommargin
  | 
| 
alpar@18
 | 
   266  | 
        \vtop to0pt{%
 | 
| 
alpar@18
 | 
   267  | 
          \line{\ewtop\hfil\ewtop}%
 | 
| 
alpar@18
 | 
   268  | 
          \nointerlineskip
  | 
| 
alpar@18
 | 
   269  | 
          \line{%
 | 
| 
alpar@18
 | 
   270  | 
            \vbox{\moveleft\cornerthick\nstop}%
 | 
| 
alpar@18
 | 
   271  | 
            \hfill
  | 
| 
alpar@18
 | 
   272  | 
            \vbox{\moveright\cornerthick\nstop}%
 | 
| 
alpar@18
 | 
   273  | 
          }%
  | 
| 
alpar@18
 | 
   274  | 
          \vss}%
  | 
| 
alpar@18
 | 
   275  | 
        \vskip\topandbottommargin
  | 
| 
alpar@18
 | 
   276  | 
        \line\bgroup
  | 
| 
alpar@18
 | 
   277  | 
          \hfil % center the page within the outer (page) hsize.
  | 
| 
alpar@18
 | 
   278  | 
          \ifodd\pageno\hskip\bindingoffset\fi
  | 
| 
alpar@18
 | 
   279  | 
          \vbox\bgroup
  | 
| 
alpar@18
 | 
   280  | 
      \fi
  | 
| 
alpar@18
 | 
   281  | 
      %
  | 
| 
alpar@18
 | 
   282  | 
      \unvbox\headlinebox
  | 
| 
alpar@18
 | 
   283  | 
      \pagebody{#1}%
 | 
| 
alpar@18
 | 
   284  | 
      \ifdim\ht\footlinebox > 0pt
  | 
| 
alpar@18
 | 
   285  | 
        % Only leave this space if the footline is nonempty.
  | 
| 
alpar@18
 | 
   286  | 
        % (We lessened \vsize for it in \oddfootingxxx.)
  | 
| 
alpar@18
 | 
   287  | 
        % The \baselineskip=24pt in plain's \makefootline has no effect.
  | 
| 
alpar@18
 | 
   288  | 
        \vskip 2\baselineskip
  | 
| 
alpar@18
 | 
   289  | 
        \unvbox\footlinebox
  | 
| 
alpar@18
 | 
   290  | 
      \fi
  | 
| 
alpar@18
 | 
   291  | 
      %
  | 
| 
alpar@18
 | 
   292  | 
      \ifcropmarks
  | 
| 
alpar@18
 | 
   293  | 
          \egroup % end of \vbox\bgroup
  | 
| 
alpar@18
 | 
   294  | 
        \hfil\egroup % end of (centering) \line\bgroup
  | 
| 
alpar@18
 | 
   295  | 
        \vskip\topandbottommargin plus1fill minus1fill
  | 
| 
alpar@18
 | 
   296  | 
        \boxmaxdepth = \cornerthick
  | 
| 
alpar@18
 | 
   297  | 
        \vbox to0pt{\vss
 | 
| 
alpar@18
 | 
   298  | 
          \line{%
 | 
| 
alpar@18
 | 
   299  | 
            \vbox{\moveleft\cornerthick\nsbot}%
 | 
| 
alpar@18
 | 
   300  | 
            \hfill
  | 
| 
alpar@18
 | 
   301  | 
            \vbox{\moveright\cornerthick\nsbot}%
 | 
| 
alpar@18
 | 
   302  | 
          }%
  | 
| 
alpar@18
 | 
   303  | 
          \nointerlineskip
  | 
| 
alpar@18
 | 
   304  | 
          \line{\ewbot\hfil\ewbot}%
 | 
| 
alpar@18
 | 
   305  | 
        }%
  | 
| 
alpar@18
 | 
   306  | 
      \egroup % \vbox from first cropmarks clause
  | 
| 
alpar@18
 | 
   307  | 
      \fi
  | 
| 
alpar@18
 | 
   308  | 
    }% end of \shipout\vbox
  | 
| 
alpar@18
 | 
   309  | 
  }% end of group with \normalturnoffactive
  | 
| 
alpar@18
 | 
   310  | 
  \advancepageno
  | 
| 
alpar@18
 | 
   311  | 
  \ifnum\outputpenalty>-20000 \else\dosupereject\fi
  | 
| 
alpar@18
 | 
   312  | 
}
  | 
| 
alpar@18
 | 
   313  | 
  | 
| 
alpar@18
 | 
   314  | 
\newinsert\margin \dimen\margin=\maxdimen
  | 
| 
alpar@18
 | 
   315  | 
  | 
| 
alpar@18
 | 
   316  | 
\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
 | 
| 
alpar@18
 | 
   317  | 
{\catcode`\@ =11
 | 
| 
alpar@18
 | 
   318  | 
\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
 | 
| 
alpar@18
 | 
   319  | 
% marginal hacks, juha@viisa.uucp (Juha Takala)
  | 
| 
alpar@18
 | 
   320  | 
\ifvoid\margin\else % marginal info is present
  | 
| 
alpar@18
 | 
   321  | 
  \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
 | 
| 
alpar@18
 | 
   322  | 
\dimen@=\dp#1 \unvbox#1
  | 
| 
alpar@18
 | 
   323  | 
\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
  | 
| 
alpar@18
 | 
   324  | 
\ifr@ggedbottom \kern-\dimen@ \vfil \fi}
  | 
| 
alpar@18
 | 
   325  | 
}
  | 
| 
alpar@18
 | 
   326  | 
  | 
| 
alpar@18
 | 
   327  | 
% Here are the rules for the cropmarks.  Note that they are
  | 
| 
alpar@18
 | 
   328  | 
% offset so that the space between them is truly \outerhsize or \outervsize
  | 
| 
alpar@18
 | 
   329  | 
% (P. A. MacKay, 12 November, 1986)
  | 
| 
alpar@18
 | 
   330  | 
%
  | 
| 
alpar@18
 | 
   331  | 
\def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
 | 
| 
alpar@18
 | 
   332  | 
\def\nstop{\vbox
 | 
| 
alpar@18
 | 
   333  | 
  {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
 | 
| 
alpar@18
 | 
   334  | 
\def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
 | 
| 
alpar@18
 | 
   335  | 
\def\nsbot{\vbox
 | 
| 
alpar@18
 | 
   336  | 
  {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
 | 
| 
alpar@18
 | 
   337  | 
  | 
| 
alpar@18
 | 
   338  | 
% Parse an argument, then pass it to #1.  The argument is the rest of
  | 
| 
alpar@18
 | 
   339  | 
% the input line (except we remove a trailing comment).  #1 should be a
  | 
| 
alpar@18
 | 
   340  | 
% macro which expects an ordinary undelimited TeX argument.
  | 
| 
alpar@18
 | 
   341  | 
%
  | 
| 
alpar@18
 | 
   342  | 
\def\parsearg#1{%
 | 
| 
alpar@18
 | 
   343  | 
  \let\next = #1%
  | 
| 
alpar@18
 | 
   344  | 
  \begingroup
  | 
| 
alpar@18
 | 
   345  | 
    \obeylines
  | 
| 
alpar@18
 | 
   346  | 
    \futurelet\temp\parseargx
  | 
| 
alpar@18
 | 
   347  | 
}
  | 
| 
alpar@18
 | 
   348  | 
  | 
| 
alpar@18
 | 
   349  | 
% If the next token is an obeyed space (from an @example environment or
  | 
| 
alpar@18
 | 
   350  | 
% the like), remove it and recurse.  Otherwise, we're done.
  | 
| 
alpar@18
 | 
   351  | 
\def\parseargx{%
 | 
| 
alpar@18
 | 
   352  | 
  % \obeyedspace is defined far below, after the definition of \sepspaces.
  | 
| 
alpar@18
 | 
   353  | 
  \ifx\obeyedspace\temp
  | 
| 
alpar@18
 | 
   354  | 
    \expandafter\parseargdiscardspace
  | 
| 
alpar@18
 | 
   355  | 
  \else
  | 
| 
alpar@18
 | 
   356  | 
    \expandafter\parseargline
  | 
| 
alpar@18
 | 
   357  | 
  \fi
  | 
| 
alpar@18
 | 
   358  | 
}
  | 
| 
alpar@18
 | 
   359  | 
  | 
| 
alpar@18
 | 
   360  | 
% Remove a single space (as the delimiter token to the macro call).
  | 
| 
alpar@18
 | 
   361  | 
{\obeyspaces %
 | 
| 
alpar@18
 | 
   362  | 
 \gdef\parseargdiscardspace {\futurelet\temp\parseargx}}
 | 
| 
alpar@18
 | 
   363  | 
  | 
| 
alpar@18
 | 
   364  | 
{\obeylines %
 | 
| 
alpar@18
 | 
   365  | 
  \gdef\parseargline#1^^M{%
 | 
| 
alpar@18
 | 
   366  | 
    \endgroup % End of the group started in \parsearg.
  | 
| 
alpar@18
 | 
   367  | 
    %
  | 
| 
alpar@18
 | 
   368  | 
    % First remove any @c comment, then any @comment.
  | 
| 
alpar@18
 | 
   369  | 
    % Result of each macro is put in \toks0.
  | 
| 
alpar@18
 | 
   370  | 
    \argremovec #1\c\relax %
  | 
| 
alpar@18
 | 
   371  | 
    \expandafter\argremovecomment \the\toks0 \comment\relax %
  | 
| 
alpar@18
 | 
   372  | 
    %
  | 
| 
alpar@18
 | 
   373  | 
    % Call the caller's macro, saved as \next in \parsearg.
  | 
| 
alpar@18
 | 
   374  | 
    \expandafter\next\expandafter{\the\toks0}%
 | 
| 
alpar@18
 | 
   375  | 
  }%
  | 
| 
alpar@18
 | 
   376  | 
}
  | 
| 
alpar@18
 | 
   377  | 
  | 
| 
alpar@18
 | 
   378  | 
% Since all \c{,omment} does is throw away the argument, we can let TeX
 | 
| 
alpar@18
 | 
   379  | 
% do that for us.  The \relax here is matched by the \relax in the call
  | 
| 
alpar@18
 | 
   380  | 
% in \parseargline; it could be more or less anything, its purpose is
  | 
| 
alpar@18
 | 
   381  | 
% just to delimit the argument to the \c.
  | 
| 
alpar@18
 | 
   382  | 
\def\argremovec#1\c#2\relax{\toks0 = {#1}}
 | 
| 
alpar@18
 | 
   383  | 
\def\argremovecomment#1\comment#2\relax{\toks0 = {#1}}
 | 
| 
alpar@18
 | 
   384  | 
  | 
| 
alpar@18
 | 
   385  | 
% \argremovec{,omment} might leave us with trailing spaces, though; e.g.,
 | 
| 
alpar@18
 | 
   386  | 
%    @end itemize  @c foo
  | 
| 
alpar@18
 | 
   387  | 
% will have two active spaces as part of the argument with the
  | 
| 
alpar@18
 | 
   388  | 
% `itemize'.  Here we remove all active spaces from #1, and assign the
  | 
| 
alpar@18
 | 
   389  | 
% result to \toks0.
  | 
| 
alpar@18
 | 
   390  | 
%
  | 
| 
alpar@18
 | 
   391  | 
% This loses if there are any *other* active characters besides spaces
  | 
| 
alpar@18
 | 
   392  | 
% in the argument -- _ ^ +, for example -- since they get expanded.
  | 
| 
alpar@18
 | 
   393  | 
% Fortunately, Texinfo does not define any such commands.  (If it ever
  | 
| 
alpar@18
 | 
   394  | 
% does, the catcode of the characters in questionwill have to be changed
  | 
| 
alpar@18
 | 
   395  | 
% here.)  But this means we cannot call \removeactivespaces as part of
  | 
| 
alpar@18
 | 
   396  | 
% \argremovec{,omment}, since @c uses \parsearg, and thus the argument
 | 
| 
alpar@18
 | 
   397  | 
% that \parsearg gets might well have any character at all in it.
  | 
| 
alpar@18
 | 
   398  | 
%
  | 
| 
alpar@18
 | 
   399  | 
\def\removeactivespaces#1{%
 | 
| 
alpar@18
 | 
   400  | 
  \begingroup
  | 
| 
alpar@18
 | 
   401  | 
    \ignoreactivespaces
  | 
| 
alpar@18
 | 
   402  | 
    \edef\temp{#1}%
 | 
| 
alpar@18
 | 
   403  | 
    \global\toks0 = \expandafter{\temp}%
 | 
| 
alpar@18
 | 
   404  | 
  \endgroup
  | 
| 
alpar@18
 | 
   405  | 
}
  | 
| 
alpar@18
 | 
   406  | 
  | 
| 
alpar@18
 | 
   407  | 
% Change the active space to expand to nothing.
  | 
| 
alpar@18
 | 
   408  | 
%
  | 
| 
alpar@18
 | 
   409  | 
\begingroup
  | 
| 
alpar@18
 | 
   410  | 
  \obeyspaces
  | 
| 
alpar@18
 | 
   411  | 
  \gdef\ignoreactivespaces{\obeyspaces\let =\empty}
 | 
| 
alpar@18
 | 
   412  | 
\endgroup
  | 
| 
alpar@18
 | 
   413  | 
  | 
| 
alpar@18
 | 
   414  | 
  | 
| 
alpar@18
 | 
   415  | 
\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
 | 
| 
alpar@18
 | 
   416  | 
  | 
| 
alpar@18
 | 
   417  | 
%% These are used to keep @begin/@end levels from running away
  | 
| 
alpar@18
 | 
   418  | 
%% Call \inENV within environments (after a \begingroup)
  | 
| 
alpar@18
 | 
   419  | 
\newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
 | 
| 
alpar@18
 | 
   420  | 
\def\ENVcheck{%
 | 
| 
alpar@18
 | 
   421  | 
\ifENV\errmessage{Still within an environment; press RETURN to continue}
 | 
| 
alpar@18
 | 
   422  | 
\endgroup\fi} % This is not perfect, but it should reduce lossage
  | 
| 
alpar@18
 | 
   423  | 
  | 
| 
alpar@18
 | 
   424  | 
% @begin foo  is the same as @foo, for now.
  | 
| 
alpar@18
 | 
   425  | 
\newhelp\EMsimple{Press RETURN to continue.}
 | 
| 
alpar@18
 | 
   426  | 
  | 
| 
alpar@18
 | 
   427  | 
\outer\def\begin{\parsearg\beginxxx}
 | 
| 
alpar@18
 | 
   428  | 
  | 
| 
alpar@18
 | 
   429  | 
\def\beginxxx #1{%
 | 
| 
alpar@18
 | 
   430  | 
\expandafter\ifx\csname #1\endcsname\relax
  | 
| 
alpar@18
 | 
   431  | 
{\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
 | 
| 
alpar@18
 | 
   432  | 
\csname #1\endcsname\fi}
  | 
| 
alpar@18
 | 
   433  | 
  | 
| 
alpar@18
 | 
   434  | 
% @end foo executes the definition of \Efoo.
  | 
| 
alpar@18
 | 
   435  | 
%
  | 
| 
alpar@18
 | 
   436  | 
\def\end{\parsearg\endxxx}
 | 
| 
alpar@18
 | 
   437  | 
\def\endxxx #1{%
 | 
| 
alpar@18
 | 
   438  | 
  \removeactivespaces{#1}%
 | 
| 
alpar@18
 | 
   439  | 
  \edef\endthing{\the\toks0}%
 | 
| 
alpar@18
 | 
   440  | 
  %
  | 
| 
alpar@18
 | 
   441  | 
  \expandafter\ifx\csname E\endthing\endcsname\relax
  | 
| 
alpar@18
 | 
   442  | 
    \expandafter\ifx\csname \endthing\endcsname\relax
  | 
| 
alpar@18
 | 
   443  | 
      % There's no \foo, i.e., no ``environment'' foo.
  | 
| 
alpar@18
 | 
   444  | 
      \errhelp = \EMsimple
  | 
| 
alpar@18
 | 
   445  | 
      \errmessage{Undefined command `@end \endthing'}%
 | 
| 
alpar@18
 | 
   446  | 
    \else
  | 
| 
alpar@18
 | 
   447  | 
      \unmatchedenderror\endthing
  | 
| 
alpar@18
 | 
   448  | 
    \fi
  | 
| 
alpar@18
 | 
   449  | 
  \else
  | 
| 
alpar@18
 | 
   450  | 
    % Everything's ok; the right environment has been started.
  | 
| 
alpar@18
 | 
   451  | 
    \csname E\endthing\endcsname
  | 
| 
alpar@18
 | 
   452  | 
  \fi
  | 
| 
alpar@18
 | 
   453  | 
}
  | 
| 
alpar@18
 | 
   454  | 
  | 
| 
alpar@18
 | 
   455  | 
% There is an environment #1, but it hasn't been started.  Give an error.
  | 
| 
alpar@18
 | 
   456  | 
%
  | 
| 
alpar@18
 | 
   457  | 
\def\unmatchedenderror#1{%
 | 
| 
alpar@18
 | 
   458  | 
  \errhelp = \EMsimple
  | 
| 
alpar@18
 | 
   459  | 
  \errmessage{This `@end #1' doesn't have a matching `@#1'}%
 | 
| 
alpar@18
 | 
   460  | 
}
  | 
| 
alpar@18
 | 
   461  | 
  | 
| 
alpar@18
 | 
   462  | 
% Define the control sequence \E#1 to give an unmatched @end error.
  | 
| 
alpar@18
 | 
   463  | 
%
  | 
| 
alpar@18
 | 
   464  | 
\def\defineunmatchedend#1{%
 | 
| 
alpar@18
 | 
   465  | 
  \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}%
 | 
| 
alpar@18
 | 
   466  | 
}
  | 
| 
alpar@18
 | 
   467  | 
  | 
| 
alpar@18
 | 
   468  | 
  | 
| 
alpar@18
 | 
   469  | 
%% Simple single-character @ commands
  | 
| 
alpar@18
 | 
   470  | 
  | 
| 
alpar@18
 | 
   471  | 
% @@ prints an @
  | 
| 
alpar@18
 | 
   472  | 
% Kludge this until the fonts are right (grr).
  | 
| 
alpar@18
 | 
   473  | 
\def\@{{\tt\char64}}
 | 
| 
alpar@18
 | 
   474  | 
  | 
| 
alpar@18
 | 
   475  | 
% This is turned off because it was never documented
  | 
| 
alpar@18
 | 
   476  | 
% and you can use @w{...} around a quote to suppress ligatures.
 | 
| 
alpar@18
 | 
   477  | 
%% Define @` and @' to be the same as ` and '
  | 
| 
alpar@18
 | 
   478  | 
%% but suppressing ligatures.
  | 
| 
alpar@18
 | 
   479  | 
%\def\`{{`}}
 | 
| 
alpar@18
 | 
   480  | 
%\def\'{{'}}
 | 
| 
alpar@18
 | 
   481  | 
  | 
| 
alpar@18
 | 
   482  | 
% Used to generate quoted braces.
  | 
| 
alpar@18
 | 
   483  | 
\def\mylbrace {{\tt\char123}}
 | 
| 
alpar@18
 | 
   484  | 
\def\myrbrace {{\tt\char125}}
 | 
| 
alpar@18
 | 
   485  | 
\let\{=\mylbrace
 | 
| 
alpar@18
 | 
   486  | 
\let\}=\myrbrace
  | 
| 
alpar@18
 | 
   487  | 
\begingroup
  | 
| 
alpar@18
 | 
   488  | 
  % Definitions to produce \{ and \} commands for indices,
 | 
| 
alpar@18
 | 
   489  | 
  % and @{ and @} for the aux file.
 | 
| 
alpar@18
 | 
   490  | 
  \catcode`\{ = \other \catcode`\} = \other
 | 
| 
alpar@18
 | 
   491  | 
  \catcode`\[ = 1 \catcode`\] = 2
  | 
| 
alpar@18
 | 
   492  | 
  \catcode`\! = 0 \catcode`\\ = \other
  | 
| 
alpar@18
 | 
   493  | 
  !gdef!lbracecmd[\{]%
 | 
| 
alpar@18
 | 
   494  | 
  !gdef!rbracecmd[\}]%
  | 
| 
alpar@18
 | 
   495  | 
  !gdef!lbraceatcmd[@{]%
 | 
| 
alpar@18
 | 
   496  | 
  !gdef!rbraceatcmd[@}]%
  | 
| 
alpar@18
 | 
   497  | 
!endgroup
  | 
| 
alpar@18
 | 
   498  | 
  | 
| 
alpar@18
 | 
   499  | 
% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
  | 
| 
alpar@18
 | 
   500  | 
% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
  | 
| 
alpar@18
 | 
   501  | 
\let\, = \c
  | 
| 
alpar@18
 | 
   502  | 
\let\dotaccent = \.
  | 
| 
alpar@18
 | 
   503  | 
\def\ringaccent#1{{\accent23 #1}}
 | 
| 
alpar@18
 | 
   504  | 
\let\tieaccent = \t
  | 
| 
alpar@18
 | 
   505  | 
\let\ubaraccent = \b
  | 
| 
alpar@18
 | 
   506  | 
\let\udotaccent = \d
  | 
| 
alpar@18
 | 
   507  | 
  | 
| 
alpar@18
 | 
   508  | 
% Other special characters: @questiondown @exclamdown
  | 
| 
alpar@18
 | 
   509  | 
% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
  | 
| 
alpar@18
 | 
   510  | 
\def\questiondown{?`}
 | 
| 
alpar@18
 | 
   511  | 
\def\exclamdown{!`}
 | 
| 
alpar@18
 | 
   512  | 
  | 
| 
alpar@18
 | 
   513  | 
% Dotless i and dotless j, used for accents.
  | 
| 
alpar@18
 | 
   514  | 
\def\imacro{i}
 | 
| 
alpar@18
 | 
   515  | 
\def\jmacro{j}
 | 
| 
alpar@18
 | 
   516  | 
\def\dotless#1{%
 | 
| 
alpar@18
 | 
   517  | 
  \def\temp{#1}%
 | 
| 
alpar@18
 | 
   518  | 
  \ifx\temp\imacro \ptexi
  | 
| 
alpar@18
 | 
   519  | 
  \else\ifx\temp\jmacro \j
  | 
| 
alpar@18
 | 
   520  | 
  \else \errmessage{@dotless can be used only with i or j}%
 | 
| 
alpar@18
 | 
   521  | 
  \fi\fi
  | 
| 
alpar@18
 | 
   522  | 
}
  | 
| 
alpar@18
 | 
   523  | 
  | 
| 
alpar@18
 | 
   524  | 
% Be sure we're in horizontal mode when doing a tie, since we make space
  | 
| 
alpar@18
 | 
   525  | 
% equivalent to this in @example-like environments. Otherwise, a space
  | 
| 
alpar@18
 | 
   526  | 
% at the beginning of a line will start with \penalty -- and
  | 
| 
alpar@18
 | 
   527  | 
% since \penalty is valid in vertical mode, we'd end up putting the
  | 
| 
alpar@18
 | 
   528  | 
% penalty on the vertical list instead of in the new paragraph.
  | 
| 
alpar@18
 | 
   529  | 
{\catcode`@ = 11
 | 
| 
alpar@18
 | 
   530  | 
 % Avoid using \@M directly, because that causes trouble
  | 
| 
alpar@18
 | 
   531  | 
 % if the definition is written into an index file.
  | 
| 
alpar@18
 | 
   532  | 
 \global\let\tiepenalty = \@M
  | 
| 
alpar@18
 | 
   533  | 
 \gdef\tie{\leavevmode\penalty\tiepenalty\ }
 | 
| 
alpar@18
 | 
   534  | 
}
  | 
| 
alpar@18
 | 
   535  | 
  | 
| 
alpar@18
 | 
   536  | 
% @: forces normal size whitespace following.
  | 
| 
alpar@18
 | 
   537  | 
\def\:{\spacefactor=1000 }
 | 
| 
alpar@18
 | 
   538  | 
  | 
| 
alpar@18
 | 
   539  | 
% @* forces a line break.
  | 
| 
alpar@18
 | 
   540  | 
\def\*{\hfil\break\hbox{}\ignorespaces}
 | 
| 
alpar@18
 | 
   541  | 
  | 
| 
alpar@18
 | 
   542  | 
% @/ allows a line break.
  | 
| 
alpar@18
 | 
   543  | 
\let\/=\allowbreak
  | 
| 
alpar@18
 | 
   544  | 
  | 
| 
alpar@18
 | 
   545  | 
% @. is an end-of-sentence period.
  | 
| 
alpar@18
 | 
   546  | 
\def\.{.\spacefactor=3000 }
 | 
| 
alpar@18
 | 
   547  | 
  | 
| 
alpar@18
 | 
   548  | 
% @! is an end-of-sentence bang.
  | 
| 
alpar@18
 | 
   549  | 
\def\!{!\spacefactor=3000 }
 | 
| 
alpar@18
 | 
   550  | 
  | 
| 
alpar@18
 | 
   551  | 
% @? is an end-of-sentence query.
  | 
| 
alpar@18
 | 
   552  | 
\def\?{?\spacefactor=3000 }
 | 
| 
alpar@18
 | 
   553  | 
  | 
| 
alpar@18
 | 
   554  | 
% @w prevents a word break.  Without the \leavevmode, @w at the
  | 
| 
alpar@18
 | 
   555  | 
% beginning of a paragraph, when TeX is still in vertical mode, would
  | 
| 
alpar@18
 | 
   556  | 
% produce a whole line of output instead of starting the paragraph.
  | 
| 
alpar@18
 | 
   557  | 
\def\w#1{\leavevmode\hbox{#1}}
 | 
| 
alpar@18
 | 
   558  | 
  | 
| 
alpar@18
 | 
   559  | 
% @group ... @end group forces ... to be all on one page, by enclosing
  | 
| 
alpar@18
 | 
   560  | 
% it in a TeX vbox.  We use \vtop instead of \vbox to construct the box
  | 
| 
alpar@18
 | 
   561  | 
% to keep its height that of a normal line.  According to the rules for
  | 
| 
alpar@18
 | 
   562  | 
% \topskip (p.114 of the TeXbook), the glue inserted is
  | 
| 
alpar@18
 | 
   563  | 
% max (\topskip - \ht (first item), 0).  If that height is large,
  | 
| 
alpar@18
 | 
   564  | 
% therefore, no glue is inserted, and the space between the headline and
  | 
| 
alpar@18
 | 
   565  | 
% the text is small, which looks bad.
  | 
| 
alpar@18
 | 
   566  | 
%
  | 
| 
alpar@18
 | 
   567  | 
% Another complication is that the group might be very large.  This can
  | 
| 
alpar@18
 | 
   568  | 
% cause the glue on the previous page to be unduly stretched, because it
  | 
| 
alpar@18
 | 
   569  | 
% does not have much material.  In this case, it's better to add an
  | 
| 
alpar@18
 | 
   570  | 
% explicit \vfill so that the extra space is at the bottom.  The
  | 
| 
alpar@18
 | 
   571  | 
% threshold for doing this is if the group is more than \vfilllimit
  | 
| 
alpar@18
 | 
   572  | 
% percent of a page (\vfilllimit can be changed inside of @tex).
  | 
| 
alpar@18
 | 
   573  | 
%
  | 
| 
alpar@18
 | 
   574  | 
\newbox\groupbox
  | 
| 
alpar@18
 | 
   575  | 
\def\vfilllimit{0.7}
 | 
| 
alpar@18
 | 
   576  | 
%
  | 
| 
alpar@18
 | 
   577  | 
\def\group{\begingroup
 | 
| 
alpar@18
 | 
   578  | 
  \ifnum\catcode13=\active \else
  | 
| 
alpar@18
 | 
   579  | 
    \errhelp = \groupinvalidhelp
  | 
| 
alpar@18
 | 
   580  | 
    \errmessage{@group invalid in context where filling is enabled}%
 | 
| 
alpar@18
 | 
   581  | 
  \fi
  | 
| 
alpar@18
 | 
   582  | 
  %
  | 
| 
alpar@18
 | 
   583  | 
  % The \vtop we start below produces a box with normal height and large
  | 
| 
alpar@18
 | 
   584  | 
  % depth; thus, TeX puts \baselineskip glue before it, and (when the
  | 
| 
alpar@18
 | 
   585  | 
  % next line of text is done) \lineskip glue after it.  (See p.82 of
  | 
| 
alpar@18
 | 
   586  | 
  % the TeXbook.)  Thus, space below is not quite equal to space
  | 
| 
alpar@18
 | 
   587  | 
  % above.  But it's pretty close.
  | 
| 
alpar@18
 | 
   588  | 
  \def\Egroup{%
 | 
| 
alpar@18
 | 
   589  | 
    \egroup           % End the \vtop.
  | 
| 
alpar@18
 | 
   590  | 
    % \dimen0 is the vertical size of the group's box.
  | 
| 
alpar@18
 | 
   591  | 
    \dimen0 = \ht\groupbox  \advance\dimen0 by \dp\groupbox
  | 
| 
alpar@18
 | 
   592  | 
    % \dimen2 is how much space is left on the page (more or less).
  | 
| 
alpar@18
 | 
   593  | 
    \dimen2 = \pageheight   \advance\dimen2 by -\pagetotal
  | 
| 
alpar@18
 | 
   594  | 
    % if the group doesn't fit on the current page, and it's a big big
  | 
| 
alpar@18
 | 
   595  | 
    % group, force a page break.
  | 
| 
alpar@18
 | 
   596  | 
    \ifdim \dimen0 > \dimen2
  | 
| 
alpar@18
 | 
   597  | 
      \ifdim \pagetotal < \vfilllimit\pageheight
  | 
| 
alpar@18
 | 
   598  | 
        \page
  | 
| 
alpar@18
 | 
   599  | 
      \fi
  | 
| 
alpar@18
 | 
   600  | 
    \fi
  | 
| 
alpar@18
 | 
   601  | 
    \copy\groupbox
  | 
| 
alpar@18
 | 
   602  | 
    \endgroup         % End the \group.
  | 
| 
alpar@18
 | 
   603  | 
  }%
  | 
| 
alpar@18
 | 
   604  | 
  %
  | 
| 
alpar@18
 | 
   605  | 
  \setbox\groupbox = \vtop\bgroup
  | 
| 
alpar@18
 | 
   606  | 
    % We have to put a strut on the last line in case the @group is in
  | 
| 
alpar@18
 | 
   607  | 
    % the midst of an example, rather than completely enclosing it.
  | 
| 
alpar@18
 | 
   608  | 
    % Otherwise, the interline space between the last line of the group
  | 
| 
alpar@18
 | 
   609  | 
    % and the first line afterwards is too small.  But we can't put the
  | 
| 
alpar@18
 | 
   610  | 
    % strut in \Egroup, since there it would be on a line by itself.
  | 
| 
alpar@18
 | 
   611  | 
    % Hence this just inserts a strut at the beginning of each line.
  | 
| 
alpar@18
 | 
   612  | 
    \everypar = {\strut}%
 | 
| 
alpar@18
 | 
   613  | 
    %
  | 
| 
alpar@18
 | 
   614  | 
    % Since we have a strut on every line, we don't need any of TeX's
  | 
| 
alpar@18
 | 
   615  | 
    % normal interline spacing.
  | 
| 
alpar@18
 | 
   616  | 
    \offinterlineskip
  | 
| 
alpar@18
 | 
   617  | 
    %
  | 
| 
alpar@18
 | 
   618  | 
    % OK, but now we have to do something about blank
  | 
| 
alpar@18
 | 
   619  | 
    % lines in the input in @example-like environments, which normally
  | 
| 
alpar@18
 | 
   620  | 
    % just turn into \lisppar, which will insert no space now that we've
  | 
| 
alpar@18
 | 
   621  | 
    % turned off the interline space.  Simplest is to make them be an
  | 
| 
alpar@18
 | 
   622  | 
    % empty paragraph.
  | 
| 
alpar@18
 | 
   623  | 
    \ifx\par\lisppar
  | 
| 
alpar@18
 | 
   624  | 
      \edef\par{\leavevmode \par}%
 | 
| 
alpar@18
 | 
   625  | 
      %
  | 
| 
alpar@18
 | 
   626  | 
      % Reset ^^M's definition to new definition of \par.
  | 
| 
alpar@18
 | 
   627  | 
      \obeylines
  | 
| 
alpar@18
 | 
   628  | 
    \fi
  | 
| 
alpar@18
 | 
   629  | 
    %
  | 
| 
alpar@18
 | 
   630  | 
    % Do @comment since we are called inside an environment such as
  | 
| 
alpar@18
 | 
   631  | 
    % @example, where each end-of-line in the input causes an
  | 
| 
alpar@18
 | 
   632  | 
    % end-of-line in the output.  We don't want the end-of-line after
  | 
| 
alpar@18
 | 
   633  | 
    % the `@group' to put extra space in the output.  Since @group
  | 
| 
alpar@18
 | 
   634  | 
    % should appear on a line by itself (according to the Texinfo
  | 
| 
alpar@18
 | 
   635  | 
    % manual), we don't worry about eating any user text.
  | 
| 
alpar@18
 | 
   636  | 
    \comment
  | 
| 
alpar@18
 | 
   637  | 
}
  | 
| 
alpar@18
 | 
   638  | 
%
  | 
| 
alpar@18
 | 
   639  | 
% TeX puts in an \escapechar (i.e., `@') at the beginning of the help
  | 
| 
alpar@18
 | 
   640  | 
% message, so this ends up printing `@group can only ...'.
  | 
| 
alpar@18
 | 
   641  | 
%
  | 
| 
alpar@18
 | 
   642  | 
\newhelp\groupinvalidhelp{%
 | 
| 
alpar@18
 | 
   643  | 
group can only be used in environments such as @example,^^J%
  | 
| 
alpar@18
 | 
   644  | 
where each line of input produces a line of output.}
  | 
| 
alpar@18
 | 
   645  | 
  | 
| 
alpar@18
 | 
   646  | 
% @need space-in-mils
  | 
| 
alpar@18
 | 
   647  | 
% forces a page break if there is not space-in-mils remaining.
  | 
| 
alpar@18
 | 
   648  | 
  | 
| 
alpar@18
 | 
   649  | 
\newdimen\mil  \mil=0.001in
  | 
| 
alpar@18
 | 
   650  | 
  | 
| 
alpar@18
 | 
   651  | 
\def\need{\parsearg\needx}
 | 
| 
alpar@18
 | 
   652  | 
  | 
| 
alpar@18
 | 
   653  | 
% Old definition--didn't work.
  | 
| 
alpar@18
 | 
   654  | 
%\def\needx #1{\par %
 | 
| 
alpar@18
 | 
   655  | 
%% This method tries to make TeX break the page naturally
  | 
| 
alpar@18
 | 
   656  | 
%% if the depth of the box does not fit.
  | 
| 
alpar@18
 | 
   657  | 
%{\baselineskip=0pt%
 | 
| 
alpar@18
 | 
   658  | 
%\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak
 | 
| 
alpar@18
 | 
   659  | 
%\prevdepth=-1000pt
  | 
| 
alpar@18
 | 
   660  | 
%}}
  | 
| 
alpar@18
 | 
   661  | 
  | 
| 
alpar@18
 | 
   662  | 
\def\needx#1{%
 | 
| 
alpar@18
 | 
   663  | 
  % Ensure vertical mode, so we don't make a big box in the middle of a
  | 
| 
alpar@18
 | 
   664  | 
  % paragraph.
  | 
| 
alpar@18
 | 
   665  | 
  \par
  | 
| 
alpar@18
 | 
   666  | 
  %
  | 
| 
alpar@18
 | 
   667  | 
  % If the @need value is less than one line space, it's useless.
  | 
| 
alpar@18
 | 
   668  | 
  \dimen0 = #1\mil
  | 
| 
alpar@18
 | 
   669  | 
  \dimen2 = \ht\strutbox
  | 
| 
alpar@18
 | 
   670  | 
  \advance\dimen2 by \dp\strutbox
  | 
| 
alpar@18
 | 
   671  | 
  \ifdim\dimen0 > \dimen2
  | 
| 
alpar@18
 | 
   672  | 
    %
  | 
| 
alpar@18
 | 
   673  | 
    % Do a \strut just to make the height of this box be normal, so the
  | 
| 
alpar@18
 | 
   674  | 
    % normal leading is inserted relative to the preceding line.
  | 
| 
alpar@18
 | 
   675  | 
    % And a page break here is fine.
  | 
| 
alpar@18
 | 
   676  | 
    \vtop to #1\mil{\strut\vfil}%
 | 
| 
alpar@18
 | 
   677  | 
    %
  | 
| 
alpar@18
 | 
   678  | 
    % TeX does not even consider page breaks if a penalty added to the
  | 
| 
alpar@18
 | 
   679  | 
    % main vertical list is 10000 or more.  But in order to see if the
  | 
| 
alpar@18
 | 
   680  | 
    % empty box we just added fits on the page, we must make it consider
  | 
| 
alpar@18
 | 
   681  | 
    % page breaks.  On the other hand, we don't want to actually break the
  | 
| 
alpar@18
 | 
   682  | 
    % page after the empty box.  So we use a penalty of 9999.
  | 
| 
alpar@18
 | 
   683  | 
    %
  | 
| 
alpar@18
 | 
   684  | 
    % There is an extremely small chance that TeX will actually break the
  | 
| 
alpar@18
 | 
   685  | 
    % page at this \penalty, if there are no other feasible breakpoints in
  | 
| 
alpar@18
 | 
   686  | 
    % sight.  (If the user is using lots of big @group commands, which
  | 
| 
alpar@18
 | 
   687  | 
    % almost-but-not-quite fill up a page, TeX will have a hard time doing
  | 
| 
alpar@18
 | 
   688  | 
    % good page breaking, for example.)  However, I could not construct an
  | 
| 
alpar@18
 | 
   689  | 
    % example where a page broke at this \penalty; if it happens in a real
  | 
| 
alpar@18
 | 
   690  | 
    % document, then we can reconsider our strategy.
  | 
| 
alpar@18
 | 
   691  | 
    \penalty9999
  | 
| 
alpar@18
 | 
   692  | 
    %
  | 
| 
alpar@18
 | 
   693  | 
    % Back up by the size of the box, whether we did a page break or not.
  | 
| 
alpar@18
 | 
   694  | 
    \kern -#1\mil
  | 
| 
alpar@18
 | 
   695  | 
    %
  | 
| 
alpar@18
 | 
   696  | 
    % Do not allow a page break right after this kern.
  | 
| 
alpar@18
 | 
   697  | 
    \nobreak
  | 
| 
alpar@18
 | 
   698  | 
  \fi
  | 
| 
alpar@18
 | 
   699  | 
}
  | 
| 
alpar@18
 | 
   700  | 
  | 
| 
alpar@18
 | 
   701  | 
% @br   forces paragraph break
  | 
| 
alpar@18
 | 
   702  | 
  | 
| 
alpar@18
 | 
   703  | 
\let\br = \par
  | 
| 
alpar@18
 | 
   704  | 
  | 
| 
alpar@18
 | 
   705  | 
% @dots{} output an ellipsis using the current font.
 | 
| 
alpar@18
 | 
   706  | 
% We do .5em per period so that it has the same spacing in a typewriter
  | 
| 
alpar@18
 | 
   707  | 
% font as three actual period characters.
  | 
| 
alpar@18
 | 
   708  | 
%
  | 
| 
alpar@18
 | 
   709  | 
\def\dots{%
 | 
| 
alpar@18
 | 
   710  | 
  \leavevmode
  | 
| 
alpar@18
 | 
   711  | 
  \hbox to 1.5em{%
 | 
| 
alpar@18
 | 
   712  | 
    \hskip 0pt plus 0.25fil minus 0.25fil
  | 
| 
alpar@18
 | 
   713  | 
    .\hss.\hss.%
  | 
| 
alpar@18
 | 
   714  | 
    \hskip 0pt plus 0.5fil minus 0.5fil
  | 
| 
alpar@18
 | 
   715  | 
  }%
  | 
| 
alpar@18
 | 
   716  | 
}
  | 
| 
alpar@18
 | 
   717  | 
  | 
| 
alpar@18
 | 
   718  | 
% @enddots{} is an end-of-sentence ellipsis.
 | 
| 
alpar@18
 | 
   719  | 
%
  | 
| 
alpar@18
 | 
   720  | 
\def\enddots{%
 | 
| 
alpar@18
 | 
   721  | 
  \leavevmode
  | 
| 
alpar@18
 | 
   722  | 
  \hbox to 2em{%
 | 
| 
alpar@18
 | 
   723  | 
    \hskip 0pt plus 0.25fil minus 0.25fil
  | 
| 
alpar@18
 | 
   724  | 
    .\hss.\hss.\hss.%
  | 
| 
alpar@18
 | 
   725  | 
    \hskip 0pt plus 0.5fil minus 0.5fil
  | 
| 
alpar@18
 | 
   726  | 
  }%
  | 
| 
alpar@18
 | 
   727  | 
  \spacefactor=3000
  | 
| 
alpar@18
 | 
   728  | 
}
  | 
| 
alpar@18
 | 
   729  | 
  | 
| 
alpar@18
 | 
   730  | 
% @page forces the start of a new page.
  | 
| 
alpar@18
 | 
   731  | 
%
  | 
| 
alpar@18
 | 
   732  | 
\def\page{\par\vfill\supereject}
 | 
| 
alpar@18
 | 
   733  | 
  | 
| 
alpar@18
 | 
   734  | 
% @exdent text....
  | 
| 
alpar@18
 | 
   735  | 
% outputs text on separate line in roman font, starting at standard page margin
  | 
| 
alpar@18
 | 
   736  | 
  | 
| 
alpar@18
 | 
   737  | 
% This records the amount of indent in the innermost environment.
  | 
| 
alpar@18
 | 
   738  | 
% That's how much \exdent should take out.
  | 
| 
alpar@18
 | 
   739  | 
\newskip\exdentamount
  | 
| 
alpar@18
 | 
   740  | 
  | 
| 
alpar@18
 | 
   741  | 
% This defn is used inside fill environments such as @defun.
  | 
| 
alpar@18
 | 
   742  | 
\def\exdent{\parsearg\exdentyyy}
 | 
| 
alpar@18
 | 
   743  | 
\def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}}
 | 
| 
alpar@18
 | 
   744  | 
  | 
| 
alpar@18
 | 
   745  | 
% This defn is used inside nofill environments such as @example.
  | 
| 
alpar@18
 | 
   746  | 
\def\nofillexdent{\parsearg\nofillexdentyyy}
 | 
| 
alpar@18
 | 
   747  | 
\def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount
 | 
| 
alpar@18
 | 
   748  | 
\leftline{\hskip\leftskip{\rm#1}}}}
 | 
| 
alpar@18
 | 
   749  | 
  | 
| 
alpar@18
 | 
   750  | 
% @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
 | 
| 
alpar@18
 | 
   751  | 
% paragraph.  For more general purposes, use the \margin insertion
  | 
| 
alpar@18
 | 
   752  | 
% class.  WHICH is `l' or `r'.
  | 
| 
alpar@18
 | 
   753  | 
%
  | 
| 
alpar@18
 | 
   754  | 
\newskip\inmarginspacing \inmarginspacing=1cm
  | 
| 
alpar@18
 | 
   755  | 
\def\strutdepth{\dp\strutbox}
 | 
| 
alpar@18
 | 
   756  | 
%
  | 
| 
alpar@18
 | 
   757  | 
\def\doinmargin#1#2{\strut\vadjust{%
 | 
| 
alpar@18
 | 
   758  | 
  \nobreak
  | 
| 
alpar@18
 | 
   759  | 
  \kern-\strutdepth
  | 
| 
alpar@18
 | 
   760  | 
  \vtop to \strutdepth{%
 | 
| 
alpar@18
 | 
   761  | 
    \baselineskip=\strutdepth
  | 
| 
alpar@18
 | 
   762  | 
    \vss
  | 
| 
alpar@18
 | 
   763  | 
    % if you have multiple lines of stuff to put here, you'll need to
  | 
| 
alpar@18
 | 
   764  | 
    % make the vbox yourself of the appropriate size.
  | 
| 
alpar@18
 | 
   765  | 
    \ifx#1l%
  | 
| 
alpar@18
 | 
   766  | 
      \llap{\ignorespaces #2\hskip\inmarginspacing}%
 | 
| 
alpar@18
 | 
   767  | 
    \else
  | 
| 
alpar@18
 | 
   768  | 
      \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
 | 
| 
alpar@18
 | 
   769  | 
    \fi
  | 
| 
alpar@18
 | 
   770  | 
    \null
  | 
| 
alpar@18
 | 
   771  | 
  }%
  | 
| 
alpar@18
 | 
   772  | 
}}
  | 
| 
alpar@18
 | 
   773  | 
\def\inleftmargin{\doinmargin l}
 | 
| 
alpar@18
 | 
   774  | 
\def\inrightmargin{\doinmargin r}
 | 
| 
alpar@18
 | 
   775  | 
%
  | 
| 
alpar@18
 | 
   776  | 
% @inmargin{TEXT [, RIGHT-TEXT]}
 | 
| 
alpar@18
 | 
   777  | 
% (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
  | 
| 
alpar@18
 | 
   778  | 
% else use TEXT for both).
  | 
| 
alpar@18
 | 
   779  | 
%
  | 
| 
alpar@18
 | 
   780  | 
\def\inmargin#1{\parseinmargin #1,,\finish}
 | 
| 
alpar@18
 | 
   781  | 
\def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
 | 
| 
alpar@18
 | 
   782  | 
  \setbox0 = \hbox{\ignorespaces #2}%
 | 
| 
alpar@18
 | 
   783  | 
  \ifdim\wd0 > 0pt
  | 
| 
alpar@18
 | 
   784  | 
    \def\lefttext{#1}%  have both texts
 | 
| 
alpar@18
 | 
   785  | 
    \def\righttext{#2}%
 | 
| 
alpar@18
 | 
   786  | 
  \else
  | 
| 
alpar@18
 | 
   787  | 
    \def\lefttext{#1}%  have only one text
 | 
| 
alpar@18
 | 
   788  | 
    \def\righttext{#1}%
 | 
| 
alpar@18
 | 
   789  | 
  \fi
  | 
| 
alpar@18
 | 
   790  | 
  %
  | 
| 
alpar@18
 | 
   791  | 
  \ifodd\pageno
  | 
| 
alpar@18
 | 
   792  | 
    \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
 | 
| 
alpar@18
 | 
   793  | 
  \else
  | 
| 
alpar@18
 | 
   794  | 
    \def\temp{\inleftmargin\lefttext}%
 | 
| 
alpar@18
 | 
   795  | 
  \fi
  | 
| 
alpar@18
 | 
   796  | 
  \temp
  | 
| 
alpar@18
 | 
   797  | 
}
  | 
| 
alpar@18
 | 
   798  | 
  | 
| 
alpar@18
 | 
   799  | 
% @include file    insert text of that file as input.
  | 
| 
alpar@18
 | 
   800  | 
% Allow normal characters that  we make active in the argument (a file name).
  | 
| 
alpar@18
 | 
   801  | 
\def\include{\begingroup
 | 
| 
alpar@18
 | 
   802  | 
  \catcode`\\=\other
  | 
| 
alpar@18
 | 
   803  | 
  \catcode`~=\other
  | 
| 
alpar@18
 | 
   804  | 
  \catcode`^=\other
  | 
| 
alpar@18
 | 
   805  | 
  \catcode`_=\other
  | 
| 
alpar@18
 | 
   806  | 
  \catcode`|=\other
  | 
| 
alpar@18
 | 
   807  | 
  \catcode`<=\other
  | 
| 
alpar@18
 | 
   808  | 
  \catcode`>=\other
  | 
| 
alpar@18
 | 
   809  | 
  \catcode`+=\other
  | 
| 
alpar@18
 | 
   810  | 
  \parsearg\includezzz}
  | 
| 
alpar@18
 | 
   811  | 
% Restore active chars for included file.
  | 
| 
alpar@18
 | 
   812  | 
\def\includezzz#1{\endgroup\begingroup
 | 
| 
alpar@18
 | 
   813  | 
  % Read the included file in a group so nested @include's work.
  | 
| 
alpar@18
 | 
   814  | 
  \def\thisfile{#1}%
 | 
| 
alpar@18
 | 
   815  | 
  \let\value=\expandablevalue
  | 
| 
alpar@18
 | 
   816  | 
  \input\thisfile
  | 
| 
alpar@18
 | 
   817  | 
\endgroup}
  | 
| 
alpar@18
 | 
   818  | 
  | 
| 
alpar@18
 | 
   819  | 
\def\thisfile{}
 | 
| 
alpar@18
 | 
   820  | 
  | 
| 
alpar@18
 | 
   821  | 
% @center line
  | 
| 
alpar@18
 | 
   822  | 
% outputs that line, centered.
  | 
| 
alpar@18
 | 
   823  | 
%
  | 
| 
alpar@18
 | 
   824  | 
\def\center{\parsearg\docenter}
 | 
| 
alpar@18
 | 
   825  | 
\def\docenter#1{{%
 | 
| 
alpar@18
 | 
   826  | 
  \ifhmode \hfil\break \fi
  | 
| 
alpar@18
 | 
   827  | 
  \advance\hsize by -\leftskip
  | 
| 
alpar@18
 | 
   828  | 
  \advance\hsize by -\rightskip
  | 
| 
alpar@18
 | 
   829  | 
  \line{\hfil \ignorespaces#1\unskip \hfil}%
 | 
| 
alpar@18
 | 
   830  | 
  \ifhmode \break \fi
  | 
| 
alpar@18
 | 
   831  | 
}}
  | 
| 
alpar@18
 | 
   832  | 
  | 
| 
alpar@18
 | 
   833  | 
% @sp n   outputs n lines of vertical space
  | 
| 
alpar@18
 | 
   834  | 
  | 
| 
alpar@18
 | 
   835  | 
\def\sp{\parsearg\spxxx}
 | 
| 
alpar@18
 | 
   836  | 
\def\spxxx #1{\vskip #1\baselineskip}
 | 
| 
alpar@18
 | 
   837  | 
  | 
| 
alpar@18
 | 
   838  | 
% @comment ...line which is ignored...
  | 
| 
alpar@18
 | 
   839  | 
% @c is the same as @comment
  | 
| 
alpar@18
 | 
   840  | 
% @ignore ... @end ignore  is another way to write a comment
  | 
| 
alpar@18
 | 
   841  | 
  | 
| 
alpar@18
 | 
   842  | 
\def\comment{\begingroup \catcode`\^^M=\other%
 | 
| 
alpar@18
 | 
   843  | 
\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
 | 
| 
alpar@18
 | 
   844  | 
\commentxxx}
  | 
| 
alpar@18
 | 
   845  | 
{\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}}
 | 
| 
alpar@18
 | 
   846  | 
  | 
| 
alpar@18
 | 
   847  | 
\let\c=\comment
  | 
| 
alpar@18
 | 
   848  | 
  | 
| 
alpar@18
 | 
   849  | 
% @paragraphindent NCHARS
  | 
| 
alpar@18
 | 
   850  | 
% We'll use ems for NCHARS, close enough.
  | 
| 
alpar@18
 | 
   851  | 
% NCHARS can also be the word `asis' or `none'.
  | 
| 
alpar@18
 | 
   852  | 
% We cannot feasibly implement @paragraphindent asis, though.
  | 
| 
alpar@18
 | 
   853  | 
%
  | 
| 
alpar@18
 | 
   854  | 
\def\asisword{asis} % no translation, these are keywords
 | 
| 
alpar@18
 | 
   855  | 
\def\noneword{none}
 | 
| 
alpar@18
 | 
   856  | 
%
  | 
| 
alpar@18
 | 
   857  | 
\def\paragraphindent{\parsearg\doparagraphindent}
 | 
| 
alpar@18
 | 
   858  | 
\def\doparagraphindent#1{%
 | 
| 
alpar@18
 | 
   859  | 
  \def\temp{#1}%
 | 
| 
alpar@18
 | 
   860  | 
  \ifx\temp\asisword
  | 
| 
alpar@18
 | 
   861  | 
  \else
  | 
| 
alpar@18
 | 
   862  | 
    \ifx\temp\noneword
  | 
| 
alpar@18
 | 
   863  | 
      \defaultparindent = 0pt
  | 
| 
alpar@18
 | 
   864  | 
    \else
  | 
| 
alpar@18
 | 
   865  | 
      \defaultparindent = #1em
  | 
| 
alpar@18
 | 
   866  | 
    \fi
  | 
| 
alpar@18
 | 
   867  | 
  \fi
  | 
| 
alpar@18
 | 
   868  | 
  \parindent = \defaultparindent
  | 
| 
alpar@18
 | 
   869  | 
}
  | 
| 
alpar@18
 | 
   870  | 
  | 
| 
alpar@18
 | 
   871  | 
% @exampleindent NCHARS
  | 
| 
alpar@18
 | 
   872  | 
% We'll use ems for NCHARS like @paragraphindent.
  | 
| 
alpar@18
 | 
   873  | 
% It seems @exampleindent asis isn't necessary, but
  | 
| 
alpar@18
 | 
   874  | 
% I preserve it to make it similar to @paragraphindent.
  | 
| 
alpar@18
 | 
   875  | 
\def\exampleindent{\parsearg\doexampleindent}
 | 
| 
alpar@18
 | 
   876  | 
\def\doexampleindent#1{%
 | 
| 
alpar@18
 | 
   877  | 
  \def\temp{#1}%
 | 
| 
alpar@18
 | 
   878  | 
  \ifx\temp\asisword
  | 
| 
alpar@18
 | 
   879  | 
  \else
  | 
| 
alpar@18
 | 
   880  | 
    \ifx\temp\noneword
  | 
| 
alpar@18
 | 
   881  | 
      \lispnarrowing = 0pt
  | 
| 
alpar@18
 | 
   882  | 
    \else
  | 
| 
alpar@18
 | 
   883  | 
      \lispnarrowing = #1em
  | 
| 
alpar@18
 | 
   884  | 
    \fi
  | 
| 
alpar@18
 | 
   885  | 
  \fi
  | 
| 
alpar@18
 | 
   886  | 
}
  | 
| 
alpar@18
 | 
   887  | 
  | 
| 
alpar@18
 | 
   888  | 
% @firstparagraphindent WORD
  | 
| 
alpar@18
 | 
   889  | 
% If WORD is `none', then suppress indentation of the first paragraph
  | 
| 
alpar@18
 | 
   890  | 
% after a section heading.  If WORD is `insert', then do indent at such
  | 
| 
alpar@18
 | 
   891  | 
% paragraphs.
  | 
| 
alpar@18
 | 
   892  | 
%
  | 
| 
alpar@18
 | 
   893  | 
% The paragraph indentation is suppressed or not by calling
  | 
| 
alpar@18
 | 
   894  | 
% \suppressfirstparagraphindent, which the sectioning commands do.
  | 
| 
alpar@18
 | 
   895  | 
% We switch the definition of this back and forth according to WORD.
  | 
| 
alpar@18
 | 
   896  | 
% By default, we suppress indentation.
  | 
| 
alpar@18
 | 
   897  | 
%
  | 
| 
alpar@18
 | 
   898  | 
\def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
 | 
| 
alpar@18
 | 
   899  | 
\newdimen\currentparindent
  | 
| 
alpar@18
 | 
   900  | 
%
  | 
| 
alpar@18
 | 
   901  | 
\def\insertword{insert}
 | 
| 
alpar@18
 | 
   902  | 
%
  | 
| 
alpar@18
 | 
   903  | 
\def\firstparagraphindent{\parsearg\dofirstparagraphindent}
 | 
| 
alpar@18
 | 
   904  | 
\def\dofirstparagraphindent#1{%
 | 
| 
alpar@18
 | 
   905  | 
  \def\temp{#1}%
 | 
| 
alpar@18
 | 
   906  | 
  \ifx\temp\noneword
  | 
| 
alpar@18
 | 
   907  | 
    \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
  | 
| 
alpar@18
 | 
   908  | 
  \else\ifx\temp\insertword
  | 
| 
alpar@18
 | 
   909  | 
    \let\suppressfirstparagraphindent = \relax
  | 
| 
alpar@18
 | 
   910  | 
  \else
  | 
| 
alpar@18
 | 
   911  | 
    \errhelp = \EMsimple
  | 
| 
alpar@18
 | 
   912  | 
    \errmessage{Unknown @firstparagraphindent option `\temp'}%
 | 
| 
alpar@18
 | 
   913  | 
  \fi\fi
  | 
| 
alpar@18
 | 
   914  | 
}
  | 
| 
alpar@18
 | 
   915  | 
  | 
| 
alpar@18
 | 
   916  | 
% Here is how we actually suppress indentation.  Redefine \everypar to
  | 
| 
alpar@18
 | 
   917  | 
% \kern backwards by \parindent, and then reset itself to empty.
  | 
| 
alpar@18
 | 
   918  | 
%
  | 
| 
alpar@18
 | 
   919  | 
% We also make \indent itself not actually do anything until the next
  | 
| 
alpar@18
 | 
   920  | 
% paragraph.
  | 
| 
alpar@18
 | 
   921  | 
%
  | 
| 
alpar@18
 | 
   922  | 
\gdef\dosuppressfirstparagraphindent{%
 | 
| 
alpar@18
 | 
   923  | 
  \gdef\indent{%
 | 
| 
alpar@18
 | 
   924  | 
    \global\let\indent=\ptexindent
  | 
| 
alpar@18
 | 
   925  | 
    \global\everypar = {}%
 | 
| 
alpar@18
 | 
   926  | 
  }%
  | 
| 
alpar@18
 | 
   927  | 
  \global\everypar = {%
 | 
| 
alpar@18
 | 
   928  | 
    \kern-\parindent
  | 
| 
alpar@18
 | 
   929  | 
    \global\let\indent=\ptexindent
  | 
| 
alpar@18
 | 
   930  | 
    \global\everypar = {}%
 | 
| 
alpar@18
 | 
   931  | 
  }%
  | 
| 
alpar@18
 | 
   932  | 
}%
  | 
| 
alpar@18
 | 
   933  | 
  | 
| 
alpar@18
 | 
   934  | 
  | 
| 
alpar@18
 | 
   935  | 
% @asis just yields its argument.  Used with @table, for example.
  | 
| 
alpar@18
 | 
   936  | 
%
  | 
| 
alpar@18
 | 
   937  | 
\def\asis#1{#1}
 | 
| 
alpar@18
 | 
   938  | 
  | 
| 
alpar@18
 | 
   939  | 
% @math outputs its argument in math mode.
  | 
| 
alpar@18
 | 
   940  | 
% We don't use $'s directly in the definition of \math because we need
  | 
| 
alpar@18
 | 
   941  | 
% to set catcodes according to plain TeX first, to allow for subscripts,
  | 
| 
alpar@18
 | 
   942  | 
% superscripts, special math chars, etc.
  | 
| 
alpar@18
 | 
   943  | 
%
  | 
| 
alpar@18
 | 
   944  | 
\let\implicitmath = $%$ font-lock fix
  | 
| 
alpar@18
 | 
   945  | 
%
  | 
| 
alpar@18
 | 
   946  | 
% One complication: _ usually means subscripts, but it could also mean
  | 
| 
alpar@18
 | 
   947  | 
% an actual _ character, as in @math{@var{some_variable} + 1}.  So make
 | 
| 
alpar@18
 | 
   948  | 
% _ within @math be active (mathcode "8000), and distinguish by seeing
  | 
| 
alpar@18
 | 
   949  | 
% if the current family is \slfam, which is what @var uses.
  | 
| 
alpar@18
 | 
   950  | 
%
  | 
| 
alpar@18
 | 
   951  | 
{\catcode\underChar = \active
 | 
| 
alpar@18
 | 
   952  | 
\gdef\mathunderscore{%
 | 
| 
alpar@18
 | 
   953  | 
  \catcode\underChar=\active
  | 
| 
alpar@18
 | 
   954  | 
  \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
 | 
| 
alpar@18
 | 
   955  | 
}}
  | 
| 
alpar@18
 | 
   956  | 
%
  | 
| 
alpar@18
 | 
   957  | 
% Another complication: we want \\ (and @\) to output a \ character.
  | 
| 
alpar@18
 | 
   958  | 
% FYI, plain.tex uses \\ as a temporary control sequence (why?), but
  | 
| 
alpar@18
 | 
   959  | 
% this is not advertised and we don't care.  Texinfo does not
  | 
| 
alpar@18
 | 
   960  | 
% otherwise define @\.
  | 
| 
alpar@18
 | 
   961  | 
%
  | 
| 
alpar@18
 | 
   962  | 
% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
  | 
| 
alpar@18
 | 
   963  | 
\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
 | 
| 
alpar@18
 | 
   964  | 
%
  | 
| 
alpar@18
 | 
   965  | 
\def\math{%
 | 
| 
alpar@18
 | 
   966  | 
  \tex
  | 
| 
alpar@18
 | 
   967  | 
  \mathcode`\_="8000 \mathunderscore
  | 
| 
alpar@18
 | 
   968  | 
  \let\\ = \mathbackslash
  | 
| 
alpar@18
 | 
   969  | 
  \mathactive
  | 
| 
alpar@18
 | 
   970  | 
  \implicitmath\finishmath}
  | 
| 
alpar@18
 | 
   971  | 
\def\finishmath#1{#1\implicitmath\Etex}
 | 
| 
alpar@18
 | 
   972  | 
  | 
| 
alpar@18
 | 
   973  | 
% Some active characters (such as <) are spaced differently in math.
  | 
| 
alpar@18
 | 
   974  | 
% We have to reset their definitions in case the @math was an
  | 
| 
alpar@18
 | 
   975  | 
% argument to a command which set the catcodes (such as @item or @section).
  | 
| 
alpar@18
 | 
   976  | 
%
  | 
| 
alpar@18
 | 
   977  | 
{
 | 
| 
alpar@18
 | 
   978  | 
  \catcode`^ = \active
  | 
| 
alpar@18
 | 
   979  | 
  \catcode`< = \active
  | 
| 
alpar@18
 | 
   980  | 
  \catcode`> = \active
  | 
| 
alpar@18
 | 
   981  | 
  \catcode`+ = \active
  | 
| 
alpar@18
 | 
   982  | 
  \gdef\mathactive{%
 | 
| 
alpar@18
 | 
   983  | 
    \let^ = \ptexhat
  | 
| 
alpar@18
 | 
   984  | 
    \let< = \ptexless
  | 
| 
alpar@18
 | 
   985  | 
    \let> = \ptexgtr
  | 
| 
alpar@18
 | 
   986  | 
    \let+ = \ptexplus
  | 
| 
alpar@18
 | 
   987  | 
  }
  | 
| 
alpar@18
 | 
   988  | 
}
  | 
| 
alpar@18
 | 
   989  | 
  | 
| 
alpar@18
 | 
   990  | 
% @bullet and @minus need the same treatment as @math, just above.
  | 
| 
alpar@18
 | 
   991  | 
\def\bullet{\implicitmath\ptexbullet\implicitmath}
 | 
| 
alpar@18
 | 
   992  | 
\def\minus{\implicitmath-\implicitmath}
 | 
| 
alpar@18
 | 
   993  | 
  | 
| 
alpar@18
 | 
   994  | 
% @refill is a no-op.
  | 
| 
alpar@18
 | 
   995  | 
\let\refill=\relax
  | 
| 
alpar@18
 | 
   996  | 
  | 
| 
alpar@18
 | 
   997  | 
% If working on a large document in chapters, it is convenient to
  | 
| 
alpar@18
 | 
   998  | 
% be able to disable indexing, cross-referencing, and contents, for test runs.
  | 
| 
alpar@18
 | 
   999  | 
% This is done with @novalidate (before @setfilename).
  | 
| 
alpar@18
 | 
  1000  | 
%
  | 
| 
alpar@18
 | 
  1001  | 
\newif\iflinks \linkstrue % by default we want the aux files.
  | 
| 
alpar@18
 | 
  1002  | 
\let\novalidate = \linksfalse
  | 
| 
alpar@18
 | 
  1003  | 
  | 
| 
alpar@18
 | 
  1004  | 
% @setfilename is done at the beginning of every texinfo file.
  | 
| 
alpar@18
 | 
  1005  | 
% So open here the files we need to have open while reading the input.
  | 
| 
alpar@18
 | 
  1006  | 
% This makes it possible to make a .fmt file for texinfo.
  | 
| 
alpar@18
 | 
  1007  | 
\def\setfilename{%
 | 
| 
alpar@18
 | 
  1008  | 
   \iflinks
  | 
| 
alpar@18
 | 
  1009  | 
     \readauxfile
  | 
| 
alpar@18
 | 
  1010  | 
   \fi % \openindices needs to do some work in any case.
  | 
| 
alpar@18
 | 
  1011  | 
   \openindices
  | 
| 
alpar@18
 | 
  1012  | 
   \fixbackslash  % Turn off hack to swallow `\input texinfo'.
  | 
| 
alpar@18
 | 
  1013  | 
   \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
  | 
| 
alpar@18
 | 
  1014  | 
   %
  | 
| 
alpar@18
 | 
  1015  | 
   % If texinfo.cnf is present on the system, read it.
  | 
| 
alpar@18
 | 
  1016  | 
   % Useful for site-wide @afourpaper, etc.
  | 
| 
alpar@18
 | 
  1017  | 
   % Just to be on the safe side, close the input stream before the \input.
  | 
| 
alpar@18
 | 
  1018  | 
   \openin 1 texinfo.cnf
  | 
| 
alpar@18
 | 
  1019  | 
   \ifeof1 \let\temp=\relax \else \def\temp{\input texinfo.cnf }\fi
 | 
| 
alpar@18
 | 
  1020  | 
   \closein1
  | 
| 
alpar@18
 | 
  1021  | 
   \temp
  | 
| 
alpar@18
 | 
  1022  | 
   %
  | 
| 
alpar@18
 | 
  1023  | 
   \comment % Ignore the actual filename.
  | 
| 
alpar@18
 | 
  1024  | 
}
  | 
| 
alpar@18
 | 
  1025  | 
  | 
| 
alpar@18
 | 
  1026  | 
% Called from \setfilename.
  | 
| 
alpar@18
 | 
  1027  | 
%
  | 
| 
alpar@18
 | 
  1028  | 
\def\openindices{%
 | 
| 
alpar@18
 | 
  1029  | 
  \newindex{cp}%
 | 
| 
alpar@18
 | 
  1030  | 
  \newcodeindex{fn}%
 | 
| 
alpar@18
 | 
  1031  | 
  \newcodeindex{vr}%
 | 
| 
alpar@18
 | 
  1032  | 
  \newcodeindex{tp}%
 | 
| 
alpar@18
 | 
  1033  | 
  \newcodeindex{ky}%
 | 
| 
alpar@18
 | 
  1034  | 
  \newcodeindex{pg}%
 | 
| 
alpar@18
 | 
  1035  | 
}
  | 
| 
alpar@18
 | 
  1036  | 
  | 
| 
alpar@18
 | 
  1037  | 
% @bye.
  | 
| 
alpar@18
 | 
  1038  | 
\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
 | 
| 
alpar@18
 | 
  1039  | 
  | 
| 
alpar@18
 | 
  1040  | 
  | 
| 
alpar@18
 | 
  1041  | 
\message{pdf,}
 | 
| 
alpar@18
 | 
  1042  | 
% adobe `portable' document format
  | 
| 
alpar@18
 | 
  1043  | 
\newcount\tempnum
  | 
| 
alpar@18
 | 
  1044  | 
\newcount\lnkcount
  | 
| 
alpar@18
 | 
  1045  | 
\newtoks\filename
  | 
| 
alpar@18
 | 
  1046  | 
\newcount\filenamelength
  | 
| 
alpar@18
 | 
  1047  | 
\newcount\pgn
  | 
| 
alpar@18
 | 
  1048  | 
\newtoks\toksA
  | 
| 
alpar@18
 | 
  1049  | 
\newtoks\toksB
  | 
| 
alpar@18
 | 
  1050  | 
\newtoks\toksC
  | 
| 
alpar@18
 | 
  1051  | 
\newtoks\toksD
  | 
| 
alpar@18
 | 
  1052  | 
\newbox\boxA
  | 
| 
alpar@18
 | 
  1053  | 
\newcount\countA
  | 
| 
alpar@18
 | 
  1054  | 
\newif\ifpdf
  | 
| 
alpar@18
 | 
  1055  | 
\newif\ifpdfmakepagedest
  | 
| 
alpar@18
 | 
  1056  | 
  | 
| 
alpar@18
 | 
  1057  | 
\ifx\pdfoutput\undefined
  | 
| 
alpar@18
 | 
  1058  | 
  \pdffalse
  | 
| 
alpar@18
 | 
  1059  | 
  \let\pdfmkdest = \gobble
  | 
| 
alpar@18
 | 
  1060  | 
  \let\pdfurl = \gobble
  | 
| 
alpar@18
 | 
  1061  | 
  \let\endlink = \relax
  | 
| 
alpar@18
 | 
  1062  | 
  \let\linkcolor = \relax
  | 
| 
alpar@18
 | 
  1063  | 
  \let\pdfmakeoutlines = \relax
  | 
| 
alpar@18
 | 
  1064  | 
\else
  | 
| 
alpar@18
 | 
  1065  | 
  \pdftrue
  | 
| 
alpar@18
 | 
  1066  | 
  \pdfoutput = 1
  | 
| 
alpar@18
 | 
  1067  | 
  \input pdfcolor
  | 
| 
alpar@18
 | 
  1068  | 
  \def\dopdfimage#1#2#3{%
 | 
| 
alpar@18
 | 
  1069  | 
    \def\imagewidth{#2}%
 | 
| 
alpar@18
 | 
  1070  | 
    \def\imageheight{#3}%
 | 
| 
alpar@18
 | 
  1071  | 
    % without \immediate, pdftex seg faults when the same image is
  | 
| 
alpar@18
 | 
  1072  | 
    % included twice.  (Version 3.14159-pre-1.0-unofficial-20010704.)
  | 
| 
alpar@18
 | 
  1073  | 
    \ifnum\pdftexversion < 14
  | 
| 
alpar@18
 | 
  1074  | 
      \immediate\pdfimage
  | 
| 
alpar@18
 | 
  1075  | 
    \else
  | 
| 
alpar@18
 | 
  1076  | 
      \immediate\pdfximage
  | 
| 
alpar@18
 | 
  1077  | 
    \fi
  | 
| 
alpar@18
 | 
  1078  | 
      \ifx\empty\imagewidth\else width \imagewidth \fi
  | 
| 
alpar@18
 | 
  1079  | 
      \ifx\empty\imageheight\else height \imageheight \fi
  | 
| 
alpar@18
 | 
  1080  | 
      \ifnum\pdftexversion<13
  | 
| 
alpar@18
 | 
  1081  | 
         #1.pdf%
  | 
| 
alpar@18
 | 
  1082  | 
       \else
  | 
| 
alpar@18
 | 
  1083  | 
         {#1.pdf}%
 | 
| 
alpar@18
 | 
  1084  | 
       \fi
  | 
| 
alpar@18
 | 
  1085  | 
    \ifnum\pdftexversion < 14 \else
  | 
| 
alpar@18
 | 
  1086  | 
      \pdfrefximage \pdflastximage
  | 
| 
alpar@18
 | 
  1087  | 
    \fi}
  | 
| 
alpar@18
 | 
  1088  | 
  \def\pdfmkdest#1{{\normalturnoffactive \pdfdest name{#1} xyz}}
 | 
| 
alpar@18
 | 
  1089  | 
  \def\pdfmkpgn#1{#1}
 | 
| 
alpar@18
 | 
  1090  | 
  \let\linkcolor = \Blue  % was Cyan, but that seems light?
  | 
| 
alpar@18
 | 
  1091  | 
  \def\endlink{\Black\pdfendlink}
 | 
| 
alpar@18
 | 
  1092  | 
  % Adding outlines to PDF; macros for calculating structure of outlines
  | 
| 
alpar@18
 | 
  1093  | 
  % come from Petr Olsak
  | 
| 
alpar@18
 | 
  1094  | 
  \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
 | 
| 
alpar@18
 | 
  1095  | 
    \else \csname#1\endcsname \fi}
  | 
| 
alpar@18
 | 
  1096  | 
  \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
 | 
| 
alpar@18
 | 
  1097  | 
    \advance\tempnum by1
  | 
| 
alpar@18
 | 
  1098  | 
    \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
 | 
| 
alpar@18
 | 
  1099  | 
  \def\pdfmakeoutlines{{%
 | 
| 
alpar@18
 | 
  1100  | 
    \openin 1 \jobname.toc
  | 
| 
alpar@18
 | 
  1101  | 
    \ifeof 1\else\begingroup
  | 
| 
alpar@18
 | 
  1102  | 
      \closein 1
  | 
| 
alpar@18
 | 
  1103  | 
      % Thanh's hack / proper braces in bookmarks
  | 
| 
alpar@18
 | 
  1104  | 
      \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace
 | 
| 
alpar@18
 | 
  1105  | 
      \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace
 | 
| 
alpar@18
 | 
  1106  | 
      %
  | 
| 
alpar@18
 | 
  1107  | 
      \def\chapentry ##1##2##3{}
 | 
| 
alpar@18
 | 
  1108  | 
      \def\secentry ##1##2##3##4{\advancenumber{chap##2}}
 | 
| 
alpar@18
 | 
  1109  | 
      \def\subsecentry ##1##2##3##4##5{\advancenumber{sec##2.##3}}
 | 
| 
alpar@18
 | 
  1110  | 
      \def\subsubsecentry ##1##2##3##4##5##6{\advancenumber{subsec##2.##3.##4}}
 | 
| 
alpar@18
 | 
  1111  | 
      \let\appendixentry = \chapentry
  | 
| 
alpar@18
 | 
  1112  | 
      \let\unnumbchapentry = \chapentry
  | 
| 
alpar@18
 | 
  1113  | 
      \let\unnumbsecentry = \secentry
  | 
| 
alpar@18
 | 
  1114  | 
      \let\unnumbsubsecentry = \subsecentry
  | 
| 
alpar@18
 | 
  1115  | 
      \let\unnumbsubsubsecentry = \subsubsecentry
  | 
| 
alpar@18
 | 
  1116  | 
      \input \jobname.toc
  | 
| 
alpar@18
 | 
  1117  | 
      \def\chapentry ##1##2##3{%
 | 
| 
alpar@18
 | 
  1118  | 
        \pdfoutline goto name{\pdfmkpgn{##3}}count-\expnumber{chap##2}{##1}}
 | 
| 
alpar@18
 | 
  1119  | 
      \def\secentry ##1##2##3##4{%
 | 
| 
alpar@18
 | 
  1120  | 
        \pdfoutline goto name{\pdfmkpgn{##4}}count-\expnumber{sec##2.##3}{##1}}
 | 
| 
alpar@18
 | 
  1121  | 
      \def\subsecentry ##1##2##3##4##5{%
 | 
| 
alpar@18
 | 
  1122  | 
        \pdfoutline goto name{\pdfmkpgn{##5}}count-\expnumber{subsec##2.##3.##4}{##1}}
 | 
| 
alpar@18
 | 
  1123  | 
      \def\subsubsecentry ##1##2##3##4##5##6{%
 | 
| 
alpar@18
 | 
  1124  | 
        \pdfoutline goto name{\pdfmkpgn{##6}}{##1}}
 | 
| 
alpar@18
 | 
  1125  | 
      \let\appendixentry = \chapentry
  | 
| 
alpar@18
 | 
  1126  | 
      \let\unnumbchapentry = \chapentry
  | 
| 
alpar@18
 | 
  1127  | 
      \let\unnumbsecentry = \secentry
  | 
| 
alpar@18
 | 
  1128  | 
      \let\unnumbsubsecentry = \subsecentry
  | 
| 
alpar@18
 | 
  1129  | 
      \let\unnumbsubsubsecentry = \subsubsecentry
  | 
| 
alpar@18
 | 
  1130  | 
      %
  | 
| 
alpar@18
 | 
  1131  | 
      % Make special characters normal for writing to the pdf file.
  | 
| 
alpar@18
 | 
  1132  | 
      %
  | 
| 
alpar@18
 | 
  1133  | 
      \indexnofonts
  | 
| 
alpar@18
 | 
  1134  | 
      \let\tt=\relax
  | 
| 
alpar@18
 | 
  1135  | 
      \turnoffactive
  | 
| 
alpar@18
 | 
  1136  | 
      \input \jobname.toc
  | 
| 
alpar@18
 | 
  1137  | 
    \endgroup\fi
  | 
| 
alpar@18
 | 
  1138  | 
  }}
  | 
| 
alpar@18
 | 
  1139  | 
  \def\makelinks #1,{%
 | 
| 
alpar@18
 | 
  1140  | 
    \def\params{#1}\def\E{END}%
 | 
| 
alpar@18
 | 
  1141  | 
    \ifx\params\E
  | 
| 
alpar@18
 | 
  1142  | 
      \let\nextmakelinks=\relax
  | 
| 
alpar@18
 | 
  1143  | 
    \else
  | 
| 
alpar@18
 | 
  1144  | 
      \let\nextmakelinks=\makelinks
  | 
| 
alpar@18
 | 
  1145  | 
      \ifnum\lnkcount>0,\fi
  | 
| 
alpar@18
 | 
  1146  | 
      \picknum{#1}%
 | 
| 
alpar@18
 | 
  1147  | 
      \startlink attr{/Border [0 0 0]}
 | 
| 
alpar@18
 | 
  1148  | 
        goto name{\pdfmkpgn{\the\pgn}}%
 | 
| 
alpar@18
 | 
  1149  | 
      \linkcolor #1%
  | 
| 
alpar@18
 | 
  1150  | 
      \advance\lnkcount by 1%
  | 
| 
alpar@18
 | 
  1151  | 
      \endlink
  | 
| 
alpar@18
 | 
  1152  | 
    \fi
  | 
| 
alpar@18
 | 
  1153  | 
    \nextmakelinks
  | 
| 
alpar@18
 | 
  1154  | 
  }
  | 
| 
alpar@18
 | 
  1155  | 
  \def\picknum#1{\expandafter\pn#1}
 | 
| 
alpar@18
 | 
  1156  | 
  \def\pn#1{%
 | 
| 
alpar@18
 | 
  1157  | 
    \def\p{#1}%
 | 
| 
alpar@18
 | 
  1158  | 
    \ifx\p\lbrace
  | 
| 
alpar@18
 | 
  1159  | 
      \let\nextpn=\ppn
  | 
| 
alpar@18
 | 
  1160  | 
    \else
  | 
| 
alpar@18
 | 
  1161  | 
      \let\nextpn=\ppnn
  | 
| 
alpar@18
 | 
  1162  | 
      \def\first{#1}
 | 
| 
alpar@18
 | 
  1163  | 
    \fi
  | 
| 
alpar@18
 | 
  1164  | 
    \nextpn
  | 
| 
alpar@18
 | 
  1165  | 
  }
  | 
| 
alpar@18
 | 
  1166  | 
  \def\ppn#1{\pgn=#1\gobble}
 | 
| 
alpar@18
 | 
  1167  | 
  \def\ppnn{\pgn=\first}
 | 
| 
alpar@18
 | 
  1168  | 
  \def\pdfmklnk#1{\lnkcount=0\makelinks #1,END,}
 | 
| 
alpar@18
 | 
  1169  | 
  \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
 | 
| 
alpar@18
 | 
  1170  | 
  \def\skipspaces#1{\def\PP{#1}\def\D{|}%
 | 
| 
alpar@18
 | 
  1171  | 
    \ifx\PP\D\let\nextsp\relax
  | 
| 
alpar@18
 | 
  1172  | 
    \else\let\nextsp\skipspaces
  | 
| 
alpar@18
 | 
  1173  | 
      \ifx\p\space\else\addtokens{\filename}{\PP}%
 | 
| 
alpar@18
 | 
  1174  | 
        \advance\filenamelength by 1
  | 
| 
alpar@18
 | 
  1175  | 
      \fi
  | 
| 
alpar@18
 | 
  1176  | 
    \fi
  | 
| 
alpar@18
 | 
  1177  | 
    \nextsp}
  | 
| 
alpar@18
 | 
  1178  | 
  \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax}
 | 
| 
alpar@18
 | 
  1179  | 
  \ifnum\pdftexversion < 14
  | 
| 
alpar@18
 | 
  1180  | 
    \let \startlink \pdfannotlink
  | 
| 
alpar@18
 | 
  1181  | 
  \else
  | 
| 
alpar@18
 | 
  1182  | 
    \let \startlink \pdfstartlink
  | 
| 
alpar@18
 | 
  1183  | 
  \fi
  | 
| 
alpar@18
 | 
  1184  | 
  \def\pdfurl#1{%
 | 
| 
alpar@18
 | 
  1185  | 
    \begingroup
  | 
| 
alpar@18
 | 
  1186  | 
      \normalturnoffactive\def\@{@}%
 | 
| 
alpar@18
 | 
  1187  | 
      \let\value=\expandablevalue
  | 
| 
alpar@18
 | 
  1188  | 
      \leavevmode\Red
  | 
| 
alpar@18
 | 
  1189  | 
      \startlink attr{/Border [0 0 0]}%
 | 
| 
alpar@18
 | 
  1190  | 
        user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
 | 
| 
alpar@18
 | 
  1191  | 
        % #1
  | 
| 
alpar@18
 | 
  1192  | 
    \endgroup}
  | 
| 
alpar@18
 | 
  1193  | 
  \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
 | 
| 
alpar@18
 | 
  1194  | 
  \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
 | 
| 
alpar@18
 | 
  1195  | 
  \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
 | 
| 
alpar@18
 | 
  1196  | 
  \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
 | 
| 
alpar@18
 | 
  1197  | 
  \def\maketoks{%
 | 
| 
alpar@18
 | 
  1198  | 
    \expandafter\poptoks\the\toksA|ENDTOKS|
  | 
| 
alpar@18
 | 
  1199  | 
    \ifx\first0\adn0
  | 
| 
alpar@18
 | 
  1200  | 
    \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
  | 
| 
alpar@18
 | 
  1201  | 
    \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
  | 
| 
alpar@18
 | 
  1202  | 
    \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
  | 
| 
alpar@18
 | 
  1203  | 
    \else
  | 
| 
alpar@18
 | 
  1204  | 
      \ifnum0=\countA\else\makelink\fi
  | 
| 
alpar@18
 | 
  1205  | 
      \ifx\first.\let\next=\done\else
  | 
| 
alpar@18
 | 
  1206  | 
        \let\next=\maketoks
  | 
| 
alpar@18
 | 
  1207  | 
        \addtokens{\toksB}{\the\toksD}
 | 
| 
alpar@18
 | 
  1208  | 
        \ifx\first,\addtokens{\toksB}{\space}\fi
 | 
| 
alpar@18
 | 
  1209  | 
      \fi
  | 
| 
alpar@18
 | 
  1210  | 
    \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
  | 
| 
alpar@18
 | 
  1211  | 
    \next}
  | 
| 
alpar@18
 | 
  1212  | 
  \def\makelink{\addtokens{\toksB}%
 | 
| 
alpar@18
 | 
  1213  | 
    {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
 | 
| 
alpar@18
 | 
  1214  | 
  \def\pdflink#1{%
 | 
| 
alpar@18
 | 
  1215  | 
    \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
 | 
| 
alpar@18
 | 
  1216  | 
    \linkcolor #1\endlink}
  | 
| 
alpar@18
 | 
  1217  | 
  \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
 | 
| 
alpar@18
 | 
  1218  | 
\fi % \ifx\pdfoutput
  | 
| 
alpar@18
 | 
  1219  | 
  | 
| 
alpar@18
 | 
  1220  | 
  | 
| 
alpar@18
 | 
  1221  | 
\message{fonts,}
 | 
| 
alpar@18
 | 
  1222  | 
% Font-change commands.
  | 
| 
alpar@18
 | 
  1223  | 
  | 
| 
alpar@18
 | 
  1224  | 
% Texinfo sort of supports the sans serif font style, which plain TeX does not.
  | 
| 
alpar@18
 | 
  1225  | 
% So we set up a \sf analogous to plain's \rm, etc.
  | 
| 
alpar@18
 | 
  1226  | 
\newfam\sffam
  | 
| 
alpar@18
 | 
  1227  | 
\def\sf{\fam=\sffam \tensf}
 | 
| 
alpar@18
 | 
  1228  | 
\let\li = \sf % Sometimes we call it \li, not \sf.
  | 
| 
alpar@18
 | 
  1229  | 
  | 
| 
alpar@18
 | 
  1230  | 
% We don't need math for this one.
  | 
| 
alpar@18
 | 
  1231  | 
\def\ttsl{\tenttsl}
 | 
| 
alpar@18
 | 
  1232  | 
  | 
| 
alpar@18
 | 
  1233  | 
% Default leading.
  | 
| 
alpar@18
 | 
  1234  | 
\newdimen\textleading  \textleading = 13.2pt
  | 
| 
alpar@18
 | 
  1235  | 
  | 
| 
alpar@18
 | 
  1236  | 
% Set the baselineskip to #1, and the lineskip and strut size
  | 
| 
alpar@18
 | 
  1237  | 
% correspondingly.  There is no deep meaning behind these magic numbers
  | 
| 
alpar@18
 | 
  1238  | 
% used as factors; they just match (closely enough) what Knuth defined.
  | 
| 
alpar@18
 | 
  1239  | 
%
  | 
| 
alpar@18
 | 
  1240  | 
\def\lineskipfactor{.08333}
 | 
| 
alpar@18
 | 
  1241  | 
\def\strutheightpercent{.70833}
 | 
| 
alpar@18
 | 
  1242  | 
\def\strutdepthpercent {.29167}
 | 
| 
alpar@18
 | 
  1243  | 
%
  | 
| 
alpar@18
 | 
  1244  | 
\def\setleading#1{%
 | 
| 
alpar@18
 | 
  1245  | 
  \normalbaselineskip = #1\relax
  | 
| 
alpar@18
 | 
  1246  | 
  \normallineskip = \lineskipfactor\normalbaselineskip
  | 
| 
alpar@18
 | 
  1247  | 
  \normalbaselines
  | 
| 
alpar@18
 | 
  1248  | 
  \setbox\strutbox =\hbox{%
 | 
| 
alpar@18
 | 
  1249  | 
    \vrule width0pt height\strutheightpercent\baselineskip
  | 
| 
alpar@18
 | 
  1250  | 
                    depth \strutdepthpercent \baselineskip
  | 
| 
alpar@18
 | 
  1251  | 
  }%
  | 
| 
alpar@18
 | 
  1252  | 
}
  | 
| 
alpar@18
 | 
  1253  | 
  | 
| 
alpar@18
 | 
  1254  | 
% Set the font macro #1 to the font named #2, adding on the
  | 
| 
alpar@18
 | 
  1255  | 
% specified font prefix (normally `cm').
  | 
| 
alpar@18
 | 
  1256  | 
% #3 is the font's design size, #4 is a scale factor
  | 
| 
alpar@18
 | 
  1257  | 
\def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4}
 | 
| 
alpar@18
 | 
  1258  | 
  | 
| 
alpar@18
 | 
  1259  | 
% Use cm as the default font prefix.
  | 
| 
alpar@18
 | 
  1260  | 
% To specify the font prefix, you must define \fontprefix
  | 
| 
alpar@18
 | 
  1261  | 
% before you read in texinfo.tex.
  | 
| 
alpar@18
 | 
  1262  | 
\ifx\fontprefix\undefined
  | 
| 
alpar@18
 | 
  1263  | 
\def\fontprefix{cm}
 | 
| 
alpar@18
 | 
  1264  | 
\fi
  | 
| 
alpar@18
 | 
  1265  | 
% Support font families that don't use the same naming scheme as CM.
  | 
| 
alpar@18
 | 
  1266  | 
\def\rmshape{r}
 | 
| 
alpar@18
 | 
  1267  | 
\def\rmbshape{bx}               %where the normal face is bold
 | 
| 
alpar@18
 | 
  1268  | 
\def\bfshape{b}
 | 
| 
alpar@18
 | 
  1269  | 
\def\bxshape{bx}
 | 
| 
alpar@18
 | 
  1270  | 
\def\ttshape{tt}
 | 
| 
alpar@18
 | 
  1271  | 
\def\ttbshape{tt}
 | 
| 
alpar@18
 | 
  1272  | 
\def\ttslshape{sltt}
 | 
| 
alpar@18
 | 
  1273  | 
\def\itshape{ti}
 | 
| 
alpar@18
 | 
  1274  | 
\def\itbshape{bxti}
 | 
| 
alpar@18
 | 
  1275  | 
\def\slshape{sl}
 | 
| 
alpar@18
 | 
  1276  | 
\def\slbshape{bxsl}
 | 
| 
alpar@18
 | 
  1277  | 
\def\sfshape{ss}
 | 
| 
alpar@18
 | 
  1278  | 
\def\sfbshape{ss}
 | 
| 
alpar@18
 | 
  1279  | 
\def\scshape{csc}
 | 
| 
alpar@18
 | 
  1280  | 
\def\scbshape{csc}
 | 
| 
alpar@18
 | 
  1281  | 
  | 
| 
alpar@18
 | 
  1282  | 
\newcount\mainmagstep
  | 
| 
alpar@18
 | 
  1283  | 
\ifx\bigger\relax
  | 
| 
alpar@18
 | 
  1284  | 
  % not really supported.
  | 
| 
alpar@18
 | 
  1285  | 
  \mainmagstep=\magstep1
  | 
| 
alpar@18
 | 
  1286  | 
  \setfont\textrm\rmshape{12}{1000}
 | 
| 
alpar@18
 | 
  1287  | 
  \setfont\texttt\ttshape{12}{1000}
 | 
| 
alpar@18
 | 
  1288  | 
\else
  | 
| 
alpar@18
 | 
  1289  | 
  \mainmagstep=\magstephalf
  | 
| 
alpar@18
 | 
  1290  | 
  \setfont\textrm\rmshape{10}{\mainmagstep}
 | 
| 
alpar@18
 | 
  1291  | 
  \setfont\texttt\ttshape{10}{\mainmagstep}
 | 
| 
alpar@18
 | 
  1292  | 
\fi
  | 
| 
alpar@18
 | 
  1293  | 
% Instead of cmb10, you may want to use cmbx10.
  | 
| 
alpar@18
 | 
  1294  | 
% cmbx10 is a prettier font on its own, but cmb10
  | 
| 
alpar@18
 | 
  1295  | 
% looks better when embedded in a line with cmr10
  | 
| 
alpar@18
 | 
  1296  | 
% (in Bob's opinion).
  | 
| 
alpar@18
 | 
  1297  | 
\setfont\textbf\bfshape{10}{\mainmagstep}
 | 
| 
alpar@18
 | 
  1298  | 
\setfont\textit\itshape{10}{\mainmagstep}
 | 
| 
alpar@18
 | 
  1299  | 
\setfont\textsl\slshape{10}{\mainmagstep}
 | 
| 
alpar@18
 | 
  1300  | 
\setfont\textsf\sfshape{10}{\mainmagstep}
 | 
| 
alpar@18
 | 
  1301  | 
\setfont\textsc\scshape{10}{\mainmagstep}
 | 
| 
alpar@18
 | 
  1302  | 
\setfont\textttsl\ttslshape{10}{\mainmagstep}
 | 
| 
alpar@18
 | 
  1303  | 
\font\texti=cmmi10 scaled \mainmagstep
  | 
| 
alpar@18
 | 
  1304  | 
\font\textsy=cmsy10 scaled \mainmagstep
  | 
| 
alpar@18
 | 
  1305  | 
  | 
| 
alpar@18
 | 
  1306  | 
% A few fonts for @defun, etc.
  | 
| 
alpar@18
 | 
  1307  | 
\setfont\defbf\bxshape{10}{\magstep1} %was 1314
 | 
| 
alpar@18
 | 
  1308  | 
\setfont\deftt\ttshape{10}{\magstep1}
 | 
| 
alpar@18
 | 
  1309  | 
\def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf}
 | 
| 
alpar@18
 | 
  1310  | 
  | 
| 
alpar@18
 | 
  1311  | 
% Fonts for indices, footnotes, small examples (9pt).
  | 
| 
alpar@18
 | 
  1312  | 
\setfont\smallrm\rmshape{9}{1000}
 | 
| 
alpar@18
 | 
  1313  | 
\setfont\smalltt\ttshape{9}{1000}
 | 
| 
alpar@18
 | 
  1314  | 
\setfont\smallbf\bfshape{10}{900}
 | 
| 
alpar@18
 | 
  1315  | 
\setfont\smallit\itshape{9}{1000}
 | 
| 
alpar@18
 | 
  1316  | 
\setfont\smallsl\slshape{9}{1000}
 | 
| 
alpar@18
 | 
  1317  | 
\setfont\smallsf\sfshape{9}{1000}
 | 
| 
alpar@18
 | 
  1318  | 
\setfont\smallsc\scshape{10}{900}
 | 
| 
alpar@18
 | 
  1319  | 
\setfont\smallttsl\ttslshape{10}{900}
 | 
| 
alpar@18
 | 
  1320  | 
\font\smalli=cmmi9
  | 
| 
alpar@18
 | 
  1321  | 
\font\smallsy=cmsy9
  | 
| 
alpar@18
 | 
  1322  | 
  | 
| 
alpar@18
 | 
  1323  | 
% Fonts for small examples (8pt).
  | 
| 
alpar@18
 | 
  1324  | 
\setfont\smallerrm\rmshape{8}{1000}
 | 
| 
alpar@18
 | 
  1325  | 
\setfont\smallertt\ttshape{8}{1000}
 | 
| 
alpar@18
 | 
  1326  | 
\setfont\smallerbf\bfshape{10}{800}
 | 
| 
alpar@18
 | 
  1327  | 
\setfont\smallerit\itshape{8}{1000}
 | 
| 
alpar@18
 | 
  1328  | 
\setfont\smallersl\slshape{8}{1000}
 | 
| 
alpar@18
 | 
  1329  | 
\setfont\smallersf\sfshape{8}{1000}
 | 
| 
alpar@18
 | 
  1330  | 
\setfont\smallersc\scshape{10}{800}
 | 
| 
alpar@18
 | 
  1331  | 
\setfont\smallerttsl\ttslshape{10}{800}
 | 
| 
alpar@18
 | 
  1332  | 
\font\smalleri=cmmi8
  | 
| 
alpar@18
 | 
  1333  | 
\font\smallersy=cmsy8
  | 
| 
alpar@18
 | 
  1334  | 
  | 
| 
alpar@18
 | 
  1335  | 
% Fonts for title page:
  | 
| 
alpar@18
 | 
  1336  | 
\setfont\titlerm\rmbshape{12}{\magstep3}
 | 
| 
alpar@18
 | 
  1337  | 
\setfont\titleit\itbshape{10}{\magstep4}
 | 
| 
alpar@18
 | 
  1338  | 
\setfont\titlesl\slbshape{10}{\magstep4}
 | 
| 
alpar@18
 | 
  1339  | 
\setfont\titlett\ttbshape{12}{\magstep3}
 | 
| 
alpar@18
 | 
  1340  | 
\setfont\titlettsl\ttslshape{10}{\magstep4}
 | 
| 
alpar@18
 | 
  1341  | 
\setfont\titlesf\sfbshape{17}{\magstep1}
 | 
| 
alpar@18
 | 
  1342  | 
\let\titlebf=\titlerm
  | 
| 
alpar@18
 | 
  1343  | 
\setfont\titlesc\scbshape{10}{\magstep4}
 | 
| 
alpar@18
 | 
  1344  | 
\font\titlei=cmmi12 scaled \magstep3
  | 
| 
alpar@18
 | 
  1345  | 
\font\titlesy=cmsy10 scaled \magstep4
  | 
| 
alpar@18
 | 
  1346  | 
\def\authorrm{\secrm}
 | 
| 
alpar@18
 | 
  1347  | 
\def\authortt{\sectt}
 | 
| 
alpar@18
 | 
  1348  | 
  | 
| 
alpar@18
 | 
  1349  | 
% Chapter (and unnumbered) fonts (17.28pt).
  | 
| 
alpar@18
 | 
  1350  | 
\setfont\chaprm\rmbshape{12}{\magstep2}
 | 
| 
alpar@18
 | 
  1351  | 
\setfont\chapit\itbshape{10}{\magstep3}
 | 
| 
alpar@18
 | 
  1352  | 
\setfont\chapsl\slbshape{10}{\magstep3}
 | 
| 
alpar@18
 | 
  1353  | 
\setfont\chaptt\ttbshape{12}{\magstep2}
 | 
| 
alpar@18
 | 
  1354  | 
\setfont\chapttsl\ttslshape{10}{\magstep3}
 | 
| 
alpar@18
 | 
  1355  | 
\setfont\chapsf\sfbshape{17}{1000}
 | 
| 
alpar@18
 | 
  1356  | 
\let\chapbf=\chaprm
  | 
| 
alpar@18
 | 
  1357  | 
\setfont\chapsc\scbshape{10}{\magstep3}
 | 
| 
alpar@18
 | 
  1358  | 
\font\chapi=cmmi12 scaled \magstep2
  | 
| 
alpar@18
 | 
  1359  | 
\font\chapsy=cmsy10 scaled \magstep3
  | 
| 
alpar@18
 | 
  1360  | 
  | 
| 
alpar@18
 | 
  1361  | 
% Section fonts (14.4pt).
  | 
| 
alpar@18
 | 
  1362  | 
\setfont\secrm\rmbshape{12}{\magstep1}
 | 
| 
alpar@18
 | 
  1363  | 
\setfont\secit\itbshape{10}{\magstep2}
 | 
| 
alpar@18
 | 
  1364  | 
\setfont\secsl\slbshape{10}{\magstep2}
 | 
| 
alpar@18
 | 
  1365  | 
\setfont\sectt\ttbshape{12}{\magstep1}
 | 
| 
alpar@18
 | 
  1366  | 
\setfont\secttsl\ttslshape{10}{\magstep2}
 | 
| 
alpar@18
 | 
  1367  | 
\setfont\secsf\sfbshape{12}{\magstep1}
 | 
| 
alpar@18
 | 
  1368  | 
\let\secbf\secrm
  | 
| 
alpar@18
 | 
  1369  | 
\setfont\secsc\scbshape{10}{\magstep2}
 | 
| 
alpar@18
 | 
  1370  | 
\font\seci=cmmi12 scaled \magstep1
  | 
| 
alpar@18
 | 
  1371  | 
\font\secsy=cmsy10 scaled \magstep2
  | 
| 
alpar@18
 | 
  1372  | 
  | 
| 
alpar@18
 | 
  1373  | 
% Subsection fonts (13.15pt).
  | 
| 
alpar@18
 | 
  1374  | 
\setfont\ssecrm\rmbshape{12}{\magstephalf}
 | 
| 
alpar@18
 | 
  1375  | 
\setfont\ssecit\itbshape{10}{1315}
 | 
| 
alpar@18
 | 
  1376  | 
\setfont\ssecsl\slbshape{10}{1315}
 | 
| 
alpar@18
 | 
  1377  | 
\setfont\ssectt\ttbshape{12}{\magstephalf}
 | 
| 
alpar@18
 | 
  1378  | 
\setfont\ssecttsl\ttslshape{10}{1315}
 | 
| 
alpar@18
 | 
  1379  | 
\setfont\ssecsf\sfbshape{12}{\magstephalf}
 | 
| 
alpar@18
 | 
  1380  | 
\let\ssecbf\ssecrm
  | 
| 
alpar@18
 | 
  1381  | 
\setfont\ssecsc\scbshape{10}{\magstep1}
 | 
| 
alpar@18
 | 
  1382  | 
\font\sseci=cmmi12 scaled \magstephalf
  | 
| 
alpar@18
 | 
  1383  | 
\font\ssecsy=cmsy10 scaled 1315
  | 
| 
alpar@18
 | 
  1384  | 
% The smallcaps and symbol fonts should actually be scaled \magstep1.5,
  | 
| 
alpar@18
 | 
  1385  | 
% but that is not a standard magnification.
  | 
| 
alpar@18
 | 
  1386  | 
  | 
| 
alpar@18
 | 
  1387  | 
% In order for the font changes to affect most math symbols and letters,
  | 
| 
alpar@18
 | 
  1388  | 
% we have to define the \textfont of the standard families.  Since
  | 
| 
alpar@18
 | 
  1389  | 
% texinfo doesn't allow for producing subscripts and superscripts except
  | 
| 
alpar@18
 | 
  1390  | 
% in the main text, we don't bother to reset \scriptfont and
  | 
| 
alpar@18
 | 
  1391  | 
% \scriptscriptfont (which would also require loading a lot more fonts).
  | 
| 
alpar@18
 | 
  1392  | 
%
  | 
| 
alpar@18
 | 
  1393  | 
\def\resetmathfonts{%
 | 
| 
alpar@18
 | 
  1394  | 
  \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy
  | 
| 
alpar@18
 | 
  1395  | 
  \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf
  | 
| 
alpar@18
 | 
  1396  | 
  \textfont\ttfam=\tentt \textfont\sffam=\tensf
  | 
| 
alpar@18
 | 
  1397  | 
}
  | 
| 
alpar@18
 | 
  1398  | 
  | 
| 
alpar@18
 | 
  1399  | 
% The font-changing commands redefine the meanings of \tenSTYLE, instead
  | 
| 
alpar@18
 | 
  1400  | 
% of just \STYLE.  We do this so that font changes will continue to work
  | 
| 
alpar@18
 | 
  1401  | 
% in math mode, where it is the current \fam that is relevant in most
  | 
| 
alpar@18
 | 
  1402  | 
% cases, not the current font.  Plain TeX does \def\bf{\fam=\bffam
 | 
| 
alpar@18
 | 
  1403  | 
% \tenbf}, for example.  By redefining \tenbf, we obviate the need to
  | 
| 
alpar@18
 | 
  1404  | 
% redefine \bf itself.
  | 
| 
alpar@18
 | 
  1405  | 
\def\textfonts{%
 | 
| 
alpar@18
 | 
  1406  | 
  \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
  | 
| 
alpar@18
 | 
  1407  | 
  \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
  | 
| 
alpar@18
 | 
  1408  | 
  \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl
  | 
| 
alpar@18
 | 
  1409  | 
  \resetmathfonts \setleading{\textleading}}
 | 
| 
alpar@18
 | 
  1410  | 
\def\titlefonts{%
 | 
| 
alpar@18
 | 
  1411  | 
  \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl
  | 
| 
alpar@18
 | 
  1412  | 
  \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc
  | 
| 
alpar@18
 | 
  1413  | 
  \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
  | 
| 
alpar@18
 | 
  1414  | 
  \let\tenttsl=\titlettsl
  | 
| 
alpar@18
 | 
  1415  | 
  \resetmathfonts \setleading{25pt}}
 | 
| 
alpar@18
 | 
  1416  | 
\def\titlefont#1{{\titlefonts\rm #1}}
 | 
| 
alpar@18
 | 
  1417  | 
\def\chapfonts{%
 | 
| 
alpar@18
 | 
  1418  | 
  \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
  | 
| 
alpar@18
 | 
  1419  | 
  \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
  | 
| 
alpar@18
 | 
  1420  | 
  \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl
  | 
| 
alpar@18
 | 
  1421  | 
  \resetmathfonts \setleading{19pt}}
 | 
| 
alpar@18
 | 
  1422  | 
\def\secfonts{%
 | 
| 
alpar@18
 | 
  1423  | 
  \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
  | 
| 
alpar@18
 | 
  1424  | 
  \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
  | 
| 
alpar@18
 | 
  1425  | 
  \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl
  | 
| 
alpar@18
 | 
  1426  | 
  \resetmathfonts \setleading{16pt}}
 | 
| 
alpar@18
 | 
  1427  | 
\def\subsecfonts{%
 | 
| 
alpar@18
 | 
  1428  | 
  \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
  | 
| 
alpar@18
 | 
  1429  | 
  \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
  | 
| 
alpar@18
 | 
  1430  | 
  \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl
  | 
| 
alpar@18
 | 
  1431  | 
  \resetmathfonts \setleading{15pt}}
 | 
| 
alpar@18
 | 
  1432  | 
\let\subsubsecfonts = \subsecfonts % Maybe make sssec fonts scaled magstephalf?
  | 
| 
alpar@18
 | 
  1433  | 
\def\smallfonts{%
 | 
| 
alpar@18
 | 
  1434  | 
  \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl
  | 
| 
alpar@18
 | 
  1435  | 
  \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc
  | 
| 
alpar@18
 | 
  1436  | 
  \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy
  | 
| 
alpar@18
 | 
  1437  | 
  \let\tenttsl=\smallttsl
  | 
| 
alpar@18
 | 
  1438  | 
  \resetmathfonts \setleading{10.5pt}}
 | 
| 
alpar@18
 | 
  1439  | 
\def\smallerfonts{%
 | 
| 
alpar@18
 | 
  1440  | 
  \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl
  | 
| 
alpar@18
 | 
  1441  | 
  \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc
  | 
| 
alpar@18
 | 
  1442  | 
  \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy
  | 
| 
alpar@18
 | 
  1443  | 
  \let\tenttsl=\smallerttsl
  | 
| 
alpar@18
 | 
  1444  | 
  \resetmathfonts \setleading{9.5pt}}
 | 
| 
alpar@18
 | 
  1445  | 
  | 
| 
alpar@18
 | 
  1446  | 
% Set the fonts to use with the @small... environments.
  | 
| 
alpar@18
 | 
  1447  | 
\let\smallexamplefonts = \smallfonts
  | 
| 
alpar@18
 | 
  1448  | 
  | 
| 
alpar@18
 | 
  1449  | 
% About \smallexamplefonts.  If we use \smallfonts (9pt), @smallexample
  | 
| 
alpar@18
 | 
  1450  | 
% can fit this many characters:
  | 
| 
alpar@18
 | 
  1451  | 
%   8.5x11=86   smallbook=72  a4=90  a5=69
  | 
| 
alpar@18
 | 
  1452  | 
% If we use \smallerfonts (8pt), then we can fit this many characters:
  | 
| 
alpar@18
 | 
  1453  | 
%   8.5x11=90+  smallbook=80  a4=90+  a5=77
  | 
| 
alpar@18
 | 
  1454  | 
% For me, subjectively, the few extra characters that fit aren't worth
  | 
| 
alpar@18
 | 
  1455  | 
% the additional smallness of 8pt.  So I'm making the default 9pt.
  | 
| 
alpar@18
 | 
  1456  | 
%
  | 
| 
alpar@18
 | 
  1457  | 
% By the way, for comparison, here's what fits with @example (10pt):
  | 
| 
alpar@18
 | 
  1458  | 
%   8.5x11=71  smallbook=60  a4=75  a5=58
  | 
| 
alpar@18
 | 
  1459  | 
%
  | 
| 
alpar@18
 | 
  1460  | 
% I wish we used A4 paper on this side of the Atlantic.
  | 
| 
alpar@18
 | 
  1461  | 
%
  | 
| 
alpar@18
 | 
  1462  | 
% --karl, 24jan03.
  | 
| 
alpar@18
 | 
  1463  | 
  | 
| 
alpar@18
 | 
  1464  | 
  | 
| 
alpar@18
 | 
  1465  | 
% Set up the default fonts, so we can use them for creating boxes.
  | 
| 
alpar@18
 | 
  1466  | 
%
  | 
| 
alpar@18
 | 
  1467  | 
\textfonts
  | 
| 
alpar@18
 | 
  1468  | 
  | 
| 
alpar@18
 | 
  1469  | 
% Define these so they can be easily changed for other fonts.
  | 
| 
alpar@18
 | 
  1470  | 
\def\angleleft{$\langle$}
 | 
| 
alpar@18
 | 
  1471  | 
\def\angleright{$\rangle$}
 | 
| 
alpar@18
 | 
  1472  | 
  | 
| 
alpar@18
 | 
  1473  | 
% Count depth in font-changes, for error checks
  | 
| 
alpar@18
 | 
  1474  | 
\newcount\fontdepth \fontdepth=0
  | 
| 
alpar@18
 | 
  1475  | 
  | 
| 
alpar@18
 | 
  1476  | 
% Fonts for short table of contents.
  | 
| 
alpar@18
 | 
  1477  | 
\setfont\shortcontrm\rmshape{12}{1000}
 | 
| 
alpar@18
 | 
  1478  | 
\setfont\shortcontbf\bxshape{12}{1000}
 | 
| 
alpar@18
 | 
  1479  | 
\setfont\shortcontsl\slshape{12}{1000}
 | 
| 
alpar@18
 | 
  1480  | 
\setfont\shortconttt\ttshape{12}{1000}
 | 
| 
alpar@18
 | 
  1481  | 
  | 
| 
alpar@18
 | 
  1482  | 
%% Add scribe-like font environments, plus @l for inline lisp (usually sans
  | 
| 
alpar@18
 | 
  1483  | 
%% serif) and @ii for TeX italic
  | 
| 
alpar@18
 | 
  1484  | 
  | 
| 
alpar@18
 | 
  1485  | 
% \smartitalic{ARG} outputs arg in italics, followed by an italic correction
 | 
| 
alpar@18
 | 
  1486  | 
% unless the following character is such as not to need one.
  | 
| 
alpar@18
 | 
  1487  | 
\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else
 | 
| 
alpar@18
 | 
  1488  | 
                    \ptexslash\fi\fi\fi}
  | 
| 
alpar@18
 | 
  1489  | 
\def\smartslanted#1{{\ifusingtt\ttsl\sl #1}\futurelet\next\smartitalicx}
 | 
| 
alpar@18
 | 
  1490  | 
\def\smartitalic#1{{\ifusingtt\ttsl\it #1}\futurelet\next\smartitalicx}
 | 
| 
alpar@18
 | 
  1491  | 
  | 
| 
alpar@18
 | 
  1492  | 
\let\i=\smartitalic
  | 
| 
alpar@18
 | 
  1493  | 
\let\var=\smartslanted
  | 
| 
alpar@18
 | 
  1494  | 
\let\dfn=\smartslanted
  | 
| 
alpar@18
 | 
  1495  | 
\let\emph=\smartitalic
  | 
| 
alpar@18
 | 
  1496  | 
\let\cite=\smartslanted
  | 
| 
alpar@18
 | 
  1497  | 
  | 
| 
alpar@18
 | 
  1498  | 
\def\b#1{{\bf #1}}
 | 
| 
alpar@18
 | 
  1499  | 
\let\strong=\b
  | 
| 
alpar@18
 | 
  1500  | 
  | 
| 
alpar@18
 | 
  1501  | 
% We can't just use \exhyphenpenalty, because that only has effect at
  | 
| 
alpar@18
 | 
  1502  | 
% the end of a paragraph.  Restore normal hyphenation at the end of the
  | 
| 
alpar@18
 | 
  1503  | 
% group within which \nohyphenation is presumably called.
  | 
| 
alpar@18
 | 
  1504  | 
%
  | 
| 
alpar@18
 | 
  1505  | 
\def\nohyphenation{\hyphenchar\font = -1  \aftergroup\restorehyphenation}
 | 
| 
alpar@18
 | 
  1506  | 
\def\restorehyphenation{\hyphenchar\font = `- }
 | 
| 
alpar@18
 | 
  1507  | 
  | 
| 
alpar@18
 | 
  1508  | 
% Set sfcode to normal for the chars that usually have another value.
  | 
| 
alpar@18
 | 
  1509  | 
% Can't use plain's \frenchspacing because it uses the `\x notation, and
  | 
| 
alpar@18
 | 
  1510  | 
% sometimes \x has an active definition that messes things up.
  | 
| 
alpar@18
 | 
  1511  | 
%
  | 
| 
alpar@18
 | 
  1512  | 
\catcode`@=11
  | 
| 
alpar@18
 | 
  1513  | 
  \def\frenchspacing{%
 | 
| 
alpar@18
 | 
  1514  | 
    \sfcode\dotChar  =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m
  | 
| 
alpar@18
 | 
  1515  | 
    \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m
  | 
| 
alpar@18
 | 
  1516  | 
  }
  | 
| 
alpar@18
 | 
  1517  | 
\catcode`@=\other
  | 
| 
alpar@18
 | 
  1518  | 
  | 
| 
alpar@18
 | 
  1519  | 
\def\t#1{%
 | 
| 
alpar@18
 | 
  1520  | 
  {\tt \rawbackslash \frenchspacing #1}%
 | 
| 
alpar@18
 | 
  1521  | 
  \null
  | 
| 
alpar@18
 | 
  1522  | 
}
  | 
| 
alpar@18
 | 
  1523  | 
\let\ttfont=\t
  | 
| 
alpar@18
 | 
  1524  | 
\def\samp#1{`\tclose{#1}'\null}
 | 
| 
alpar@18
 | 
  1525  | 
\setfont\keyrm\rmshape{8}{1000}
 | 
| 
alpar@18
 | 
  1526  | 
\font\keysy=cmsy9
  | 
| 
alpar@18
 | 
  1527  | 
\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
 | 
| 
alpar@18
 | 
  1528  | 
  \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
 | 
| 
alpar@18
 | 
  1529  | 
    \vbox{\hrule\kern-0.4pt
 | 
| 
alpar@18
 | 
  1530  | 
     \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
 | 
| 
alpar@18
 | 
  1531  | 
    \kern-0.4pt\hrule}%
  | 
| 
alpar@18
 | 
  1532  | 
  \kern-.06em\raise0.4pt\hbox{\angleright}}}}
 | 
| 
alpar@18
 | 
  1533  | 
% The old definition, with no lozenge:
  | 
| 
alpar@18
 | 
  1534  | 
%\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null}
 | 
| 
alpar@18
 | 
  1535  | 
\def\ctrl #1{{\tt \rawbackslash \hat}#1}
 | 
| 
alpar@18
 | 
  1536  | 
  | 
| 
alpar@18
 | 
  1537  | 
% @file, @option are the same as @samp.
  | 
| 
alpar@18
 | 
  1538  | 
\let\file=\samp
  | 
| 
alpar@18
 | 
  1539  | 
\let\option=\samp
  | 
| 
alpar@18
 | 
  1540  | 
  | 
| 
alpar@18
 | 
  1541  | 
% @code is a modification of @t,
  | 
| 
alpar@18
 | 
  1542  | 
% which makes spaces the same size as normal in the surrounding text.
  | 
| 
alpar@18
 | 
  1543  | 
\def\tclose#1{%
 | 
| 
alpar@18
 | 
  1544  | 
  {%
 | 
| 
alpar@18
 | 
  1545  | 
    % Change normal interword space to be same as for the current font.
  | 
| 
alpar@18
 | 
  1546  | 
    \spaceskip = \fontdimen2\font
  | 
| 
alpar@18
 | 
  1547  | 
    %
  | 
| 
alpar@18
 | 
  1548  | 
    % Switch to typewriter.
  | 
| 
alpar@18
 | 
  1549  | 
    \tt
  | 
| 
alpar@18
 | 
  1550  | 
    %
  | 
| 
alpar@18
 | 
  1551  | 
    % But `\ ' produces the large typewriter interword space.
  | 
| 
alpar@18
 | 
  1552  | 
    \def\ {{\spaceskip = 0pt{} }}%
 | 
| 
alpar@18
 | 
  1553  | 
    %
  | 
| 
alpar@18
 | 
  1554  | 
    % Turn off hyphenation.
  | 
| 
alpar@18
 | 
  1555  | 
    \nohyphenation
  | 
| 
alpar@18
 | 
  1556  | 
    %
  | 
| 
alpar@18
 | 
  1557  | 
    \rawbackslash
  | 
| 
alpar@18
 | 
  1558  | 
    \frenchspacing
  | 
| 
alpar@18
 | 
  1559  | 
    #1%
  | 
| 
alpar@18
 | 
  1560  | 
  }%
  | 
| 
alpar@18
 | 
  1561  | 
  \null
  | 
| 
alpar@18
 | 
  1562  | 
}
  | 
| 
alpar@18
 | 
  1563  | 
  | 
| 
alpar@18
 | 
  1564  | 
% We *must* turn on hyphenation at `-' and `_' in \code.
  | 
| 
alpar@18
 | 
  1565  | 
% Otherwise, it is too hard to avoid overfull hboxes
  | 
| 
alpar@18
 | 
  1566  | 
% in the Emacs manual, the Library manual, etc.
  | 
| 
alpar@18
 | 
  1567  | 
  | 
| 
alpar@18
 | 
  1568  | 
% Unfortunately, TeX uses one parameter (\hyphenchar) to control
  | 
| 
alpar@18
 | 
  1569  | 
% both hyphenation at - and hyphenation within words.
  | 
| 
alpar@18
 | 
  1570  | 
% We must therefore turn them both off (\tclose does that)
  | 
| 
alpar@18
 | 
  1571  | 
% and arrange explicitly to hyphenate at a dash.
  | 
| 
alpar@18
 | 
  1572  | 
%  -- rms.
  | 
| 
alpar@18
 | 
  1573  | 
{
 | 
| 
alpar@18
 | 
  1574  | 
  \catcode`\-=\active
  | 
| 
alpar@18
 | 
  1575  | 
  \catcode`\_=\active
  | 
| 
alpar@18
 | 
  1576  | 
  %
  | 
| 
alpar@18
 | 
  1577  | 
  \global\def\code{\begingroup
 | 
| 
alpar@18
 | 
  1578  | 
    \catcode`\-=\active \let-\codedash
  | 
| 
alpar@18
 | 
  1579  | 
    \catcode`\_=\active \let_\codeunder
  | 
| 
alpar@18
 | 
  1580  | 
    \codex
  | 
| 
alpar@18
 | 
  1581  | 
  }
  | 
| 
alpar@18
 | 
  1582  | 
  %
  | 
| 
alpar@18
 | 
  1583  | 
  % If we end up with any active - characters when handling the index,
  | 
| 
alpar@18
 | 
  1584  | 
  % just treat them as a normal -.
  | 
| 
alpar@18
 | 
  1585  | 
  \global\def\indexbreaks{\catcode`\-=\active \let-\realdash}
 | 
| 
alpar@18
 | 
  1586  | 
}
  | 
| 
alpar@18
 | 
  1587  | 
  | 
| 
alpar@18
 | 
  1588  | 
\def\realdash{-}
 | 
| 
alpar@18
 | 
  1589  | 
\def\codedash{-\discretionary{}{}{}}
 | 
| 
alpar@18
 | 
  1590  | 
\def\codeunder{%
 | 
| 
alpar@18
 | 
  1591  | 
  % this is all so @math{@code{var_name}+1} can work.  In math mode, _
 | 
| 
alpar@18
 | 
  1592  | 
  % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
  | 
| 
alpar@18
 | 
  1593  | 
  % will therefore expand the active definition of _, which is us
  | 
| 
alpar@18
 | 
  1594  | 
  % (inside @code that is), therefore an endless loop.
  | 
| 
alpar@18
 | 
  1595  | 
  \ifusingtt{\ifmmode
 | 
| 
alpar@18
 | 
  1596  | 
               \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_.
  | 
| 
alpar@18
 | 
  1597  | 
             \else\normalunderscore \fi
  | 
| 
alpar@18
 | 
  1598  | 
             \discretionary{}{}{}}%
 | 
| 
alpar@18
 | 
  1599  | 
            {\_}%
 | 
| 
alpar@18
 | 
  1600  | 
}
  | 
| 
alpar@18
 | 
  1601  | 
\def\codex #1{\tclose{#1}\endgroup}
 | 
| 
alpar@18
 | 
  1602  | 
  | 
| 
alpar@18
 | 
  1603  | 
% @kbd is like @code, except that if the argument is just one @key command,
  | 
| 
alpar@18
 | 
  1604  | 
% then @kbd has no effect.
  | 
| 
alpar@18
 | 
  1605  | 
  | 
| 
alpar@18
 | 
  1606  | 
% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
  | 
| 
alpar@18
 | 
  1607  | 
%   `example' (@kbd uses ttsl only inside of @example and friends),
  | 
| 
alpar@18
 | 
  1608  | 
%   or `code' (@kbd uses normal tty font always).
  | 
| 
alpar@18
 | 
  1609  | 
\def\kbdinputstyle{\parsearg\kbdinputstylexxx}
 | 
| 
alpar@18
 | 
  1610  | 
\def\kbdinputstylexxx#1{%
 | 
| 
alpar@18
 | 
  1611  | 
  \def\arg{#1}%
 | 
| 
alpar@18
 | 
  1612  | 
  \ifx\arg\worddistinct
  | 
| 
alpar@18
 | 
  1613  | 
    \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
 | 
| 
alpar@18
 | 
  1614  | 
  \else\ifx\arg\wordexample
  | 
| 
alpar@18
 | 
  1615  | 
    \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
 | 
| 
alpar@18
 | 
  1616  | 
  \else\ifx\arg\wordcode
  | 
| 
alpar@18
 | 
  1617  | 
    \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
 | 
| 
alpar@18
 | 
  1618  | 
  \else
  | 
| 
alpar@18
 | 
  1619  | 
    \errhelp = \EMsimple
  | 
| 
alpar@18
 | 
  1620  | 
    \errmessage{Unknown @kbdinputstyle option `\arg'}%
 | 
| 
alpar@18
 | 
  1621  | 
  \fi\fi\fi
  | 
| 
alpar@18
 | 
  1622  | 
}
  | 
| 
alpar@18
 | 
  1623  | 
\def\worddistinct{distinct}
 | 
| 
alpar@18
 | 
  1624  | 
\def\wordexample{example}
 | 
| 
alpar@18
 | 
  1625  | 
\def\wordcode{code}
 | 
| 
alpar@18
 | 
  1626  | 
  | 
| 
alpar@18
 | 
  1627  | 
% Default is `distinct.'
  | 
| 
alpar@18
 | 
  1628  | 
\kbdinputstyle distinct
  | 
| 
alpar@18
 | 
  1629  | 
  | 
| 
alpar@18
 | 
  1630  | 
\def\xkey{\key}
 | 
| 
alpar@18
 | 
  1631  | 
\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
 | 
| 
alpar@18
 | 
  1632  | 
\ifx\one\xkey\ifx\threex\three \key{#2}%
 | 
| 
alpar@18
 | 
  1633  | 
\else{\tclose{\kbdfont\look}}\fi
 | 
| 
alpar@18
 | 
  1634  | 
\else{\tclose{\kbdfont\look}}\fi}
 | 
| 
alpar@18
 | 
  1635  | 
  | 
| 
alpar@18
 | 
  1636  | 
% For @url, @env, @command quotes seem unnecessary, so use \code.
  | 
| 
alpar@18
 | 
  1637  | 
\let\url=\code
  | 
| 
alpar@18
 | 
  1638  | 
\let\env=\code
  | 
| 
alpar@18
 | 
  1639  | 
\let\command=\code
  | 
| 
alpar@18
 | 
  1640  | 
  | 
| 
alpar@18
 | 
  1641  | 
% @uref (abbreviation for `urlref') takes an optional (comma-separated)
  | 
| 
alpar@18
 | 
  1642  | 
% second argument specifying the text to display and an optional third
  | 
| 
alpar@18
 | 
  1643  | 
% arg as text to display instead of (rather than in addition to) the url
  | 
| 
alpar@18
 | 
  1644  | 
% itself.  First (mandatory) arg is the url.  Perhaps eventually put in
  | 
| 
alpar@18
 | 
  1645  | 
% a hypertex \special here.
  | 
| 
alpar@18
 | 
  1646  | 
%
  | 
| 
alpar@18
 | 
  1647  | 
\def\uref#1{\douref #1,,,\finish}
 | 
| 
alpar@18
 | 
  1648  | 
\def\douref#1,#2,#3,#4\finish{\begingroup
 | 
| 
alpar@18
 | 
  1649  | 
  \unsepspaces
  | 
| 
alpar@18
 | 
  1650  | 
  \pdfurl{#1}%
 | 
| 
alpar@18
 | 
  1651  | 
  \setbox0 = \hbox{\ignorespaces #3}%
 | 
| 
alpar@18
 | 
  1652  | 
  \ifdim\wd0 > 0pt
  | 
| 
alpar@18
 | 
  1653  | 
    \unhbox0 % third arg given, show only that
  | 
| 
alpar@18
 | 
  1654  | 
  \else
  | 
| 
alpar@18
 | 
  1655  | 
    \setbox0 = \hbox{\ignorespaces #2}%
 | 
| 
alpar@18
 | 
  1656  | 
    \ifdim\wd0 > 0pt
  | 
| 
alpar@18
 | 
  1657  | 
      \ifpdf
  | 
| 
alpar@18
 | 
  1658  | 
        \unhbox0             % PDF: 2nd arg given, show only it
  | 
| 
alpar@18
 | 
  1659  | 
      \else
  | 
| 
alpar@18
 | 
  1660  | 
        \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url
 | 
| 
alpar@18
 | 
  1661  | 
      \fi
  | 
| 
alpar@18
 | 
  1662  | 
    \else
  | 
| 
alpar@18
 | 
  1663  | 
      \code{#1}% only url given, so show it
 | 
| 
alpar@18
 | 
  1664  | 
    \fi
  | 
| 
alpar@18
 | 
  1665  | 
  \fi
  | 
| 
alpar@18
 | 
  1666  | 
  \endlink
  | 
| 
alpar@18
 | 
  1667  | 
\endgroup}
  | 
| 
alpar@18
 | 
  1668  | 
  | 
| 
alpar@18
 | 
  1669  | 
% rms does not like angle brackets --karl, 17may97.
  | 
| 
alpar@18
 | 
  1670  | 
% So now @email is just like @uref, unless we are pdf.
  | 
| 
alpar@18
 | 
  1671  | 
%
  | 
| 
alpar@18
 | 
  1672  | 
%\def\email#1{\angleleft{\tt #1}\angleright}
 | 
| 
alpar@18
 | 
  1673  | 
\ifpdf
  | 
| 
alpar@18
 | 
  1674  | 
  \def\email#1{\doemail#1,,\finish}
 | 
| 
alpar@18
 | 
  1675  | 
  \def\doemail#1,#2,#3\finish{\begingroup
 | 
| 
alpar@18
 | 
  1676  | 
    \unsepspaces
  | 
| 
alpar@18
 | 
  1677  | 
    \pdfurl{mailto:#1}%
 | 
| 
alpar@18
 | 
  1678  | 
    \setbox0 = \hbox{\ignorespaces #2}%
 | 
| 
alpar@18
 | 
  1679  | 
    \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
 | 
| 
alpar@18
 | 
  1680  | 
    \endlink
  | 
| 
alpar@18
 | 
  1681  | 
  \endgroup}
  | 
| 
alpar@18
 | 
  1682  | 
\else
  | 
| 
alpar@18
 | 
  1683  | 
  \let\email=\uref
  | 
| 
alpar@18
 | 
  1684  | 
\fi
  | 
| 
alpar@18
 | 
  1685  | 
  | 
| 
alpar@18
 | 
  1686  | 
% Check if we are currently using a typewriter font.  Since all the
  | 
| 
alpar@18
 | 
  1687  | 
% Computer Modern typewriter fonts have zero interword stretch (and
  | 
| 
alpar@18
 | 
  1688  | 
% shrink), and it is reasonable to expect all typewriter fonts to have
  | 
| 
alpar@18
 | 
  1689  | 
% this property, we can check that font parameter.
  | 
| 
alpar@18
 | 
  1690  | 
%
  | 
| 
alpar@18
 | 
  1691  | 
\def\ifmonospace{\ifdim\fontdimen3\font=0pt }
 | 
| 
alpar@18
 | 
  1692  | 
  | 
| 
alpar@18
 | 
  1693  | 
% Typeset a dimension, e.g., `in' or `pt'.  The only reason for the
  | 
| 
alpar@18
 | 
  1694  | 
% argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
 | 
| 
alpar@18
 | 
  1695  | 
%
  | 
| 
alpar@18
 | 
  1696  | 
\def\dmn#1{\thinspace #1}
 | 
| 
alpar@18
 | 
  1697  | 
  | 
| 
alpar@18
 | 
  1698  | 
\def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par}
 | 
| 
alpar@18
 | 
  1699  | 
  | 
| 
alpar@18
 | 
  1700  | 
% @l was never documented to mean ``switch to the Lisp font'',
  | 
| 
alpar@18
 | 
  1701  | 
% and it is not used as such in any manual I can find.  We need it for
  | 
| 
alpar@18
 | 
  1702  | 
% Polish suppressed-l.  --karl, 22sep96.
  | 
| 
alpar@18
 | 
  1703  | 
%\def\l#1{{\li #1}\null}
 | 
| 
alpar@18
 | 
  1704  | 
  | 
| 
alpar@18
 | 
  1705  | 
% Explicit font changes: @r, @sc, undocumented @ii.
  | 
| 
alpar@18
 | 
  1706  | 
\def\r#1{{\rm #1}}              % roman font
 | 
| 
alpar@18
 | 
  1707  | 
\def\sc#1{{\smallcaps#1}}       % smallcaps font
 | 
| 
alpar@18
 | 
  1708  | 
\def\ii#1{{\it #1}}             % italic font
 | 
| 
alpar@18
 | 
  1709  | 
  | 
| 
alpar@18
 | 
  1710  | 
% @acronym downcases the argument and prints in smallcaps.
  | 
| 
alpar@18
 | 
  1711  | 
\def\acronym#1{{\smallcaps \lowercase{#1}}}
 | 
| 
alpar@18
 | 
  1712  | 
  | 
| 
alpar@18
 | 
  1713  | 
% @pounds{} is a sterling sign.
 | 
| 
alpar@18
 | 
  1714  | 
\def\pounds{{\it\$}}
 | 
| 
alpar@18
 | 
  1715  | 
  | 
| 
alpar@18
 | 
  1716  | 
% @registeredsymbol - R in a circle.  For now, only works in text size;
  | 
| 
alpar@18
 | 
  1717  | 
% we'd have to redo the font mechanism to change the \scriptstyle and
  | 
| 
alpar@18
 | 
  1718  | 
% \scriptscriptstyle font sizes to make it look right in headings.
  | 
| 
alpar@18
 | 
  1719  | 
% Adapted from the plain.tex definition of \copyright.
  | 
| 
alpar@18
 | 
  1720  | 
%
  | 
| 
alpar@18
 | 
  1721  | 
\def\registeredsymbol{%
 | 
| 
alpar@18
 | 
  1722  | 
  $^{{\ooalign{\hfil\raise.07ex\hbox{$\scriptstyle\rm R$}\hfil\crcr\Orb}}%
 | 
| 
alpar@18
 | 
  1723  | 
    }$%
  | 
| 
alpar@18
 | 
  1724  | 
}
  | 
| 
alpar@18
 | 
  1725  | 
  | 
| 
alpar@18
 | 
  1726  | 
  | 
| 
alpar@18
 | 
  1727  | 
\message{page headings,}
 | 
| 
alpar@18
 | 
  1728  | 
  | 
| 
alpar@18
 | 
  1729  | 
\newskip\titlepagetopglue \titlepagetopglue = 1.5in
  | 
| 
alpar@18
 | 
  1730  | 
\newskip\titlepagebottomglue \titlepagebottomglue = 2pc
  | 
| 
alpar@18
 | 
  1731  | 
  | 
| 
alpar@18
 | 
  1732  | 
% First the title page.  Must do @settitle before @titlepage.
  | 
| 
alpar@18
 | 
  1733  | 
\newif\ifseenauthor
  | 
| 
alpar@18
 | 
  1734  | 
\newif\iffinishedtitlepage
  | 
| 
alpar@18
 | 
  1735  | 
  | 
| 
alpar@18
 | 
  1736  | 
% Do an implicit @contents or @shortcontents after @end titlepage if the
  | 
| 
alpar@18
 | 
  1737  | 
% user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage.
  | 
| 
alpar@18
 | 
  1738  | 
%
  | 
| 
alpar@18
 | 
  1739  | 
\newif\ifsetcontentsaftertitlepage
  | 
| 
alpar@18
 | 
  1740  | 
 \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue
  | 
| 
alpar@18
 | 
  1741  | 
\newif\ifsetshortcontentsaftertitlepage
  | 
| 
alpar@18
 | 
  1742  | 
 \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue
  | 
| 
alpar@18
 | 
  1743  | 
  | 
| 
alpar@18
 | 
  1744  | 
\def\shorttitlepage{\parsearg\shorttitlepagezzz}
 | 
| 
alpar@18
 | 
  1745  | 
\def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}%
 | 
| 
alpar@18
 | 
  1746  | 
        \endgroup\page\hbox{}\page}
 | 
| 
alpar@18
 | 
  1747  | 
  | 
| 
alpar@18
 | 
  1748  | 
\def\titlepage{\begingroup \parindent=0pt \textfonts
 | 
| 
alpar@18
 | 
  1749  | 
   \let\subtitlerm=\tenrm
  | 
| 
alpar@18
 | 
  1750  | 
   \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
 | 
| 
alpar@18
 | 
  1751  | 
   %
  | 
| 
alpar@18
 | 
  1752  | 
   \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines
 | 
| 
alpar@18
 | 
  1753  | 
                   \let\tt=\authortt}%
  | 
| 
alpar@18
 | 
  1754  | 
   %
  | 
| 
alpar@18
 | 
  1755  | 
   % Leave some space at the very top of the page.
  | 
| 
alpar@18
 | 
  1756  | 
   \vglue\titlepagetopglue
  | 
| 
alpar@18
 | 
  1757  | 
   %
  | 
| 
alpar@18
 | 
  1758  | 
   % Now you can print the title using @title.
  | 
| 
alpar@18
 | 
  1759  | 
   \def\title{\parsearg\titlezzz}%
 | 
| 
alpar@18
 | 
  1760  | 
   \def\titlezzz##1{\leftline{\titlefonts\rm ##1}
 | 
| 
alpar@18
 | 
  1761  | 
                    % print a rule at the page bottom also.
  | 
| 
alpar@18
 | 
  1762  | 
                    \finishedtitlepagefalse
  | 
| 
alpar@18
 | 
  1763  | 
                    \vskip4pt \hrule height 4pt width \hsize \vskip4pt}%
  | 
| 
alpar@18
 | 
  1764  | 
   % No rule at page bottom unless we print one at the top with @title.
  | 
| 
alpar@18
 | 
  1765  | 
   \finishedtitlepagetrue
  | 
| 
alpar@18
 | 
  1766  | 
   %
  | 
| 
alpar@18
 | 
  1767  | 
   % Now you can put text using @subtitle.
  | 
| 
alpar@18
 | 
  1768  | 
   \def\subtitle{\parsearg\subtitlezzz}%
 | 
| 
alpar@18
 | 
  1769  | 
   \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}%
 | 
| 
alpar@18
 | 
  1770  | 
   %
  | 
| 
alpar@18
 | 
  1771  | 
   % @author should come last, but may come many times.
  | 
| 
alpar@18
 | 
  1772  | 
   \def\author{\parsearg\authorzzz}%
 | 
| 
alpar@18
 | 
  1773  | 
   \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
 | 
| 
alpar@18
 | 
  1774  | 
      {\authorfont \leftline{##1}}}%
 | 
| 
alpar@18
 | 
  1775  | 
   %
  | 
| 
alpar@18
 | 
  1776  | 
   % Most title ``pages'' are actually two pages long, with space
  | 
| 
alpar@18
 | 
  1777  | 
   % at the top of the second.  We don't want the ragged left on the second.
  | 
| 
alpar@18
 | 
  1778  | 
   \let\oldpage = \page
  | 
| 
alpar@18
 | 
  1779  | 
   \def\page{%
 | 
| 
alpar@18
 | 
  1780  | 
      \iffinishedtitlepage\else
  | 
| 
alpar@18
 | 
  1781  | 
         \finishtitlepage
  | 
| 
alpar@18
 | 
  1782  | 
      \fi
  | 
| 
alpar@18
 | 
  1783  | 
      \oldpage
  | 
| 
alpar@18
 | 
  1784  | 
      \let\page = \oldpage
  | 
| 
alpar@18
 | 
  1785  | 
      \hbox{}}%
 | 
| 
alpar@18
 | 
  1786  | 
%   \def\page{\oldpage \hbox{}}
 | 
| 
alpar@18
 | 
  1787  | 
}
  | 
| 
alpar@18
 | 
  1788  | 
  | 
| 
alpar@18
 | 
  1789  | 
\def\Etitlepage{%
 | 
| 
alpar@18
 | 
  1790  | 
   \iffinishedtitlepage\else
  | 
| 
alpar@18
 | 
  1791  | 
      \finishtitlepage
  | 
| 
alpar@18
 | 
  1792  | 
   \fi
  | 
| 
alpar@18
 | 
  1793  | 
   % It is important to do the page break before ending the group,
  | 
| 
alpar@18
 | 
  1794  | 
   % because the headline and footline are only empty inside the group.
  | 
| 
alpar@18
 | 
  1795  | 
   % If we use the new definition of \page, we always get a blank page
  | 
| 
alpar@18
 | 
  1796  | 
   % after the title page, which we certainly don't want.
  | 
| 
alpar@18
 | 
  1797  | 
   \oldpage
  | 
| 
alpar@18
 | 
  1798  | 
   \endgroup
  | 
| 
alpar@18
 | 
  1799  | 
   %
  | 
| 
alpar@18
 | 
  1800  | 
   % Need this before the \...aftertitlepage checks so that if they are
  | 
| 
alpar@18
 | 
  1801  | 
   % in effect the toc pages will come out with page numbers.
  | 
| 
alpar@18
 | 
  1802  | 
   \HEADINGSon
  | 
| 
alpar@18
 | 
  1803  | 
   %
  | 
| 
alpar@18
 | 
  1804  | 
   % If they want short, they certainly want long too.
  | 
| 
alpar@18
 | 
  1805  | 
   \ifsetshortcontentsaftertitlepage
  | 
| 
alpar@18
 | 
  1806  | 
     \shortcontents
  | 
| 
alpar@18
 | 
  1807  | 
     \contents
  | 
| 
alpar@18
 | 
  1808  | 
     \global\let\shortcontents = \relax
  | 
| 
alpar@18
 | 
  1809  | 
     \global\let\contents = \relax
  | 
| 
alpar@18
 | 
  1810  | 
   \fi
  | 
| 
alpar@18
 | 
  1811  | 
   %
  | 
| 
alpar@18
 | 
  1812  | 
   \ifsetcontentsaftertitlepage
  | 
| 
alpar@18
 | 
  1813  | 
     \contents
  | 
| 
alpar@18
 | 
  1814  | 
     \global\let\contents = \relax
  | 
| 
alpar@18
 | 
  1815  | 
     \global\let\shortcontents = \relax
  | 
| 
alpar@18
 | 
  1816  | 
   \fi
  | 
| 
alpar@18
 | 
  1817  | 
}
  | 
| 
alpar@18
 | 
  1818  | 
  | 
| 
alpar@18
 | 
  1819  | 
\def\finishtitlepage{%
 | 
| 
alpar@18
 | 
  1820  | 
   \vskip4pt \hrule height 2pt width \hsize
  | 
| 
alpar@18
 | 
  1821  | 
   \vskip\titlepagebottomglue
  | 
| 
alpar@18
 | 
  1822  | 
   \finishedtitlepagetrue
  | 
| 
alpar@18
 | 
  1823  | 
}
  | 
| 
alpar@18
 | 
  1824  | 
  | 
| 
alpar@18
 | 
  1825  | 
%%% Set up page headings and footings.
  | 
| 
alpar@18
 | 
  1826  | 
  | 
| 
alpar@18
 | 
  1827  | 
\let\thispage=\folio
  | 
| 
alpar@18
 | 
  1828  | 
  | 
| 
alpar@18
 | 
  1829  | 
\newtoks\evenheadline    % headline on even pages
  | 
| 
alpar@18
 | 
  1830  | 
\newtoks\oddheadline     % headline on odd pages
  | 
| 
alpar@18
 | 
  1831  | 
\newtoks\evenfootline    % footline on even pages
  | 
| 
alpar@18
 | 
  1832  | 
\newtoks\oddfootline     % footline on odd pages
  | 
| 
alpar@18
 | 
  1833  | 
  | 
| 
alpar@18
 | 
  1834  | 
% Now make Tex use those variables
  | 
| 
alpar@18
 | 
  1835  | 
\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
 | 
| 
alpar@18
 | 
  1836  | 
                            \else \the\evenheadline \fi}}
  | 
| 
alpar@18
 | 
  1837  | 
\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
 | 
| 
alpar@18
 | 
  1838  | 
                            \else \the\evenfootline \fi}\HEADINGShook}
  | 
| 
alpar@18
 | 
  1839  | 
\let\HEADINGShook=\relax
  | 
| 
alpar@18
 | 
  1840  | 
  | 
| 
alpar@18
 | 
  1841  | 
% Commands to set those variables.
  | 
| 
alpar@18
 | 
  1842  | 
% For example, this is what  @headings on  does
  | 
| 
alpar@18
 | 
  1843  | 
% @evenheading @thistitle|@thispage|@thischapter
  | 
| 
alpar@18
 | 
  1844  | 
% @oddheading @thischapter|@thispage|@thistitle
  | 
| 
alpar@18
 | 
  1845  | 
% @evenfooting @thisfile||
  | 
| 
alpar@18
 | 
  1846  | 
% @oddfooting ||@thisfile
  | 
| 
alpar@18
 | 
  1847  | 
  | 
| 
alpar@18
 | 
  1848  | 
\def\evenheading{\parsearg\evenheadingxxx}
 | 
| 
alpar@18
 | 
  1849  | 
\def\oddheading{\parsearg\oddheadingxxx}
 | 
| 
alpar@18
 | 
  1850  | 
\def\everyheading{\parsearg\everyheadingxxx}
 | 
| 
alpar@18
 | 
  1851  | 
  | 
| 
alpar@18
 | 
  1852  | 
\def\evenfooting{\parsearg\evenfootingxxx}
 | 
| 
alpar@18
 | 
  1853  | 
\def\oddfooting{\parsearg\oddfootingxxx}
 | 
| 
alpar@18
 | 
  1854  | 
\def\everyfooting{\parsearg\everyfootingxxx}
 | 
| 
alpar@18
 | 
  1855  | 
  | 
| 
alpar@18
 | 
  1856  | 
{\catcode`\@=0 %
 | 
| 
alpar@18
 | 
  1857  | 
  | 
| 
alpar@18
 | 
  1858  | 
\gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
 | 
| 
alpar@18
 | 
  1859  | 
\gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
 | 
| 
alpar@18
 | 
  1860  | 
\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
 | 
| 
alpar@18
 | 
  1861  | 
  | 
| 
alpar@18
 | 
  1862  | 
\gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
 | 
| 
alpar@18
 | 
  1863  | 
\gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
 | 
| 
alpar@18
 | 
  1864  | 
\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
 | 
| 
alpar@18
 | 
  1865  | 
  | 
| 
alpar@18
 | 
  1866  | 
\gdef\everyheadingxxx#1{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
 | 
| 
alpar@18
 | 
  1867  | 
  | 
| 
alpar@18
 | 
  1868  | 
\gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
 | 
| 
alpar@18
 | 
  1869  | 
\gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
 | 
| 
alpar@18
 | 
  1870  | 
\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
 | 
| 
alpar@18
 | 
  1871  | 
  | 
| 
alpar@18
 | 
  1872  | 
\gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
 | 
| 
alpar@18
 | 
  1873  | 
\gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
 | 
| 
alpar@18
 | 
  1874  | 
  \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
 | 
| 
alpar@18
 | 
  1875  | 
  %
  | 
| 
alpar@18
 | 
  1876  | 
  % Leave some space for the footline.  Hopefully ok to assume
  | 
| 
alpar@18
 | 
  1877  | 
  % @evenfooting will not be used by itself.
  | 
| 
alpar@18
 | 
  1878  | 
  \global\advance\pageheight by -\baselineskip
  | 
| 
alpar@18
 | 
  1879  | 
  \global\advance\vsize by -\baselineskip
  | 
| 
alpar@18
 | 
  1880  | 
}
  | 
| 
alpar@18
 | 
  1881  | 
  | 
| 
alpar@18
 | 
  1882  | 
\gdef\everyfootingxxx#1{\oddfootingxxx{#1}\evenfootingxxx{#1}}
 | 
| 
alpar@18
 | 
  1883  | 
%
  | 
| 
alpar@18
 | 
  1884  | 
}% unbind the catcode of @.
  | 
| 
alpar@18
 | 
  1885  | 
  | 
| 
alpar@18
 | 
  1886  | 
% @headings double      turns headings on for double-sided printing.
  | 
| 
alpar@18
 | 
  1887  | 
% @headings single      turns headings on for single-sided printing.
  | 
| 
alpar@18
 | 
  1888  | 
% @headings off         turns them off.
  | 
| 
alpar@18
 | 
  1889  | 
% @headings on          same as @headings double, retained for compatibility.
  | 
| 
alpar@18
 | 
  1890  | 
% @headings after       turns on double-sided headings after this page.
  | 
| 
alpar@18
 | 
  1891  | 
% @headings doubleafter turns on double-sided headings after this page.
  | 
| 
alpar@18
 | 
  1892  | 
% @headings singleafter turns on single-sided headings after this page.
  | 
| 
alpar@18
 | 
  1893  | 
% By default, they are off at the start of a document,
  | 
| 
alpar@18
 | 
  1894  | 
% and turned `on' after @end titlepage.
  | 
| 
alpar@18
 | 
  1895  | 
  | 
| 
alpar@18
 | 
  1896  | 
\def\headings #1 {\csname HEADINGS#1\endcsname}
 | 
| 
alpar@18
 | 
  1897  | 
  | 
| 
alpar@18
 | 
  1898  | 
\def\HEADINGSoff{
 | 
| 
alpar@18
 | 
  1899  | 
\global\evenheadline={\hfil} \global\evenfootline={\hfil}
 | 
| 
alpar@18
 | 
  1900  | 
\global\oddheadline={\hfil} \global\oddfootline={\hfil}}
 | 
| 
alpar@18
 | 
  1901  | 
\HEADINGSoff
  | 
| 
alpar@18
 | 
  1902  | 
% When we turn headings on, set the page number to 1.
  | 
| 
alpar@18
 | 
  1903  | 
% For double-sided printing, put current file name in lower left corner,
  | 
| 
alpar@18
 | 
  1904  | 
% chapter name on inside top of right hand pages, document
  | 
| 
alpar@18
 | 
  1905  | 
% title on inside top of left hand pages, and page numbers on outside top
  | 
| 
alpar@18
 | 
  1906  | 
% edge of all pages.
  | 
| 
alpar@18
 | 
  1907  | 
\def\HEADINGSdouble{
 | 
| 
alpar@18
 | 
  1908  | 
\global\pageno=1
  | 
| 
alpar@18
 | 
  1909  | 
\global\evenfootline={\hfil}
 | 
| 
alpar@18
 | 
  1910  | 
\global\oddfootline={\hfil}
 | 
| 
alpar@18
 | 
  1911  | 
\global\evenheadline={\line{\folio\hfil\thistitle}}
 | 
| 
alpar@18
 | 
  1912  | 
\global\oddheadline={\line{\thischapter\hfil\folio}}
 | 
| 
alpar@18
 | 
  1913  | 
\global\let\contentsalignmacro = \chapoddpage
  | 
| 
alpar@18
 | 
  1914  | 
}
  | 
| 
alpar@18
 | 
  1915  | 
\let\contentsalignmacro = \chappager
  | 
| 
alpar@18
 | 
  1916  | 
  | 
| 
alpar@18
 | 
  1917  | 
% For single-sided printing, chapter title goes across top left of page,
  | 
| 
alpar@18
 | 
  1918  | 
% page number on top right.
  | 
| 
alpar@18
 | 
  1919  | 
\def\HEADINGSsingle{
 | 
| 
alpar@18
 | 
  1920  | 
\global\pageno=1
  | 
| 
alpar@18
 | 
  1921  | 
\global\evenfootline={\hfil}
 | 
| 
alpar@18
 | 
  1922  | 
\global\oddfootline={\hfil}
 | 
| 
alpar@18
 | 
  1923  | 
\global\evenheadline={\line{\thischapter\hfil\folio}}
 | 
| 
alpar@18
 | 
  1924  | 
\global\oddheadline={\line{\thischapter\hfil\folio}}
 | 
| 
alpar@18
 | 
  1925  | 
\global\let\contentsalignmacro = \chappager
  | 
| 
alpar@18
 | 
  1926  | 
}
  | 
| 
alpar@18
 | 
  1927  | 
\def\HEADINGSon{\HEADINGSdouble}
 | 
| 
alpar@18
 | 
  1928  | 
  | 
| 
alpar@18
 | 
  1929  | 
\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
 | 
| 
alpar@18
 | 
  1930  | 
\let\HEADINGSdoubleafter=\HEADINGSafter
  | 
| 
alpar@18
 | 
  1931  | 
\def\HEADINGSdoublex{%
 | 
| 
alpar@18
 | 
  1932  | 
\global\evenfootline={\hfil}
 | 
| 
alpar@18
 | 
  1933  | 
\global\oddfootline={\hfil}
 | 
| 
alpar@18
 | 
  1934  | 
\global\evenheadline={\line{\folio\hfil\thistitle}}
 | 
| 
alpar@18
 | 
  1935  | 
\global\oddheadline={\line{\thischapter\hfil\folio}}
 | 
| 
alpar@18
 | 
  1936  | 
\global\let\contentsalignmacro = \chapoddpage
  | 
| 
alpar@18
 | 
  1937  | 
}
  | 
| 
alpar@18
 | 
  1938  | 
  | 
| 
alpar@18
 | 
  1939  | 
\def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
 | 
| 
alpar@18
 | 
  1940  | 
\def\HEADINGSsinglex{%
 | 
| 
alpar@18
 | 
  1941  | 
\global\evenfootline={\hfil}
 | 
| 
alpar@18
 | 
  1942  | 
\global\oddfootline={\hfil}
 | 
| 
alpar@18
 | 
  1943  | 
\global\evenheadline={\line{\thischapter\hfil\folio}}
 | 
| 
alpar@18
 | 
  1944  | 
\global\oddheadline={\line{\thischapter\hfil\folio}}
 | 
| 
alpar@18
 | 
  1945  | 
\global\let\contentsalignmacro = \chappager
  | 
| 
alpar@18
 | 
  1946  | 
}
  | 
| 
alpar@18
 | 
  1947  | 
  | 
| 
alpar@18
 | 
  1948  | 
% Subroutines used in generating headings
  | 
| 
alpar@18
 | 
  1949  | 
% This produces Day Month Year style of output.
  | 
| 
alpar@18
 | 
  1950  | 
% Only define if not already defined, in case a txi-??.tex file has set
  | 
| 
alpar@18
 | 
  1951  | 
% up a different format (e.g., txi-cs.tex does this).
  | 
| 
alpar@18
 | 
  1952  | 
\ifx\today\undefined
  | 
| 
alpar@18
 | 
  1953  | 
\def\today{%
 | 
| 
alpar@18
 | 
  1954  | 
  \number\day\space
  | 
| 
alpar@18
 | 
  1955  | 
  \ifcase\month
  | 
| 
alpar@18
 | 
  1956  | 
  \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
  | 
| 
alpar@18
 | 
  1957  | 
  \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
  | 
| 
alpar@18
 | 
  1958  | 
  \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
  | 
| 
alpar@18
 | 
  1959  | 
  \fi
  | 
| 
alpar@18
 | 
  1960  | 
  \space\number\year}
  | 
| 
alpar@18
 | 
  1961  | 
\fi
  | 
| 
alpar@18
 | 
  1962  | 
  | 
| 
alpar@18
 | 
  1963  | 
% @settitle line...  specifies the title of the document, for headings.
  | 
| 
alpar@18
 | 
  1964  | 
% It generates no output of its own.
  | 
| 
alpar@18
 | 
  1965  | 
\def\thistitle{\putwordNoTitle}
 | 
| 
alpar@18
 | 
  1966  | 
\def\settitle{\parsearg\settitlezzz}
 | 
| 
alpar@18
 | 
  1967  | 
\def\settitlezzz #1{\gdef\thistitle{#1}}
 | 
| 
alpar@18
 | 
  1968  | 
  | 
| 
alpar@18
 | 
  1969  | 
  | 
| 
alpar@18
 | 
  1970  | 
\message{tables,}
 | 
| 
alpar@18
 | 
  1971  | 
% Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x).
  | 
| 
alpar@18
 | 
  1972  | 
  | 
| 
alpar@18
 | 
  1973  | 
% default indentation of table text
  | 
| 
alpar@18
 | 
  1974  | 
\newdimen\tableindent \tableindent=.8in
  | 
| 
alpar@18
 | 
  1975  | 
% default indentation of @itemize and @enumerate text
  | 
| 
alpar@18
 | 
  1976  | 
\newdimen\itemindent  \itemindent=.3in
  | 
| 
alpar@18
 | 
  1977  | 
% margin between end of table item and start of table text.
  | 
| 
alpar@18
 | 
  1978  | 
\newdimen\itemmargin  \itemmargin=.1in
  | 
| 
alpar@18
 | 
  1979  | 
  | 
| 
alpar@18
 | 
  1980  | 
% used internally for \itemindent minus \itemmargin
  | 
| 
alpar@18
 | 
  1981  | 
\newdimen\itemmax
  | 
| 
alpar@18
 | 
  1982  | 
  | 
| 
alpar@18
 | 
  1983  | 
% Note @table, @vtable, and @vtable define @item, @itemx, etc., with
  | 
| 
alpar@18
 | 
  1984  | 
% these defs.
  | 
| 
alpar@18
 | 
  1985  | 
% They also define \itemindex
  | 
| 
alpar@18
 | 
  1986  | 
% to index the item name in whatever manner is desired (perhaps none).
  | 
| 
alpar@18
 | 
  1987  | 
  | 
| 
alpar@18
 | 
  1988  | 
\newif\ifitemxneedsnegativevskip
  | 
| 
alpar@18
 | 
  1989  | 
  | 
| 
alpar@18
 | 
  1990  | 
\def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
 | 
| 
alpar@18
 | 
  1991  | 
  | 
| 
alpar@18
 | 
  1992  | 
\def\internalBitem{\smallbreak \parsearg\itemzzz}
 | 
| 
alpar@18
 | 
  1993  | 
\def\internalBitemx{\itemxpar \parsearg\itemzzz}
 | 
| 
alpar@18
 | 
  1994  | 
  | 
| 
alpar@18
 | 
  1995  | 
\def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
 | 
| 
alpar@18
 | 
  1996  | 
\def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \itemxpar \parsearg\xitemzzz}
 | 
| 
alpar@18
 | 
  1997  | 
  | 
| 
alpar@18
 | 
  1998  | 
\def\internalBkitem{\smallbreak \parsearg\kitemzzz}
 | 
| 
alpar@18
 | 
  1999  | 
\def\internalBkitemx{\itemxpar \parsearg\kitemzzz}
 | 
| 
alpar@18
 | 
  2000  | 
  | 
| 
alpar@18
 | 
  2001  | 
\def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}%
 | 
| 
alpar@18
 | 
  2002  | 
                 \itemzzz {#1}}
 | 
| 
alpar@18
 | 
  2003  | 
  | 
| 
alpar@18
 | 
  2004  | 
\def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}%
 | 
| 
alpar@18
 | 
  2005  | 
                 \itemzzz {#1}}
 | 
| 
alpar@18
 | 
  2006  | 
  | 
| 
alpar@18
 | 
  2007  | 
\def\itemzzz #1{\begingroup %
 | 
| 
alpar@18
 | 
  2008  | 
  \advance\hsize by -\rightskip
  | 
| 
alpar@18
 | 
  2009  | 
  \advance\hsize by -\tableindent
  | 
| 
alpar@18
 | 
  2010  | 
  \setbox0=\hbox{\itemfont{#1}}%
 | 
| 
alpar@18
 | 
  2011  | 
  \itemindex{#1}%
 | 
| 
alpar@18
 | 
  2012  | 
  \nobreak % This prevents a break before @itemx.
  | 
| 
alpar@18
 | 
  2013  | 
  %
  | 
| 
alpar@18
 | 
  2014  | 
  % If the item text does not fit in the space we have, put it on a line
  | 
| 
alpar@18
 | 
  2015  | 
  % by itself, and do not allow a page break either before or after that
  | 
| 
alpar@18
 | 
  2016  | 
  % line.  We do not start a paragraph here because then if the next
  | 
| 
alpar@18
 | 
  2017  | 
  % command is, e.g., @kindex, the whatsit would get put into the
  | 
| 
alpar@18
 | 
  2018  | 
  % horizontal list on a line by itself, resulting in extra blank space.
  | 
| 
alpar@18
 | 
  2019  | 
  \ifdim \wd0>\itemmax
  | 
| 
alpar@18
 | 
  2020  | 
    %
  | 
| 
alpar@18
 | 
  2021  | 
    % Make this a paragraph so we get the \parskip glue and wrapping,
  | 
| 
alpar@18
 | 
  2022  | 
    % but leave it ragged-right.
  | 
| 
alpar@18
 | 
  2023  | 
    \begingroup
  | 
| 
alpar@18
 | 
  2024  | 
      \advance\leftskip by-\tableindent
  | 
| 
alpar@18
 | 
  2025  | 
      \advance\hsize by\tableindent
  | 
| 
alpar@18
 | 
  2026  | 
      \advance\rightskip by0pt plus1fil
  | 
| 
alpar@18
 | 
  2027  | 
      \leavevmode\unhbox0\par
  | 
| 
alpar@18
 | 
  2028  | 
    \endgroup
  | 
| 
alpar@18
 | 
  2029  | 
    %
  | 
| 
alpar@18
 | 
  2030  | 
    % We're going to be starting a paragraph, but we don't want the
  | 
| 
alpar@18
 | 
  2031  | 
    % \parskip glue -- logically it's part of the @item we just started.
  | 
| 
alpar@18
 | 
  2032  | 
    \nobreak \vskip-\parskip
  | 
| 
alpar@18
 | 
  2033  | 
    %
  | 
| 
alpar@18
 | 
  2034  | 
    % Stop a page break at the \parskip glue coming up.  (Unfortunately
  | 
| 
alpar@18
 | 
  2035  | 
    % we can't prevent a possible page break at the following
  | 
| 
alpar@18
 | 
  2036  | 
    % \baselineskip glue.)  However, if what follows is an environment
  | 
| 
alpar@18
 | 
  2037  | 
    % such as @example, there will be no \parskip glue; then
  | 
| 
alpar@18
 | 
  2038  | 
    % the negative vskip we just would cause the example and the item to
  | 
| 
alpar@18
 | 
  2039  | 
    % crash together.  So we use this bizarre value of 10001 as a signal
  | 
| 
alpar@18
 | 
  2040  | 
    % to \aboveenvbreak to insert \parskip glue after all.
  | 
| 
alpar@18
 | 
  2041  | 
    % (Possibly there are other commands that could be followed by
  | 
| 
alpar@18
 | 
  2042  | 
    % @example which need the same treatment, but not section titles; or
  | 
| 
alpar@18
 | 
  2043  | 
    % maybe section titles are the only special case and they should be
  | 
| 
alpar@18
 | 
  2044  | 
    % penalty 10001...)
  | 
| 
alpar@18
 | 
  2045  | 
    \penalty 10001
  | 
| 
alpar@18
 | 
  2046  | 
    \endgroup
  | 
| 
alpar@18
 | 
  2047  | 
    \itemxneedsnegativevskipfalse
  | 
| 
alpar@18
 | 
  2048  | 
  \else
  | 
| 
alpar@18
 | 
  2049  | 
    % The item text fits into the space.  Start a paragraph, so that the
  | 
| 
alpar@18
 | 
  2050  | 
    % following text (if any) will end up on the same line.
  | 
| 
alpar@18
 | 
  2051  | 
    \noindent
  | 
| 
alpar@18
 | 
  2052  | 
    % Do this with kerns and \unhbox so that if there is a footnote in
  | 
| 
alpar@18
 | 
  2053  | 
    % the item text, it can migrate to the main vertical list and
  | 
| 
alpar@18
 | 
  2054  | 
    % eventually be printed.
  | 
| 
alpar@18
 | 
  2055  | 
    \nobreak\kern-\tableindent
  | 
| 
alpar@18
 | 
  2056  | 
    \dimen0 = \itemmax  \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
  | 
| 
alpar@18
 | 
  2057  | 
    \unhbox0
  | 
| 
alpar@18
 | 
  2058  | 
    \nobreak\kern\dimen0
  | 
| 
alpar@18
 | 
  2059  | 
    \endgroup
  | 
| 
alpar@18
 | 
  2060  | 
    \itemxneedsnegativevskiptrue
  | 
| 
alpar@18
 | 
  2061  | 
  \fi
  | 
| 
alpar@18
 | 
  2062  | 
}
  | 
| 
alpar@18
 | 
  2063  | 
  | 
| 
alpar@18
 | 
  2064  | 
\def\item{\errmessage{@item while not in a table}}
 | 
| 
alpar@18
 | 
  2065  | 
\def\itemx{\errmessage{@itemx while not in a table}}
 | 
| 
alpar@18
 | 
  2066  | 
\def\kitem{\errmessage{@kitem while not in a table}}
 | 
| 
alpar@18
 | 
  2067  | 
\def\kitemx{\errmessage{@kitemx while not in a table}}
 | 
| 
alpar@18
 | 
  2068  | 
\def\xitem{\errmessage{@xitem while not in a table}}
 | 
| 
alpar@18
 | 
  2069  | 
\def\xitemx{\errmessage{@xitemx while not in a table}}
 | 
| 
alpar@18
 | 
  2070  | 
  | 
| 
alpar@18
 | 
  2071  | 
% Contains a kludge to get @end[description] to work.
  | 
| 
alpar@18
 | 
  2072  | 
\def\description{\tablez{\dontindex}{1}{}{}{}{}}
 | 
| 
alpar@18
 | 
  2073  | 
  | 
| 
alpar@18
 | 
  2074  | 
% @table, @ftable, @vtable.
  | 
| 
alpar@18
 | 
  2075  | 
\def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
 | 
| 
alpar@18
 | 
  2076  | 
{\obeylines\obeyspaces%
 | 
| 
alpar@18
 | 
  2077  | 
\gdef\tablex #1^^M{%
 | 
| 
alpar@18
 | 
  2078  | 
\tabley\dontindex#1        \endtabley}}
  | 
| 
alpar@18
 | 
  2079  | 
  | 
| 
alpar@18
 | 
  2080  | 
\def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
 | 
| 
alpar@18
 | 
  2081  | 
{\obeylines\obeyspaces%
 | 
| 
alpar@18
 | 
  2082  | 
\gdef\ftablex #1^^M{%
 | 
| 
alpar@18
 | 
  2083  | 
\tabley\fnitemindex#1        \endtabley
  | 
| 
alpar@18
 | 
  2084  | 
\def\Eftable{\endgraf\afterenvbreak\endgroup}%
 | 
| 
alpar@18
 | 
  2085  | 
\let\Etable=\relax}}
  | 
| 
alpar@18
 | 
  2086  | 
  | 
| 
alpar@18
 | 
  2087  | 
\def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex}
 | 
| 
alpar@18
 | 
  2088  | 
{\obeylines\obeyspaces%
 | 
| 
alpar@18
 | 
  2089  | 
\gdef\vtablex #1^^M{%
 | 
| 
alpar@18
 | 
  2090  | 
\tabley\vritemindex#1        \endtabley
  | 
| 
alpar@18
 | 
  2091  | 
\def\Evtable{\endgraf\afterenvbreak\endgroup}%
 | 
| 
alpar@18
 | 
  2092  | 
\let\Etable=\relax}}
  | 
| 
alpar@18
 | 
  2093  | 
  | 
| 
alpar@18
 | 
  2094  | 
\def\dontindex #1{}
 | 
| 
alpar@18
 | 
  2095  | 
\def\fnitemindex #1{\doind {fn}{\code{#1}}}%
 | 
| 
alpar@18
 | 
  2096  | 
\def\vritemindex #1{\doind {vr}{\code{#1}}}%
 | 
| 
alpar@18
 | 
  2097  | 
  | 
| 
alpar@18
 | 
  2098  | 
{\obeyspaces %
 | 
| 
alpar@18
 | 
  2099  | 
\gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
 | 
| 
alpar@18
 | 
  2100  | 
\tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
 | 
| 
alpar@18
 | 
  2101  | 
  | 
| 
alpar@18
 | 
  2102  | 
\def\tablez #1#2#3#4#5#6{%
 | 
| 
alpar@18
 | 
  2103  | 
\aboveenvbreak %
  | 
| 
alpar@18
 | 
  2104  | 
\begingroup %
  | 
| 
alpar@18
 | 
  2105  | 
\def\Edescription{\Etable}% Necessary kludge.
 | 
| 
alpar@18
 | 
  2106  | 
\let\itemindex=#1%
  | 
| 
alpar@18
 | 
  2107  | 
\ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
  | 
| 
alpar@18
 | 
  2108  | 
\ifnum 0#4>0 \tableindent=#4\mil \fi %
  | 
| 
alpar@18
 | 
  2109  | 
\ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
  | 
| 
alpar@18
 | 
  2110  | 
\def\itemfont{#2}%
 | 
| 
alpar@18
 | 
  2111  | 
\itemmax=\tableindent %
  | 
| 
alpar@18
 | 
  2112  | 
\advance \itemmax by -\itemmargin %
  | 
| 
alpar@18
 | 
  2113  | 
\advance \leftskip by \tableindent %
  | 
| 
alpar@18
 | 
  2114  | 
\exdentamount=\tableindent
  | 
| 
alpar@18
 | 
  2115  | 
\parindent = 0pt
  | 
| 
alpar@18
 | 
  2116  | 
\parskip = \smallskipamount
  | 
| 
alpar@18
 | 
  2117  | 
\ifdim \parskip=0pt \parskip=2pt \fi%
  | 
| 
alpar@18
 | 
  2118  | 
\def\Etable{\endgraf\afterenvbreak\endgroup}%
 | 
| 
alpar@18
 | 
  2119  | 
\let\item = \internalBitem %
  | 
| 
alpar@18
 | 
  2120  | 
\let\itemx = \internalBitemx %
  | 
| 
alpar@18
 | 
  2121  | 
\let\kitem = \internalBkitem %
  | 
| 
alpar@18
 | 
  2122  | 
\let\kitemx = \internalBkitemx %
  | 
| 
alpar@18
 | 
  2123  | 
\let\xitem = \internalBxitem %
  | 
| 
alpar@18
 | 
  2124  | 
\let\xitemx = \internalBxitemx %
  | 
| 
alpar@18
 | 
  2125  | 
}
  | 
| 
alpar@18
 | 
  2126  | 
  | 
| 
alpar@18
 | 
  2127  | 
% This is the counter used by @enumerate, which is really @itemize
  | 
| 
alpar@18
 | 
  2128  | 
  | 
| 
alpar@18
 | 
  2129  | 
\newcount \itemno
  | 
| 
alpar@18
 | 
  2130  | 
  | 
| 
alpar@18
 | 
  2131  | 
\def\itemize{\parsearg\itemizezzz}
 | 
| 
alpar@18
 | 
  2132  | 
  | 
| 
alpar@18
 | 
  2133  | 
\def\itemizezzz #1{%
 | 
| 
alpar@18
 | 
  2134  | 
  \begingroup % ended by the @end itemize
  | 
| 
alpar@18
 | 
  2135  | 
  \itemizey {#1}{\Eitemize}
 | 
| 
alpar@18
 | 
  2136  | 
}
  | 
| 
alpar@18
 | 
  2137  | 
  | 
| 
alpar@18
 | 
  2138  | 
\def\itemizey#1#2{%
 | 
| 
alpar@18
 | 
  2139  | 
  \aboveenvbreak
  | 
| 
alpar@18
 | 
  2140  | 
  \itemmax=\itemindent
  | 
| 
alpar@18
 | 
  2141  | 
  \advance\itemmax by -\itemmargin
  | 
| 
alpar@18
 | 
  2142  | 
  \advance\leftskip by \itemindent
  | 
| 
alpar@18
 | 
  2143  | 
  \exdentamount=\itemindent
  | 
| 
alpar@18
 | 
  2144  | 
  \parindent=0pt
  | 
| 
alpar@18
 | 
  2145  | 
  \parskip=\smallskipamount
  | 
| 
alpar@18
 | 
  2146  | 
  \ifdim\parskip=0pt \parskip=2pt \fi
  | 
| 
alpar@18
 | 
  2147  | 
  \def#2{\endgraf\afterenvbreak\endgroup}%
 | 
| 
alpar@18
 | 
  2148  | 
  \def\itemcontents{#1}%
 | 
| 
alpar@18
 | 
  2149  | 
  % @itemize with no arg is equivalent to @itemize @bullet.
  | 
| 
alpar@18
 | 
  2150  | 
  \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
 | 
| 
alpar@18
 | 
  2151  | 
  \let\item=\itemizeitem
  | 
| 
alpar@18
 | 
  2152  | 
}
  | 
| 
alpar@18
 | 
  2153  | 
  | 
| 
alpar@18
 | 
  2154  | 
% \splitoff TOKENS\endmark defines \first to be the first token in
  | 
| 
alpar@18
 | 
  2155  | 
% TOKENS, and \rest to be the remainder.
  | 
| 
alpar@18
 | 
  2156  | 
%
  | 
| 
alpar@18
 | 
  2157  | 
\def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
 | 
| 
alpar@18
 | 
  2158  | 
  | 
| 
alpar@18
 | 
  2159  | 
% Allow an optional argument of an uppercase letter, lowercase letter,
  | 
| 
alpar@18
 | 
  2160  | 
% or number, to specify the first label in the enumerated list.  No
  | 
| 
alpar@18
 | 
  2161  | 
% argument is the same as `1'.
  | 
| 
alpar@18
 | 
  2162  | 
%
  | 
| 
alpar@18
 | 
  2163  | 
\def\enumerate{\parsearg\enumeratezzz}
 | 
| 
alpar@18
 | 
  2164  | 
\def\enumeratezzz #1{\enumeratey #1  \endenumeratey}
 | 
| 
alpar@18
 | 
  2165  | 
\def\enumeratey #1 #2\endenumeratey{%
 | 
| 
alpar@18
 | 
  2166  | 
  \begingroup % ended by the @end enumerate
  | 
| 
alpar@18
 | 
  2167  | 
  %
  | 
| 
alpar@18
 | 
  2168  | 
  % If we were given no argument, pretend we were given `1'.
  | 
| 
alpar@18
 | 
  2169  | 
  \def\thearg{#1}%
 | 
| 
alpar@18
 | 
  2170  | 
  \ifx\thearg\empty \def\thearg{1}\fi
 | 
| 
alpar@18
 | 
  2171  | 
  %
  | 
| 
alpar@18
 | 
  2172  | 
  % Detect if the argument is a single token.  If so, it might be a
  | 
| 
alpar@18
 | 
  2173  | 
  % letter.  Otherwise, the only valid thing it can be is a number.
  | 
| 
alpar@18
 | 
  2174  | 
  % (We will always have one token, because of the test we just made.
  | 
| 
alpar@18
 | 
  2175  | 
  % This is a good thing, since \splitoff doesn't work given nothing at
  | 
| 
alpar@18
 | 
  2176  | 
  % all -- the first parameter is undelimited.)
  | 
| 
alpar@18
 | 
  2177  | 
  \expandafter\splitoff\thearg\endmark
  | 
| 
alpar@18
 | 
  2178  | 
  \ifx\rest\empty
  | 
| 
alpar@18
 | 
  2179  | 
    % Only one token in the argument.  It could still be anything.
  | 
| 
alpar@18
 | 
  2180  | 
    % A ``lowercase letter'' is one whose \lccode is nonzero.
  | 
| 
alpar@18
 | 
  2181  | 
    % An ``uppercase letter'' is one whose \lccode is both nonzero, and
  | 
| 
alpar@18
 | 
  2182  | 
    %   not equal to itself.
  | 
| 
alpar@18
 | 
  2183  | 
    % Otherwise, we assume it's a number.
  | 
| 
alpar@18
 | 
  2184  | 
    %
  | 
| 
alpar@18
 | 
  2185  | 
    % We need the \relax at the end of the \ifnum lines to stop TeX from
  | 
| 
alpar@18
 | 
  2186  | 
    % continuing to look for a <number>.
  | 
| 
alpar@18
 | 
  2187  | 
    %
  | 
| 
alpar@18
 | 
  2188  | 
    \ifnum\lccode\expandafter`\thearg=0\relax
  | 
| 
alpar@18
 | 
  2189  | 
      \numericenumerate % a number (we hope)
  | 
| 
alpar@18
 | 
  2190  | 
    \else
  | 
| 
alpar@18
 | 
  2191  | 
      % It's a letter.
  | 
| 
alpar@18
 | 
  2192  | 
      \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
  | 
| 
alpar@18
 | 
  2193  | 
        \lowercaseenumerate % lowercase letter
  | 
| 
alpar@18
 | 
  2194  | 
      \else
  | 
| 
alpar@18
 | 
  2195  | 
        \uppercaseenumerate % uppercase letter
  | 
| 
alpar@18
 | 
  2196  | 
      \fi
  | 
| 
alpar@18
 | 
  2197  | 
    \fi
  | 
| 
alpar@18
 | 
  2198  | 
  \else
  | 
| 
alpar@18
 | 
  2199  | 
    % Multiple tokens in the argument.  We hope it's a number.
  | 
| 
alpar@18
 | 
  2200  | 
    \numericenumerate
  | 
| 
alpar@18
 | 
  2201  | 
  \fi
  | 
| 
alpar@18
 | 
  2202  | 
}
  | 
| 
alpar@18
 | 
  2203  | 
  | 
| 
alpar@18
 | 
  2204  | 
% An @enumerate whose labels are integers.  The starting integer is
  | 
| 
alpar@18
 | 
  2205  | 
% given in \thearg.
  | 
| 
alpar@18
 | 
  2206  | 
%
  | 
| 
alpar@18
 | 
  2207  | 
\def\numericenumerate{%
 | 
| 
alpar@18
 | 
  2208  | 
  \itemno = \thearg
  | 
| 
alpar@18
 | 
  2209  | 
  \startenumeration{\the\itemno}%
 | 
| 
alpar@18
 | 
  2210  | 
}
  | 
| 
alpar@18
 | 
  2211  | 
  | 
| 
alpar@18
 | 
  2212  | 
% The starting (lowercase) letter is in \thearg.
  | 
| 
alpar@18
 | 
  2213  | 
\def\lowercaseenumerate{%
 | 
| 
alpar@18
 | 
  2214  | 
  \itemno = \expandafter`\thearg
  | 
| 
alpar@18
 | 
  2215  | 
  \startenumeration{%
 | 
| 
alpar@18
 | 
  2216  | 
    % Be sure we're not beyond the end of the alphabet.
  | 
| 
alpar@18
 | 
  2217  | 
    \ifnum\itemno=0
  | 
| 
alpar@18
 | 
  2218  | 
      \errmessage{No more lowercase letters in @enumerate; get a bigger
 | 
| 
alpar@18
 | 
  2219  | 
                  alphabet}%
  | 
| 
alpar@18
 | 
  2220  | 
    \fi
  | 
| 
alpar@18
 | 
  2221  | 
    \char\lccode\itemno
  | 
| 
alpar@18
 | 
  2222  | 
  }%
  | 
| 
alpar@18
 | 
  2223  | 
}
  | 
| 
alpar@18
 | 
  2224  | 
  | 
| 
alpar@18
 | 
  2225  | 
% The starting (uppercase) letter is in \thearg.
  | 
| 
alpar@18
 | 
  2226  | 
\def\uppercaseenumerate{%
 | 
| 
alpar@18
 | 
  2227  | 
  \itemno = \expandafter`\thearg
  | 
| 
alpar@18
 | 
  2228  | 
  \startenumeration{%
 | 
| 
alpar@18
 | 
  2229  | 
    % Be sure we're not beyond the end of the alphabet.
  | 
| 
alpar@18
 | 
  2230  | 
    \ifnum\itemno=0
  | 
| 
alpar@18
 | 
  2231  | 
      \errmessage{No more uppercase letters in @enumerate; get a bigger
 | 
| 
alpar@18
 | 
  2232  | 
                  alphabet}
  | 
| 
alpar@18
 | 
  2233  | 
    \fi
  | 
| 
alpar@18
 | 
  2234  | 
    \char\uccode\itemno
  | 
| 
alpar@18
 | 
  2235  | 
  }%
  | 
| 
alpar@18
 | 
  2236  | 
}
  | 
| 
alpar@18
 | 
  2237  | 
  | 
| 
alpar@18
 | 
  2238  | 
% Call itemizey, adding a period to the first argument and supplying the
  | 
| 
alpar@18
 | 
  2239  | 
% common last two arguments.  Also subtract one from the initial value in
  | 
| 
alpar@18
 | 
  2240  | 
% \itemno, since @item increments \itemno.
  | 
| 
alpar@18
 | 
  2241  | 
%
  | 
| 
alpar@18
 | 
  2242  | 
\def\startenumeration#1{%
 | 
| 
alpar@18
 | 
  2243  | 
  \advance\itemno by -1
  | 
| 
alpar@18
 | 
  2244  | 
  \itemizey{#1.}\Eenumerate\flushcr
 | 
| 
alpar@18
 | 
  2245  | 
}
  | 
| 
alpar@18
 | 
  2246  | 
  | 
| 
alpar@18
 | 
  2247  | 
% @alphaenumerate and @capsenumerate are abbreviations for giving an arg
  | 
| 
alpar@18
 | 
  2248  | 
% to @enumerate.
  | 
| 
alpar@18
 | 
  2249  | 
%
  | 
| 
alpar@18
 | 
  2250  | 
\def\alphaenumerate{\enumerate{a}}
 | 
| 
alpar@18
 | 
  2251  | 
\def\capsenumerate{\enumerate{A}}
 | 
| 
alpar@18
 | 
  2252  | 
\def\Ealphaenumerate{\Eenumerate}
 | 
| 
alpar@18
 | 
  2253  | 
\def\Ecapsenumerate{\Eenumerate}
 | 
| 
alpar@18
 | 
  2254  | 
  | 
| 
alpar@18
 | 
  2255  | 
% Definition of @item while inside @itemize.
  | 
| 
alpar@18
 | 
  2256  | 
  | 
| 
alpar@18
 | 
  2257  | 
\def\itemizeitem{%
 | 
| 
alpar@18
 | 
  2258  | 
\advance\itemno by 1
  | 
| 
alpar@18
 | 
  2259  | 
{\let\par=\endgraf \smallbreak}%
 | 
| 
alpar@18
 | 
  2260  | 
\ifhmode \errmessage{In hmode at itemizeitem}\fi
 | 
| 
alpar@18
 | 
  2261  | 
{\parskip=0in \hskip 0pt
 | 
| 
alpar@18
 | 
  2262  | 
\hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
 | 
| 
alpar@18
 | 
  2263  | 
\vadjust{\penalty 1200}}%
 | 
| 
alpar@18
 | 
  2264  | 
\flushcr}
  | 
| 
alpar@18
 | 
  2265  | 
  | 
| 
alpar@18
 | 
  2266  | 
% @multitable macros
  | 
| 
alpar@18
 | 
  2267  | 
% Amy Hendrickson, 8/18/94, 3/6/96
  | 
| 
alpar@18
 | 
  2268  | 
%
  | 
| 
alpar@18
 | 
  2269  | 
% @multitable ... @end multitable will make as many columns as desired.
  | 
| 
alpar@18
 | 
  2270  | 
% Contents of each column will wrap at width given in preamble.  Width
  | 
| 
alpar@18
 | 
  2271  | 
% can be specified either with sample text given in a template line,
  | 
| 
alpar@18
 | 
  2272  | 
% or in percent of \hsize, the current width of text on page.
  | 
| 
alpar@18
 | 
  2273  | 
  | 
| 
alpar@18
 | 
  2274  | 
% Table can continue over pages but will only break between lines.
  | 
| 
alpar@18
 | 
  2275  | 
  | 
| 
alpar@18
 | 
  2276  | 
% To make preamble:
  | 
| 
alpar@18
 | 
  2277  | 
%
  | 
| 
alpar@18
 | 
  2278  | 
% Either define widths of columns in terms of percent of \hsize:
  | 
| 
alpar@18
 | 
  2279  | 
%   @multitable @columnfractions .25 .3 .45
  | 
| 
alpar@18
 | 
  2280  | 
%   @item ...
  | 
| 
alpar@18
 | 
  2281  | 
%
  | 
| 
alpar@18
 | 
  2282  | 
%   Numbers following @columnfractions are the percent of the total
  | 
| 
alpar@18
 | 
  2283  | 
%   current hsize to be used for each column. You may use as many
  | 
| 
alpar@18
 | 
  2284  | 
%   columns as desired.
  | 
| 
alpar@18
 | 
  2285  | 
  | 
| 
alpar@18
 | 
  2286  | 
  | 
| 
alpar@18
 | 
  2287  | 
% Or use a template:
  | 
| 
alpar@18
 | 
  2288  | 
%   @multitable {Column 1 template} {Column 2 template} {Column 3 template}
 | 
| 
alpar@18
 | 
  2289  | 
%   @item ...
  | 
| 
alpar@18
 | 
  2290  | 
%   using the widest term desired in each column.
  | 
| 
alpar@18
 | 
  2291  | 
%
  | 
| 
alpar@18
 | 
  2292  | 
% For those who want to use more than one line's worth of words in
  | 
| 
alpar@18
 | 
  2293  | 
% the preamble, break the line within one argument and it
  | 
| 
alpar@18
 | 
  2294  | 
% will parse correctly, i.e.,
  | 
| 
alpar@18
 | 
  2295  | 
%
  | 
| 
alpar@18
 | 
  2296  | 
%     @multitable {Column 1 template} {Column 2 template} {Column 3
 | 
| 
alpar@18
 | 
  2297  | 
%      template}
  | 
| 
alpar@18
 | 
  2298  | 
% Not:
  | 
| 
alpar@18
 | 
  2299  | 
%     @multitable {Column 1 template} {Column 2 template}
 | 
| 
alpar@18
 | 
  2300  | 
%      {Column 3 template}
 | 
| 
alpar@18
 | 
  2301  | 
  | 
| 
alpar@18
 | 
  2302  | 
% Each new table line starts with @item, each subsequent new column
  | 
| 
alpar@18
 | 
  2303  | 
% starts with @tab. Empty columns may be produced by supplying @tab's
  | 
| 
alpar@18
 | 
  2304  | 
% with nothing between them for as many times as empty columns are needed,
  | 
| 
alpar@18
 | 
  2305  | 
% ie, @tab@tab@tab will produce two empty columns.
  | 
| 
alpar@18
 | 
  2306  | 
  | 
| 
alpar@18
 | 
  2307  | 
% @item, @tab, @multitable or @end multitable do not need to be on their
  | 
| 
alpar@18
 | 
  2308  | 
% own lines, but it will not hurt if they are.
  | 
| 
alpar@18
 | 
  2309  | 
  | 
| 
alpar@18
 | 
  2310  | 
% Sample multitable:
  | 
| 
alpar@18
 | 
  2311  | 
  | 
| 
alpar@18
 | 
  2312  | 
%   @multitable {Column 1 template} {Column 2 template} {Column 3 template}
 | 
| 
alpar@18
 | 
  2313  | 
%   @item first col stuff @tab second col stuff @tab third col
  | 
| 
alpar@18
 | 
  2314  | 
%   @item
  | 
| 
alpar@18
 | 
  2315  | 
%   first col stuff
  | 
| 
alpar@18
 | 
  2316  | 
%   @tab
  | 
| 
alpar@18
 | 
  2317  | 
%   second col stuff
  | 
| 
alpar@18
 | 
  2318  | 
%   @tab
  | 
| 
alpar@18
 | 
  2319  | 
%   third col
  | 
| 
alpar@18
 | 
  2320  | 
%   @item first col stuff @tab second col stuff
  | 
| 
alpar@18
 | 
  2321  | 
%   @tab Many paragraphs of text may be used in any column.
  | 
| 
alpar@18
 | 
  2322  | 
%
  | 
| 
alpar@18
 | 
  2323  | 
%         They will wrap at the width determined by the template.
  | 
| 
alpar@18
 | 
  2324  | 
%   @item@tab@tab This will be in third column.
  | 
| 
alpar@18
 | 
  2325  | 
%   @end multitable
  | 
| 
alpar@18
 | 
  2326  | 
  | 
| 
alpar@18
 | 
  2327  | 
% Default dimensions may be reset by user.
  | 
| 
alpar@18
 | 
  2328  | 
% @multitableparskip is vertical space between paragraphs in table.
  | 
| 
alpar@18
 | 
  2329  | 
% @multitableparindent is paragraph indent in table.
  | 
| 
alpar@18
 | 
  2330  | 
% @multitablecolmargin is horizontal space to be left between columns.
  | 
| 
alpar@18
 | 
  2331  | 
% @multitablelinespace is space to leave between table items, baseline
  | 
| 
alpar@18
 | 
  2332  | 
%                                                            to baseline.
  | 
| 
alpar@18
 | 
  2333  | 
%   0pt means it depends on current normal line spacing.
  | 
| 
alpar@18
 | 
  2334  | 
%
  | 
| 
alpar@18
 | 
  2335  | 
\newskip\multitableparskip
  | 
| 
alpar@18
 | 
  2336  | 
\newskip\multitableparindent
  | 
| 
alpar@18
 | 
  2337  | 
\newdimen\multitablecolspace
  | 
| 
alpar@18
 | 
  2338  | 
\newskip\multitablelinespace
  | 
| 
alpar@18
 | 
  2339  | 
\multitableparskip=0pt
  | 
| 
alpar@18
 | 
  2340  | 
\multitableparindent=6pt
  | 
| 
alpar@18
 | 
  2341  | 
\multitablecolspace=12pt
  | 
| 
alpar@18
 | 
  2342  | 
\multitablelinespace=0pt
  | 
| 
alpar@18
 | 
  2343  | 
  | 
| 
alpar@18
 | 
  2344  | 
% Macros used to set up halign preamble:
  | 
| 
alpar@18
 | 
  2345  | 
%
  | 
| 
alpar@18
 | 
  2346  | 
\let\endsetuptable\relax
  | 
| 
alpar@18
 | 
  2347  | 
\def\xendsetuptable{\endsetuptable}
 | 
| 
alpar@18
 | 
  2348  | 
\let\columnfractions\relax
  | 
| 
alpar@18
 | 
  2349  | 
\def\xcolumnfractions{\columnfractions}
 | 
| 
alpar@18
 | 
  2350  | 
\newif\ifsetpercent
  | 
| 
alpar@18
 | 
  2351  | 
  | 
| 
alpar@18
 | 
  2352  | 
% #1 is the part of the @columnfraction before the decimal point, which
  | 
| 
alpar@18
 | 
  2353  | 
% is presumably either 0 or the empty string (but we don't check, we
  | 
| 
alpar@18
 | 
  2354  | 
% just throw it away).  #2 is the decimal part, which we use as the
  | 
| 
alpar@18
 | 
  2355  | 
% percent of \hsize for this column.
  | 
| 
alpar@18
 | 
  2356  | 
\def\pickupwholefraction#1.#2 {%
 | 
| 
alpar@18
 | 
  2357  | 
  \global\advance\colcount by 1
  | 
| 
alpar@18
 | 
  2358  | 
  \expandafter\xdef\csname col\the\colcount\endcsname{.#2\hsize}%
 | 
| 
alpar@18
 | 
  2359  | 
  \setuptable
  | 
| 
alpar@18
 | 
  2360  | 
}
  | 
| 
alpar@18
 | 
  2361  | 
  | 
| 
alpar@18
 | 
  2362  | 
\newcount\colcount
  | 
| 
alpar@18
 | 
  2363  | 
\def\setuptable#1{%
 | 
| 
alpar@18
 | 
  2364  | 
  \def\firstarg{#1}%
 | 
| 
alpar@18
 | 
  2365  | 
  \ifx\firstarg\xendsetuptable
  | 
| 
alpar@18
 | 
  2366  | 
    \let\go = \relax
  | 
| 
alpar@18
 | 
  2367  | 
  \else
  | 
| 
alpar@18
 | 
  2368  | 
    \ifx\firstarg\xcolumnfractions
  | 
| 
alpar@18
 | 
  2369  | 
      \global\setpercenttrue
  | 
| 
alpar@18
 | 
  2370  | 
    \else
  | 
| 
alpar@18
 | 
  2371  | 
      \ifsetpercent
  | 
| 
alpar@18
 | 
  2372  | 
         \let\go\pickupwholefraction
  | 
| 
alpar@18
 | 
  2373  | 
      \else
  | 
| 
alpar@18
 | 
  2374  | 
         \global\advance\colcount by 1
  | 
| 
alpar@18
 | 
  2375  | 
         \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a
 | 
| 
alpar@18
 | 
  2376  | 
                   % separator; typically that is always in the input, anyway.
  | 
| 
alpar@18
 | 
  2377  | 
         \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
 | 
| 
alpar@18
 | 
  2378  | 
      \fi
  | 
| 
alpar@18
 | 
  2379  | 
    \fi
  | 
| 
alpar@18
 | 
  2380  | 
    \ifx\go\pickupwholefraction
  | 
| 
alpar@18
 | 
  2381  | 
      % Put the argument back for the \pickupwholefraction call, so
  | 
| 
alpar@18
 | 
  2382  | 
      % we'll always have a period there to be parsed.
  | 
| 
alpar@18
 | 
  2383  | 
      \def\go{\pickupwholefraction#1}%
 | 
| 
alpar@18
 | 
  2384  | 
    \else
  | 
| 
alpar@18
 | 
  2385  | 
      \let\go = \setuptable
  | 
| 
alpar@18
 | 
  2386  | 
    \fi%
  | 
| 
alpar@18
 | 
  2387  | 
  \fi
  | 
| 
alpar@18
 | 
  2388  | 
  \go
  | 
| 
alpar@18
 | 
  2389  | 
}
  | 
| 
alpar@18
 | 
  2390  | 
  | 
| 
alpar@18
 | 
  2391  | 
% @multitable ... @end multitable definitions:
  | 
| 
alpar@18
 | 
  2392  | 
%
  | 
| 
alpar@18
 | 
  2393  | 
\def\multitable{\parsearg\dotable}
 | 
| 
alpar@18
 | 
  2394  | 
\def\dotable#1{\bgroup
 | 
| 
alpar@18
 | 
  2395  | 
  \vskip\parskip
  | 
| 
alpar@18
 | 
  2396  | 
  \let\item=\crcrwithfootnotes
  | 
| 
alpar@18
 | 
  2397  | 
  % A \tab used to include \hskip1sp.  But then the space in a template
  | 
| 
alpar@18
 | 
  2398  | 
  % line is not enough.  That is bad.  So let's go back to just & until
  | 
| 
alpar@18
 | 
  2399  | 
  % we encounter the problem it was intended to solve again.  --karl,
  | 
| 
alpar@18
 | 
  2400  | 
  % nathan@acm.org, 20apr99.
  | 
| 
alpar@18
 | 
  2401  | 
  \let\tab=&%
  | 
| 
alpar@18
 | 
  2402  | 
  \let\startfootins=\startsavedfootnote
  | 
| 
alpar@18
 | 
  2403  | 
  \tolerance=9500
  | 
| 
alpar@18
 | 
  2404  | 
  \hbadness=9500
  | 
| 
alpar@18
 | 
  2405  | 
  \setmultitablespacing
  | 
| 
alpar@18
 | 
  2406  | 
  \parskip=\multitableparskip
  | 
| 
alpar@18
 | 
  2407  | 
  \parindent=\multitableparindent
  | 
| 
alpar@18
 | 
  2408  | 
  \overfullrule=0pt
  | 
| 
alpar@18
 | 
  2409  | 
  \global\colcount=0
  | 
| 
alpar@18
 | 
  2410  | 
  \def\Emultitable{%
 | 
| 
alpar@18
 | 
  2411  | 
    \global\setpercentfalse
  | 
| 
alpar@18
 | 
  2412  | 
    \crcrwithfootnotes\crcr
  | 
| 
alpar@18
 | 
  2413  | 
    \egroup\egroup
  | 
| 
alpar@18
 | 
  2414  | 
  }%
  | 
| 
alpar@18
 | 
  2415  | 
  %
  | 
| 
alpar@18
 | 
  2416  | 
  % To parse everything between @multitable and @item:
  | 
| 
alpar@18
 | 
  2417  | 
  \setuptable#1 \endsetuptable
  | 
| 
alpar@18
 | 
  2418  | 
  %
  | 
| 
alpar@18
 | 
  2419  | 
  % \everycr will reset column counter, \colcount, at the end of
  | 
| 
alpar@18
 | 
  2420  | 
  % each line. Every column entry will cause \colcount to advance by one.
  | 
| 
alpar@18
 | 
  2421  | 
  % The table preamble
  | 
| 
alpar@18
 | 
  2422  | 
  % looks at the current \colcount to find the correct column width.
  | 
| 
alpar@18
 | 
  2423  | 
  \everycr{\noalign{%
 | 
| 
alpar@18
 | 
  2424  | 
  %
  | 
| 
alpar@18
 | 
  2425  | 
  % \filbreak%% keeps underfull box messages off when table breaks over pages.
  | 
| 
alpar@18
 | 
  2426  | 
  % Maybe so, but it also creates really weird page breaks when the table
  | 
| 
alpar@18
 | 
  2427  | 
  % breaks over pages. Wouldn't \vfil be better?  Wait until the problem
  | 
| 
alpar@18
 | 
  2428  | 
  % manifests itself, so it can be fixed for real --karl.
  | 
| 
alpar@18
 | 
  2429  | 
    \global\colcount=0\relax}}%
  | 
| 
alpar@18
 | 
  2430  | 
  %
  | 
| 
alpar@18
 | 
  2431  | 
  % This preamble sets up a generic column definition, which will
  | 
| 
alpar@18
 | 
  2432  | 
  % be used as many times as user calls for columns.
  | 
| 
alpar@18
 | 
  2433  | 
  % \vtop will set a single line and will also let text wrap and
  | 
| 
alpar@18
 | 
  2434  | 
  % continue for many paragraphs if desired.
  | 
| 
alpar@18
 | 
  2435  | 
  \halign\bgroup&\global\advance\colcount by 1\relax
  | 
| 
alpar@18
 | 
  2436  | 
    \multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname
 | 
| 
alpar@18
 | 
  2437  | 
  %
  | 
| 
alpar@18
 | 
  2438  | 
  % In order to keep entries from bumping into each other
  | 
| 
alpar@18
 | 
  2439  | 
  % we will add a \leftskip of \multitablecolspace to all columns after
  | 
| 
alpar@18
 | 
  2440  | 
  % the first one.
  | 
| 
alpar@18
 | 
  2441  | 
  %
  | 
| 
alpar@18
 | 
  2442  | 
  % If a template has been used, we will add \multitablecolspace
  | 
| 
alpar@18
 | 
  2443  | 
  % to the width of each template entry.
  | 
| 
alpar@18
 | 
  2444  | 
  %
  | 
| 
alpar@18
 | 
  2445  | 
  % If the user has set preamble in terms of percent of \hsize we will
  | 
| 
alpar@18
 | 
  2446  | 
  % use that dimension as the width of the column, and the \leftskip
  | 
| 
alpar@18
 | 
  2447  | 
  % will keep entries from bumping into each other.  Table will start at
  | 
| 
alpar@18
 | 
  2448  | 
  % left margin and final column will justify at right margin.
  | 
| 
alpar@18
 | 
  2449  | 
  %
  | 
| 
alpar@18
 | 
  2450  | 
  % Make sure we don't inherit \rightskip from the outer environment.
  | 
| 
alpar@18
 | 
  2451  | 
  \rightskip=0pt
  | 
| 
alpar@18
 | 
  2452  | 
  \ifnum\colcount=1
  | 
| 
alpar@18
 | 
  2453  | 
    % The first column will be indented with the surrounding text.
  | 
| 
alpar@18
 | 
  2454  | 
    \advance\hsize by\leftskip
  | 
| 
alpar@18
 | 
  2455  | 
  \else
  | 
| 
alpar@18
 | 
  2456  | 
    \ifsetpercent \else
  | 
| 
alpar@18
 | 
  2457  | 
      % If user has not set preamble in terms of percent of \hsize
  | 
| 
alpar@18
 | 
  2458  | 
      % we will advance \hsize by \multitablecolspace.
  | 
| 
alpar@18
 | 
  2459  | 
      \advance\hsize by \multitablecolspace
  | 
| 
alpar@18
 | 
  2460  | 
    \fi
  | 
| 
alpar@18
 | 
  2461  | 
   % In either case we will make \leftskip=\multitablecolspace:
  | 
| 
alpar@18
 | 
  2462  | 
  \leftskip=\multitablecolspace
  | 
| 
alpar@18
 | 
  2463  | 
  \fi
  | 
| 
alpar@18
 | 
  2464  | 
  % Ignoring space at the beginning and end avoids an occasional spurious
  | 
| 
alpar@18
 | 
  2465  | 
  % blank line, when TeX decides to break the line at the space before the
  | 
| 
alpar@18
 | 
  2466  | 
  % box from the multistrut, so the strut ends up on a line by itself.
  | 
| 
alpar@18
 | 
  2467  | 
  % For example:
  | 
| 
alpar@18
 | 
  2468  | 
  % @multitable @columnfractions .11 .89
  | 
| 
alpar@18
 | 
  2469  | 
  % @item @code{#}
 | 
| 
alpar@18
 | 
  2470  | 
  % @tab Legal holiday which is valid in major parts of the whole country.
  | 
| 
alpar@18
 | 
  2471  | 
  % Is automatically provided with highlighting sequences respectively marking
  | 
| 
alpar@18
 | 
  2472  | 
  % characters.
  | 
| 
alpar@18
 | 
  2473  | 
  \noindent\ignorespaces##\unskip\multistrut}\cr
  | 
| 
alpar@18
 | 
  2474  | 
}
  | 
| 
alpar@18
 | 
  2475  | 
  | 
| 
alpar@18
 | 
  2476  | 
\def\setmultitablespacing{% test to see if user has set \multitablelinespace.
 | 
| 
alpar@18
 | 
  2477  | 
% If so, do nothing. If not, give it an appropriate dimension based on
  | 
| 
alpar@18
 | 
  2478  | 
% current baselineskip.
  | 
| 
alpar@18
 | 
  2479  | 
\ifdim\multitablelinespace=0pt
  | 
| 
alpar@18
 | 
  2480  | 
\setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
 | 
| 
alpar@18
 | 
  2481  | 
\global\advance\multitablelinespace by-\ht0
  | 
| 
alpar@18
 | 
  2482  | 
%% strut to put in table in case some entry doesn't have descenders,
  | 
| 
alpar@18
 | 
  2483  | 
%% to keep lines equally spaced
  | 
| 
alpar@18
 | 
  2484  | 
\let\multistrut = \strut
  | 
| 
alpar@18
 | 
  2485  | 
\else
  | 
| 
alpar@18
 | 
  2486  | 
%% FIXME: what is \box0 supposed to be?
  | 
| 
alpar@18
 | 
  2487  | 
\gdef\multistrut{\vrule height\multitablelinespace depth\dp0
 | 
| 
alpar@18
 | 
  2488  | 
width0pt\relax} \fi
  | 
| 
alpar@18
 | 
  2489  | 
%% Test to see if parskip is larger than space between lines of
  | 
| 
alpar@18
 | 
  2490  | 
%% table. If not, do nothing.
  | 
| 
alpar@18
 | 
  2491  | 
%%        If so, set to same dimension as multitablelinespace.
  | 
| 
alpar@18
 | 
  2492  | 
\ifdim\multitableparskip>\multitablelinespace
  | 
| 
alpar@18
 | 
  2493  | 
\global\multitableparskip=\multitablelinespace
  | 
| 
alpar@18
 | 
  2494  | 
\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
  | 
| 
alpar@18
 | 
  2495  | 
                                      %% than skip between lines in the table.
  | 
| 
alpar@18
 | 
  2496  | 
\fi%
  | 
| 
alpar@18
 | 
  2497  | 
\ifdim\multitableparskip=0pt
  | 
| 
alpar@18
 | 
  2498  | 
\global\multitableparskip=\multitablelinespace
  | 
| 
alpar@18
 | 
  2499  | 
\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
  | 
| 
alpar@18
 | 
  2500  | 
                                      %% than skip between lines in the table.
  | 
| 
alpar@18
 | 
  2501  | 
\fi}
  | 
| 
alpar@18
 | 
  2502  | 
  | 
| 
alpar@18
 | 
  2503  | 
% In case a @footnote appears inside an alignment, save the footnote
  | 
| 
alpar@18
 | 
  2504  | 
% text to a box and make the \insert when a row of the table is
  | 
| 
alpar@18
 | 
  2505  | 
% finished.  Otherwise, the insertion is lost, it never migrates to the
  | 
| 
alpar@18
 | 
  2506  | 
% main vertical list.  --kasal, 22jan03.
  | 
| 
alpar@18
 | 
  2507  | 
%
  | 
| 
alpar@18
 | 
  2508  | 
\newbox\savedfootnotes
  | 
| 
alpar@18
 | 
  2509  | 
%
  | 
| 
alpar@18
 | 
  2510  | 
% \dotable \let's \startfootins to this, so that \dofootnote will call
  | 
| 
alpar@18
 | 
  2511  | 
% it instead of starting the insertion right away.
  | 
| 
alpar@18
 | 
  2512  | 
\def\startsavedfootnote{%
 | 
| 
alpar@18
 | 
  2513  | 
  \global\setbox\savedfootnotes = \vbox\bgroup
  | 
| 
alpar@18
 | 
  2514  | 
    \unvbox\savedfootnotes
  | 
| 
alpar@18
 | 
  2515  | 
}
  | 
| 
alpar@18
 | 
  2516  | 
\def\crcrwithfootnotes{%
 | 
| 
alpar@18
 | 
  2517  | 
  \crcr
  | 
| 
alpar@18
 | 
  2518  | 
  \ifvoid\savedfootnotes \else
  | 
| 
alpar@18
 | 
  2519  | 
    \noalign{\insert\footins{\box\savedfootnotes}}%
 | 
| 
alpar@18
 | 
  2520  | 
  \fi
  | 
| 
alpar@18
 | 
  2521  | 
}
  | 
| 
alpar@18
 | 
  2522  | 
  | 
| 
alpar@18
 | 
  2523  | 
\message{conditionals,}
 | 
| 
alpar@18
 | 
  2524  | 
% Prevent errors for section commands.
  | 
| 
alpar@18
 | 
  2525  | 
% Used in @ignore and in failing conditionals.
  | 
| 
alpar@18
 | 
  2526  | 
\def\ignoresections{%
 | 
| 
alpar@18
 | 
  2527  | 
  \let\appendix=\relax
  | 
| 
alpar@18
 | 
  2528  | 
  \let\appendixsec=\relax
  | 
| 
alpar@18
 | 
  2529  | 
  \let\appendixsection=\relax
  | 
| 
alpar@18
 | 
  2530  | 
  \let\appendixsubsec=\relax
  | 
| 
alpar@18
 | 
  2531  | 
  \let\appendixsubsection=\relax
  | 
| 
alpar@18
 | 
  2532  | 
  \let\appendixsubsubsec=\relax
  | 
| 
alpar@18
 | 
  2533  | 
  \let\appendixsubsubsection=\relax
  | 
| 
alpar@18
 | 
  2534  | 
  %\let\begin=\relax
  | 
| 
alpar@18
 | 
  2535  | 
  %\let\bye=\relax
  | 
| 
alpar@18
 | 
  2536  | 
  \let\centerchap=\relax
  | 
| 
alpar@18
 | 
  2537  | 
  \let\chapter=\relax
  | 
| 
alpar@18
 | 
  2538  | 
  \let\contents=\relax
  | 
| 
alpar@18
 | 
  2539  | 
  \let\section=\relax
  | 
| 
alpar@18
 | 
  2540  | 
  \let\smallbook=\relax
  | 
| 
alpar@18
 | 
  2541  | 
  \let\subsec=\relax
  | 
| 
alpar@18
 | 
  2542  | 
  \let\subsection=\relax
  | 
| 
alpar@18
 | 
  2543  | 
  \let\subsubsec=\relax
  | 
| 
alpar@18
 | 
  2544  | 
  \let\subsubsection=\relax
  | 
| 
alpar@18
 | 
  2545  | 
  \let\titlepage=\relax
  | 
| 
alpar@18
 | 
  2546  | 
  \let\top=\relax
  | 
| 
alpar@18
 | 
  2547  | 
  \let\unnumbered=\relax
  | 
| 
alpar@18
 | 
  2548  | 
  \let\unnumberedsec=\relax
  | 
| 
alpar@18
 | 
  2549  | 
  \let\unnumberedsection=\relax
  | 
| 
alpar@18
 | 
  2550  | 
  \let\unnumberedsubsec=\relax
  | 
| 
alpar@18
 | 
  2551  | 
  \let\unnumberedsubsection=\relax
  | 
| 
alpar@18
 | 
  2552  | 
  \let\unnumberedsubsubsec=\relax
  | 
| 
alpar@18
 | 
  2553  | 
  \let\unnumberedsubsubsection=\relax
  | 
| 
alpar@18
 | 
  2554  | 
}
  | 
| 
alpar@18
 | 
  2555  | 
  | 
| 
alpar@18
 | 
  2556  | 
% Ignore @ignore, @ifhtml, @ifinfo, and the like.
  | 
| 
alpar@18
 | 
  2557  | 
%
  | 
| 
alpar@18
 | 
  2558  | 
\def\direntry{\doignore{direntry}}
 | 
| 
alpar@18
 | 
  2559  | 
\def\documentdescriptionword{documentdescription}
 | 
| 
alpar@18
 | 
  2560  | 
\def\documentdescription{\doignore{documentdescription}}
 | 
| 
alpar@18
 | 
  2561  | 
\def\html{\doignore{html}}
 | 
| 
alpar@18
 | 
  2562  | 
\def\ifhtml{\doignore{ifhtml}}
 | 
| 
alpar@18
 | 
  2563  | 
\def\ifinfo{\doignore{ifinfo}}
 | 
| 
alpar@18
 | 
  2564  | 
\def\ifnottex{\doignore{ifnottex}}
 | 
| 
alpar@18
 | 
  2565  | 
\def\ifplaintext{\doignore{ifplaintext}}
 | 
| 
alpar@18
 | 
  2566  | 
\def\ifxml{\doignore{ifxml}}
 | 
| 
alpar@18
 | 
  2567  | 
\def\ignore{\doignore{ignore}}
 | 
| 
alpar@18
 | 
  2568  | 
\def\menu{\doignore{menu}}
 | 
| 
alpar@18
 | 
  2569  | 
\def\xml{\doignore{xml}}
 | 
| 
alpar@18
 | 
  2570  | 
  | 
| 
alpar@18
 | 
  2571  | 
% @dircategory CATEGORY  -- specify a category of the dir file
  | 
| 
alpar@18
 | 
  2572  | 
% which this file should belong to.  Ignore this in TeX.
  | 
| 
alpar@18
 | 
  2573  | 
\let\dircategory = \comment
  | 
| 
alpar@18
 | 
  2574  | 
  | 
| 
alpar@18
 | 
  2575  | 
% Ignore text until a line `@end #1', keeping track of nested conditionals.
  | 
| 
alpar@18
 | 
  2576  | 
%
  | 
| 
alpar@18
 | 
  2577  | 
% A count to remember the depth of nesting.
  | 
| 
alpar@18
 | 
  2578  | 
\newcount\doignorecount  \doignorecount = 0
  | 
| 
alpar@18
 | 
  2579  | 
  | 
| 
alpar@18
 | 
  2580  | 
\def\doignore#1{\begingroup
 | 
| 
alpar@18
 | 
  2581  | 
  % Don't complain about control sequences we have declared \outer.
  | 
| 
alpar@18
 | 
  2582  | 
  \ignoresections
  | 
| 
alpar@18
 | 
  2583  | 
  %
  | 
| 
alpar@18
 | 
  2584  | 
  % Make sure that spaces turn into tokens that match what \doignoretext wants.
  | 
| 
alpar@18
 | 
  2585  | 
  \catcode\spaceChar = 10
  | 
| 
alpar@18
 | 
  2586  | 
  %
  | 
| 
alpar@18
 | 
  2587  | 
  % Ignore braces, so mismatched braces don't cause trouble.
  | 
| 
alpar@18
 | 
  2588  | 
  \catcode`\{ = 9
 | 
| 
alpar@18
 | 
  2589  | 
  \catcode`\} = 9
  | 
| 
alpar@18
 | 
  2590  | 
  %
  | 
| 
alpar@18
 | 
  2591  | 
  % Count number of #1's that we've seen.
  | 
| 
alpar@18
 | 
  2592  | 
  \doignorecount = 0
  | 
| 
alpar@18
 | 
  2593  | 
  %
  | 
| 
alpar@18
 | 
  2594  | 
  % Swallow text until we reach the matching `@end #1'.
  | 
| 
alpar@18
 | 
  2595  | 
  \expandafter \dodoignore \csname#1\endcsname {#1}%
 | 
| 
alpar@18
 | 
  2596  | 
}
  | 
| 
alpar@18
 | 
  2597  | 
  | 
| 
alpar@18
 | 
  2598  | 
{ \catcode`@=11 % We want to use \ST@P which cannot appear in texinfo source.
 | 
| 
alpar@18
 | 
  2599  | 
  \obeylines %
  | 
| 
alpar@18
 | 
  2600  | 
  %
  | 
| 
alpar@18
 | 
  2601  | 
  \gdef\dodoignore#1#2{%
 | 
| 
alpar@18
 | 
  2602  | 
    % #1 contains, e.g., \ifinfo, a.k.a. @ifinfo.
  | 
| 
alpar@18
 | 
  2603  | 
    % #2 contains the string `ifinfo'.
  | 
| 
alpar@18
 | 
  2604  | 
    %
  | 
| 
alpar@18
 | 
  2605  | 
    % Define a command to find the next `@end #2', which must be on a line
  | 
| 
alpar@18
 | 
  2606  | 
    % by itself.
  | 
| 
alpar@18
 | 
  2607  | 
    \long\def\doignoretext##1^^M\end #2{\doignoretextyyy##1^^M#1\ST@P}%
 | 
| 
alpar@18
 | 
  2608  | 
    % And this command to find another #1 command, at the beginning of a
  | 
| 
alpar@18
 | 
  2609  | 
    % line.  (Otherwise, we would consider a line `@c @ifset', for
  | 
| 
alpar@18
 | 
  2610  | 
    % example, to count as an @ifset for nesting.)
  | 
| 
alpar@18
 | 
  2611  | 
    \long\def\doignoretextyyy##1^^M#1##2\ST@P{\doignoreyyy{##2}\ST@P}%
 | 
| 
alpar@18
 | 
  2612  | 
    %
  | 
| 
alpar@18
 | 
  2613  | 
    % And now expand that command.
  | 
| 
alpar@18
 | 
  2614  | 
    \obeylines %
  | 
| 
alpar@18
 | 
  2615  | 
    \doignoretext ^^M%
  | 
| 
alpar@18
 | 
  2616  | 
  }%
  | 
| 
alpar@18
 | 
  2617  | 
}
  | 
| 
alpar@18
 | 
  2618  | 
  | 
| 
alpar@18
 | 
  2619  | 
\def\doignoreyyy#1{%
 | 
| 
alpar@18
 | 
  2620  | 
  \def\temp{#1}%
 | 
| 
alpar@18
 | 
  2621  | 
  \ifx\temp\empty			% Nothing found.
  | 
| 
alpar@18
 | 
  2622  | 
    \let\next\doignoretextzzz
  | 
| 
alpar@18
 | 
  2623  | 
  \else					% Found a nested condition, ...
  | 
| 
alpar@18
 | 
  2624  | 
    \advance\doignorecount by 1
  | 
| 
alpar@18
 | 
  2625  | 
    \let\next\doignoretextyyy		% ..., look for another.
  | 
| 
alpar@18
 | 
  2626  | 
    % If we're here, #1 ends with \ifinfo (for example).
  | 
| 
alpar@18
 | 
  2627  | 
  \fi
  | 
| 
alpar@18
 | 
  2628  | 
  \next #1% the token \ST@P is present just after this macro.
  | 
| 
alpar@18
 | 
  2629  | 
}
  | 
| 
alpar@18
 | 
  2630  | 
  | 
| 
alpar@18
 | 
  2631  | 
% We have to swallow the remaining "\ST@P".
  | 
| 
alpar@18
 | 
  2632  | 
% 
  | 
| 
alpar@18
 | 
  2633  | 
\def\doignoretextzzz#1{%
 | 
| 
alpar@18
 | 
  2634  | 
  \ifnum\doignorecount = 0	% We have just found the outermost @end.
  | 
| 
alpar@18
 | 
  2635  | 
    \let\next\enddoignore
  | 
| 
alpar@18
 | 
  2636  | 
  \else				% Still inside a nested condition.
  | 
| 
alpar@18
 | 
  2637  | 
    \advance\doignorecount by -1
  | 
| 
alpar@18
 | 
  2638  | 
    \let\next\doignoretext      % Look for the next @end.
  | 
| 
alpar@18
 | 
  2639  | 
  \fi
  | 
| 
alpar@18
 | 
  2640  | 
  \next
  | 
| 
alpar@18
 | 
  2641  | 
}
  | 
| 
alpar@18
 | 
  2642  | 
  | 
| 
alpar@18
 | 
  2643  | 
% Finish off ignored text.
  | 
| 
alpar@18
 | 
  2644  | 
\def\enddoignore{\endgroup\ignorespaces}
 | 
| 
alpar@18
 | 
  2645  | 
  | 
| 
alpar@18
 | 
  2646  | 
  | 
| 
alpar@18
 | 
  2647  | 
% @set VAR sets the variable VAR to an empty value.
  | 
| 
alpar@18
 | 
  2648  | 
% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
  | 
| 
alpar@18
 | 
  2649  | 
%
  | 
| 
alpar@18
 | 
  2650  | 
% Since we want to separate VAR from REST-OF-LINE (which might be
  | 
| 
alpar@18
 | 
  2651  | 
% empty), we can't just use \parsearg; we have to insert a space of our
  | 
| 
alpar@18
 | 
  2652  | 
% own to delimit the rest of the line, and then take it out again if we
  | 
| 
alpar@18
 | 
  2653  | 
% didn't need it.  Make sure the catcode of space is correct to avoid
  | 
| 
alpar@18
 | 
  2654  | 
% losing inside @example, for instance.
  | 
| 
alpar@18
 | 
  2655  | 
%
  | 
| 
alpar@18
 | 
  2656  | 
\def\set{\begingroup\catcode` =10
 | 
| 
alpar@18
 | 
  2657  | 
  \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR.
  | 
| 
alpar@18
 | 
  2658  | 
  \parsearg\setxxx}
  | 
| 
alpar@18
 | 
  2659  | 
\def\setxxx#1{\setyyy#1 \endsetyyy}
 | 
| 
alpar@18
 | 
  2660  | 
\def\setyyy#1 #2\endsetyyy{%
 | 
| 
alpar@18
 | 
  2661  | 
  \def\temp{#2}%
 | 
| 
alpar@18
 | 
  2662  | 
  \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty
  | 
| 
alpar@18
 | 
  2663  | 
  \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted.
 | 
| 
alpar@18
 | 
  2664  | 
  \fi
  | 
| 
alpar@18
 | 
  2665  | 
  \endgroup
  | 
| 
alpar@18
 | 
  2666  | 
}
  | 
| 
alpar@18
 | 
  2667  | 
% Can't use \xdef to pre-expand #2 and save some time, since \temp or
  | 
| 
alpar@18
 | 
  2668  | 
% \next or other control sequences that we've defined might get us into
  | 
| 
alpar@18
 | 
  2669  | 
% an infinite loop. Consider `@set foo @cite{bar}'.
 | 
| 
alpar@18
 | 
  2670  | 
\def\setzzz#1#2 \endsetzzz{\expandafter\gdef\csname SET#1\endcsname{#2}}
 | 
| 
alpar@18
 | 
  2671  | 
  | 
| 
alpar@18
 | 
  2672  | 
% @clear VAR clears (i.e., unsets) the variable VAR.
  | 
| 
alpar@18
 | 
  2673  | 
%
  | 
| 
alpar@18
 | 
  2674  | 
\def\clear{\parsearg\clearxxx}
 | 
| 
alpar@18
 | 
  2675  | 
\def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax}
 | 
| 
alpar@18
 | 
  2676  | 
  | 
| 
alpar@18
 | 
  2677  | 
% @value{foo} gets the text saved in variable foo.
 | 
| 
alpar@18
 | 
  2678  | 
{
 | 
| 
alpar@18
 | 
  2679  | 
  \catcode`\_ = \active
  | 
| 
alpar@18
 | 
  2680  | 
  %
  | 
| 
alpar@18
 | 
  2681  | 
  % We might end up with active _ or - characters in the argument if
  | 
| 
alpar@18
 | 
  2682  | 
  % we're called from @code, as @code{@value{foo-bar_}}.  So \let any
 | 
| 
alpar@18
 | 
  2683  | 
  % such active characters to their normal equivalents.
  | 
| 
alpar@18
 | 
  2684  | 
  \gdef\value{\begingroup
 | 
| 
alpar@18
 | 
  2685  | 
    \catcode`\-=\other \catcode`\_=\other
  | 
| 
alpar@18
 | 
  2686  | 
    \indexbreaks \let_\normalunderscore
  | 
| 
alpar@18
 | 
  2687  | 
    \valuexxx}
  | 
| 
alpar@18
 | 
  2688  | 
}
  | 
| 
alpar@18
 | 
  2689  | 
\def\valuexxx#1{\expandablevalue{#1}\endgroup}
 | 
| 
alpar@18
 | 
  2690  | 
  | 
| 
alpar@18
 | 
  2691  | 
% We have this subroutine so that we can handle at least some @value's
  | 
| 
alpar@18
 | 
  2692  | 
% properly in indexes (we \let\value to this in \indexdummies).  Ones
  | 
| 
alpar@18
 | 
  2693  | 
% whose names contain - or _ still won't work, but we can't do anything
  | 
| 
alpar@18
 | 
  2694  | 
% about that.  The command has to be fully expandable (if the variable
  | 
| 
alpar@18
 | 
  2695  | 
% is set), since the result winds up in the index file.  This means that
  | 
| 
alpar@18
 | 
  2696  | 
% if the variable's value contains other Texinfo commands, it's almost
  | 
| 
alpar@18
 | 
  2697  | 
% certain it will fail (although perhaps we could fix that with
  | 
| 
alpar@18
 | 
  2698  | 
% sufficient work to do a one-level expansion on the result, instead of
  | 
| 
alpar@18
 | 
  2699  | 
% complete).
  | 
| 
alpar@18
 | 
  2700  | 
%
  | 
| 
alpar@18
 | 
  2701  | 
\def\expandablevalue#1{%
 | 
| 
alpar@18
 | 
  2702  | 
  \expandafter\ifx\csname SET#1\endcsname\relax
  | 
| 
alpar@18
 | 
  2703  | 
    {[No value for ``#1'']}%
 | 
| 
alpar@18
 | 
  2704  | 
    \message{Variable `#1', used in @value, is not set.}%
 | 
| 
alpar@18
 | 
  2705  | 
  \else
  | 
| 
alpar@18
 | 
  2706  | 
    \csname SET#1\endcsname
  | 
| 
alpar@18
 | 
  2707  | 
  \fi
  | 
| 
alpar@18
 | 
  2708  | 
}
  | 
| 
alpar@18
 | 
  2709  | 
  | 
| 
alpar@18
 | 
  2710  | 
% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
  | 
| 
alpar@18
 | 
  2711  | 
% with @set.
  | 
| 
alpar@18
 | 
  2712  | 
%
  | 
| 
alpar@18
 | 
  2713  | 
\def\ifset{\parsearg\doifset}
 | 
| 
alpar@18
 | 
  2714  | 
\def\doifset#1{%
 | 
| 
alpar@18
 | 
  2715  | 
  \expandafter\ifx\csname SET#1\endcsname\relax
  | 
| 
alpar@18
 | 
  2716  | 
    \let\next=\ifsetfail
  | 
| 
alpar@18
 | 
  2717  | 
  \else
  | 
| 
alpar@18
 | 
  2718  | 
    \let\next=\ifsetsucceed
  | 
| 
alpar@18
 | 
  2719  | 
  \fi
  | 
| 
alpar@18
 | 
  2720  | 
  \next
  | 
| 
alpar@18
 | 
  2721  | 
}
  | 
| 
alpar@18
 | 
  2722  | 
\def\ifsetsucceed{\conditionalsucceed{ifset}}
 | 
| 
alpar@18
 | 
  2723  | 
\def\ifsetfail{\doignore{ifset}}
 | 
| 
alpar@18
 | 
  2724  | 
\defineunmatchedend{ifset}
 | 
| 
alpar@18
 | 
  2725  | 
  | 
| 
alpar@18
 | 
  2726  | 
% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
  | 
| 
alpar@18
 | 
  2727  | 
% defined with @set, or has been undefined with @clear.
  | 
| 
alpar@18
 | 
  2728  | 
%
  | 
| 
alpar@18
 | 
  2729  | 
\def\ifclear{\parsearg\doifclear}
 | 
| 
alpar@18
 | 
  2730  | 
\def\doifclear#1{%
 | 
| 
alpar@18
 | 
  2731  | 
  \expandafter\ifx\csname SET#1\endcsname\relax
  | 
| 
alpar@18
 | 
  2732  | 
    \let\next=\ifclearsucceed
  | 
| 
alpar@18
 | 
  2733  | 
  \else
  | 
| 
alpar@18
 | 
  2734  | 
    \let\next=\ifclearfail
  | 
| 
alpar@18
 | 
  2735  | 
  \fi
  | 
| 
alpar@18
 | 
  2736  | 
  \next
  | 
| 
alpar@18
 | 
  2737  | 
}
  | 
| 
alpar@18
 | 
  2738  | 
\def\ifclearsucceed{\conditionalsucceed{ifclear}}
 | 
| 
alpar@18
 | 
  2739  | 
\def\ifclearfail{\doignore{ifclear}}
 | 
| 
alpar@18
 | 
  2740  | 
\defineunmatchedend{ifclear}
 | 
| 
alpar@18
 | 
  2741  | 
  | 
| 
alpar@18
 | 
  2742  | 
% @iftex, @ifnothtml, @ifnotinfo, @ifnotplaintext always succeed; we
  | 
| 
alpar@18
 | 
  2743  | 
% read the text following, through the first @end iftex (etc.).  Make
  | 
| 
alpar@18
 | 
  2744  | 
% `@end iftex' (etc.) valid only after an @iftex.
  | 
| 
alpar@18
 | 
  2745  | 
%
  | 
| 
alpar@18
 | 
  2746  | 
\def\iftex{\conditionalsucceed{iftex}}
 | 
| 
alpar@18
 | 
  2747  | 
\def\ifnothtml{\conditionalsucceed{ifnothtml}}
 | 
| 
alpar@18
 | 
  2748  | 
\def\ifnotinfo{\conditionalsucceed{ifnotinfo}}
 | 
| 
alpar@18
 | 
  2749  | 
\def\ifnotplaintext{\conditionalsucceed{ifnotplaintext}}
 | 
| 
alpar@18
 | 
  2750  | 
\defineunmatchedend{iftex}
 | 
| 
alpar@18
 | 
  2751  | 
\defineunmatchedend{ifnothtml}
 | 
| 
alpar@18
 | 
  2752  | 
\defineunmatchedend{ifnotinfo}
 | 
| 
alpar@18
 | 
  2753  | 
\defineunmatchedend{ifnotplaintext}
 | 
| 
alpar@18
 | 
  2754  | 
  | 
| 
alpar@18
 | 
  2755  | 
% True conditional.  Since \set globally defines its variables, we can
  | 
| 
alpar@18
 | 
  2756  | 
% just start and end a group (to keep the @end definition undefined at
  | 
| 
alpar@18
 | 
  2757  | 
% the outer level).
  | 
| 
alpar@18
 | 
  2758  | 
%
  | 
| 
alpar@18
 | 
  2759  | 
\def\conditionalsucceed#1{\begingroup
 | 
| 
alpar@18
 | 
  2760  | 
  \expandafter\def\csname E#1\endcsname{\endgroup}%
 | 
| 
alpar@18
 | 
  2761  | 
}
  | 
| 
alpar@18
 | 
  2762  | 
  | 
| 
alpar@18
 | 
  2763  | 
% @defininfoenclose.
  | 
| 
alpar@18
 | 
  2764  | 
\let\definfoenclose=\comment
  | 
| 
alpar@18
 | 
  2765  | 
  | 
| 
alpar@18
 | 
  2766  | 
  | 
| 
alpar@18
 | 
  2767  | 
\message{indexing,}
 | 
| 
alpar@18
 | 
  2768  | 
% Index generation facilities
  | 
| 
alpar@18
 | 
  2769  | 
  | 
| 
alpar@18
 | 
  2770  | 
% Define \newwrite to be identical to plain tex's \newwrite
  | 
| 
alpar@18
 | 
  2771  | 
% except not \outer, so it can be used within \newindex.
  | 
| 
alpar@18
 | 
  2772  | 
{\catcode`\@=11
 | 
| 
alpar@18
 | 
  2773  | 
\gdef\newwrite{\alloc@7\write\chardef\sixt@@n}}
 | 
| 
alpar@18
 | 
  2774  | 
  | 
| 
alpar@18
 | 
  2775  | 
% \newindex {foo} defines an index named foo.
 | 
| 
alpar@18
 | 
  2776  | 
% It automatically defines \fooindex such that
  | 
| 
alpar@18
 | 
  2777  | 
% \fooindex ...rest of line... puts an entry in the index foo.
  | 
| 
alpar@18
 | 
  2778  | 
% It also defines \fooindfile to be the number of the output channel for
  | 
| 
alpar@18
 | 
  2779  | 
% the file that accumulates this index.  The file's extension is foo.
  | 
| 
alpar@18
 | 
  2780  | 
% The name of an index should be no more than 2 characters long
  | 
| 
alpar@18
 | 
  2781  | 
% for the sake of vms.
  | 
| 
alpar@18
 | 
  2782  | 
%
  | 
| 
alpar@18
 | 
  2783  | 
\def\newindex#1{%
 | 
| 
alpar@18
 | 
  2784  | 
  \iflinks
  | 
| 
alpar@18
 | 
  2785  | 
    \expandafter\newwrite \csname#1indfile\endcsname
  | 
| 
alpar@18
 | 
  2786  | 
    \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
  | 
| 
alpar@18
 | 
  2787  | 
  \fi
  | 
| 
alpar@18
 | 
  2788  | 
  \expandafter\xdef\csname#1index\endcsname{%     % Define @#1index
 | 
| 
alpar@18
 | 
  2789  | 
    \noexpand\doindex{#1}}
 | 
| 
alpar@18
 | 
  2790  | 
}
  | 
| 
alpar@18
 | 
  2791  | 
  | 
| 
alpar@18
 | 
  2792  | 
% @defindex foo  ==  \newindex{foo}
 | 
| 
alpar@18
 | 
  2793  | 
%
  | 
| 
alpar@18
 | 
  2794  | 
\def\defindex{\parsearg\newindex}
 | 
| 
alpar@18
 | 
  2795  | 
  | 
| 
alpar@18
 | 
  2796  | 
% Define @defcodeindex, like @defindex except put all entries in @code.
  | 
| 
alpar@18
 | 
  2797  | 
%
  | 
| 
alpar@18
 | 
  2798  | 
\def\defcodeindex{\parsearg\newcodeindex}
 | 
| 
alpar@18
 | 
  2799  | 
%
  | 
| 
alpar@18
 | 
  2800  | 
\def\newcodeindex#1{%
 | 
| 
alpar@18
 | 
  2801  | 
  \iflinks
  | 
| 
alpar@18
 | 
  2802  | 
    \expandafter\newwrite \csname#1indfile\endcsname
  | 
| 
alpar@18
 | 
  2803  | 
    \openout \csname#1indfile\endcsname \jobname.#1
  | 
| 
alpar@18
 | 
  2804  | 
  \fi
  | 
| 
alpar@18
 | 
  2805  | 
  \expandafter\xdef\csname#1index\endcsname{%
 | 
| 
alpar@18
 | 
  2806  | 
    \noexpand\docodeindex{#1}}%
 | 
| 
alpar@18
 | 
  2807  | 
}
  | 
| 
alpar@18
 | 
  2808  | 
  | 
| 
alpar@18
 | 
  2809  | 
  | 
| 
alpar@18
 | 
  2810  | 
% @synindex foo bar    makes index foo feed into index bar.
  | 
| 
alpar@18
 | 
  2811  | 
% Do this instead of @defindex foo if you don't want it as a separate index.
  | 
| 
alpar@18
 | 
  2812  | 
%
  | 
| 
alpar@18
 | 
  2813  | 
% @syncodeindex foo bar   similar, but put all entries made for index foo
  | 
| 
alpar@18
 | 
  2814  | 
% inside @code.
  | 
| 
alpar@18
 | 
  2815  | 
%
  | 
| 
alpar@18
 | 
  2816  | 
\def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
 | 
| 
alpar@18
 | 
  2817  | 
\def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}
 | 
| 
alpar@18
 | 
  2818  | 
  | 
| 
alpar@18
 | 
  2819  | 
% #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
  | 
| 
alpar@18
 | 
  2820  | 
% #3 the target index (bar).
  | 
| 
alpar@18
 | 
  2821  | 
\def\dosynindex#1#2#3{%
 | 
| 
alpar@18
 | 
  2822  | 
  % Only do \closeout if we haven't already done it, else we'll end up
  | 
| 
alpar@18
 | 
  2823  | 
  % closing the target index.
  | 
| 
alpar@18
 | 
  2824  | 
  \expandafter \ifx\csname donesynindex#2\endcsname \undefined
  | 
| 
alpar@18
 | 
  2825  | 
    % The \closeout helps reduce unnecessary open files; the limit on the
  | 
| 
alpar@18
 | 
  2826  | 
    % Acorn RISC OS is a mere 16 files.
  | 
| 
alpar@18
 | 
  2827  | 
    \expandafter\closeout\csname#2indfile\endcsname
  | 
| 
alpar@18
 | 
  2828  | 
    \expandafter\let\csname\donesynindex#2\endcsname = 1
  | 
| 
alpar@18
 | 
  2829  | 
  \fi
  | 
| 
alpar@18
 | 
  2830  | 
  % redefine \fooindfile:
  | 
| 
alpar@18
 | 
  2831  | 
  \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
  | 
| 
alpar@18
 | 
  2832  | 
  \expandafter\let\csname#2indfile\endcsname=\temp
  | 
| 
alpar@18
 | 
  2833  | 
  % redefine \fooindex:
  | 
| 
alpar@18
 | 
  2834  | 
  \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
 | 
| 
alpar@18
 | 
  2835  | 
}
  | 
| 
alpar@18
 | 
  2836  | 
  | 
| 
alpar@18
 | 
  2837  | 
% Define \doindex, the driver for all \fooindex macros.
  | 
| 
alpar@18
 | 
  2838  | 
% Argument #1 is generated by the calling \fooindex macro,
  | 
| 
alpar@18
 | 
  2839  | 
%  and it is "foo", the name of the index.
  | 
| 
alpar@18
 | 
  2840  | 
  | 
| 
alpar@18
 | 
  2841  | 
% \doindex just uses \parsearg; it calls \doind for the actual work.
  | 
| 
alpar@18
 | 
  2842  | 
% This is because \doind is more useful to call from other macros.
  | 
| 
alpar@18
 | 
  2843  | 
  | 
| 
alpar@18
 | 
  2844  | 
% There is also \dosubind {index}{topic}{subtopic}
 | 
| 
alpar@18
 | 
  2845  | 
% which makes an entry in a two-level index such as the operation index.
  | 
| 
alpar@18
 | 
  2846  | 
  | 
| 
alpar@18
 | 
  2847  | 
\def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
 | 
| 
alpar@18
 | 
  2848  | 
\def\singleindexer #1{\doind{\indexname}{#1}}
 | 
| 
alpar@18
 | 
  2849  | 
  | 
| 
alpar@18
 | 
  2850  | 
% like the previous two, but they put @code around the argument.
  | 
| 
alpar@18
 | 
  2851  | 
\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
 | 
| 
alpar@18
 | 
  2852  | 
\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
 | 
| 
alpar@18
 | 
  2853  | 
  | 
| 
alpar@18
 | 
  2854  | 
% Take care of Texinfo commands that can appear in an index entry.
  | 
| 
alpar@18
 | 
  2855  | 
% Since there are some commands we want to expand, and others we don't,
  | 
| 
alpar@18
 | 
  2856  | 
% we have to laboriously prevent expansion for those that we don't.
  | 
| 
alpar@18
 | 
  2857  | 
%
  | 
| 
alpar@18
 | 
  2858  | 
\def\indexdummies{%
 | 
| 
alpar@18
 | 
  2859  | 
  \def\@{@}% change to @@ when we switch to @ as escape char in index files.
 | 
| 
alpar@18
 | 
  2860  | 
  \def\ {\realbackslash\space }%
 | 
| 
alpar@18
 | 
  2861  | 
  % Need these in case \tex is in effect and \{ is a \delimiter again.
 | 
| 
alpar@18
 | 
  2862  | 
  % But can't use \lbracecmd and \rbracecmd because texindex assumes
  | 
| 
alpar@18
 | 
  2863  | 
  % braces and backslashes are used only as delimiters.
  | 
| 
alpar@18
 | 
  2864  | 
  \let\{ = \mylbrace
 | 
| 
alpar@18
 | 
  2865  | 
  \let\} = \myrbrace
  | 
| 
alpar@18
 | 
  2866  | 
  %
  | 
| 
alpar@18
 | 
  2867  | 
  % \definedummyword defines \#1 as \realbackslash #1\space, thus
  | 
| 
alpar@18
 | 
  2868  | 
  % effectively preventing its expansion.  This is used only for control
  | 
| 
alpar@18
 | 
  2869  | 
  % words, not control letters, because the \space would be incorrect
  | 
| 
alpar@18
 | 
  2870  | 
  % for control characters, but is needed to separate the control word
  | 
| 
alpar@18
 | 
  2871  | 
  % from whatever follows.
  | 
| 
alpar@18
 | 
  2872  | 
  %
  | 
| 
alpar@18
 | 
  2873  | 
  % For control letters, we have \definedummyletter, which omits the
  | 
| 
alpar@18
 | 
  2874  | 
  % space.
  | 
| 
alpar@18
 | 
  2875  | 
  %
  | 
| 
alpar@18
 | 
  2876  | 
  % These can be used both for control words that take an argument and
  | 
| 
alpar@18
 | 
  2877  | 
  % those that do not.  If it is followed by {arg} in the input, then
 | 
| 
alpar@18
 | 
  2878  | 
  % that will dutifully get written to the index (or wherever).
  | 
| 
alpar@18
 | 
  2879  | 
  %
  | 
| 
alpar@18
 | 
  2880  | 
  \def\definedummyword##1{%
 | 
| 
alpar@18
 | 
  2881  | 
    \expandafter\def\csname ##1\endcsname{\realbackslash ##1\space}%
 | 
| 
alpar@18
 | 
  2882  | 
  }%
  | 
| 
alpar@18
 | 
  2883  | 
  \def\definedummyletter##1{%
 | 
| 
alpar@18
 | 
  2884  | 
    \expandafter\def\csname ##1\endcsname{\realbackslash ##1}%
 | 
| 
alpar@18
 | 
  2885  | 
  }%
  | 
| 
alpar@18
 | 
  2886  | 
  %
  | 
| 
alpar@18
 | 
  2887  | 
  % Do the redefinitions.
  | 
| 
alpar@18
 | 
  2888  | 
  \commondummies
  | 
| 
alpar@18
 | 
  2889  | 
}
  | 
| 
alpar@18
 | 
  2890  | 
  | 
| 
alpar@18
 | 
  2891  | 
% For the aux file, @ is the escape character.  So we want to redefine
  | 
| 
alpar@18
 | 
  2892  | 
% everything using @ instead of \realbackslash.  When everything uses
  | 
| 
alpar@18
 | 
  2893  | 
% @, this will be simpler.
  | 
| 
alpar@18
 | 
  2894  | 
%
  | 
| 
alpar@18
 | 
  2895  | 
\def\atdummies{%
 | 
| 
alpar@18
 | 
  2896  | 
  \def\@{@@}%
 | 
| 
alpar@18
 | 
  2897  | 
  \def\ {@ }%
 | 
| 
alpar@18
 | 
  2898  | 
  \let\{ = \lbraceatcmd
 | 
| 
alpar@18
 | 
  2899  | 
  \let\} = \rbraceatcmd
  | 
| 
alpar@18
 | 
  2900  | 
  %
  | 
| 
alpar@18
 | 
  2901  | 
  % (See comments in \indexdummies.)
  | 
| 
alpar@18
 | 
  2902  | 
  \def\definedummyword##1{%
 | 
| 
alpar@18
 | 
  2903  | 
    \expandafter\def\csname ##1\endcsname{@##1\space}%
 | 
| 
alpar@18
 | 
  2904  | 
  }%
  | 
| 
alpar@18
 | 
  2905  | 
  \def\definedummyletter##1{%
 | 
| 
alpar@18
 | 
  2906  | 
    \expandafter\def\csname ##1\endcsname{@##1}%
 | 
| 
alpar@18
 | 
  2907  | 
  }%
  | 
| 
alpar@18
 | 
  2908  | 
  %
  | 
| 
alpar@18
 | 
  2909  | 
  % Do the redefinitions.
  | 
| 
alpar@18
 | 
  2910  | 
  \commondummies
  | 
| 
alpar@18
 | 
  2911  | 
}
  | 
| 
alpar@18
 | 
  2912  | 
  | 
| 
alpar@18
 | 
  2913  | 
% Called from \indexdummies and \atdummies.  \definedummyword and
  | 
| 
alpar@18
 | 
  2914  | 
% \definedummyletter must be defined first.
  | 
| 
alpar@18
 | 
  2915  | 
%
  | 
| 
alpar@18
 | 
  2916  | 
\def\commondummies{%
 | 
| 
alpar@18
 | 
  2917  | 
  %
  | 
| 
alpar@18
 | 
  2918  | 
  \normalturnoffactive
  | 
| 
alpar@18
 | 
  2919  | 
  %
  | 
| 
alpar@18
 | 
  2920  | 
  % Control letters and accents.
  | 
| 
alpar@18
 | 
  2921  | 
  \definedummyletter{_}%
 | 
| 
alpar@18
 | 
  2922  | 
  \definedummyletter{,}%
 | 
| 
alpar@18
 | 
  2923  | 
  \definedummyletter{"}%
 | 
| 
alpar@18
 | 
  2924  | 
  \definedummyletter{`}%
 | 
| 
alpar@18
 | 
  2925  | 
  \definedummyletter{'}%
 | 
| 
alpar@18
 | 
  2926  | 
  \definedummyletter{^}%
 | 
| 
alpar@18
 | 
  2927  | 
  \definedummyletter{~}%
 | 
| 
alpar@18
 | 
  2928  | 
  \definedummyletter{=}%
 | 
| 
alpar@18
 | 
  2929  | 
  \definedummyword{u}%
 | 
| 
alpar@18
 | 
  2930  | 
  \definedummyword{v}%
 | 
| 
alpar@18
 | 
  2931  | 
  \definedummyword{H}%
 | 
| 
alpar@18
 | 
  2932  | 
  \definedummyword{dotaccent}%
 | 
| 
alpar@18
 | 
  2933  | 
  \definedummyword{ringaccent}%
 | 
| 
alpar@18
 | 
  2934  | 
  \definedummyword{tieaccent}%
 | 
| 
alpar@18
 | 
  2935  | 
  \definedummyword{ubaraccent}%
 | 
| 
alpar@18
 | 
  2936  | 
  \definedummyword{udotaccent}%
 | 
| 
alpar@18
 | 
  2937  | 
  \definedummyword{dotless}%
 | 
| 
alpar@18
 | 
  2938  | 
  %
  | 
| 
alpar@18
 | 
  2939  | 
  % Other non-English letters.
  | 
| 
alpar@18
 | 
  2940  | 
  \definedummyword{AA}%
 | 
| 
alpar@18
 | 
  2941  | 
  \definedummyword{AE}%
 | 
| 
alpar@18
 | 
  2942  | 
  \definedummyword{L}%
 | 
| 
alpar@18
 | 
  2943  | 
  \definedummyword{OE}%
 | 
| 
alpar@18
 | 
  2944  | 
  \definedummyword{O}%
 | 
| 
alpar@18
 | 
  2945  | 
  \definedummyword{aa}%
 | 
| 
alpar@18
 | 
  2946  | 
  \definedummyword{ae}%
 | 
| 
alpar@18
 | 
  2947  | 
  \definedummyword{l}%
 | 
| 
alpar@18
 | 
  2948  | 
  \definedummyword{oe}%
 | 
| 
alpar@18
 | 
  2949  | 
  \definedummyword{o}%
 | 
| 
alpar@18
 | 
  2950  | 
  \definedummyword{ss}%
 | 
| 
alpar@18
 | 
  2951  | 
  %
  | 
| 
alpar@18
 | 
  2952  | 
  % Although these internal commands shouldn't show up, sometimes they do.
  | 
| 
alpar@18
 | 
  2953  | 
  \definedummyword{bf}%
 | 
| 
alpar@18
 | 
  2954  | 
  \definedummyword{gtr}%
 | 
| 
alpar@18
 | 
  2955  | 
  \definedummyword{hat}%
 | 
| 
alpar@18
 | 
  2956  | 
  \definedummyword{less}%
 | 
| 
alpar@18
 | 
  2957  | 
  \definedummyword{sf}%
 | 
| 
alpar@18
 | 
  2958  | 
  \definedummyword{sl}%
 | 
| 
alpar@18
 | 
  2959  | 
  \definedummyword{tclose}%
 | 
| 
alpar@18
 | 
  2960  | 
  \definedummyword{tt}%
 | 
| 
alpar@18
 | 
  2961  | 
  %
  | 
| 
alpar@18
 | 
  2962  | 
  % Texinfo font commands.
  | 
| 
alpar@18
 | 
  2963  | 
  \definedummyword{b}%
 | 
| 
alpar@18
 | 
  2964  | 
  \definedummyword{i}%
 | 
| 
alpar@18
 | 
  2965  | 
  \definedummyword{r}%
 | 
| 
alpar@18
 | 
  2966  | 
  \definedummyword{sc}%
 | 
| 
alpar@18
 | 
  2967  | 
  \definedummyword{t}%
 | 
| 
alpar@18
 | 
  2968  | 
  %
  | 
| 
alpar@18
 | 
  2969  | 
  \definedummyword{TeX}%
 | 
| 
alpar@18
 | 
  2970  | 
  \definedummyword{acronym}%
 | 
| 
alpar@18
 | 
  2971  | 
  \definedummyword{cite}%
 | 
| 
alpar@18
 | 
  2972  | 
  \definedummyword{code}%
 | 
| 
alpar@18
 | 
  2973  | 
  \definedummyword{command}%
 | 
| 
alpar@18
 | 
  2974  | 
  \definedummyword{dfn}%
 | 
| 
alpar@18
 | 
  2975  | 
  \definedummyword{dots}%
 | 
| 
alpar@18
 | 
  2976  | 
  \definedummyword{emph}%
 | 
| 
alpar@18
 | 
  2977  | 
  \definedummyword{env}%
 | 
| 
alpar@18
 | 
  2978  | 
  \definedummyword{file}%
 | 
| 
alpar@18
 | 
  2979  | 
  \definedummyword{kbd}%
 | 
| 
alpar@18
 | 
  2980  | 
  \definedummyword{key}%
 | 
| 
alpar@18
 | 
  2981  | 
  \definedummyword{math}%
 | 
| 
alpar@18
 | 
  2982  | 
  \definedummyword{option}%
 | 
| 
alpar@18
 | 
  2983  | 
  \definedummyword{samp}%
 | 
| 
alpar@18
 | 
  2984  | 
  \definedummyword{strong}%
 | 
| 
alpar@18
 | 
  2985  | 
  \definedummyword{uref}%
 | 
| 
alpar@18
 | 
  2986  | 
  \definedummyword{url}%
 | 
| 
alpar@18
 | 
  2987  | 
  \definedummyword{var}%
 | 
| 
alpar@18
 | 
  2988  | 
  \definedummyword{w}%
 | 
| 
alpar@18
 | 
  2989  | 
  %
  | 
| 
alpar@18
 | 
  2990  | 
  % Assorted special characters.
  | 
| 
alpar@18
 | 
  2991  | 
  \definedummyword{bullet}%
 | 
| 
alpar@18
 | 
  2992  | 
  \definedummyword{copyright}%
 | 
| 
alpar@18
 | 
  2993  | 
  \definedummyword{dots}%
 | 
| 
alpar@18
 | 
  2994  | 
  \definedummyword{enddots}%
 | 
| 
alpar@18
 | 
  2995  | 
  \definedummyword{equiv}%
 | 
| 
alpar@18
 | 
  2996  | 
  \definedummyword{error}%
 | 
| 
alpar@18
 | 
  2997  | 
  \definedummyword{expansion}%
 | 
| 
alpar@18
 | 
  2998  | 
  \definedummyword{minus}%
 | 
| 
alpar@18
 | 
  2999  | 
  \definedummyword{pounds}%
 | 
| 
alpar@18
 | 
  3000  | 
  \definedummyword{point}%
 | 
| 
alpar@18
 | 
  3001  | 
  \definedummyword{print}%
 | 
| 
alpar@18
 | 
  3002  | 
  \definedummyword{result}%
 | 
| 
alpar@18
 | 
  3003  | 
  %
  | 
| 
alpar@18
 | 
  3004  | 
  % Handle some cases of @value -- where the variable name does not
  | 
| 
alpar@18
 | 
  3005  | 
  % contain - or _, and the value does not contain any
  | 
| 
alpar@18
 | 
  3006  | 
  % (non-fully-expandable) commands.
  | 
| 
alpar@18
 | 
  3007  | 
  \let\value = \expandablevalue
  | 
| 
alpar@18
 | 
  3008  | 
  %
  | 
| 
alpar@18
 | 
  3009  | 
  % Normal spaces, not active ones.
  | 
| 
alpar@18
 | 
  3010  | 
  \unsepspaces
  | 
| 
alpar@18
 | 
  3011  | 
  %
  | 
| 
alpar@18
 | 
  3012  | 
  % No macro expansion.
  | 
| 
alpar@18
 | 
  3013  | 
  \turnoffmacros
  | 
| 
alpar@18
 | 
  3014  | 
}
  | 
| 
alpar@18
 | 
  3015  | 
  | 
| 
alpar@18
 | 
  3016  | 
% If an index command is used in an @example environment, any spaces
  | 
| 
alpar@18
 | 
  3017  | 
% therein should become regular spaces in the raw index file, not the
  | 
| 
alpar@18
 | 
  3018  | 
% expansion of \tie (\leavevmode \penalty \@M \ ).
  | 
| 
alpar@18
 | 
  3019  | 
{\obeyspaces
 | 
| 
alpar@18
 | 
  3020  | 
 \gdef\unsepspaces{\obeyspaces\let =\space}}
 | 
| 
alpar@18
 | 
  3021  | 
  | 
| 
alpar@18
 | 
  3022  | 
  | 
| 
alpar@18
 | 
  3023  | 
% \indexnofonts is used when outputting the strings to sort the index
  | 
| 
alpar@18
 | 
  3024  | 
% by, and when constructing control sequence names.  It eliminates all
  | 
| 
alpar@18
 | 
  3025  | 
% control sequences and just writes whatever the best ASCII sort string
  | 
| 
alpar@18
 | 
  3026  | 
% would be for a given command (usually its argument).
  | 
| 
alpar@18
 | 
  3027  | 
%
  | 
| 
alpar@18
 | 
  3028  | 
\def\indexdummytex{TeX}
 | 
| 
alpar@18
 | 
  3029  | 
\def\indexdummydots{...}
 | 
| 
alpar@18
 | 
  3030  | 
%
  | 
| 
alpar@18
 | 
  3031  | 
\def\indexnofonts{%
 | 
| 
alpar@18
 | 
  3032  | 
  \def\ { }%
 | 
| 
alpar@18
 | 
  3033  | 
  \def\@{@}%
 | 
| 
alpar@18
 | 
  3034  | 
  % how to handle braces?
  | 
| 
alpar@18
 | 
  3035  | 
  \def\_{\normalunderscore}%
 | 
| 
alpar@18
 | 
  3036  | 
  %
  | 
| 
alpar@18
 | 
  3037  | 
  \let\,=\asis
  | 
| 
alpar@18
 | 
  3038  | 
  \let\"=\asis
  | 
| 
alpar@18
 | 
  3039  | 
  \let\`=\asis
  | 
| 
alpar@18
 | 
  3040  | 
  \let\'=\asis
  | 
| 
alpar@18
 | 
  3041  | 
  \let\^=\asis
  | 
| 
alpar@18
 | 
  3042  | 
  \let\~=\asis
  | 
| 
alpar@18
 | 
  3043  | 
  \let\==\asis
  | 
| 
alpar@18
 | 
  3044  | 
  \let\u=\asis
  | 
| 
alpar@18
 | 
  3045  | 
  \let\v=\asis
  | 
| 
alpar@18
 | 
  3046  | 
  \let\H=\asis
  | 
| 
alpar@18
 | 
  3047  | 
  \let\dotaccent=\asis
  | 
| 
alpar@18
 | 
  3048  | 
  \let\ringaccent=\asis
  | 
| 
alpar@18
 | 
  3049  | 
  \let\tieaccent=\asis
  | 
| 
alpar@18
 | 
  3050  | 
  \let\ubaraccent=\asis
  | 
| 
alpar@18
 | 
  3051  | 
  \let\udotaccent=\asis
  | 
| 
alpar@18
 | 
  3052  | 
  \let\dotless=\asis
  | 
| 
alpar@18
 | 
  3053  | 
  %
  | 
| 
alpar@18
 | 
  3054  | 
  % Other non-English letters.
  | 
| 
alpar@18
 | 
  3055  | 
  \def\AA{AA}%
 | 
| 
alpar@18
 | 
  3056  | 
  \def\AE{AE}%
 | 
| 
alpar@18
 | 
  3057  | 
  \def\L{L}%
 | 
| 
alpar@18
 | 
  3058  | 
  \def\OE{OE}%
 | 
| 
alpar@18
 | 
  3059  | 
  \def\O{O}%
 | 
| 
alpar@18
 | 
  3060  | 
  \def\aa{aa}%
 | 
| 
alpar@18
 | 
  3061  | 
  \def\ae{ae}%
 | 
| 
alpar@18
 | 
  3062  | 
  \def\l{l}%
 | 
| 
alpar@18
 | 
  3063  | 
  \def\oe{oe}%
 | 
| 
alpar@18
 | 
  3064  | 
  \def\o{o}%
 | 
| 
alpar@18
 | 
  3065  | 
  \def\ss{ss}%
 | 
| 
alpar@18
 | 
  3066  | 
  \def\exclamdown{!}%
 | 
| 
alpar@18
 | 
  3067  | 
  \def\questiondown{?}%
 | 
| 
alpar@18
 | 
  3068  | 
  %
  | 
| 
alpar@18
 | 
  3069  | 
  % Don't no-op \tt, since it isn't a user-level command
  | 
| 
alpar@18
 | 
  3070  | 
  % and is used in the definitions of the active chars like <, >, |, etc.
  | 
| 
alpar@18
 | 
  3071  | 
  % Likewise with the other plain tex font commands.
  | 
| 
alpar@18
 | 
  3072  | 
  %\let\tt=\asis
  | 
| 
alpar@18
 | 
  3073  | 
  %
  | 
| 
alpar@18
 | 
  3074  | 
  % Texinfo font commands.
  | 
| 
alpar@18
 | 
  3075  | 
  \let\b=\asis
  | 
| 
alpar@18
 | 
  3076  | 
  \let\i=\asis
  | 
| 
alpar@18
 | 
  3077  | 
  \let\r=\asis
  | 
| 
alpar@18
 | 
  3078  | 
  \let\sc=\asis
  | 
| 
alpar@18
 | 
  3079  | 
  \let\t=\asis
  | 
| 
alpar@18
 | 
  3080  | 
  %
  | 
| 
alpar@18
 | 
  3081  | 
  \let\TeX=\indexdummytex
  | 
| 
alpar@18
 | 
  3082  | 
  \let\acronym=\asis
  | 
| 
alpar@18
 | 
  3083  | 
  \let\cite=\asis
  | 
| 
alpar@18
 | 
  3084  | 
  \let\code=\asis
  | 
| 
alpar@18
 | 
  3085  | 
  \let\command=\asis
  | 
| 
alpar@18
 | 
  3086  | 
  \let\dfn=\asis
  | 
| 
alpar@18
 | 
  3087  | 
  \let\dots=\indexdummydots
  | 
| 
alpar@18
 | 
  3088  | 
  \let\emph=\asis
  | 
| 
alpar@18
 | 
  3089  | 
  \let\env=\asis
  | 
| 
alpar@18
 | 
  3090  | 
  \let\file=\asis
  | 
| 
alpar@18
 | 
  3091  | 
  \let\kbd=\asis
  | 
| 
alpar@18
 | 
  3092  | 
  \let\key=\asis
  | 
| 
alpar@18
 | 
  3093  | 
  \let\math=\asis
  | 
| 
alpar@18
 | 
  3094  | 
  \let\option=\asis
  | 
| 
alpar@18
 | 
  3095  | 
  \let\samp=\asis
  | 
| 
alpar@18
 | 
  3096  | 
  \let\strong=\asis
  | 
| 
alpar@18
 | 
  3097  | 
  \let\uref=\asis
  | 
| 
alpar@18
 | 
  3098  | 
  \let\url=\asis
  | 
| 
alpar@18
 | 
  3099  | 
  \let\var=\asis
  | 
| 
alpar@18
 | 
  3100  | 
  \let\w=\asis
  | 
| 
alpar@18
 | 
  3101  | 
}
  | 
| 
alpar@18
 | 
  3102  | 
  | 
| 
alpar@18
 | 
  3103  | 
\let\indexbackslash=0  %overridden during \printindex.
  | 
| 
alpar@18
 | 
  3104  | 
\let\SETmarginindex=\relax % put index entries in margin (undocumented)?
  | 
| 
alpar@18
 | 
  3105  | 
  | 
| 
alpar@18
 | 
  3106  | 
% For \ifx comparisons.
  | 
| 
alpar@18
 | 
  3107  | 
\def\emptymacro{\empty}
 | 
| 
alpar@18
 | 
  3108  | 
  | 
| 
alpar@18
 | 
  3109  | 
% Most index entries go through here, but \dosubind is the general case.
  | 
| 
alpar@18
 | 
  3110  | 
%
  | 
| 
alpar@18
 | 
  3111  | 
\def\doind#1#2{\dosubind{#1}{#2}\empty}
 | 
| 
alpar@18
 | 
  3112  | 
  | 
| 
alpar@18
 | 
  3113  | 
% Workhorse for all \fooindexes.
  | 
| 
alpar@18
 | 
  3114  | 
% #1 is name of index, #2 is stuff to put there, #3 is subentry --
  | 
| 
alpar@18
 | 
  3115  | 
% \empty if called from \doind, as we usually are.  The main exception
  | 
| 
alpar@18
 | 
  3116  | 
% is with defuns, which call us directly.
  | 
| 
alpar@18
 | 
  3117  | 
%
  | 
| 
alpar@18
 | 
  3118  | 
\def\dosubind#1#2#3{%
 | 
| 
alpar@18
 | 
  3119  | 
  % Put the index entry in the margin if desired.
  | 
| 
alpar@18
 | 
  3120  | 
  \ifx\SETmarginindex\relax\else
  | 
| 
alpar@18
 | 
  3121  | 
    \insert\margin{\hbox{\vrule height8pt depth3pt width0pt #2}}%
 | 
| 
alpar@18
 | 
  3122  | 
  \fi
  | 
| 
alpar@18
 | 
  3123  | 
  {%
 | 
| 
alpar@18
 | 
  3124  | 
    \count255=\lastpenalty
  | 
| 
alpar@18
 | 
  3125  | 
    {%
 | 
| 
alpar@18
 | 
  3126  | 
      \indexdummies % Must do this here, since \bf, etc expand at this stage
  | 
| 
alpar@18
 | 
  3127  | 
      \escapechar=`\\
  | 
| 
alpar@18
 | 
  3128  | 
      {%
 | 
| 
alpar@18
 | 
  3129  | 
        \let\folio = 0% We will expand all macros now EXCEPT \folio.
  | 
| 
alpar@18
 | 
  3130  | 
        \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
 | 
| 
alpar@18
 | 
  3131  | 
        % so it will be output as is; and it will print as backslash.
  | 
| 
alpar@18
 | 
  3132  | 
        %
  | 
| 
alpar@18
 | 
  3133  | 
        % The main index entry text.
  | 
| 
alpar@18
 | 
  3134  | 
        \toks0 = {#2}%
 | 
| 
alpar@18
 | 
  3135  | 
        %
  | 
| 
alpar@18
 | 
  3136  | 
        % If third arg is present, precede it with space in sort key.
  | 
| 
alpar@18
 | 
  3137  | 
        \def\thirdarg{#3}%
 | 
| 
alpar@18
 | 
  3138  | 
        \ifx\thirdarg\emptymacro \else
  | 
| 
alpar@18
 | 
  3139  | 
           % If the third (subentry) arg is present, add it to the index
  | 
| 
alpar@18
 | 
  3140  | 
           % line to write.
  | 
| 
alpar@18
 | 
  3141  | 
          \toks0 = \expandafter{\the\toks0 \space #3}%
 | 
| 
alpar@18
 | 
  3142  | 
        \fi
  | 
| 
alpar@18
 | 
  3143  | 
        %
  | 
| 
alpar@18
 | 
  3144  | 
        % Process the index entry with all font commands turned off, to
  | 
| 
alpar@18
 | 
  3145  | 
        % get the string to sort by.
  | 
| 
alpar@18
 | 
  3146  | 
        {\indexnofonts
 | 
| 
alpar@18
 | 
  3147  | 
         \edef\temp{\the\toks0}% need full expansion
 | 
| 
alpar@18
 | 
  3148  | 
         \xdef\indexsorttmp{\temp}%
 | 
| 
alpar@18
 | 
  3149  | 
        }%
  | 
| 
alpar@18
 | 
  3150  | 
        %
  | 
| 
alpar@18
 | 
  3151  | 
        % Set up the complete index entry, with both the sort key and
  | 
| 
alpar@18
 | 
  3152  | 
        % the original text, including any font commands.  We write
  | 
| 
alpar@18
 | 
  3153  | 
        % three arguments to \entry to the .?? file (four in the
  | 
| 
alpar@18
 | 
  3154  | 
        % subentry case), texindex reduces to two when writing the .??s
  | 
| 
alpar@18
 | 
  3155  | 
        % sorted result.
  | 
| 
alpar@18
 | 
  3156  | 
        \edef\temp{%
 | 
| 
alpar@18
 | 
  3157  | 
          \write\csname#1indfile\endcsname{%
 | 
| 
alpar@18
 | 
  3158  | 
            \realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}%
 | 
| 
alpar@18
 | 
  3159  | 
        }%
  | 
| 
alpar@18
 | 
  3160  | 
        %
  | 
| 
alpar@18
 | 
  3161  | 
        % If a skip is the last thing on the list now, preserve it
  | 
| 
alpar@18
 | 
  3162  | 
        % by backing up by \lastskip, doing the \write, then inserting
  | 
| 
alpar@18
 | 
  3163  | 
        % the skip again.  Otherwise, the whatsit generated by the
  | 
| 
alpar@18
 | 
  3164  | 
        % \write will make \lastskip zero.  The result is that sequences
  | 
| 
alpar@18
 | 
  3165  | 
        % like this:
  | 
| 
alpar@18
 | 
  3166  | 
        % @end defun
  | 
| 
alpar@18
 | 
  3167  | 
        % @tindex whatever
  | 
| 
alpar@18
 | 
  3168  | 
        % @defun ...
  | 
| 
alpar@18
 | 
  3169  | 
        % will have extra space inserted, because the \medbreak in the
  | 
| 
alpar@18
 | 
  3170  | 
        % start of the @defun won't see the skip inserted by the @end of
  | 
| 
alpar@18
 | 
  3171  | 
        % the previous defun.
  | 
| 
alpar@18
 | 
  3172  | 
        %
  | 
| 
alpar@18
 | 
  3173  | 
        % But don't do any of this if we're not in vertical mode.  We
  | 
| 
alpar@18
 | 
  3174  | 
        % don't want to do a \vskip and prematurely end a paragraph.
  | 
| 
alpar@18
 | 
  3175  | 
        %
  | 
| 
alpar@18
 | 
  3176  | 
        % Avoid page breaks due to these extra skips, too.
  | 
| 
alpar@18
 | 
  3177  | 
        %
  | 
| 
alpar@18
 | 
  3178  | 
        \iflinks
  | 
| 
alpar@18
 | 
  3179  | 
          \ifvmode
  | 
| 
alpar@18
 | 
  3180  | 
            \skip0 = \lastskip
  | 
| 
alpar@18
 | 
  3181  | 
            \ifdim\lastskip = 0pt \else \nobreak\vskip-\skip0 \fi
  | 
| 
alpar@18
 | 
  3182  | 
          \fi
  | 
| 
alpar@18
 | 
  3183  | 
          %
  | 
| 
alpar@18
 | 
  3184  | 
          \temp % do the write
  | 
| 
alpar@18
 | 
  3185  | 
          %
  | 
| 
alpar@18
 | 
  3186  | 
          \ifvmode \ifdim\skip0 = 0pt \else \nobreak\vskip\skip0 \fi \fi
  | 
| 
alpar@18
 | 
  3187  | 
        \fi
  | 
| 
alpar@18
 | 
  3188  | 
      }%
  | 
| 
alpar@18
 | 
  3189  | 
    }%
  | 
| 
alpar@18
 | 
  3190  | 
    \penalty\count255
  | 
| 
alpar@18
 | 
  3191  | 
  }%
  | 
| 
alpar@18
 | 
  3192  | 
}
  | 
| 
alpar@18
 | 
  3193  | 
  | 
| 
alpar@18
 | 
  3194  | 
% The index entry written in the file actually looks like
  | 
| 
alpar@18
 | 
  3195  | 
%  \entry {sortstring}{page}{topic}
 | 
| 
alpar@18
 | 
  3196  | 
% or
  | 
| 
alpar@18
 | 
  3197  | 
%  \entry {sortstring}{page}{topic}{subtopic}
 | 
| 
alpar@18
 | 
  3198  | 
% The texindex program reads in these files and writes files
  | 
| 
alpar@18
 | 
  3199  | 
% containing these kinds of lines:
  | 
| 
alpar@18
 | 
  3200  | 
%  \initial {c}
 | 
| 
alpar@18
 | 
  3201  | 
%     before the first topic whose initial is c
  | 
| 
alpar@18
 | 
  3202  | 
%  \entry {topic}{pagelist}
 | 
| 
alpar@18
 | 
  3203  | 
%     for a topic that is used without subtopics
  | 
| 
alpar@18
 | 
  3204  | 
%  \primary {topic}
 | 
| 
alpar@18
 | 
  3205  | 
%     for the beginning of a topic that is used with subtopics
  | 
| 
alpar@18
 | 
  3206  | 
%  \secondary {subtopic}{pagelist}
 | 
| 
alpar@18
 | 
  3207  | 
%     for each subtopic.
  | 
| 
alpar@18
 | 
  3208  | 
  | 
| 
alpar@18
 | 
  3209  | 
% Define the user-accessible indexing commands
  | 
| 
alpar@18
 | 
  3210  | 
% @findex, @vindex, @kindex, @cindex.
  | 
| 
alpar@18
 | 
  3211  | 
  | 
| 
alpar@18
 | 
  3212  | 
\def\findex {\fnindex}
 | 
| 
alpar@18
 | 
  3213  | 
\def\kindex {\kyindex}
 | 
| 
alpar@18
 | 
  3214  | 
\def\cindex {\cpindex}
 | 
| 
alpar@18
 | 
  3215  | 
\def\vindex {\vrindex}
 | 
| 
alpar@18
 | 
  3216  | 
\def\tindex {\tpindex}
 | 
| 
alpar@18
 | 
  3217  | 
\def\pindex {\pgindex}
 | 
| 
alpar@18
 | 
  3218  | 
  | 
| 
alpar@18
 | 
  3219  | 
\def\cindexsub {\begingroup\obeylines\cindexsub}
 | 
| 
alpar@18
 | 
  3220  | 
{\obeylines %
 | 
| 
alpar@18
 | 
  3221  | 
\gdef\cindexsub "#1" #2^^M{\endgroup %
 | 
| 
alpar@18
 | 
  3222  | 
\dosubind{cp}{#2}{#1}}}
 | 
| 
alpar@18
 | 
  3223  | 
  | 
| 
alpar@18
 | 
  3224  | 
% Define the macros used in formatting output of the sorted index material.
  | 
| 
alpar@18
 | 
  3225  | 
  | 
| 
alpar@18
 | 
  3226  | 
% @printindex causes a particular index (the ??s file) to get printed.
  | 
| 
alpar@18
 | 
  3227  | 
% It does not print any chapter heading (usually an @unnumbered).
  | 
| 
alpar@18
 | 
  3228  | 
%
  | 
| 
alpar@18
 | 
  3229  | 
\def\printindex{\parsearg\doprintindex}
 | 
| 
alpar@18
 | 
  3230  | 
\def\doprintindex#1{\begingroup
 | 
| 
alpar@18
 | 
  3231  | 
  \dobreak \chapheadingskip{10000}%
 | 
| 
alpar@18
 | 
  3232  | 
  %
  | 
| 
alpar@18
 | 
  3233  | 
  \smallfonts \rm
  | 
| 
alpar@18
 | 
  3234  | 
  \tolerance = 9500
  | 
| 
alpar@18
 | 
  3235  | 
  \everypar = {}% don't want the \kern\-parindent from indentation suppression.
 | 
| 
alpar@18
 | 
  3236  | 
  \indexbreaks
  | 
| 
alpar@18
 | 
  3237  | 
  %
  | 
| 
alpar@18
 | 
  3238  | 
  % See if the index file exists and is nonempty.
  | 
| 
alpar@18
 | 
  3239  | 
  % Change catcode of @ here so that if the index file contains
  | 
| 
alpar@18
 | 
  3240  | 
  % \initial {@}
 | 
| 
alpar@18
 | 
  3241  | 
  % as its first line, TeX doesn't complain about mismatched braces
  | 
| 
alpar@18
 | 
  3242  | 
  % (because it thinks @} is a control sequence).
  | 
| 
alpar@18
 | 
  3243  | 
  \catcode`\@ = 11
  | 
| 
alpar@18
 | 
  3244  | 
  \openin 1 \jobname.#1s
  | 
| 
alpar@18
 | 
  3245  | 
  \ifeof 1
  | 
| 
alpar@18
 | 
  3246  | 
    % \enddoublecolumns gets confused if there is no text in the index,
  | 
| 
alpar@18
 | 
  3247  | 
    % and it loses the chapter title and the aux file entries for the
  | 
| 
alpar@18
 | 
  3248  | 
    % index.  The easiest way to prevent this problem is to make sure
  | 
| 
alpar@18
 | 
  3249  | 
    % there is some text.
  | 
| 
alpar@18
 | 
  3250  | 
    \putwordIndexNonexistent
  | 
| 
alpar@18
 | 
  3251  | 
  \else
  | 
| 
alpar@18
 | 
  3252  | 
    %
  | 
| 
alpar@18
 | 
  3253  | 
    % If the index file exists but is empty, then \openin leaves \ifeof
  | 
| 
alpar@18
 | 
  3254  | 
    % false.  We have to make TeX try to read something from the file, so
  | 
| 
alpar@18
 | 
  3255  | 
    % it can discover if there is anything in it.
  | 
| 
alpar@18
 | 
  3256  | 
    \read 1 to \temp
  | 
| 
alpar@18
 | 
  3257  | 
    \ifeof 1
  | 
| 
alpar@18
 | 
  3258  | 
      \putwordIndexIsEmpty
  | 
| 
alpar@18
 | 
  3259  | 
    \else
  | 
| 
alpar@18
 | 
  3260  | 
      % Index files are almost Texinfo source, but we use \ as the escape
  | 
| 
alpar@18
 | 
  3261  | 
      % character.  It would be better to use @, but that's too big a change
  | 
| 
alpar@18
 | 
  3262  | 
      % to make right now.
  | 
| 
alpar@18
 | 
  3263  | 
      \def\indexbackslash{\rawbackslashxx}%
 | 
| 
alpar@18
 | 
  3264  | 
      \catcode`\\ = 0
  | 
| 
alpar@18
 | 
  3265  | 
      \escapechar = `\\
  | 
| 
alpar@18
 | 
  3266  | 
      \begindoublecolumns
  | 
| 
alpar@18
 | 
  3267  | 
      \input \jobname.#1s
  | 
| 
alpar@18
 | 
  3268  | 
      \enddoublecolumns
  | 
| 
alpar@18
 | 
  3269  | 
    \fi
  | 
| 
alpar@18
 | 
  3270  | 
  \fi
  | 
| 
alpar@18
 | 
  3271  | 
  \closein 1
  | 
| 
alpar@18
 | 
  3272  | 
\endgroup}
  | 
| 
alpar@18
 | 
  3273  | 
  | 
| 
alpar@18
 | 
  3274  | 
% These macros are used by the sorted index file itself.
  | 
| 
alpar@18
 | 
  3275  | 
% Change them to control the appearance of the index.
  | 
| 
alpar@18
 | 
  3276  | 
  | 
| 
alpar@18
 | 
  3277  | 
\def\initial#1{{%
 | 
| 
alpar@18
 | 
  3278  | 
  % Some minor font changes for the special characters.
  | 
| 
alpar@18
 | 
  3279  | 
  \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
  | 
| 
alpar@18
 | 
  3280  | 
  %
  | 
| 
alpar@18
 | 
  3281  | 
  % Remove any glue we may have, we'll be inserting our own.
  | 
| 
alpar@18
 | 
  3282  | 
  \removelastskip
  | 
| 
alpar@18
 | 
  3283  | 
  %
  | 
| 
alpar@18
 | 
  3284  | 
  % We like breaks before the index initials, so insert a bonus.
  | 
| 
alpar@18
 | 
  3285  | 
  \penalty -300
  | 
| 
alpar@18
 | 
  3286  | 
  %
  | 
| 
alpar@18
 | 
  3287  | 
  % Typeset the initial.  Making this add up to a whole number of
  | 
| 
alpar@18
 | 
  3288  | 
  % baselineskips increases the chance of the dots lining up from column
  | 
| 
alpar@18
 | 
  3289  | 
  % to column.  It still won't often be perfect, because of the stretch
  | 
| 
alpar@18
 | 
  3290  | 
  % we need before each entry, but it's better.
  | 
| 
alpar@18
 | 
  3291  | 
  %
  | 
| 
alpar@18
 | 
  3292  | 
  % No shrink because it confuses \balancecolumns.
  | 
| 
alpar@18
 | 
  3293  | 
  \vskip 1.67\baselineskip plus .5\baselineskip
  | 
| 
alpar@18
 | 
  3294  | 
  \leftline{\secbf #1}%
 | 
| 
alpar@18
 | 
  3295  | 
  \vskip .33\baselineskip plus .1\baselineskip
  | 
| 
alpar@18
 | 
  3296  | 
  %
  | 
| 
alpar@18
 | 
  3297  | 
  % Do our best not to break after the initial.
  | 
| 
alpar@18
 | 
  3298  | 
  \nobreak
  | 
| 
alpar@18
 | 
  3299  | 
}}
  | 
| 
alpar@18
 | 
  3300  | 
  | 
| 
alpar@18
 | 
  3301  | 
% This typesets a paragraph consisting of #1, dot leaders, and then #2
  | 
| 
alpar@18
 | 
  3302  | 
% flush to the right margin.  It is used for index and table of contents
  | 
| 
alpar@18
 | 
  3303  | 
% entries.  The paragraph is indented by \leftskip.
  | 
| 
alpar@18
 | 
  3304  | 
%
  | 
| 
alpar@18
 | 
  3305  | 
\def\entry#1#2{\begingroup
 | 
| 
alpar@18
 | 
  3306  | 
  %
  | 
| 
alpar@18
 | 
  3307  | 
  % Start a new paragraph if necessary, so our assignments below can't
  | 
| 
alpar@18
 | 
  3308  | 
  % affect previous text.
  | 
| 
alpar@18
 | 
  3309  | 
  \par
  | 
| 
alpar@18
 | 
  3310  | 
  %
  | 
| 
alpar@18
 | 
  3311  | 
  % Do not fill out the last line with white space.
  | 
| 
alpar@18
 | 
  3312  | 
  \parfillskip = 0in
  | 
| 
alpar@18
 | 
  3313  | 
  %
  | 
| 
alpar@18
 | 
  3314  | 
  % No extra space above this paragraph.
  | 
| 
alpar@18
 | 
  3315  | 
  \parskip = 0in
  | 
| 
alpar@18
 | 
  3316  | 
  %
  | 
| 
alpar@18
 | 
  3317  | 
  % Do not prefer a separate line ending with a hyphen to fewer lines.
  | 
| 
alpar@18
 | 
  3318  | 
  \finalhyphendemerits = 0
  | 
| 
alpar@18
 | 
  3319  | 
  %
  | 
| 
alpar@18
 | 
  3320  | 
  % \hangindent is only relevant when the entry text and page number
  | 
| 
alpar@18
 | 
  3321  | 
  % don't both fit on one line.  In that case, bob suggests starting the
  | 
| 
alpar@18
 | 
  3322  | 
  % dots pretty far over on the line.  Unfortunately, a large
  | 
| 
alpar@18
 | 
  3323  | 
  % indentation looks wrong when the entry text itself is broken across
  | 
| 
alpar@18
 | 
  3324  | 
  % lines.  So we use a small indentation and put up with long leaders.
  | 
| 
alpar@18
 | 
  3325  | 
  %
  | 
| 
alpar@18
 | 
  3326  | 
  % \hangafter is reset to 1 (which is the value we want) at the start
  | 
| 
alpar@18
 | 
  3327  | 
  % of each paragraph, so we need not do anything with that.
  | 
| 
alpar@18
 | 
  3328  | 
  \hangindent = 2em
  | 
| 
alpar@18
 | 
  3329  | 
  %
  | 
| 
alpar@18
 | 
  3330  | 
  % When the entry text needs to be broken, just fill out the first line
  | 
| 
alpar@18
 | 
  3331  | 
  % with blank space.
  | 
| 
alpar@18
 | 
  3332  | 
  \rightskip = 0pt plus1fil
  | 
| 
alpar@18
 | 
  3333  | 
  %
  | 
| 
alpar@18
 | 
  3334  | 
  % A bit of stretch before each entry for the benefit of balancing columns.
  | 
| 
alpar@18
 | 
  3335  | 
  \vskip 0pt plus1pt
  | 
| 
alpar@18
 | 
  3336  | 
  %
  | 
| 
alpar@18
 | 
  3337  | 
  % Start a ``paragraph'' for the index entry so the line breaking
  | 
| 
alpar@18
 | 
  3338  | 
  % parameters we've set above will have an effect.
  | 
| 
alpar@18
 | 
  3339  | 
  \noindent
  | 
| 
alpar@18
 | 
  3340  | 
  %
  | 
| 
alpar@18
 | 
  3341  | 
  % Insert the text of the index entry.  TeX will do line-breaking on it.
  | 
| 
alpar@18
 | 
  3342  | 
  #1%
  | 
| 
alpar@18
 | 
  3343  | 
  % The following is kludged to not output a line of dots in the index if
  | 
| 
alpar@18
 | 
  3344  | 
  % there are no page numbers.  The next person who breaks this will be
  | 
| 
alpar@18
 | 
  3345  | 
  % cursed by a Unix daemon.
  | 
| 
alpar@18
 | 
  3346  | 
  \def\tempa{{\rm }}%
 | 
| 
alpar@18
 | 
  3347  | 
  \def\tempb{#2}%
 | 
| 
alpar@18
 | 
  3348  | 
  \edef\tempc{\tempa}%
 | 
| 
alpar@18
 | 
  3349  | 
  \edef\tempd{\tempb}%
 | 
| 
alpar@18
 | 
  3350  | 
  \ifx\tempc\tempd\ \else%
  | 
| 
alpar@18
 | 
  3351  | 
    %
  | 
| 
alpar@18
 | 
  3352  | 
    % If we must, put the page number on a line of its own, and fill out
  | 
| 
alpar@18
 | 
  3353  | 
    % this line with blank space.  (The \hfil is overwhelmed with the
  | 
| 
alpar@18
 | 
  3354  | 
    % fill leaders glue in \indexdotfill if the page number does fit.)
  | 
| 
alpar@18
 | 
  3355  | 
    \hfil\penalty50
  | 
| 
alpar@18
 | 
  3356  | 
    \null\nobreak\indexdotfill % Have leaders before the page number.
  | 
| 
alpar@18
 | 
  3357  | 
    %
  | 
| 
alpar@18
 | 
  3358  | 
    % The `\ ' here is removed by the implicit \unskip that TeX does as
  | 
| 
alpar@18
 | 
  3359  | 
    % part of (the primitive) \par.  Without it, a spurious underfull
  | 
| 
alpar@18
 | 
  3360  | 
    % \hbox ensues.
  | 
| 
alpar@18
 | 
  3361  | 
    \ifpdf
  | 
| 
alpar@18
 | 
  3362  | 
      \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
  | 
| 
alpar@18
 | 
  3363  | 
    \else
  | 
| 
alpar@18
 | 
  3364  | 
      \ #2% The page number ends the paragraph.
  | 
| 
alpar@18
 | 
  3365  | 
    \fi
  | 
| 
alpar@18
 | 
  3366  | 
  \fi%
  | 
| 
alpar@18
 | 
  3367  | 
  \par
  | 
| 
alpar@18
 | 
  3368  | 
\endgroup}
  | 
| 
alpar@18
 | 
  3369  | 
  | 
| 
alpar@18
 | 
  3370  | 
% Like \dotfill except takes at least 1 em.
  | 
| 
alpar@18
 | 
  3371  | 
\def\indexdotfill{\cleaders
 | 
| 
alpar@18
 | 
  3372  | 
  \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill}
 | 
| 
alpar@18
 | 
  3373  | 
  | 
| 
alpar@18
 | 
  3374  | 
\def\primary #1{\line{#1\hfil}}
 | 
| 
alpar@18
 | 
  3375  | 
  | 
| 
alpar@18
 | 
  3376  | 
\newskip\secondaryindent \secondaryindent=0.5cm
  | 
| 
alpar@18
 | 
  3377  | 
\def\secondary#1#2{{%
 | 
| 
alpar@18
 | 
  3378  | 
  \parfillskip=0in
  | 
| 
alpar@18
 | 
  3379  | 
  \parskip=0in
  | 
| 
alpar@18
 | 
  3380  | 
  \hangindent=1in
  | 
| 
alpar@18
 | 
  3381  | 
  \hangafter=1
  | 
| 
alpar@18
 | 
  3382  | 
  \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill
 | 
| 
alpar@18
 | 
  3383  | 
  \ifpdf
  | 
| 
alpar@18
 | 
  3384  | 
    \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
  | 
| 
alpar@18
 | 
  3385  | 
  \else
  | 
| 
alpar@18
 | 
  3386  | 
    #2
  | 
| 
alpar@18
 | 
  3387  | 
  \fi
  | 
| 
alpar@18
 | 
  3388  | 
  \par
  | 
| 
alpar@18
 | 
  3389  | 
}}
  | 
| 
alpar@18
 | 
  3390  | 
  | 
| 
alpar@18
 | 
  3391  | 
% Define two-column mode, which we use to typeset indexes.
  | 
| 
alpar@18
 | 
  3392  | 
% Adapted from the TeXbook, page 416, which is to say,
  | 
| 
alpar@18
 | 
  3393  | 
% the manmac.tex format used to print the TeXbook itself.
  | 
| 
alpar@18
 | 
  3394  | 
\catcode`\@=11
  | 
| 
alpar@18
 | 
  3395  | 
  | 
| 
alpar@18
 | 
  3396  | 
\newbox\partialpage
  | 
| 
alpar@18
 | 
  3397  | 
\newdimen\doublecolumnhsize
  | 
| 
alpar@18
 | 
  3398  | 
  | 
| 
alpar@18
 | 
  3399  | 
\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
 | 
| 
alpar@18
 | 
  3400  | 
  % Grab any single-column material above us.
  | 
| 
alpar@18
 | 
  3401  | 
  \output = {%
 | 
| 
alpar@18
 | 
  3402  | 
    %
  | 
| 
alpar@18
 | 
  3403  | 
    % Here is a possibility not foreseen in manmac: if we accumulate a
  | 
| 
alpar@18
 | 
  3404  | 
    % whole lot of material, we might end up calling this \output
  | 
| 
alpar@18
 | 
  3405  | 
    % routine twice in a row (see the doublecol-lose test, which is
  | 
| 
alpar@18
 | 
  3406  | 
    % essentially a couple of indexes with @setchapternewpage off).  In
  | 
| 
alpar@18
 | 
  3407  | 
    % that case we just ship out what is in \partialpage with the normal
  | 
| 
alpar@18
 | 
  3408  | 
    % output routine.  Generally, \partialpage will be empty when this
  | 
| 
alpar@18
 | 
  3409  | 
    % runs and this will be a no-op.  See the indexspread.tex test case.
  | 
| 
alpar@18
 | 
  3410  | 
    \ifvoid\partialpage \else
  | 
| 
alpar@18
 | 
  3411  | 
      \onepageout{\pagecontents\partialpage}%
 | 
| 
alpar@18
 | 
  3412  | 
    \fi
  | 
| 
alpar@18
 | 
  3413  | 
    %
  | 
| 
alpar@18
 | 
  3414  | 
    \global\setbox\partialpage = \vbox{%
 | 
| 
alpar@18
 | 
  3415  | 
      % Unvbox the main output page.
  | 
| 
alpar@18
 | 
  3416  | 
      \unvbox\PAGE
  | 
| 
alpar@18
 | 
  3417  | 
      \kern-\topskip \kern\baselineskip
  | 
| 
alpar@18
 | 
  3418  | 
    }%
  | 
| 
alpar@18
 | 
  3419  | 
  }%
  | 
| 
alpar@18
 | 
  3420  | 
  \eject % run that output routine to set \partialpage
  | 
| 
alpar@18
 | 
  3421  | 
  %
  | 
| 
alpar@18
 | 
  3422  | 
  % Use the double-column output routine for subsequent pages.
  | 
| 
alpar@18
 | 
  3423  | 
  \output = {\doublecolumnout}%
 | 
| 
alpar@18
 | 
  3424  | 
  %
  | 
| 
alpar@18
 | 
  3425  | 
  % Change the page size parameters.  We could do this once outside this
  | 
| 
alpar@18
 | 
  3426  | 
  % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
  | 
| 
alpar@18
 | 
  3427  | 
  % format, but then we repeat the same computation.  Repeating a couple
  | 
| 
alpar@18
 | 
  3428  | 
  % of assignments once per index is clearly meaningless for the
  | 
| 
alpar@18
 | 
  3429  | 
  % execution time, so we may as well do it in one place.
  | 
| 
alpar@18
 | 
  3430  | 
  %
  | 
| 
alpar@18
 | 
  3431  | 
  % First we halve the line length, less a little for the gutter between
  | 
| 
alpar@18
 | 
  3432  | 
  % the columns.  We compute the gutter based on the line length, so it
  | 
| 
alpar@18
 | 
  3433  | 
  % changes automatically with the paper format.  The magic constant
  | 
| 
alpar@18
 | 
  3434  | 
  % below is chosen so that the gutter has the same value (well, +-<1pt)
  | 
| 
alpar@18
 | 
  3435  | 
  % as it did when we hard-coded it.
  | 
| 
alpar@18
 | 
  3436  | 
  %
  | 
| 
alpar@18
 | 
  3437  | 
  % We put the result in a separate register, \doublecolumhsize, so we
  | 
| 
alpar@18
 | 
  3438  | 
  % can restore it in \pagesofar, after \hsize itself has (potentially)
  | 
| 
alpar@18
 | 
  3439  | 
  % been clobbered.
  | 
| 
alpar@18
 | 
  3440  | 
  %
  | 
| 
alpar@18
 | 
  3441  | 
  \doublecolumnhsize = \hsize
  | 
| 
alpar@18
 | 
  3442  | 
    \advance\doublecolumnhsize by -.04154\hsize
  | 
| 
alpar@18
 | 
  3443  | 
    \divide\doublecolumnhsize by 2
  | 
| 
alpar@18
 | 
  3444  | 
  \hsize = \doublecolumnhsize
  | 
| 
alpar@18
 | 
  3445  | 
  %
  | 
| 
alpar@18
 | 
  3446  | 
  % Double the \vsize as well.  (We don't need a separate register here,
  | 
| 
alpar@18
 | 
  3447  | 
  % since nobody clobbers \vsize.)
  | 
| 
alpar@18
 | 
  3448  | 
  \vsize = 2\vsize
  | 
| 
alpar@18
 | 
  3449  | 
}
  | 
| 
alpar@18
 | 
  3450  | 
  | 
| 
alpar@18
 | 
  3451  | 
% The double-column output routine for all double-column pages except
  | 
| 
alpar@18
 | 
  3452  | 
% the last.
  | 
| 
alpar@18
 | 
  3453  | 
%
  | 
| 
alpar@18
 | 
  3454  | 
\def\doublecolumnout{%
 | 
| 
alpar@18
 | 
  3455  | 
  \splittopskip=\topskip \splitmaxdepth=\maxdepth
  | 
| 
alpar@18
 | 
  3456  | 
  % Get the available space for the double columns -- the normal
  | 
| 
alpar@18
 | 
  3457  | 
  % (undoubled) page height minus any material left over from the
  | 
| 
alpar@18
 | 
  3458  | 
  % previous page.
  | 
| 
alpar@18
 | 
  3459  | 
  \dimen@ = \vsize
  | 
| 
alpar@18
 | 
  3460  | 
  \divide\dimen@ by 2
  | 
| 
alpar@18
 | 
  3461  | 
  \advance\dimen@ by -\ht\partialpage
  | 
| 
alpar@18
 | 
  3462  | 
  %
  | 
| 
alpar@18
 | 
  3463  | 
  % box0 will be the left-hand column, box2 the right.
  | 
| 
alpar@18
 | 
  3464  | 
  \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
  | 
| 
alpar@18
 | 
  3465  | 
  \onepageout\pagesofar
  | 
| 
alpar@18
 | 
  3466  | 
  \unvbox255
  | 
| 
alpar@18
 | 
  3467  | 
  \penalty\outputpenalty
  | 
| 
alpar@18
 | 
  3468  | 
}
  | 
| 
alpar@18
 | 
  3469  | 
%
  | 
| 
alpar@18
 | 
  3470  | 
% Re-output the contents of the output page -- any previous material,
  | 
| 
alpar@18
 | 
  3471  | 
% followed by the two boxes we just split, in box0 and box2.
  | 
| 
alpar@18
 | 
  3472  | 
\def\pagesofar{%
 | 
| 
alpar@18
 | 
  3473  | 
  \unvbox\partialpage
  | 
| 
alpar@18
 | 
  3474  | 
  %
  | 
| 
alpar@18
 | 
  3475  | 
  \hsize = \doublecolumnhsize
  | 
| 
alpar@18
 | 
  3476  | 
  \wd0=\hsize \wd2=\hsize
  | 
| 
alpar@18
 | 
  3477  | 
  \hbox to\pagewidth{\box0\hfil\box2}%
 | 
| 
alpar@18
 | 
  3478  | 
}
  | 
| 
alpar@18
 | 
  3479  | 
%
  | 
| 
alpar@18
 | 
  3480  | 
% All done with double columns.
  | 
| 
alpar@18
 | 
  3481  | 
\def\enddoublecolumns{%
 | 
| 
alpar@18
 | 
  3482  | 
  \output = {%
 | 
| 
alpar@18
 | 
  3483  | 
    % Split the last of the double-column material.  Leave it on the
  | 
| 
alpar@18
 | 
  3484  | 
    % current page, no automatic page break.
  | 
| 
alpar@18
 | 
  3485  | 
    \balancecolumns
  | 
| 
alpar@18
 | 
  3486  | 
    %
  | 
| 
alpar@18
 | 
  3487  | 
    % If we end up splitting too much material for the current page,
  | 
| 
alpar@18
 | 
  3488  | 
    % though, there will be another page break right after this \output
  | 
| 
alpar@18
 | 
  3489  | 
    % invocation ends.  Having called \balancecolumns once, we do not
  | 
| 
alpar@18
 | 
  3490  | 
    % want to call it again.  Therefore, reset \output to its normal
  | 
| 
alpar@18
 | 
  3491  | 
    % definition right away.  (We hope \balancecolumns will never be
  | 
| 
alpar@18
 | 
  3492  | 
    % called on to balance too much material, but if it is, this makes
  | 
| 
alpar@18
 | 
  3493  | 
    % the output somewhat more palatable.)
  | 
| 
alpar@18
 | 
  3494  | 
    \global\output = {\onepageout{\pagecontents\PAGE}}%
 | 
| 
alpar@18
 | 
  3495  | 
  }%
  | 
| 
alpar@18
 | 
  3496  | 
  \eject
  | 
| 
alpar@18
 | 
  3497  | 
  \endgroup % started in \begindoublecolumns
  | 
| 
alpar@18
 | 
  3498  | 
  %
  | 
| 
alpar@18
 | 
  3499  | 
  % \pagegoal was set to the doubled \vsize above, since we restarted
  | 
| 
alpar@18
 | 
  3500  | 
  % the current page.  We're now back to normal single-column
  | 
| 
alpar@18
 | 
  3501  | 
  % typesetting, so reset \pagegoal to the normal \vsize (after the
  | 
| 
alpar@18
 | 
  3502  | 
  % \endgroup where \vsize got restored).
  | 
| 
alpar@18
 | 
  3503  | 
  \pagegoal = \vsize
  | 
| 
alpar@18
 | 
  3504  | 
}
  | 
| 
alpar@18
 | 
  3505  | 
%
  | 
| 
alpar@18
 | 
  3506  | 
% Called at the end of the double column material.
  | 
| 
alpar@18
 | 
  3507  | 
\def\balancecolumns{%
 | 
| 
alpar@18
 | 
  3508  | 
  \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120.
 | 
| 
alpar@18
 | 
  3509  | 
  \dimen@ = \ht0
  | 
| 
alpar@18
 | 
  3510  | 
  \advance\dimen@ by \topskip
  | 
| 
alpar@18
 | 
  3511  | 
  \advance\dimen@ by-\baselineskip
  | 
| 
alpar@18
 | 
  3512  | 
  \divide\dimen@ by 2 % target to split to
  | 
| 
alpar@18
 | 
  3513  | 
  %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}%
 | 
| 
alpar@18
 | 
  3514  | 
  \splittopskip = \topskip
  | 
| 
alpar@18
 | 
  3515  | 
  % Loop until we get a decent breakpoint.
  | 
| 
alpar@18
 | 
  3516  | 
  {%
 | 
| 
alpar@18
 | 
  3517  | 
    \vbadness = 10000
  | 
| 
alpar@18
 | 
  3518  | 
    \loop
  | 
| 
alpar@18
 | 
  3519  | 
      \global\setbox3 = \copy0
  | 
| 
alpar@18
 | 
  3520  | 
      \global\setbox1 = \vsplit3 to \dimen@
  | 
| 
alpar@18
 | 
  3521  | 
    \ifdim\ht3>\dimen@
  | 
| 
alpar@18
 | 
  3522  | 
      \global\advance\dimen@ by 1pt
  | 
| 
alpar@18
 | 
  3523  | 
    \repeat
  | 
| 
alpar@18
 | 
  3524  | 
  }%
  | 
| 
alpar@18
 | 
  3525  | 
  %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}%
 | 
| 
alpar@18
 | 
  3526  | 
  \setbox0=\vbox to\dimen@{\unvbox1}%
 | 
| 
alpar@18
 | 
  3527  | 
  \setbox2=\vbox to\dimen@{\unvbox3}%
 | 
| 
alpar@18
 | 
  3528  | 
  %
  | 
| 
alpar@18
 | 
  3529  | 
  \pagesofar
  | 
| 
alpar@18
 | 
  3530  | 
}
  | 
| 
alpar@18
 | 
  3531  | 
\catcode`\@ = \other
  | 
| 
alpar@18
 | 
  3532  | 
  | 
| 
alpar@18
 | 
  3533  | 
  | 
| 
alpar@18
 | 
  3534  | 
\message{sectioning,}
 | 
| 
alpar@18
 | 
  3535  | 
% Chapters, sections, etc.
  | 
| 
alpar@18
 | 
  3536  | 
  | 
| 
alpar@18
 | 
  3537  | 
\newcount\chapno
  | 
| 
alpar@18
 | 
  3538  | 
\newcount\secno        \secno=0
  | 
| 
alpar@18
 | 
  3539  | 
\newcount\subsecno     \subsecno=0
  | 
| 
alpar@18
 | 
  3540  | 
\newcount\subsubsecno  \subsubsecno=0
  | 
| 
alpar@18
 | 
  3541  | 
  | 
| 
alpar@18
 | 
  3542  | 
% This counter is funny since it counts through charcodes of letters A, B, ...
  | 
| 
alpar@18
 | 
  3543  | 
\newcount\appendixno  \appendixno = `\@
  | 
| 
alpar@18
 | 
  3544  | 
% \def\appendixletter{\char\the\appendixno}
 | 
| 
alpar@18
 | 
  3545  | 
% We do the following for the sake of pdftex, which needs the actual
  | 
| 
alpar@18
 | 
  3546  | 
% letter in the expansion, not just typeset.
  | 
| 
alpar@18
 | 
  3547  | 
\def\appendixletter{%
 | 
| 
alpar@18
 | 
  3548  | 
  \ifnum\appendixno=`A A%
  | 
| 
alpar@18
 | 
  3549  | 
  \else\ifnum\appendixno=`B B%
  | 
| 
alpar@18
 | 
  3550  | 
  \else\ifnum\appendixno=`C C%
  | 
| 
alpar@18
 | 
  3551  | 
  \else\ifnum\appendixno=`D D%
  | 
| 
alpar@18
 | 
  3552  | 
  \else\ifnum\appendixno=`E E%
  | 
| 
alpar@18
 | 
  3553  | 
  \else\ifnum\appendixno=`F F%
  | 
| 
alpar@18
 | 
  3554  | 
  \else\ifnum\appendixno=`G G%
  | 
| 
alpar@18
 | 
  3555  | 
  \else\ifnum\appendixno=`H H%
  | 
| 
alpar@18
 | 
  3556  | 
  \else\ifnum\appendixno=`I I%
  | 
| 
alpar@18
 | 
  3557  | 
  \else\ifnum\appendixno=`J J%
  | 
| 
alpar@18
 | 
  3558  | 
  \else\ifnum\appendixno=`K K%
  | 
| 
alpar@18
 | 
  3559  | 
  \else\ifnum\appendixno=`L L%
  | 
| 
alpar@18
 | 
  3560  | 
  \else\ifnum\appendixno=`M M%
  | 
| 
alpar@18
 | 
  3561  | 
  \else\ifnum\appendixno=`N N%
  | 
| 
alpar@18
 | 
  3562  | 
  \else\ifnum\appendixno=`O O%
  | 
| 
alpar@18
 | 
  3563  | 
  \else\ifnum\appendixno=`P P%
  | 
| 
alpar@18
 | 
  3564  | 
  \else\ifnum\appendixno=`Q Q%
  | 
| 
alpar@18
 | 
  3565  | 
  \else\ifnum\appendixno=`R R%
  | 
| 
alpar@18
 | 
  3566  | 
  \else\ifnum\appendixno=`S S%
  | 
| 
alpar@18
 | 
  3567  | 
  \else\ifnum\appendixno=`T T%
  | 
| 
alpar@18
 | 
  3568  | 
  \else\ifnum\appendixno=`U U%
  | 
| 
alpar@18
 | 
  3569  | 
  \else\ifnum\appendixno=`V V%
  | 
| 
alpar@18
 | 
  3570  | 
  \else\ifnum\appendixno=`W W%
  | 
| 
alpar@18
 | 
  3571  | 
  \else\ifnum\appendixno=`X X%
  | 
| 
alpar@18
 | 
  3572  | 
  \else\ifnum\appendixno=`Y Y%
  | 
| 
alpar@18
 | 
  3573  | 
  \else\ifnum\appendixno=`Z Z%
  | 
| 
alpar@18
 | 
  3574  | 
  % The \the is necessary, despite appearances, because \appendixletter is
  | 
| 
alpar@18
 | 
  3575  | 
  % expanded while writing the .toc file.  \char\appendixno is not
  | 
| 
alpar@18
 | 
  3576  | 
  % expandable, thus it is written literally, thus all appendixes come out
  | 
| 
alpar@18
 | 
  3577  | 
  % with the same letter (or @) in the toc without it.
  | 
| 
alpar@18
 | 
  3578  | 
  \else\char\the\appendixno
  | 
| 
alpar@18
 | 
  3579  | 
  \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
  | 
| 
alpar@18
 | 
  3580  | 
  \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
  | 
| 
alpar@18
 | 
  3581  | 
  | 
| 
alpar@18
 | 
  3582  | 
% Each @chapter defines this as the name of the chapter.
  | 
| 
alpar@18
 | 
  3583  | 
% page headings and footings can use it.  @section does likewise.
  | 
| 
alpar@18
 | 
  3584  | 
\def\thischapter{}
 | 
| 
alpar@18
 | 
  3585  | 
\def\thissection{}
 | 
| 
alpar@18
 | 
  3586  | 
  | 
| 
alpar@18
 | 
  3587  | 
\newcount\absseclevel % used to calculate proper heading level
  | 
| 
alpar@18
 | 
  3588  | 
\newcount\secbase\secbase=0 % @raise/lowersections modify this count
  | 
| 
alpar@18
 | 
  3589  | 
  | 
| 
alpar@18
 | 
  3590  | 
% @raisesections: treat @section as chapter, @subsection as section, etc.
  | 
| 
alpar@18
 | 
  3591  | 
\def\raisesections{\global\advance\secbase by -1}
 | 
| 
alpar@18
 | 
  3592  | 
\let\up=\raisesections % original BFox name
  | 
| 
alpar@18
 | 
  3593  | 
  | 
| 
alpar@18
 | 
  3594  | 
% @lowersections: treat @chapter as section, @section as subsection, etc.
  | 
| 
alpar@18
 | 
  3595  | 
\def\lowersections{\global\advance\secbase by 1}
 | 
| 
alpar@18
 | 
  3596  | 
\let\down=\lowersections % original BFox name
  | 
| 
alpar@18
 | 
  3597  | 
  | 
| 
alpar@18
 | 
  3598  | 
% Choose a numbered-heading macro
  | 
| 
alpar@18
 | 
  3599  | 
% #1 is heading level if unmodified by @raisesections or @lowersections
  | 
| 
alpar@18
 | 
  3600  | 
% #2 is text for heading
  | 
| 
alpar@18
 | 
  3601  | 
\def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
 | 
| 
alpar@18
 | 
  3602  | 
\ifcase\absseclevel
  | 
| 
alpar@18
 | 
  3603  | 
  \chapterzzz{#2}
 | 
| 
alpar@18
 | 
  3604  | 
\or
  | 
| 
alpar@18
 | 
  3605  | 
  \seczzz{#2}
 | 
| 
alpar@18
 | 
  3606  | 
\or
  | 
| 
alpar@18
 | 
  3607  | 
  \numberedsubseczzz{#2}
 | 
| 
alpar@18
 | 
  3608  | 
\or
  | 
| 
alpar@18
 | 
  3609  | 
  \numberedsubsubseczzz{#2}
 | 
| 
alpar@18
 | 
  3610  | 
\else
  | 
| 
alpar@18
 | 
  3611  | 
  \ifnum \absseclevel<0
  | 
| 
alpar@18
 | 
  3612  | 
    \chapterzzz{#2}
 | 
| 
alpar@18
 | 
  3613  | 
  \else
  | 
| 
alpar@18
 | 
  3614  | 
    \numberedsubsubseczzz{#2}
 | 
| 
alpar@18
 | 
  3615  | 
  \fi
  | 
| 
alpar@18
 | 
  3616  | 
\fi
  | 
| 
alpar@18
 | 
  3617  | 
\suppressfirstparagraphindent
  | 
| 
alpar@18
 | 
  3618  | 
}
  | 
| 
alpar@18
 | 
  3619  | 
  | 
| 
alpar@18
 | 
  3620  | 
% like \numhead, but chooses appendix heading levels
  | 
| 
alpar@18
 | 
  3621  | 
\def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
 | 
| 
alpar@18
 | 
  3622  | 
\ifcase\absseclevel
  | 
| 
alpar@18
 | 
  3623  | 
  \appendixzzz{#2}
 | 
| 
alpar@18
 | 
  3624  | 
\or
  | 
| 
alpar@18
 | 
  3625  | 
  \appendixsectionzzz{#2}
 | 
| 
alpar@18
 | 
  3626  | 
\or
  | 
| 
alpar@18
 | 
  3627  | 
  \appendixsubseczzz{#2}
 | 
| 
alpar@18
 | 
  3628  | 
\or
  | 
| 
alpar@18
 | 
  3629  | 
  \appendixsubsubseczzz{#2}
 | 
| 
alpar@18
 | 
  3630  | 
\else
  | 
| 
alpar@18
 | 
  3631  | 
  \ifnum \absseclevel<0
  | 
| 
alpar@18
 | 
  3632  | 
    \appendixzzz{#2}
 | 
| 
alpar@18
 | 
  3633  | 
  \else
  | 
| 
alpar@18
 | 
  3634  | 
    \appendixsubsubseczzz{#2}
 | 
| 
alpar@18
 | 
  3635  | 
  \fi
  | 
| 
alpar@18
 | 
  3636  | 
\fi
  | 
| 
alpar@18
 | 
  3637  | 
\suppressfirstparagraphindent
  | 
| 
alpar@18
 | 
  3638  | 
}
  | 
| 
alpar@18
 | 
  3639  | 
  | 
| 
alpar@18
 | 
  3640  | 
% like \numhead, but chooses numberless heading levels
  | 
| 
alpar@18
 | 
  3641  | 
\def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
 | 
| 
alpar@18
 | 
  3642  | 
\ifcase\absseclevel
  | 
| 
alpar@18
 | 
  3643  | 
  \unnumberedzzz{#2}
 | 
| 
alpar@18
 | 
  3644  | 
\or
  | 
| 
alpar@18
 | 
  3645  | 
  \unnumberedseczzz{#2}
 | 
| 
alpar@18
 | 
  3646  | 
\or
  | 
| 
alpar@18
 | 
  3647  | 
  \unnumberedsubseczzz{#2}
 | 
| 
alpar@18
 | 
  3648  | 
\or
  | 
| 
alpar@18
 | 
  3649  | 
  \unnumberedsubsubseczzz{#2}
 | 
| 
alpar@18
 | 
  3650  | 
\else
  | 
| 
alpar@18
 | 
  3651  | 
  \ifnum \absseclevel<0
  | 
| 
alpar@18
 | 
  3652  | 
    \unnumberedzzz{#2}
 | 
| 
alpar@18
 | 
  3653  | 
  \else
  | 
| 
alpar@18
 | 
  3654  | 
    \unnumberedsubsubseczzz{#2}
 | 
| 
alpar@18
 | 
  3655  | 
  \fi
  | 
| 
alpar@18
 | 
  3656  | 
\fi
  | 
| 
alpar@18
 | 
  3657  | 
\suppressfirstparagraphindent
  | 
| 
alpar@18
 | 
  3658  | 
}
  | 
| 
alpar@18
 | 
  3659  | 
  | 
| 
alpar@18
 | 
  3660  | 
% @chapter, @appendix, @unnumbered.
  | 
| 
alpar@18
 | 
  3661  | 
\def\thischaptername{No Chapter Title}
 | 
| 
alpar@18
 | 
  3662  | 
\outer\def\chapter{\parsearg\chapteryyy}
 | 
| 
alpar@18
 | 
  3663  | 
\def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz
 | 
| 
alpar@18
 | 
  3664  | 
\def\chapterzzz #1{%
 | 
| 
alpar@18
 | 
  3665  | 
  \secno=0 \subsecno=0 \subsubsecno=0
  | 
| 
alpar@18
 | 
  3666  | 
  \global\advance \chapno by 1 \message{\putwordChapter\space \the\chapno}%
 | 
| 
alpar@18
 | 
  3667  | 
  \chapmacro {#1}{\the\chapno}%
 | 
| 
alpar@18
 | 
  3668  | 
  \gdef\thissection{#1}%
 | 
| 
alpar@18
 | 
  3669  | 
  \gdef\thischaptername{#1}%
 | 
| 
alpar@18
 | 
  3670  | 
  % We don't substitute the actual chapter name into \thischapter
  | 
| 
alpar@18
 | 
  3671  | 
  % because we don't want its macros evaluated now.
  | 
| 
alpar@18
 | 
  3672  | 
  \xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}%
 | 
| 
alpar@18
 | 
  3673  | 
  \writetocentry{chap}{#1}{{\the\chapno}}
 | 
| 
alpar@18
 | 
  3674  | 
  \donoderef
  | 
| 
alpar@18
 | 
  3675  | 
  \global\let\section = \numberedsec
  | 
| 
alpar@18
 | 
  3676  | 
  \global\let\subsection = \numberedsubsec
  | 
| 
alpar@18
 | 
  3677  | 
  \global\let\subsubsection = \numberedsubsubsec
  | 
| 
alpar@18
 | 
  3678  | 
}
  | 
| 
alpar@18
 | 
  3679  | 
  | 
| 
alpar@18
 | 
  3680  | 
% we use \chapno to avoid indenting back
  | 
| 
alpar@18
 | 
  3681  | 
\def\appendixbox#1{%
 | 
| 
alpar@18
 | 
  3682  | 
  \setbox0 = \hbox{\putwordAppendix{} \the\chapno}%
 | 
| 
alpar@18
 | 
  3683  | 
  \hbox to \wd0{#1\hss}}
 | 
| 
alpar@18
 | 
  3684  | 
  | 
| 
alpar@18
 | 
  3685  | 
\outer\def\appendix{\parsearg\appendixyyy}
 | 
| 
alpar@18
 | 
  3686  | 
\def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz
 | 
| 
alpar@18
 | 
  3687  | 
\def\appendixzzz #1{%
 | 
| 
alpar@18
 | 
  3688  | 
  \secno=0 \subsecno=0 \subsubsecno=0
  | 
| 
alpar@18
 | 
  3689  | 
  \global\advance \appendixno by 1
  | 
| 
alpar@18
 | 
  3690  | 
  \message{\putwordAppendix\space \appendixletter}%
 | 
| 
alpar@18
 | 
  3691  | 
  \chapmacro {#1}{\appendixbox{\putwordAppendix{} \appendixletter}}%
 | 
| 
alpar@18
 | 
  3692  | 
  \gdef\thissection{#1}%
 | 
| 
alpar@18
 | 
  3693  | 
  \gdef\thischaptername{#1}%
 | 
| 
alpar@18
 | 
  3694  | 
  \xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}%
 | 
| 
alpar@18
 | 
  3695  | 
  \writetocentry{appendix}{#1}{{\appendixletter}}
 | 
| 
alpar@18
 | 
  3696  | 
  \appendixnoderef
  | 
| 
alpar@18
 | 
  3697  | 
  \global\let\section = \appendixsec
  | 
| 
alpar@18
 | 
  3698  | 
  \global\let\subsection = \appendixsubsec
  | 
| 
alpar@18
 | 
  3699  | 
  \global\let\subsubsection = \appendixsubsubsec
  | 
| 
alpar@18
 | 
  3700  | 
}
  | 
| 
alpar@18
 | 
  3701  | 
  | 
| 
alpar@18
 | 
  3702  | 
% @centerchap is like @unnumbered, but the heading is centered.
  | 
| 
alpar@18
 | 
  3703  | 
\outer\def\centerchap{\parsearg\centerchapyyy}
 | 
| 
alpar@18
 | 
  3704  | 
\def\centerchapyyy #1{{\let\unnumbchapmacro=\centerchapmacro \unnumberedyyy{#1}}}
 | 
| 
alpar@18
 | 
  3705  | 
  | 
| 
alpar@18
 | 
  3706  | 
% @top is like @unnumbered.
  | 
| 
alpar@18
 | 
  3707  | 
\outer\def\top{\parsearg\unnumberedyyy}
 | 
| 
alpar@18
 | 
  3708  | 
  | 
| 
alpar@18
 | 
  3709  | 
\outer\def\unnumbered{\parsearg\unnumberedyyy}
 | 
| 
alpar@18
 | 
  3710  | 
\def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz
 | 
| 
alpar@18
 | 
  3711  | 
\def\unnumberedzzz #1{%
 | 
| 
alpar@18
 | 
  3712  | 
  \secno=0 \subsecno=0 \subsubsecno=0
  | 
| 
alpar@18
 | 
  3713  | 
  %
  | 
| 
alpar@18
 | 
  3714  | 
  % This used to be simply \message{#1}, but TeX fully expands the
 | 
| 
alpar@18
 | 
  3715  | 
  % argument to \message.  Therefore, if #1 contained @-commands, TeX
  | 
| 
alpar@18
 | 
  3716  | 
  % expanded them.  For example, in `@unnumbered The @cite{Book}', TeX
 | 
| 
alpar@18
 | 
  3717  | 
  % expanded @cite (which turns out to cause errors because \cite is meant
  | 
| 
alpar@18
 | 
  3718  | 
  % to be executed, not expanded).
  | 
| 
alpar@18
 | 
  3719  | 
  %
  | 
| 
alpar@18
 | 
  3720  | 
  % Anyway, we don't want the fully-expanded definition of @cite to appear
  | 
| 
alpar@18
 | 
  3721  | 
  % as a result of the \message, we just want `@cite' itself.  We use
  | 
| 
alpar@18
 | 
  3722  | 
  % \the<toks register> to achieve this: TeX expands \the<toks> only once,
  | 
| 
alpar@18
 | 
  3723  | 
  % simply yielding the contents of <toks register>.  (We also do this for
  | 
| 
alpar@18
 | 
  3724  | 
  % the toc entries.)
  | 
| 
alpar@18
 | 
  3725  | 
  \toks0 = {#1}\message{(\the\toks0)}%
 | 
| 
alpar@18
 | 
  3726  | 
  %
  | 
| 
alpar@18
 | 
  3727  | 
  \unnumbchapmacro {#1}%
 | 
| 
alpar@18
 | 
  3728  | 
  \gdef\thischapter{#1}\gdef\thissection{#1}%
 | 
| 
alpar@18
 | 
  3729  | 
  \writetocentry{unnumbchap}{#1}{{\the\chapno}}
 | 
| 
alpar@18
 | 
  3730  | 
  \unnumbnoderef
  | 
| 
alpar@18
 | 
  3731  | 
  \global\let\section = \unnumberedsec
  | 
| 
alpar@18
 | 
  3732  | 
  \global\let\subsection = \unnumberedsubsec
  | 
| 
alpar@18
 | 
  3733  | 
  \global\let\subsubsection = \unnumberedsubsubsec
  | 
| 
alpar@18
 | 
  3734  | 
}
  | 
| 
alpar@18
 | 
  3735  | 
  | 
| 
alpar@18
 | 
  3736  | 
% Sections.
  | 
| 
alpar@18
 | 
  3737  | 
\outer\def\numberedsec{\parsearg\secyyy}
 | 
| 
alpar@18
 | 
  3738  | 
\def\secyyy #1{\numhead1{#1}} % normally calls seczzz
 | 
| 
alpar@18
 | 
  3739  | 
\def\seczzz #1{%
 | 
| 
alpar@18
 | 
  3740  | 
  \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
  | 
| 
alpar@18
 | 
  3741  | 
  \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
 | 
| 
alpar@18
 | 
  3742  | 
  \writetocentry{sec}{#1}{{\the\chapno}{\the\secno}}
 | 
| 
alpar@18
 | 
  3743  | 
  \donoderef
  | 
| 
alpar@18
 | 
  3744  | 
  \nobreak
  | 
| 
alpar@18
 | 
  3745  | 
}
  | 
| 
alpar@18
 | 
  3746  | 
  | 
| 
alpar@18
 | 
  3747  | 
\outer\def\appendixsection{\parsearg\appendixsecyyy}
 | 
| 
alpar@18
 | 
  3748  | 
\outer\def\appendixsec{\parsearg\appendixsecyyy}
 | 
| 
alpar@18
 | 
  3749  | 
\def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz
 | 
| 
alpar@18
 | 
  3750  | 
\def\appendixsectionzzz #1{%
 | 
| 
alpar@18
 | 
  3751  | 
  \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
  | 
| 
alpar@18
 | 
  3752  | 
  \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
 | 
| 
alpar@18
 | 
  3753  | 
  \writetocentry{sec}{#1}{{\appendixletter}{\the\secno}}
 | 
| 
alpar@18
 | 
  3754  | 
  \appendixnoderef
  | 
| 
alpar@18
 | 
  3755  | 
  \nobreak
  | 
| 
alpar@18
 | 
  3756  | 
}
  | 
| 
alpar@18
 | 
  3757  | 
  | 
| 
alpar@18
 | 
  3758  | 
\outer\def\unnumberedsec{\parsearg\unnumberedsecyyy}
 | 
| 
alpar@18
 | 
  3759  | 
\def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz
 | 
| 
alpar@18
 | 
  3760  | 
\def\unnumberedseczzz #1{%
 | 
| 
alpar@18
 | 
  3761  | 
  \plainsecheading {#1}\gdef\thissection{#1}%
 | 
| 
alpar@18
 | 
  3762  | 
  \writetocentry{unnumbsec}{#1}{{\the\chapno}{\the\secno}}
 | 
| 
alpar@18
 | 
  3763  | 
  \unnumbnoderef
  | 
| 
alpar@18
 | 
  3764  | 
  \nobreak
  | 
| 
alpar@18
 | 
  3765  | 
}
  | 
| 
alpar@18
 | 
  3766  | 
  | 
| 
alpar@18
 | 
  3767  | 
% Subsections.
  | 
| 
alpar@18
 | 
  3768  | 
\outer\def\numberedsubsec{\parsearg\numberedsubsecyyy}
 | 
| 
alpar@18
 | 
  3769  | 
\def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz
 | 
| 
alpar@18
 | 
  3770  | 
\def\numberedsubseczzz #1{%
 | 
| 
alpar@18
 | 
  3771  | 
  \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
 | 
| 
alpar@18
 | 
  3772  | 
  \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
 | 
| 
alpar@18
 | 
  3773  | 
  \writetocentry{subsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}}
 | 
| 
alpar@18
 | 
  3774  | 
  \donoderef
  | 
| 
alpar@18
 | 
  3775  | 
  \nobreak
  | 
| 
alpar@18
 | 
  3776  | 
}
  | 
| 
alpar@18
 | 
  3777  | 
  | 
| 
alpar@18
 | 
  3778  | 
\outer\def\appendixsubsec{\parsearg\appendixsubsecyyy}
 | 
| 
alpar@18
 | 
  3779  | 
\def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz
 | 
| 
alpar@18
 | 
  3780  | 
\def\appendixsubseczzz #1{%
 | 
| 
alpar@18
 | 
  3781  | 
  \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
 | 
| 
alpar@18
 | 
  3782  | 
  \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
 | 
| 
alpar@18
 | 
  3783  | 
  \writetocentry{subsec}{#1}{{\appendixletter}{\the\secno}{\the\subsecno}}
 | 
| 
alpar@18
 | 
  3784  | 
  \appendixnoderef
  | 
| 
alpar@18
 | 
  3785  | 
  \nobreak
  | 
| 
alpar@18
 | 
  3786  | 
}
  | 
| 
alpar@18
 | 
  3787  | 
  | 
| 
alpar@18
 | 
  3788  | 
\outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy}
 | 
| 
alpar@18
 | 
  3789  | 
\def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz
 | 
| 
alpar@18
 | 
  3790  | 
\def\unnumberedsubseczzz #1{%
 | 
| 
alpar@18
 | 
  3791  | 
  \plainsubsecheading {#1}\gdef\thissection{#1}%
 | 
| 
alpar@18
 | 
  3792  | 
  \writetocentry{unnumbsubsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}}
 | 
| 
alpar@18
 | 
  3793  | 
  \unnumbnoderef
  | 
| 
alpar@18
 | 
  3794  | 
  \nobreak
  | 
| 
alpar@18
 | 
  3795  | 
}
  | 
| 
alpar@18
 | 
  3796  | 
  | 
| 
alpar@18
 | 
  3797  | 
% Subsubsections.
  | 
| 
alpar@18
 | 
  3798  | 
\outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy}
 | 
| 
alpar@18
 | 
  3799  | 
\def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz
 | 
| 
alpar@18
 | 
  3800  | 
\def\numberedsubsubseczzz #1{%
 | 
| 
alpar@18
 | 
  3801  | 
  \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
 | 
| 
alpar@18
 | 
  3802  | 
  \subsubsecheading {#1}
 | 
| 
alpar@18
 | 
  3803  | 
    {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
 | 
| 
alpar@18
 | 
  3804  | 
  \writetocentry{subsubsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}}
 | 
| 
alpar@18
 | 
  3805  | 
  \donoderef
  | 
| 
alpar@18
 | 
  3806  | 
  \nobreak
  | 
| 
alpar@18
 | 
  3807  | 
}
  | 
| 
alpar@18
 | 
  3808  | 
  | 
| 
alpar@18
 | 
  3809  | 
\outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy}
 | 
| 
alpar@18
 | 
  3810  | 
\def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz
 | 
| 
alpar@18
 | 
  3811  | 
\def\appendixsubsubseczzz #1{%
 | 
| 
alpar@18
 | 
  3812  | 
  \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
 | 
| 
alpar@18
 | 
  3813  | 
  \subsubsecheading {#1}
 | 
| 
alpar@18
 | 
  3814  | 
    {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
 | 
| 
alpar@18
 | 
  3815  | 
  \writetocentry{subsubsec}{#1}{{\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}}
 | 
| 
alpar@18
 | 
  3816  | 
  \appendixnoderef
  | 
| 
alpar@18
 | 
  3817  | 
  \nobreak
  | 
| 
alpar@18
 | 
  3818  | 
}
  | 
| 
alpar@18
 | 
  3819  | 
  | 
| 
alpar@18
 | 
  3820  | 
\outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy}
 | 
| 
alpar@18
 | 
  3821  | 
\def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz
 | 
| 
alpar@18
 | 
  3822  | 
\def\unnumberedsubsubseczzz #1{%
 | 
| 
alpar@18
 | 
  3823  | 
  \plainsubsubsecheading {#1}\gdef\thissection{#1}%
 | 
| 
alpar@18
 | 
  3824  | 
  \writetocentry{unnumbsubsubsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}}
 | 
| 
alpar@18
 | 
  3825  | 
  \unnumbnoderef
  | 
| 
alpar@18
 | 
  3826  | 
  \nobreak
  | 
| 
alpar@18
 | 
  3827  | 
}
  | 
| 
alpar@18
 | 
  3828  | 
  | 
| 
alpar@18
 | 
  3829  | 
% These are variants which are not "outer", so they can appear in @ifinfo.
  | 
| 
alpar@18
 | 
  3830  | 
% Actually, they should now be obsolete; ordinary section commands should work.
  | 
| 
alpar@18
 | 
  3831  | 
\def\infotop{\parsearg\unnumberedzzz}
 | 
| 
alpar@18
 | 
  3832  | 
\def\infounnumbered{\parsearg\unnumberedzzz}
 | 
| 
alpar@18
 | 
  3833  | 
\def\infounnumberedsec{\parsearg\unnumberedseczzz}
 | 
| 
alpar@18
 | 
  3834  | 
\def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz}
 | 
| 
alpar@18
 | 
  3835  | 
\def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
 | 
| 
alpar@18
 | 
  3836  | 
  | 
| 
alpar@18
 | 
  3837  | 
\def\infoappendix{\parsearg\appendixzzz}
 | 
| 
alpar@18
 | 
  3838  | 
\def\infoappendixsec{\parsearg\appendixseczzz}
 | 
| 
alpar@18
 | 
  3839  | 
\def\infoappendixsubsec{\parsearg\appendixsubseczzz}
 | 
| 
alpar@18
 | 
  3840  | 
\def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz}
 | 
| 
alpar@18
 | 
  3841  | 
  | 
| 
alpar@18
 | 
  3842  | 
\def\infochapter{\parsearg\chapterzzz}
 | 
| 
alpar@18
 | 
  3843  | 
\def\infosection{\parsearg\sectionzzz}
 | 
| 
alpar@18
 | 
  3844  | 
\def\infosubsection{\parsearg\subsectionzzz}
 | 
| 
alpar@18
 | 
  3845  | 
\def\infosubsubsection{\parsearg\subsubsectionzzz}
 | 
| 
alpar@18
 | 
  3846  | 
  | 
| 
alpar@18
 | 
  3847  | 
% These macros control what the section commands do, according
  | 
| 
alpar@18
 | 
  3848  | 
% to what kind of chapter we are in (ordinary, appendix, or unnumbered).
  | 
| 
alpar@18
 | 
  3849  | 
% Define them by default for a numbered chapter.
  | 
| 
alpar@18
 | 
  3850  | 
\global\let\section = \numberedsec
  | 
| 
alpar@18
 | 
  3851  | 
\global\let\subsection = \numberedsubsec
  | 
| 
alpar@18
 | 
  3852  | 
\global\let\subsubsection = \numberedsubsubsec
  | 
| 
alpar@18
 | 
  3853  | 
  | 
| 
alpar@18
 | 
  3854  | 
% Define @majorheading, @heading and @subheading
  | 
| 
alpar@18
 | 
  3855  | 
  | 
| 
alpar@18
 | 
  3856  | 
% NOTE on use of \vbox for chapter headings, section headings, and such:
  | 
| 
alpar@18
 | 
  3857  | 
%       1) We use \vbox rather than the earlier \line to permit
  | 
| 
alpar@18
 | 
  3858  | 
%          overlong headings to fold.
  | 
| 
alpar@18
 | 
  3859  | 
%       2) \hyphenpenalty is set to 10000 because hyphenation in a
  | 
| 
alpar@18
 | 
  3860  | 
%          heading is obnoxious; this forbids it.
  | 
| 
alpar@18
 | 
  3861  | 
%       3) Likewise, headings look best if no \parindent is used, and
  | 
| 
alpar@18
 | 
  3862  | 
%          if justification is not attempted.  Hence \raggedright.
  | 
| 
alpar@18
 | 
  3863  | 
  | 
| 
alpar@18
 | 
  3864  | 
  | 
| 
alpar@18
 | 
  3865  | 
\def\majorheading{%
 | 
| 
alpar@18
 | 
  3866  | 
  {\advance\chapheadingskip by 10pt \chapbreak }%
 | 
| 
alpar@18
 | 
  3867  | 
  \parsearg\chapheadingzzz
  | 
| 
alpar@18
 | 
  3868  | 
}
  | 
| 
alpar@18
 | 
  3869  | 
  | 
| 
alpar@18
 | 
  3870  | 
\def\chapheading{\chapbreak \parsearg\chapheadingzzz}
 | 
| 
alpar@18
 | 
  3871  | 
\def\chapheadingzzz #1{%
 | 
| 
alpar@18
 | 
  3872  | 
  {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
 | 
| 
alpar@18
 | 
  3873  | 
                    \parindent=0pt\raggedright
  | 
| 
alpar@18
 | 
  3874  | 
                    \rm #1\hfill}}%
  | 
| 
alpar@18
 | 
  3875  | 
  \bigskip \par\penalty 200\relax
  | 
| 
alpar@18
 | 
  3876  | 
  \suppressfirstparagraphindent
  | 
| 
alpar@18
 | 
  3877  | 
}
  | 
| 
alpar@18
 | 
  3878  | 
  | 
| 
alpar@18
 | 
  3879  | 
% @heading, @subheading, @subsubheading.
  | 
| 
alpar@18
 | 
  3880  | 
\def\heading{\parsearg\doheading}
 | 
| 
alpar@18
 | 
  3881  | 
\def\subheading{\parsearg\dosubheading}
 | 
| 
alpar@18
 | 
  3882  | 
\def\subsubheading{\parsearg\dosubsubheading}
 | 
| 
alpar@18
 | 
  3883  | 
\def\doheading#1{\plainsecheading{#1}\suppressfirstparagraphindent}
 | 
| 
alpar@18
 | 
  3884  | 
\def\dosubheading#1{\plainsubsecheading{#1}\suppressfirstparagraphindent}
 | 
| 
alpar@18
 | 
  3885  | 
\def\dosubsubheading#1{\plainsubsubsecheading{#1}\suppressfirstparagraphindent}
 | 
| 
alpar@18
 | 
  3886  | 
  | 
| 
alpar@18
 | 
  3887  | 
% These macros generate a chapter, section, etc. heading only
  | 
| 
alpar@18
 | 
  3888  | 
% (including whitespace, linebreaking, etc. around it),
  | 
| 
alpar@18
 | 
  3889  | 
% given all the information in convenient, parsed form.
  | 
| 
alpar@18
 | 
  3890  | 
  | 
| 
alpar@18
 | 
  3891  | 
%%% Args are the skip and penalty (usually negative)
  | 
| 
alpar@18
 | 
  3892  | 
\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
 | 
| 
alpar@18
 | 
  3893  | 
  | 
| 
alpar@18
 | 
  3894  | 
\def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
 | 
| 
alpar@18
 | 
  3895  | 
  | 
| 
alpar@18
 | 
  3896  | 
%%% Define plain chapter starts, and page on/off switching for it
  | 
| 
alpar@18
 | 
  3897  | 
% Parameter controlling skip before chapter headings (if needed)
  | 
| 
alpar@18
 | 
  3898  | 
  | 
| 
alpar@18
 | 
  3899  | 
\newskip\chapheadingskip
  | 
| 
alpar@18
 | 
  3900  | 
  | 
| 
alpar@18
 | 
  3901  | 
\def\chapbreak{\dobreak \chapheadingskip {-4000}}
 | 
| 
alpar@18
 | 
  3902  | 
\def\chappager{\par\vfill\supereject}
 | 
| 
alpar@18
 | 
  3903  | 
\def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
 | 
| 
alpar@18
 | 
  3904  | 
  | 
| 
alpar@18
 | 
  3905  | 
\def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
 | 
| 
alpar@18
 | 
  3906  | 
  | 
| 
alpar@18
 | 
  3907  | 
\def\CHAPPAGoff{%
 | 
| 
alpar@18
 | 
  3908  | 
\global\let\contentsalignmacro = \chappager
  | 
| 
alpar@18
 | 
  3909  | 
\global\let\pchapsepmacro=\chapbreak
  | 
| 
alpar@18
 | 
  3910  | 
\global\let\pagealignmacro=\chappager}
  | 
| 
alpar@18
 | 
  3911  | 
  | 
| 
alpar@18
 | 
  3912  | 
\def\CHAPPAGon{%
 | 
| 
alpar@18
 | 
  3913  | 
\global\let\contentsalignmacro = \chappager
  | 
| 
alpar@18
 | 
  3914  | 
\global\let\pchapsepmacro=\chappager
  | 
| 
alpar@18
 | 
  3915  | 
\global\let\pagealignmacro=\chappager
  | 
| 
alpar@18
 | 
  3916  | 
\global\def\HEADINGSon{\HEADINGSsingle}}
 | 
| 
alpar@18
 | 
  3917  | 
  | 
| 
alpar@18
 | 
  3918  | 
\def\CHAPPAGodd{
 | 
| 
alpar@18
 | 
  3919  | 
\global\let\contentsalignmacro = \chapoddpage
  | 
| 
alpar@18
 | 
  3920  | 
\global\let\pchapsepmacro=\chapoddpage
  | 
| 
alpar@18
 | 
  3921  | 
\global\let\pagealignmacro=\chapoddpage
  | 
| 
alpar@18
 | 
  3922  | 
\global\def\HEADINGSon{\HEADINGSdouble}}
 | 
| 
alpar@18
 | 
  3923  | 
  | 
| 
alpar@18
 | 
  3924  | 
\CHAPPAGon
  | 
| 
alpar@18
 | 
  3925  | 
  | 
| 
alpar@18
 | 
  3926  | 
\def\CHAPFplain{
 | 
| 
alpar@18
 | 
  3927  | 
\global\let\chapmacro=\chfplain
  | 
| 
alpar@18
 | 
  3928  | 
\global\let\unnumbchapmacro=\unnchfplain
  | 
| 
alpar@18
 | 
  3929  | 
\global\let\centerchapmacro=\centerchfplain}
  | 
| 
alpar@18
 | 
  3930  | 
  | 
| 
alpar@18
 | 
  3931  | 
% Plain chapter opening.
  | 
| 
alpar@18
 | 
  3932  | 
% #1 is the text, #2 the chapter number or empty if unnumbered.
  | 
| 
alpar@18
 | 
  3933  | 
\def\chfplain#1#2{%
 | 
| 
alpar@18
 | 
  3934  | 
  \pchapsepmacro
  | 
| 
alpar@18
 | 
  3935  | 
  {%
 | 
| 
alpar@18
 | 
  3936  | 
    \chapfonts \rm
  | 
| 
alpar@18
 | 
  3937  | 
    \def\chapnum{#2}%
 | 
| 
alpar@18
 | 
  3938  | 
    \setbox0 = \hbox{#2\ifx\chapnum\empty\else\enspace\fi}%
 | 
| 
alpar@18
 | 
  3939  | 
    \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
 | 
| 
alpar@18
 | 
  3940  | 
          \hangindent = \wd0 \centerparametersmaybe
  | 
| 
alpar@18
 | 
  3941  | 
          \unhbox0 #1\par}%
  | 
| 
alpar@18
 | 
  3942  | 
  }%
  | 
| 
alpar@18
 | 
  3943  | 
  \nobreak\bigskip % no page break after a chapter title
  | 
| 
alpar@18
 | 
  3944  | 
  \nobreak
  | 
| 
alpar@18
 | 
  3945  | 
}
  | 
| 
alpar@18
 | 
  3946  | 
  | 
| 
alpar@18
 | 
  3947  | 
% Plain opening for unnumbered.
  | 
| 
alpar@18
 | 
  3948  | 
\def\unnchfplain#1{\chfplain{#1}{}}
 | 
| 
alpar@18
 | 
  3949  | 
  | 
| 
alpar@18
 | 
  3950  | 
% @centerchap -- centered and unnumbered.
  | 
| 
alpar@18
 | 
  3951  | 
\let\centerparametersmaybe = \relax
  | 
| 
alpar@18
 | 
  3952  | 
\def\centerchfplain#1{{%
 | 
| 
alpar@18
 | 
  3953  | 
  \def\centerparametersmaybe{%
 | 
| 
alpar@18
 | 
  3954  | 
    \advance\rightskip by 3\rightskip
  | 
| 
alpar@18
 | 
  3955  | 
    \leftskip = \rightskip
  | 
| 
alpar@18
 | 
  3956  | 
    \parfillskip = 0pt
  | 
| 
alpar@18
 | 
  3957  | 
  }%
  | 
| 
alpar@18
 | 
  3958  | 
  \chfplain{#1}{}%
 | 
| 
alpar@18
 | 
  3959  | 
}}
  | 
| 
alpar@18
 | 
  3960  | 
  | 
| 
alpar@18
 | 
  3961  | 
\CHAPFplain % The default
  | 
| 
alpar@18
 | 
  3962  | 
  | 
| 
alpar@18
 | 
  3963  | 
\def\unnchfopen #1{%
 | 
| 
alpar@18
 | 
  3964  | 
\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
 | 
| 
alpar@18
 | 
  3965  | 
                       \parindent=0pt\raggedright
  | 
| 
alpar@18
 | 
  3966  | 
                       \rm #1\hfill}}\bigskip \par\nobreak
  | 
| 
alpar@18
 | 
  3967  | 
}
  | 
| 
alpar@18
 | 
  3968  | 
  | 
| 
alpar@18
 | 
  3969  | 
\def\chfopen #1#2{\chapoddpage {\chapfonts
 | 
| 
alpar@18
 | 
  3970  | 
\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
 | 
| 
alpar@18
 | 
  3971  | 
\par\penalty 5000 %
  | 
| 
alpar@18
 | 
  3972  | 
}
  | 
| 
alpar@18
 | 
  3973  | 
  | 
| 
alpar@18
 | 
  3974  | 
\def\centerchfopen #1{%
 | 
| 
alpar@18
 | 
  3975  | 
\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
 | 
| 
alpar@18
 | 
  3976  | 
                       \parindent=0pt
  | 
| 
alpar@18
 | 
  3977  | 
                       \hfill {\rm #1}\hfill}}\bigskip \par\nobreak
 | 
| 
alpar@18
 | 
  3978  | 
}
  | 
| 
alpar@18
 | 
  3979  | 
  | 
| 
alpar@18
 | 
  3980  | 
\def\CHAPFopen{
 | 
| 
alpar@18
 | 
  3981  | 
\global\let\chapmacro=\chfopen
  | 
| 
alpar@18
 | 
  3982  | 
\global\let\unnumbchapmacro=\unnchfopen
  | 
| 
alpar@18
 | 
  3983  | 
\global\let\centerchapmacro=\centerchfopen}
  | 
| 
alpar@18
 | 
  3984  | 
  | 
| 
alpar@18
 | 
  3985  | 
  | 
| 
alpar@18
 | 
  3986  | 
% Section titles.
  | 
| 
alpar@18
 | 
  3987  | 
\newskip\secheadingskip
  | 
| 
alpar@18
 | 
  3988  | 
\def\secheadingbreak{\dobreak \secheadingskip {-1000}}
 | 
| 
alpar@18
 | 
  3989  | 
\def\secheading#1#2#3{\sectionheading{sec}{#2.#3}{#1}}
 | 
| 
alpar@18
 | 
  3990  | 
\def\plainsecheading#1{\sectionheading{sec}{}{#1}}
 | 
| 
alpar@18
 | 
  3991  | 
  | 
| 
alpar@18
 | 
  3992  | 
% Subsection titles.
  | 
| 
alpar@18
 | 
  3993  | 
\newskip \subsecheadingskip
  | 
| 
alpar@18
 | 
  3994  | 
\def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
 | 
| 
alpar@18
 | 
  3995  | 
\def\subsecheading#1#2#3#4{\sectionheading{subsec}{#2.#3.#4}{#1}}
 | 
| 
alpar@18
 | 
  3996  | 
\def\plainsubsecheading#1{\sectionheading{subsec}{}{#1}}
 | 
| 
alpar@18
 | 
  3997  | 
  | 
| 
alpar@18
 | 
  3998  | 
% Subsubsection titles.
  | 
| 
alpar@18
 | 
  3999  | 
\let\subsubsecheadingskip = \subsecheadingskip
  | 
| 
alpar@18
 | 
  4000  | 
\let\subsubsecheadingbreak = \subsecheadingbreak
  | 
| 
alpar@18
 | 
  4001  | 
\def\subsubsecheading#1#2#3#4#5{\sectionheading{subsubsec}{#2.#3.#4.#5}{#1}}
 | 
| 
alpar@18
 | 
  4002  | 
\def\plainsubsubsecheading#1{\sectionheading{subsubsec}{}{#1}}
 | 
| 
alpar@18
 | 
  4003  | 
  | 
| 
alpar@18
 | 
  4004  | 
  | 
| 
alpar@18
 | 
  4005  | 
% Print any size section title.
  | 
| 
alpar@18
 | 
  4006  | 
%
  | 
| 
alpar@18
 | 
  4007  | 
% #1 is the section type (sec/subsec/subsubsec), #2 is the section
  | 
| 
alpar@18
 | 
  4008  | 
% number (maybe empty), #3 the text.
  | 
| 
alpar@18
 | 
  4009  | 
\def\sectionheading#1#2#3{%
 | 
| 
alpar@18
 | 
  4010  | 
  {%
 | 
| 
alpar@18
 | 
  4011  | 
    \expandafter\advance\csname #1headingskip\endcsname by \parskip
  | 
| 
alpar@18
 | 
  4012  | 
    \csname #1headingbreak\endcsname
  | 
| 
alpar@18
 | 
  4013  | 
  }%
  | 
| 
alpar@18
 | 
  4014  | 
  {%
 | 
| 
alpar@18
 | 
  4015  | 
    % Switch to the right set of fonts.
  | 
| 
alpar@18
 | 
  4016  | 
    \csname #1fonts\endcsname \rm
  | 
| 
alpar@18
 | 
  4017  | 
    %
  | 
| 
alpar@18
 | 
  4018  | 
    % Only insert the separating space if we have a section number.
  | 
| 
alpar@18
 | 
  4019  | 
    \def\secnum{#2}%
 | 
| 
alpar@18
 | 
  4020  | 
    \setbox0 = \hbox{#2\ifx\secnum\empty\else\enspace\fi}%
 | 
| 
alpar@18
 | 
  4021  | 
    %
  | 
| 
alpar@18
 | 
  4022  | 
    \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
 | 
| 
alpar@18
 | 
  4023  | 
          \hangindent = \wd0 % zero if no section number
  | 
| 
alpar@18
 | 
  4024  | 
          \unhbox0 #3}%
  | 
| 
alpar@18
 | 
  4025  | 
  }%
  | 
| 
alpar@18
 | 
  4026  | 
  % Add extra space after the heading -- either a line space or a
  | 
| 
alpar@18
 | 
  4027  | 
  % paragraph space, whichever is more.  (Some people like to set
  | 
| 
alpar@18
 | 
  4028  | 
  % \parskip to large values for some reason.)  Don't allow stretch, though.
  | 
| 
alpar@18
 | 
  4029  | 
  \nobreak
  | 
| 
alpar@18
 | 
  4030  | 
  \ifdim\parskip>\normalbaselineskip
  | 
| 
alpar@18
 | 
  4031  | 
    \kern\parskip
  | 
| 
alpar@18
 | 
  4032  | 
  \else
  | 
| 
alpar@18
 | 
  4033  | 
    \kern\normalbaselineskip
  | 
| 
alpar@18
 | 
  4034  | 
  \fi
  | 
| 
alpar@18
 | 
  4035  | 
  \nobreak
  | 
| 
alpar@18
 | 
  4036  | 
}
  | 
| 
alpar@18
 | 
  4037  | 
  | 
| 
alpar@18
 | 
  4038  | 
  | 
| 
alpar@18
 | 
  4039  | 
\message{toc,}
 | 
| 
alpar@18
 | 
  4040  | 
% Table of contents.
  | 
| 
alpar@18
 | 
  4041  | 
\newwrite\tocfile
  | 
| 
alpar@18
 | 
  4042  | 
  | 
| 
alpar@18
 | 
  4043  | 
% Write an entry to the toc file, opening it if necessary.
  | 
| 
alpar@18
 | 
  4044  | 
% Called from @chapter, etc.  We supply {\folio} at the end of the
 | 
| 
alpar@18
 | 
  4045  | 
% argument, which will end up as the last argument to the \...entry macro.
  | 
| 
alpar@18
 | 
  4046  | 
%
  | 
| 
alpar@18
 | 
  4047  | 
% Usage: \writetocentry{chap}{The Name of The Game}{{\the\chapno}}
 | 
| 
alpar@18
 | 
  4048  | 
% We open the .toc file for writing here instead of at @setfilename (or
  | 
| 
alpar@18
 | 
  4049  | 
% any other fixed time) so that @contents can be anywhere in the document.
  | 
| 
alpar@18
 | 
  4050  | 
%
  | 
| 
alpar@18
 | 
  4051  | 
\newif\iftocfileopened
  | 
| 
alpar@18
 | 
  4052  | 
\def\writetocentry#1#2#3{%
 | 
| 
alpar@18
 | 
  4053  | 
  \iftocfileopened\else
  | 
| 
alpar@18
 | 
  4054  | 
    \immediate\openout\tocfile = \jobname.toc
  | 
| 
alpar@18
 | 
  4055  | 
    \global\tocfileopenedtrue
  | 
| 
alpar@18
 | 
  4056  | 
  \fi
  | 
| 
alpar@18
 | 
  4057  | 
  %
  | 
| 
alpar@18
 | 
  4058  | 
  \iflinks
  | 
| 
alpar@18
 | 
  4059  | 
    \toks0 = {#2}%
 | 
| 
alpar@18
 | 
  4060  | 
    \edef\temp{\write\tocfile{\realbackslash #1entry{\the\toks0}#3{\folio}}}%
 | 
| 
alpar@18
 | 
  4061  | 
    \temp
  | 
| 
alpar@18
 | 
  4062  | 
  \fi
  | 
| 
alpar@18
 | 
  4063  | 
  %
  | 
| 
alpar@18
 | 
  4064  | 
  % Tell \shipout to create a page destination if we're doing pdf, which
  | 
| 
alpar@18
 | 
  4065  | 
  % will be the target of the links in the table of contents.  We can't
  | 
| 
alpar@18
 | 
  4066  | 
  % just do it on every page because the title pages are numbered 1 and
  | 
| 
alpar@18
 | 
  4067  | 
  % 2 (the page numbers aren't printed), and so are the first two pages
  | 
| 
alpar@18
 | 
  4068  | 
  % of the document.  Thus, we'd have two destinations named `1', and
  | 
| 
alpar@18
 | 
  4069  | 
  % two named `2'.
  | 
| 
alpar@18
 | 
  4070  | 
  \ifpdf \pdfmakepagedesttrue \fi
  | 
| 
alpar@18
 | 
  4071  | 
}
  | 
| 
alpar@18
 | 
  4072  | 
  | 
| 
alpar@18
 | 
  4073  | 
\newskip\contentsrightmargin \contentsrightmargin=1in
  | 
| 
alpar@18
 | 
  4074  | 
\newcount\savepageno
  | 
| 
alpar@18
 | 
  4075  | 
\newcount\lastnegativepageno \lastnegativepageno = -1
  | 
| 
alpar@18
 | 
  4076  | 
  | 
| 
alpar@18
 | 
  4077  | 
% Finish up the main text and prepare to read what we've written
  | 
| 
alpar@18
 | 
  4078  | 
% to \tocfile.
  | 
| 
alpar@18
 | 
  4079  | 
%
  | 
| 
alpar@18
 | 
  4080  | 
\def\startcontents#1{%
 | 
| 
alpar@18
 | 
  4081  | 
   % If @setchapternewpage on, and @headings double, the contents should
  | 
| 
alpar@18
 | 
  4082  | 
   % start on an odd page, unlike chapters.  Thus, we maintain
  | 
| 
alpar@18
 | 
  4083  | 
   % \contentsalignmacro in parallel with \pagealignmacro.
  | 
| 
alpar@18
 | 
  4084  | 
   % From: Torbjorn Granlund <tege@matematik.su.se>
  | 
| 
alpar@18
 | 
  4085  | 
   \contentsalignmacro
  | 
| 
alpar@18
 | 
  4086  | 
   \immediate\closeout\tocfile
  | 
| 
alpar@18
 | 
  4087  | 
   %
  | 
| 
alpar@18
 | 
  4088  | 
   % Don't need to put `Contents' or `Short Contents' in the headline.
  | 
| 
alpar@18
 | 
  4089  | 
   % It is abundantly clear what they are.
  | 
| 
alpar@18
 | 
  4090  | 
   \unnumbchapmacro{#1}\def\thischapter{}%
 | 
| 
alpar@18
 | 
  4091  | 
   \savepageno = \pageno
  | 
| 
alpar@18
 | 
  4092  | 
   \begingroup                  % Set up to handle contents files properly.
  | 
| 
alpar@18
 | 
  4093  | 
      \catcode`\\=0  \catcode`\{=1  \catcode`\}=2  \catcode`\@=11
 | 
| 
alpar@18
 | 
  4094  | 
      % We can't do this, because then an actual ^ in a section
  | 
| 
alpar@18
 | 
  4095  | 
      % title fails, e.g., @chapter ^ -- exponentiation.  --karl, 9jul97.
  | 
| 
alpar@18
 | 
  4096  | 
      %\catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi
  | 
| 
alpar@18
 | 
  4097  | 
      \raggedbottom             % Worry more about breakpoints than the bottom.
  | 
| 
alpar@18
 | 
  4098  | 
      \advance\hsize by -\contentsrightmargin % Don't use the full line length.
  | 
| 
alpar@18
 | 
  4099  | 
      %
  | 
| 
alpar@18
 | 
  4100  | 
      % Roman numerals for page numbers.
  | 
| 
alpar@18
 | 
  4101  | 
      \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
  | 
| 
alpar@18
 | 
  4102  | 
}
  | 
| 
alpar@18
 | 
  4103  | 
  | 
| 
alpar@18
 | 
  4104  | 
  | 
| 
alpar@18
 | 
  4105  | 
% Normal (long) toc.
  | 
| 
alpar@18
 | 
  4106  | 
\def\contents{%
 | 
| 
alpar@18
 | 
  4107  | 
   \startcontents{\putwordTOC}%
 | 
| 
alpar@18
 | 
  4108  | 
     \openin 1 \jobname.toc
  | 
| 
alpar@18
 | 
  4109  | 
     \ifeof 1 \else
  | 
| 
alpar@18
 | 
  4110  | 
       \closein 1
  | 
| 
alpar@18
 | 
  4111  | 
       \input \jobname.toc
  | 
| 
alpar@18
 | 
  4112  | 
     \fi
  | 
| 
alpar@18
 | 
  4113  | 
     \vfill \eject
  | 
| 
alpar@18
 | 
  4114  | 
     \contentsalignmacro % in case @setchapternewpage odd is in effect
  | 
| 
alpar@18
 | 
  4115  | 
     \pdfmakeoutlines
  | 
| 
alpar@18
 | 
  4116  | 
   \endgroup
  | 
| 
alpar@18
 | 
  4117  | 
   \lastnegativepageno = \pageno
  | 
| 
alpar@18
 | 
  4118  | 
   \global\pageno = \savepageno
  | 
| 
alpar@18
 | 
  4119  | 
}
  | 
| 
alpar@18
 | 
  4120  | 
  | 
| 
alpar@18
 | 
  4121  | 
% And just the chapters.
  | 
| 
alpar@18
 | 
  4122  | 
\def\summarycontents{%
 | 
| 
alpar@18
 | 
  4123  | 
   \startcontents{\putwordShortTOC}%
 | 
| 
alpar@18
 | 
  4124  | 
      %
  | 
| 
alpar@18
 | 
  4125  | 
      \let\chapentry = \shortchapentry
  | 
| 
alpar@18
 | 
  4126  | 
      \let\appendixentry = \shortappendixentry
  | 
| 
alpar@18
 | 
  4127  | 
      \let\unnumbchapentry = \shortunnumberedentry
  | 
| 
alpar@18
 | 
  4128  | 
      % We want a true roman here for the page numbers.
  | 
| 
alpar@18
 | 
  4129  | 
      \secfonts
  | 
| 
alpar@18
 | 
  4130  | 
      \let\rm=\shortcontrm \let\bf=\shortcontbf
  | 
| 
alpar@18
 | 
  4131  | 
      \let\sl=\shortcontsl \let\tt=\shortconttt
  | 
| 
alpar@18
 | 
  4132  | 
      \rm
  | 
| 
alpar@18
 | 
  4133  | 
      \hyphenpenalty = 10000
  | 
| 
alpar@18
 | 
  4134  | 
      \advance\baselineskip by 1pt % Open it up a little.
  | 
| 
alpar@18
 | 
  4135  | 
      \def\secentry ##1##2##3##4{}
 | 
| 
alpar@18
 | 
  4136  | 
      \def\subsecentry ##1##2##3##4##5{}
 | 
| 
alpar@18
 | 
  4137  | 
      \def\subsubsecentry ##1##2##3##4##5##6{}
 | 
| 
alpar@18
 | 
  4138  | 
      \let\unnumbsecentry = \secentry
  | 
| 
alpar@18
 | 
  4139  | 
      \let\unnumbsubsecentry = \subsecentry
  | 
| 
alpar@18
 | 
  4140  | 
      \let\unnumbsubsubsecentry = \subsubsecentry
  | 
| 
alpar@18
 | 
  4141  | 
      \openin 1 \jobname.toc
  | 
| 
alpar@18
 | 
  4142  | 
      \ifeof 1 \else
  | 
| 
alpar@18
 | 
  4143  | 
        \closein 1
  | 
| 
alpar@18
 | 
  4144  | 
        \input \jobname.toc
  | 
| 
alpar@18
 | 
  4145  | 
      \fi
  | 
| 
alpar@18
 | 
  4146  | 
     \vfill \eject
  | 
| 
alpar@18
 | 
  4147  | 
     \contentsalignmacro % in case @setchapternewpage odd is in effect
  | 
| 
alpar@18
 | 
  4148  | 
   \endgroup
  | 
| 
alpar@18
 | 
  4149  | 
   \lastnegativepageno = \pageno
  | 
| 
alpar@18
 | 
  4150  | 
   \global\pageno = \savepageno
  | 
| 
alpar@18
 | 
  4151  | 
}
  | 
| 
alpar@18
 | 
  4152  | 
\let\shortcontents = \summarycontents
  | 
| 
alpar@18
 | 
  4153  | 
  | 
| 
alpar@18
 | 
  4154  | 
\ifpdf
  | 
| 
alpar@18
 | 
  4155  | 
  \pdfcatalog{/PageMode /UseOutlines}%
 | 
| 
alpar@18
 | 
  4156  | 
\fi
  | 
| 
alpar@18
 | 
  4157  | 
  | 
| 
alpar@18
 | 
  4158  | 
% These macros generate individual entries in the table of contents.
  | 
| 
alpar@18
 | 
  4159  | 
% The first argument is the chapter or section name.
  | 
| 
alpar@18
 | 
  4160  | 
% The last argument is the page number.
  | 
| 
alpar@18
 | 
  4161  | 
% The arguments in between are the chapter number, section number, ...
  | 
| 
alpar@18
 | 
  4162  | 
  | 
| 
alpar@18
 | 
  4163  | 
% Chapters, in the main contents.
  | 
| 
alpar@18
 | 
  4164  | 
\def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}}
 | 
| 
alpar@18
 | 
  4165  | 
%
  | 
| 
alpar@18
 | 
  4166  | 
% Chapters, in the short toc.
  | 
| 
alpar@18
 | 
  4167  | 
% See comments in \dochapentry re vbox and related settings.
  | 
| 
alpar@18
 | 
  4168  | 
\def\shortchapentry#1#2#3{%
 | 
| 
alpar@18
 | 
  4169  | 
  \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#3\egroup}%
 | 
| 
alpar@18
 | 
  4170  | 
}
  | 
| 
alpar@18
 | 
  4171  | 
  | 
| 
alpar@18
 | 
  4172  | 
% Appendices, in the main contents.
  | 
| 
alpar@18
 | 
  4173  | 
\def\appendixentry#1#2#3{%
 | 
| 
alpar@18
 | 
  4174  | 
  \dochapentry{\appendixbox{\putwordAppendix{} #2}\labelspace#1}{#3}}
 | 
| 
alpar@18
 | 
  4175  | 
%
  | 
| 
alpar@18
 | 
  4176  | 
% Appendices, in the short toc.
  | 
| 
alpar@18
 | 
  4177  | 
\let\shortappendixentry = \shortchapentry
  | 
| 
alpar@18
 | 
  4178  | 
  | 
| 
alpar@18
 | 
  4179  | 
% Typeset the label for a chapter or appendix for the short contents.
  | 
| 
alpar@18
 | 
  4180  | 
% The arg is, e.g., `Appendix A' for an appendix, or `3' for a chapter.
  | 
| 
alpar@18
 | 
  4181  | 
% We could simplify the code here by writing out an \appendixentry
  | 
| 
alpar@18
 | 
  4182  | 
% command in the toc file for appendices, instead of using \chapentry
  | 
| 
alpar@18
 | 
  4183  | 
% for both, but it doesn't seem worth it.
  | 
| 
alpar@18
 | 
  4184  | 
%
  | 
| 
alpar@18
 | 
  4185  | 
\newdimen\shortappendixwidth
  | 
| 
alpar@18
 | 
  4186  | 
%
  | 
| 
alpar@18
 | 
  4187  | 
\def\shortchaplabel#1{%
 | 
| 
alpar@18
 | 
  4188  | 
  % This space should be enough, since a single number is .5em, and the
  | 
| 
alpar@18
 | 
  4189  | 
  % widest letter (M) is 1em, at least in the Computer Modern fonts.
  | 
| 
alpar@18
 | 
  4190  | 
  % But use \hss just in case.
  | 
| 
alpar@18
 | 
  4191  | 
  % (This space doesn't include the extra space that gets added after
  | 
| 
alpar@18
 | 
  4192  | 
  % the label; that gets put in by \shortchapentry above.)
  | 
| 
alpar@18
 | 
  4193  | 
  \dimen0 = 1em
  | 
| 
alpar@18
 | 
  4194  | 
  \hbox to \dimen0{#1\hss}%
 | 
| 
alpar@18
 | 
  4195  | 
}
  | 
| 
alpar@18
 | 
  4196  | 
  | 
| 
alpar@18
 | 
  4197  | 
% Unnumbered chapters.
  | 
| 
alpar@18
 | 
  4198  | 
\def\unnumbchapentry#1#2#3{\dochapentry{#1}{#3}}
 | 
| 
alpar@18
 | 
  4199  | 
\def\shortunnumberedentry#1#2#3{\tocentry{#1}{\doshortpageno\bgroup#3\egroup}}
 | 
| 
alpar@18
 | 
  4200  | 
  | 
| 
alpar@18
 | 
  4201  | 
% Sections.
  | 
| 
alpar@18
 | 
  4202  | 
\def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}}
 | 
| 
alpar@18
 | 
  4203  | 
\def\unnumbsecentry#1#2#3#4{\dosecentry{#1}{#4}}
 | 
| 
alpar@18
 | 
  4204  | 
  | 
| 
alpar@18
 | 
  4205  | 
% Subsections.
  | 
| 
alpar@18
 | 
  4206  | 
\def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}}
 | 
| 
alpar@18
 | 
  4207  | 
\def\unnumbsubsecentry#1#2#3#4#5{\dosubsecentry{#1}{#5}}
 | 
| 
alpar@18
 | 
  4208  | 
  | 
| 
alpar@18
 | 
  4209  | 
% And subsubsections.
  | 
| 
alpar@18
 | 
  4210  | 
\def\subsubsecentry#1#2#3#4#5#6{%
 | 
| 
alpar@18
 | 
  4211  | 
  \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}}
 | 
| 
alpar@18
 | 
  4212  | 
\def\unnumbsubsubsecentry#1#2#3#4#5#6{\dosubsubsecentry{#1}{#6}}
 | 
| 
alpar@18
 | 
  4213  | 
  | 
| 
alpar@18
 | 
  4214  | 
% This parameter controls the indentation of the various levels.
  | 
| 
alpar@18
 | 
  4215  | 
\newdimen\tocindent \tocindent = 3pc
  | 
| 
alpar@18
 | 
  4216  | 
  | 
| 
alpar@18
 | 
  4217  | 
% Now for the actual typesetting. In all these, #1 is the text and #2 is the
  | 
| 
alpar@18
 | 
  4218  | 
% page number.
  | 
| 
alpar@18
 | 
  4219  | 
%
  | 
| 
alpar@18
 | 
  4220  | 
% If the toc has to be broken over pages, we want it to be at chapters
  | 
| 
alpar@18
 | 
  4221  | 
% if at all possible; hence the \penalty.
  | 
| 
alpar@18
 | 
  4222  | 
\def\dochapentry#1#2{%
 | 
| 
alpar@18
 | 
  4223  | 
   \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
  | 
| 
alpar@18
 | 
  4224  | 
   \begingroup
  | 
| 
alpar@18
 | 
  4225  | 
     \chapentryfonts
  | 
| 
alpar@18
 | 
  4226  | 
     \tocentry{#1}{\dopageno\bgroup#2\egroup}%
 | 
| 
alpar@18
 | 
  4227  | 
   \endgroup
  | 
| 
alpar@18
 | 
  4228  | 
   \nobreak\vskip .25\baselineskip plus.1\baselineskip
  | 
| 
alpar@18
 | 
  4229  | 
}
  | 
| 
alpar@18
 | 
  4230  | 
  | 
| 
alpar@18
 | 
  4231  | 
\def\dosecentry#1#2{\begingroup
 | 
| 
alpar@18
 | 
  4232  | 
  \secentryfonts \leftskip=\tocindent
  | 
| 
alpar@18
 | 
  4233  | 
  \tocentry{#1}{\dopageno\bgroup#2\egroup}%
 | 
| 
alpar@18
 | 
  4234  | 
\endgroup}
  | 
| 
alpar@18
 | 
  4235  | 
  | 
| 
alpar@18
 | 
  4236  | 
\def\dosubsecentry#1#2{\begingroup
 | 
| 
alpar@18
 | 
  4237  | 
  \subsecentryfonts \leftskip=2\tocindent
  | 
| 
alpar@18
 | 
  4238  | 
  \tocentry{#1}{\dopageno\bgroup#2\egroup}%
 | 
| 
alpar@18
 | 
  4239  | 
\endgroup}
  | 
| 
alpar@18
 | 
  4240  | 
  | 
| 
alpar@18
 | 
  4241  | 
\def\dosubsubsecentry#1#2{\begingroup
 | 
| 
alpar@18
 | 
  4242  | 
  \subsubsecentryfonts \leftskip=3\tocindent
  | 
| 
alpar@18
 | 
  4243  | 
  \tocentry{#1}{\dopageno\bgroup#2\egroup}%
 | 
| 
alpar@18
 | 
  4244  | 
\endgroup}
  | 
| 
alpar@18
 | 
  4245  | 
  | 
| 
alpar@18
 | 
  4246  | 
% Final typesetting of a toc entry; we use the same \entry macro as for
  | 
| 
alpar@18
 | 
  4247  | 
% the index entries, but we want to suppress hyphenation here.  (We
  | 
| 
alpar@18
 | 
  4248  | 
% can't do that in the \entry macro, since index entries might consist
  | 
| 
alpar@18
 | 
  4249  | 
% of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.)
  | 
| 
alpar@18
 | 
  4250  | 
\def\tocentry#1#2{\begingroup
 | 
| 
alpar@18
 | 
  4251  | 
  \vskip 0pt plus1pt % allow a little stretch for the sake of nice page breaks
  | 
| 
alpar@18
 | 
  4252  | 
  % Do not use \turnoffactive in these arguments.  Since the toc is
  | 
| 
alpar@18
 | 
  4253  | 
  % typeset in cmr, characters such as _ would come out wrong; we
  | 
| 
alpar@18
 | 
  4254  | 
  % have to do the usual translation tricks.
  | 
| 
alpar@18
 | 
  4255  | 
  \entry{#1}{#2}%
 | 
| 
alpar@18
 | 
  4256  | 
\endgroup}
  | 
| 
alpar@18
 | 
  4257  | 
  | 
| 
alpar@18
 | 
  4258  | 
% Space between chapter (or whatever) number and the title.
  | 
| 
alpar@18
 | 
  4259  | 
\def\labelspace{\hskip1em \relax}
 | 
| 
alpar@18
 | 
  4260  | 
  | 
| 
alpar@18
 | 
  4261  | 
\def\dopageno#1{{\rm #1}}
 | 
| 
alpar@18
 | 
  4262  | 
\def\doshortpageno#1{{\rm #1}}
 | 
| 
alpar@18
 | 
  4263  | 
  | 
| 
alpar@18
 | 
  4264  | 
\def\chapentryfonts{\secfonts \rm}
 | 
| 
alpar@18
 | 
  4265  | 
\def\secentryfonts{\textfonts}
 | 
| 
alpar@18
 | 
  4266  | 
\let\subsecentryfonts = \textfonts
  | 
| 
alpar@18
 | 
  4267  | 
\let\subsubsecentryfonts = \textfonts
  | 
| 
alpar@18
 | 
  4268  | 
  | 
| 
alpar@18
 | 
  4269  | 
  | 
| 
alpar@18
 | 
  4270  | 
\message{environments,}
 | 
| 
alpar@18
 | 
  4271  | 
% @foo ... @end foo.
  | 
| 
alpar@18
 | 
  4272  | 
  | 
| 
alpar@18
 | 
  4273  | 
% @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
 | 
| 
alpar@18
 | 
  4274  | 
%
  | 
| 
alpar@18
 | 
  4275  | 
% Since these characters are used in examples, it should be an even number of
  | 
| 
alpar@18
 | 
  4276  | 
% \tt widths. Each \tt character is 1en, so two makes it 1em.
  | 
| 
alpar@18
 | 
  4277  | 
%
  | 
| 
alpar@18
 | 
  4278  | 
\def\point{$\star$}
 | 
| 
alpar@18
 | 
  4279  | 
\def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
 | 
| 
alpar@18
 | 
  4280  | 
\def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}}
 | 
| 
alpar@18
 | 
  4281  | 
\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
 | 
| 
alpar@18
 | 
  4282  | 
\def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}}
 | 
| 
alpar@18
 | 
  4283  | 
  | 
| 
alpar@18
 | 
  4284  | 
% The @error{} command.
 | 
| 
alpar@18
 | 
  4285  | 
% Adapted from the TeXbook's \boxit.
  | 
| 
alpar@18
 | 
  4286  | 
%
  | 
| 
alpar@18
 | 
  4287  | 
\newbox\errorbox
  | 
| 
alpar@18
 | 
  4288  | 
%
  | 
| 
alpar@18
 | 
  4289  | 
{\tentt \global\dimen0 = 3em}% Width of the box.
 | 
| 
alpar@18
 | 
  4290  | 
\dimen2 = .55pt % Thickness of rules
  | 
| 
alpar@18
 | 
  4291  | 
% The text. (`r' is open on the right, `e' somewhat less so on the left.)
  | 
| 
alpar@18
 | 
  4292  | 
\setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
 | 
| 
alpar@18
 | 
  4293  | 
%
  | 
| 
alpar@18
 | 
  4294  | 
\global\setbox\errorbox=\hbox to \dimen0{\hfil
 | 
| 
alpar@18
 | 
  4295  | 
   \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
  | 
| 
alpar@18
 | 
  4296  | 
   \advance\hsize by -2\dimen2 % Rules.
  | 
| 
alpar@18
 | 
  4297  | 
   \vbox{
 | 
| 
alpar@18
 | 
  4298  | 
      \hrule height\dimen2
  | 
| 
alpar@18
 | 
  4299  | 
      \hbox{\vrule width\dimen2 \kern3pt          % Space to left of text.
 | 
| 
alpar@18
 | 
  4300  | 
         \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
 | 
| 
alpar@18
 | 
  4301  | 
         \kern3pt\vrule width\dimen2}% Space to right.
  | 
| 
alpar@18
 | 
  4302  | 
      \hrule height\dimen2}
  | 
| 
alpar@18
 | 
  4303  | 
    \hfil}
  | 
| 
alpar@18
 | 
  4304  | 
%
  | 
| 
alpar@18
 | 
  4305  | 
\def\error{\leavevmode\lower.7ex\copy\errorbox}
 | 
| 
alpar@18
 | 
  4306  | 
  | 
| 
alpar@18
 | 
  4307  | 
% @tex ... @end tex    escapes into raw Tex temporarily.
  | 
| 
alpar@18
 | 
  4308  | 
% One exception: @ is still an escape character, so that @end tex works.
  | 
| 
alpar@18
 | 
  4309  | 
% But \@ or @@ will get a plain tex @ character.
  | 
| 
alpar@18
 | 
  4310  | 
  | 
| 
alpar@18
 | 
  4311  | 
\def\tex{\begingroup
 | 
| 
alpar@18
 | 
  4312  | 
  \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
 | 
| 
alpar@18
 | 
  4313  | 
  \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
  | 
| 
alpar@18
 | 
  4314  | 
  \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
  | 
| 
alpar@18
 | 
  4315  | 
  \catcode `\%=14
  | 
| 
alpar@18
 | 
  4316  | 
  \catcode `\+=\other
  | 
| 
alpar@18
 | 
  4317  | 
  \catcode `\"=\other
  | 
| 
alpar@18
 | 
  4318  | 
  \catcode `\==\other
  | 
| 
alpar@18
 | 
  4319  | 
  \catcode `\|=\other
  | 
| 
alpar@18
 | 
  4320  | 
  \catcode `\<=\other
  | 
| 
alpar@18
 | 
  4321  | 
  \catcode `\>=\other
  | 
| 
alpar@18
 | 
  4322  | 
  \escapechar=`\\
  | 
| 
alpar@18
 | 
  4323  | 
  %
  | 
| 
alpar@18
 | 
  4324  | 
  \let\b=\ptexb
  | 
| 
alpar@18
 | 
  4325  | 
  \let\bullet=\ptexbullet
  | 
| 
alpar@18
 | 
  4326  | 
  \let\c=\ptexc
  | 
| 
alpar@18
 | 
  4327  | 
  \let\,=\ptexcomma
  | 
| 
alpar@18
 | 
  4328  | 
  \let\.=\ptexdot
  | 
| 
alpar@18
 | 
  4329  | 
  \let\dots=\ptexdots
  | 
| 
alpar@18
 | 
  4330  | 
  \let\equiv=\ptexequiv
  | 
| 
alpar@18
 | 
  4331  | 
  \let\!=\ptexexclam
  | 
| 
alpar@18
 | 
  4332  | 
  \let\i=\ptexi
  | 
| 
alpar@18
 | 
  4333  | 
  \let\indent=\ptexindent
  | 
| 
alpar@18
 | 
  4334  | 
  \let\{=\ptexlbrace
 | 
| 
alpar@18
 | 
  4335  | 
  \let\+=\tabalign
  | 
| 
alpar@18
 | 
  4336  | 
  \let\}=\ptexrbrace
  | 
| 
alpar@18
 | 
  4337  | 
  \let\/=\ptexslash
  | 
| 
alpar@18
 | 
  4338  | 
  \let\*=\ptexstar
  | 
| 
alpar@18
 | 
  4339  | 
  \let\t=\ptext
  | 
| 
alpar@18
 | 
  4340  | 
  %
  | 
| 
alpar@18
 | 
  4341  | 
  \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
 | 
| 
alpar@18
 | 
  4342  | 
  \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
 | 
| 
alpar@18
 | 
  4343  | 
  \def\@{@}%
 | 
| 
alpar@18
 | 
  4344  | 
\let\Etex=\endgroup}
  | 
| 
alpar@18
 | 
  4345  | 
  | 
| 
alpar@18
 | 
  4346  | 
% Define @lisp ... @end lisp.
  | 
| 
alpar@18
 | 
  4347  | 
% @lisp does a \begingroup so it can rebind things,
  | 
| 
alpar@18
 | 
  4348  | 
% including the definition of @end lisp (which normally is erroneous).
  | 
| 
alpar@18
 | 
  4349  | 
  | 
| 
alpar@18
 | 
  4350  | 
% Amount to narrow the margins by for @lisp.
  | 
| 
alpar@18
 | 
  4351  | 
\newskip\lispnarrowing \lispnarrowing=0.4in
  | 
| 
alpar@18
 | 
  4352  | 
  | 
| 
alpar@18
 | 
  4353  | 
% This is the definition that ^^M gets inside @lisp, @example, and other
  | 
| 
alpar@18
 | 
  4354  | 
% such environments.  \null is better than a space, since it doesn't
  | 
| 
alpar@18
 | 
  4355  | 
% have any width.
  | 
| 
alpar@18
 | 
  4356  | 
\def\lisppar{\null\endgraf}
 | 
| 
alpar@18
 | 
  4357  | 
  | 
| 
alpar@18
 | 
  4358  | 
% Make each space character in the input produce a normal interword
  | 
| 
alpar@18
 | 
  4359  | 
% space in the output.  Don't allow a line break at this space, as this
  | 
| 
alpar@18
 | 
  4360  | 
% is used only in environments like @example, where each line of input
  | 
| 
alpar@18
 | 
  4361  | 
% should produce a line of output anyway.
  | 
| 
alpar@18
 | 
  4362  | 
%
  | 
| 
alpar@18
 | 
  4363  | 
{\obeyspaces %
 | 
| 
alpar@18
 | 
  4364  | 
\gdef\sepspaces{\obeyspaces\let =\tie}}
 | 
| 
alpar@18
 | 
  4365  | 
  | 
| 
alpar@18
 | 
  4366  | 
% Define \obeyedspace to be our active space, whatever it is.  This is
  | 
| 
alpar@18
 | 
  4367  | 
% for use in \parsearg.
  | 
| 
alpar@18
 | 
  4368  | 
{\sepspaces%
 | 
| 
alpar@18
 | 
  4369  | 
\global\let\obeyedspace= }
  | 
| 
alpar@18
 | 
  4370  | 
  | 
| 
alpar@18
 | 
  4371  | 
% This space is always present above and below environments.
  | 
| 
alpar@18
 | 
  4372  | 
\newskip\envskipamount \envskipamount = 0pt
  | 
| 
alpar@18
 | 
  4373  | 
  | 
| 
alpar@18
 | 
  4374  | 
% Make spacing and below environment symmetrical.  We use \parskip here
  | 
| 
alpar@18
 | 
  4375  | 
% to help in doing that, since in @example-like environments \parskip
  | 
| 
alpar@18
 | 
  4376  | 
% is reset to zero; thus the \afterenvbreak inserts no space -- but the
  | 
| 
alpar@18
 | 
  4377  | 
% start of the next paragraph will insert \parskip.
  | 
| 
alpar@18
 | 
  4378  | 
%
  | 
| 
alpar@18
 | 
  4379  | 
\def\aboveenvbreak{{%
 | 
| 
alpar@18
 | 
  4380  | 
  % =10000 instead of <10000 because of a special case in \itemzzz, q.v.
  | 
| 
alpar@18
 | 
  4381  | 
  \ifnum \lastpenalty=10000 \else
  | 
| 
alpar@18
 | 
  4382  | 
    \advance\envskipamount by \parskip
  | 
| 
alpar@18
 | 
  4383  | 
    \endgraf
  | 
| 
alpar@18
 | 
  4384  | 
    \ifdim\lastskip<\envskipamount
  | 
| 
alpar@18
 | 
  4385  | 
      \removelastskip
  | 
| 
alpar@18
 | 
  4386  | 
      % it's not a good place to break if the last penalty was \nobreak
  | 
| 
alpar@18
 | 
  4387  | 
      % or better ...
  | 
| 
alpar@18
 | 
  4388  | 
      \ifnum\lastpenalty>10000 \else \penalty-50 \fi
  | 
| 
alpar@18
 | 
  4389  | 
      \vskip\envskipamount
  | 
| 
alpar@18
 | 
  4390  | 
    \fi
  | 
| 
alpar@18
 | 
  4391  | 
  \fi
  | 
| 
alpar@18
 | 
  4392  | 
}}
  | 
| 
alpar@18
 | 
  4393  | 
  | 
| 
alpar@18
 | 
  4394  | 
\let\afterenvbreak = \aboveenvbreak
  | 
| 
alpar@18
 | 
  4395  | 
  | 
| 
alpar@18
 | 
  4396  | 
% \nonarrowing is a flag.  If "set", @lisp etc don't narrow margins.
  | 
| 
alpar@18
 | 
  4397  | 
\let\nonarrowing=\relax
  | 
| 
alpar@18
 | 
  4398  | 
  | 
| 
alpar@18
 | 
  4399  | 
% @cartouche ... @end cartouche: draw rectangle w/rounded corners around
  | 
| 
alpar@18
 | 
  4400  | 
% environment contents.
  | 
| 
alpar@18
 | 
  4401  | 
\font\circle=lcircle10
  | 
| 
alpar@18
 | 
  4402  | 
\newdimen\circthick
  | 
| 
alpar@18
 | 
  4403  | 
\newdimen\cartouter\newdimen\cartinner
  | 
| 
alpar@18
 | 
  4404  | 
\newskip\normbskip\newskip\normpskip\newskip\normlskip
  | 
| 
alpar@18
 | 
  4405  | 
\circthick=\fontdimen8\circle
  | 
| 
alpar@18
 | 
  4406  | 
%
  | 
| 
alpar@18
 | 
  4407  | 
\def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
 | 
| 
alpar@18
 | 
  4408  | 
\def\ctr{{\hskip 6pt\circle\char'010}}
 | 
| 
alpar@18
 | 
  4409  | 
\def\cbl{{\circle\char'012\hskip -6pt}}
 | 
| 
alpar@18
 | 
  4410  | 
\def\cbr{{\hskip 6pt\circle\char'011}}
 | 
| 
alpar@18
 | 
  4411  | 
\def\carttop{\hbox to \cartouter{\hskip\lskip
 | 
| 
alpar@18
 | 
  4412  | 
        \ctl\leaders\hrule height\circthick\hfil\ctr
  | 
| 
alpar@18
 | 
  4413  | 
        \hskip\rskip}}
  | 
| 
alpar@18
 | 
  4414  | 
\def\cartbot{\hbox to \cartouter{\hskip\lskip
 | 
| 
alpar@18
 | 
  4415  | 
        \cbl\leaders\hrule height\circthick\hfil\cbr
  | 
| 
alpar@18
 | 
  4416  | 
        \hskip\rskip}}
  | 
| 
alpar@18
 | 
  4417  | 
%
  | 
| 
alpar@18
 | 
  4418  | 
\newskip\lskip\newskip\rskip
  | 
| 
alpar@18
 | 
  4419  | 
  | 
| 
alpar@18
 | 
  4420  | 
\def\cartouche{%
 | 
| 
alpar@18
 | 
  4421  | 
\par  % can't be in the midst of a paragraph.
  | 
| 
alpar@18
 | 
  4422  | 
\begingroup
  | 
| 
alpar@18
 | 
  4423  | 
        \lskip=\leftskip \rskip=\rightskip
  | 
| 
alpar@18
 | 
  4424  | 
        \leftskip=0pt\rightskip=0pt %we want these *outside*.
  | 
| 
alpar@18
 | 
  4425  | 
        \cartinner=\hsize \advance\cartinner by-\lskip
  | 
| 
alpar@18
 | 
  4426  | 
                          \advance\cartinner by-\rskip
  | 
| 
alpar@18
 | 
  4427  | 
        \cartouter=\hsize
  | 
| 
alpar@18
 | 
  4428  | 
        \advance\cartouter by 18.4pt % allow for 3pt kerns on either
  | 
| 
alpar@18
 | 
  4429  | 
%                                    side, and for 6pt waste from
  | 
| 
alpar@18
 | 
  4430  | 
%                                    each corner char, and rule thickness
  | 
| 
alpar@18
 | 
  4431  | 
        \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
  | 
| 
alpar@18
 | 
  4432  | 
        % Flag to tell @lisp, etc., not to narrow margin.
  | 
| 
alpar@18
 | 
  4433  | 
        \let\nonarrowing=\comment
  | 
| 
alpar@18
 | 
  4434  | 
        \vbox\bgroup
  | 
| 
alpar@18
 | 
  4435  | 
                \baselineskip=0pt\parskip=0pt\lineskip=0pt
  | 
| 
alpar@18
 | 
  4436  | 
                \carttop
  | 
| 
alpar@18
 | 
  4437  | 
                \hbox\bgroup
  | 
| 
alpar@18
 | 
  4438  | 
                        \hskip\lskip
  | 
| 
alpar@18
 | 
  4439  | 
                        \vrule\kern3pt
  | 
| 
alpar@18
 | 
  4440  | 
                        \vbox\bgroup
  | 
| 
alpar@18
 | 
  4441  | 
                                \hsize=\cartinner
  | 
| 
alpar@18
 | 
  4442  | 
                                \kern3pt
  | 
| 
alpar@18
 | 
  4443  | 
                                \begingroup
  | 
| 
alpar@18
 | 
  4444  | 
                                        \baselineskip=\normbskip
  | 
| 
alpar@18
 | 
  4445  | 
                                        \lineskip=\normlskip
  | 
| 
alpar@18
 | 
  4446  | 
                                        \parskip=\normpskip
  | 
| 
alpar@18
 | 
  4447  | 
                                        \vskip -\parskip
  | 
| 
alpar@18
 | 
  4448  | 
\def\Ecartouche{%
 | 
| 
alpar@18
 | 
  4449  | 
                                \endgroup
  | 
| 
alpar@18
 | 
  4450  | 
                                \kern3pt
  | 
| 
alpar@18
 | 
  4451  | 
                        \egroup
  | 
| 
alpar@18
 | 
  4452  | 
                        \kern3pt\vrule
  | 
| 
alpar@18
 | 
  4453  | 
                        \hskip\rskip
  | 
| 
alpar@18
 | 
  4454  | 
                \egroup
  | 
| 
alpar@18
 | 
  4455  | 
                \cartbot
  | 
| 
alpar@18
 | 
  4456  | 
        \egroup
  | 
| 
alpar@18
 | 
  4457  | 
\endgroup
  | 
| 
alpar@18
 | 
  4458  | 
}}
  | 
| 
alpar@18
 | 
  4459  | 
  | 
| 
alpar@18
 | 
  4460  | 
  | 
| 
alpar@18
 | 
  4461  | 
% This macro is called at the beginning of all the @example variants,
  | 
| 
alpar@18
 | 
  4462  | 
% inside a group.
  | 
| 
alpar@18
 | 
  4463  | 
\def\nonfillstart{%
 | 
| 
alpar@18
 | 
  4464  | 
  \aboveenvbreak
  | 
| 
alpar@18
 | 
  4465  | 
  \inENV % This group ends at the end of the body
  | 
| 
alpar@18
 | 
  4466  | 
  \hfuzz = 12pt % Don't be fussy
  | 
| 
alpar@18
 | 
  4467  | 
  \sepspaces % Make spaces be word-separators rather than space tokens.
  | 
| 
alpar@18
 | 
  4468  | 
  \let\par = \lisppar % don't ignore blank lines
  | 
| 
alpar@18
 | 
  4469  | 
  \obeylines % each line of input is a line of output
  | 
| 
alpar@18
 | 
  4470  | 
  \parskip = 0pt
  | 
| 
alpar@18
 | 
  4471  | 
  \parindent = 0pt
  | 
| 
alpar@18
 | 
  4472  | 
  \emergencystretch = 0pt % don't try to avoid overfull boxes
  | 
| 
alpar@18
 | 
  4473  | 
  % @cartouche defines \nonarrowing to inhibit narrowing
  | 
| 
alpar@18
 | 
  4474  | 
  % at next level down.
  | 
| 
alpar@18
 | 
  4475  | 
  \ifx\nonarrowing\relax
  | 
| 
alpar@18
 | 
  4476  | 
    \advance \leftskip by \lispnarrowing
  | 
| 
alpar@18
 | 
  4477  | 
    \exdentamount=\lispnarrowing
  | 
| 
alpar@18
 | 
  4478  | 
    \let\exdent=\nofillexdent
  | 
| 
alpar@18
 | 
  4479  | 
    \let\nonarrowing=\relax
  | 
| 
alpar@18
 | 
  4480  | 
  \fi
  | 
| 
alpar@18
 | 
  4481  | 
}
  | 
| 
alpar@18
 | 
  4482  | 
  | 
| 
alpar@18
 | 
  4483  | 
% Define the \E... control sequence only if we are inside the particular
  | 
| 
alpar@18
 | 
  4484  | 
% environment, so the error checking in \end will work.
  | 
| 
alpar@18
 | 
  4485  | 
%
  | 
| 
alpar@18
 | 
  4486  | 
% To end an @example-like environment, we first end the paragraph (via
  | 
| 
alpar@18
 | 
  4487  | 
% \afterenvbreak's vertical glue), and then the group.  That way we keep
  | 
| 
alpar@18
 | 
  4488  | 
% the zero \parskip that the environments set -- \parskip glue will be
  | 
| 
alpar@18
 | 
  4489  | 
% inserted at the beginning of the next paragraph in the document, after
  | 
| 
alpar@18
 | 
  4490  | 
% the environment.
  | 
| 
alpar@18
 | 
  4491  | 
%
  | 
| 
alpar@18
 | 
  4492  | 
\def\nonfillfinish{\afterenvbreak\endgroup}
 | 
| 
alpar@18
 | 
  4493  | 
  | 
| 
alpar@18
 | 
  4494  | 
% @lisp: indented, narrowed, typewriter font.
  | 
| 
alpar@18
 | 
  4495  | 
\def\lisp{\begingroup
 | 
| 
alpar@18
 | 
  4496  | 
  \nonfillstart
  | 
| 
alpar@18
 | 
  4497  | 
  \let\Elisp = \nonfillfinish
  | 
| 
alpar@18
 | 
  4498  | 
  \tt
  | 
| 
alpar@18
 | 
  4499  | 
  \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
  | 
| 
alpar@18
 | 
  4500  | 
  \gobble       % eat return
  | 
| 
alpar@18
 | 
  4501  | 
}
  | 
| 
alpar@18
 | 
  4502  | 
  | 
| 
alpar@18
 | 
  4503  | 
% @example: Same as @lisp.
  | 
| 
alpar@18
 | 
  4504  | 
\def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp}
 | 
| 
alpar@18
 | 
  4505  | 
  | 
| 
alpar@18
 | 
  4506  | 
% @smallexample and @smalllisp: use smaller fonts.
  | 
| 
alpar@18
 | 
  4507  | 
% Originally contributed by Pavel@xerox.
  | 
| 
alpar@18
 | 
  4508  | 
\def\smalllisp{\begingroup
 | 
| 
alpar@18
 | 
  4509  | 
  \def\Esmalllisp{\nonfillfinish\endgroup}%
 | 
| 
alpar@18
 | 
  4510  | 
  \def\Esmallexample{\nonfillfinish\endgroup}%
 | 
| 
alpar@18
 | 
  4511  | 
  \smallexamplefonts
  | 
| 
alpar@18
 | 
  4512  | 
  \lisp
  | 
| 
alpar@18
 | 
  4513  | 
}
  | 
| 
alpar@18
 | 
  4514  | 
\let\smallexample = \smalllisp
  | 
| 
alpar@18
 | 
  4515  | 
  | 
| 
alpar@18
 | 
  4516  | 
  | 
| 
alpar@18
 | 
  4517  | 
% @display: same as @lisp except keep current font.
  | 
| 
alpar@18
 | 
  4518  | 
%
  | 
| 
alpar@18
 | 
  4519  | 
\def\display{\begingroup
 | 
| 
alpar@18
 | 
  4520  | 
  \nonfillstart
  | 
| 
alpar@18
 | 
  4521  | 
  \let\Edisplay = \nonfillfinish
  | 
| 
alpar@18
 | 
  4522  | 
  \gobble
  | 
| 
alpar@18
 | 
  4523  | 
}
  | 
| 
alpar@18
 | 
  4524  | 
%
  | 
| 
alpar@18
 | 
  4525  | 
% @smalldisplay: @display plus smaller fonts.
  | 
| 
alpar@18
 | 
  4526  | 
%
  | 
| 
alpar@18
 | 
  4527  | 
\def\smalldisplay{\begingroup
 | 
| 
alpar@18
 | 
  4528  | 
  \def\Esmalldisplay{\nonfillfinish\endgroup}%
 | 
| 
alpar@18
 | 
  4529  | 
  \smallexamplefonts \rm
  | 
| 
alpar@18
 | 
  4530  | 
  \display
  | 
| 
alpar@18
 | 
  4531  | 
}
  | 
| 
alpar@18
 | 
  4532  | 
  | 
| 
alpar@18
 | 
  4533  | 
% @format: same as @display except don't narrow margins.
  | 
| 
alpar@18
 | 
  4534  | 
%
  | 
| 
alpar@18
 | 
  4535  | 
\def\format{\begingroup
 | 
| 
alpar@18
 | 
  4536  | 
  \let\nonarrowing = t
  | 
| 
alpar@18
 | 
  4537  | 
  \nonfillstart
  | 
| 
alpar@18
 | 
  4538  | 
  \let\Eformat = \nonfillfinish
  | 
| 
alpar@18
 | 
  4539  | 
  \gobble
  | 
| 
alpar@18
 | 
  4540  | 
}
  | 
| 
alpar@18
 | 
  4541  | 
%
  | 
| 
alpar@18
 | 
  4542  | 
% @smallformat: @format plus smaller fonts.
  | 
| 
alpar@18
 | 
  4543  | 
%
  | 
| 
alpar@18
 | 
  4544  | 
\def\smallformat{\begingroup
 | 
| 
alpar@18
 | 
  4545  | 
  \def\Esmallformat{\nonfillfinish\endgroup}%
 | 
| 
alpar@18
 | 
  4546  | 
  \smallexamplefonts \rm
  | 
| 
alpar@18
 | 
  4547  | 
  \format
  | 
| 
alpar@18
 | 
  4548  | 
}
  | 
| 
alpar@18
 | 
  4549  | 
  | 
| 
alpar@18
 | 
  4550  | 
% @flushleft (same as @format).
  | 
| 
alpar@18
 | 
  4551  | 
%
  | 
| 
alpar@18
 | 
  4552  | 
\def\flushleft{\begingroup \def\Eflushleft{\nonfillfinish\endgroup}\format}
 | 
| 
alpar@18
 | 
  4553  | 
  | 
| 
alpar@18
 | 
  4554  | 
% @flushright.
  | 
| 
alpar@18
 | 
  4555  | 
%
  | 
| 
alpar@18
 | 
  4556  | 
\def\flushright{\begingroup
 | 
| 
alpar@18
 | 
  4557  | 
  \let\nonarrowing = t
  | 
| 
alpar@18
 | 
  4558  | 
  \nonfillstart
  | 
| 
alpar@18
 | 
  4559  | 
  \let\Eflushright = \nonfillfinish
  | 
| 
alpar@18
 | 
  4560  | 
  \advance\leftskip by 0pt plus 1fill
  | 
| 
alpar@18
 | 
  4561  | 
  \gobble
  | 
| 
alpar@18
 | 
  4562  | 
}
  | 
| 
alpar@18
 | 
  4563  | 
  | 
| 
alpar@18
 | 
  4564  | 
  | 
| 
alpar@18
 | 
  4565  | 
% @quotation does normal linebreaking (hence we can't use \nonfillstart)
  | 
| 
alpar@18
 | 
  4566  | 
% and narrows the margins.
  | 
| 
alpar@18
 | 
  4567  | 
%
  | 
| 
alpar@18
 | 
  4568  | 
\def\quotation{%
 | 
| 
alpar@18
 | 
  4569  | 
  \begingroup\inENV %This group ends at the end of the @quotation body
  | 
| 
alpar@18
 | 
  4570  | 
  {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
 | 
| 
alpar@18
 | 
  4571  | 
  \parindent=0pt
  | 
| 
alpar@18
 | 
  4572  | 
  % We have retained a nonzero parskip for the environment, since we're
  | 
| 
alpar@18
 | 
  4573  | 
  % doing normal filling. So to avoid extra space below the environment...
  | 
| 
alpar@18
 | 
  4574  | 
  \def\Equotation{\parskip = 0pt \nonfillfinish}%
 | 
| 
alpar@18
 | 
  4575  | 
  %
  | 
| 
alpar@18
 | 
  4576  | 
  % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
  | 
| 
alpar@18
 | 
  4577  | 
  \ifx\nonarrowing\relax
  | 
| 
alpar@18
 | 
  4578  | 
    \advance\leftskip by \lispnarrowing
  | 
| 
alpar@18
 | 
  4579  | 
    \advance\rightskip by \lispnarrowing
  | 
| 
alpar@18
 | 
  4580  | 
    \exdentamount = \lispnarrowing
  | 
| 
alpar@18
 | 
  4581  | 
    \let\nonarrowing = \relax
  | 
| 
alpar@18
 | 
  4582  | 
  \fi
  | 
| 
alpar@18
 | 
  4583  | 
}
  | 
| 
alpar@18
 | 
  4584  | 
  | 
| 
alpar@18
 | 
  4585  | 
  | 
| 
alpar@18
 | 
  4586  | 
% LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
 | 
| 
alpar@18
 | 
  4587  | 
% If we want to allow any <char> as delimiter,
  | 
| 
alpar@18
 | 
  4588  | 
% we need the curly braces so that makeinfo sees the @verb command, eg:
  | 
| 
alpar@18
 | 
  4589  | 
% `@verbx...x' would look like the '@verbx' command.  --janneke@gnu.org
  | 
| 
alpar@18
 | 
  4590  | 
%
  | 
| 
alpar@18
 | 
  4591  | 
% [Knuth]: Donald Ervin Knuth, 1996.  The TeXbook.
  | 
| 
alpar@18
 | 
  4592  | 
%
  | 
| 
alpar@18
 | 
  4593  | 
% [Knuth] p.344; only we need to do the other characters Texinfo sets
  | 
| 
alpar@18
 | 
  4594  | 
% active too.  Otherwise, they get lost as the first character on a
  | 
| 
alpar@18
 | 
  4595  | 
% verbatim line.
  | 
| 
alpar@18
 | 
  4596  | 
\def\dospecials{%
 | 
| 
alpar@18
 | 
  4597  | 
  \do\ \do\\\do\{\do\}\do\$\do\&%
 | 
| 
alpar@18
 | 
  4598  | 
  \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~%
  | 
| 
alpar@18
 | 
  4599  | 
  \do\<\do\>\do\|\do\@\do+\do\"%
  | 
| 
alpar@18
 | 
  4600  | 
}
  | 
| 
alpar@18
 | 
  4601  | 
%
  | 
| 
alpar@18
 | 
  4602  | 
% [Knuth] p. 380
  | 
| 
alpar@18
 | 
  4603  | 
\def\uncatcodespecials{%
 | 
| 
alpar@18
 | 
  4604  | 
  \def\do##1{\catcode`##1=12}\dospecials}
 | 
| 
alpar@18
 | 
  4605  | 
%
  | 
| 
alpar@18
 | 
  4606  | 
% [Knuth] pp. 380,381,391
  | 
| 
alpar@18
 | 
  4607  | 
% Disable Spanish ligatures ?` and !` of \tt font
  | 
| 
alpar@18
 | 
  4608  | 
\begingroup
  | 
| 
alpar@18
 | 
  4609  | 
  \catcode`\`=\active\gdef`{\relax\lq}
 | 
| 
alpar@18
 | 
  4610  | 
\endgroup
  | 
| 
alpar@18
 | 
  4611  | 
%
  | 
| 
alpar@18
 | 
  4612  | 
% Setup for the @verb command.
  | 
| 
alpar@18
 | 
  4613  | 
%
  | 
| 
alpar@18
 | 
  4614  | 
% Eight spaces for a tab
  | 
| 
alpar@18
 | 
  4615  | 
\begingroup
  | 
| 
alpar@18
 | 
  4616  | 
  \catcode`\^^I=\active
  | 
| 
alpar@18
 | 
  4617  | 
  \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
 | 
| 
alpar@18
 | 
  4618  | 
\endgroup
  | 
| 
alpar@18
 | 
  4619  | 
%
  | 
| 
alpar@18
 | 
  4620  | 
\def\setupverb{%
 | 
| 
alpar@18
 | 
  4621  | 
  \tt  % easiest (and conventionally used) font for verbatim
  | 
| 
alpar@18
 | 
  4622  | 
  \def\par{\leavevmode\endgraf}%
 | 
| 
alpar@18
 | 
  4623  | 
  \catcode`\`=\active
  | 
| 
alpar@18
 | 
  4624  | 
  \tabeightspaces
  | 
| 
alpar@18
 | 
  4625  | 
  % Respect line breaks,
  | 
| 
alpar@18
 | 
  4626  | 
  % print special symbols as themselves, and
  | 
| 
alpar@18
 | 
  4627  | 
  % make each space count
  | 
| 
alpar@18
 | 
  4628  | 
  % must do in this order:
  | 
| 
alpar@18
 | 
  4629  | 
  \obeylines \uncatcodespecials \sepspaces
  | 
| 
alpar@18
 | 
  4630  | 
}
  | 
| 
alpar@18
 | 
  4631  | 
  | 
| 
alpar@18
 | 
  4632  | 
% Setup for the @verbatim environment
  | 
| 
alpar@18
 | 
  4633  | 
%
  | 
| 
alpar@18
 | 
  4634  | 
% Real tab expansion
  | 
| 
alpar@18
 | 
  4635  | 
\newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
 | 
| 
alpar@18
 | 
  4636  | 
%
  | 
| 
alpar@18
 | 
  4637  | 
\def\starttabbox{\setbox0=\hbox\bgroup}
 | 
| 
alpar@18
 | 
  4638  | 
\begingroup
  | 
| 
alpar@18
 | 
  4639  | 
  \catcode`\^^I=\active
  | 
| 
alpar@18
 | 
  4640  | 
  \gdef\tabexpand{%
 | 
| 
alpar@18
 | 
  4641  | 
    \catcode`\^^I=\active
  | 
| 
alpar@18
 | 
  4642  | 
    \def^^I{\leavevmode\egroup
 | 
| 
alpar@18
 | 
  4643  | 
      \dimen0=\wd0 % the width so far, or since the previous tab
  | 
| 
alpar@18
 | 
  4644  | 
      \divide\dimen0 by\tabw
  | 
| 
alpar@18
 | 
  4645  | 
      \multiply\dimen0 by\tabw % compute previous multiple of \tabw
  | 
| 
alpar@18
 | 
  4646  | 
      \advance\dimen0 by\tabw  % advance to next multiple of \tabw
  | 
| 
alpar@18
 | 
  4647  | 
      \wd0=\dimen0 \box0 \starttabbox
  | 
| 
alpar@18
 | 
  4648  | 
    }%
  | 
| 
alpar@18
 | 
  4649  | 
  }
  | 
| 
alpar@18
 | 
  4650  | 
\endgroup
  | 
| 
alpar@18
 | 
  4651  | 
\def\setupverbatim{%
 | 
| 
alpar@18
 | 
  4652  | 
  % Easiest (and conventionally used) font for verbatim
  | 
| 
alpar@18
 | 
  4653  | 
  \tt
  | 
| 
alpar@18
 | 
  4654  | 
  \def\par{\leavevmode\egroup\box0\endgraf}%
 | 
| 
alpar@18
 | 
  4655  | 
  \catcode`\`=\active
  | 
| 
alpar@18
 | 
  4656  | 
  \tabexpand
  | 
| 
alpar@18
 | 
  4657  | 
  % Respect line breaks,
  | 
| 
alpar@18
 | 
  4658  | 
  % print special symbols as themselves, and
  | 
| 
alpar@18
 | 
  4659  | 
  % make each space count
  | 
| 
alpar@18
 | 
  4660  | 
  % must do in this order:
  | 
| 
alpar@18
 | 
  4661  | 
  \obeylines \uncatcodespecials \sepspaces
  | 
| 
alpar@18
 | 
  4662  | 
  \everypar{\starttabbox}%
 | 
| 
alpar@18
 | 
  4663  | 
}
  | 
| 
alpar@18
 | 
  4664  | 
  | 
| 
alpar@18
 | 
  4665  | 
% Do the @verb magic: verbatim text is quoted by unique
  | 
| 
alpar@18
 | 
  4666  | 
% delimiter characters.  Before first delimiter expect a
  | 
| 
alpar@18
 | 
  4667  | 
% right brace, after last delimiter expect closing brace:
  | 
| 
alpar@18
 | 
  4668  | 
%
  | 
| 
alpar@18
 | 
  4669  | 
%    \def\doverb'{'<char>#1<char>'}'{#1}
 | 
| 
alpar@18
 | 
  4670  | 
%
  | 
| 
alpar@18
 | 
  4671  | 
% [Knuth] p. 382; only eat outer {}
 | 
| 
alpar@18
 | 
  4672  | 
\begingroup
  | 
| 
alpar@18
 | 
  4673  | 
  \catcode`[=1\catcode`]=2\catcode`\{=12\catcode`\}=12
 | 
| 
alpar@18
 | 
  4674  | 
  \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
 | 
| 
alpar@18
 | 
  4675  | 
\endgroup
  | 
| 
alpar@18
 | 
  4676  | 
%
  | 
| 
alpar@18
 | 
  4677  | 
\def\verb{\begingroup\setupverb\doverb}
 | 
| 
alpar@18
 | 
  4678  | 
%
  | 
| 
alpar@18
 | 
  4679  | 
%
  | 
| 
alpar@18
 | 
  4680  | 
% Do the @verbatim magic: define the macro \doverbatim so that
  | 
| 
alpar@18
 | 
  4681  | 
% the (first) argument ends when '@end verbatim' is reached, ie:
  | 
| 
alpar@18
 | 
  4682  | 
%
  | 
| 
alpar@18
 | 
  4683  | 
%     \def\doverbatim#1@end verbatim{#1}
 | 
| 
alpar@18
 | 
  4684  | 
%
  | 
| 
alpar@18
 | 
  4685  | 
% For Texinfo it's a lot easier than for LaTeX,
  | 
| 
alpar@18
 | 
  4686  | 
% because texinfo's \verbatim doesn't stop at '\end{verbatim}':
 | 
| 
alpar@18
 | 
  4687  | 
% we need not redefine '\', '{' and '}'.
 | 
| 
alpar@18
 | 
  4688  | 
%
  | 
| 
alpar@18
 | 
  4689  | 
% Inspired by LaTeX's verbatim command set [latex.ltx]
  | 
| 
alpar@18
 | 
  4690  | 
%% Include LaTeX hack for completeness -- never know
  | 
| 
alpar@18
 | 
  4691  | 
%% \begingroup
  | 
| 
alpar@18
 | 
  4692  | 
%% \catcode`|=0 \catcode`[=1
  | 
| 
alpar@18
 | 
  4693  | 
%% \catcode`]=2\catcode`\{=12\catcode`\}=12\catcode`\ =\active
 | 
| 
alpar@18
 | 
  4694  | 
%% \catcode`\\=12|gdef|doverbatim#1@end verbatim[
  | 
| 
alpar@18
 | 
  4695  | 
%% #1|endgroup|def|Everbatim[]|end[verbatim]]
  | 
| 
alpar@18
 | 
  4696  | 
%% |endgroup
  | 
| 
alpar@18
 | 
  4697  | 
%
  | 
| 
alpar@18
 | 
  4698  | 
\begingroup
  | 
| 
alpar@18
 | 
  4699  | 
  \catcode`\ =\active
  | 
| 
alpar@18
 | 
  4700  | 
  \obeylines %
  | 
| 
alpar@18
 | 
  4701  | 
  % ignore everything up to the first ^^M, that's the newline at the end
  | 
| 
alpar@18
 | 
  4702  | 
  % of the @verbatim input line itself.  Otherwise we get an extra blank
  | 
| 
alpar@18
 | 
  4703  | 
  % line in the output.
  | 
| 
alpar@18
 | 
  4704  | 
  \gdef\doverbatim#1^^M#2@end verbatim{#2\end{verbatim}}%
 | 
| 
alpar@18
 | 
  4705  | 
\endgroup
  | 
| 
alpar@18
 | 
  4706  | 
%
  | 
| 
alpar@18
 | 
  4707  | 
\def\verbatim{%
 | 
| 
alpar@18
 | 
  4708  | 
  \def\Everbatim{\nonfillfinish\endgroup}%
 | 
| 
alpar@18
 | 
  4709  | 
  \begingroup
  | 
| 
alpar@18
 | 
  4710  | 
    \nonfillstart
  | 
| 
alpar@18
 | 
  4711  | 
    \advance\leftskip by -\defbodyindent
  | 
| 
alpar@18
 | 
  4712  | 
    \begingroup\setupverbatim\doverbatim
  | 
| 
alpar@18
 | 
  4713  | 
}
  | 
| 
alpar@18
 | 
  4714  | 
  | 
| 
alpar@18
 | 
  4715  | 
% @verbatiminclude FILE - insert text of file in verbatim environment.
  | 
| 
alpar@18
 | 
  4716  | 
%
  | 
| 
alpar@18
 | 
  4717  | 
% Allow normal characters that we make active in the argument (a file name).
  | 
| 
alpar@18
 | 
  4718  | 
\def\verbatiminclude{%
 | 
| 
alpar@18
 | 
  4719  | 
  \begingroup
  | 
| 
alpar@18
 | 
  4720  | 
    \catcode`\\=\other
  | 
| 
alpar@18
 | 
  4721  | 
    \catcode`~=\other
  | 
| 
alpar@18
 | 
  4722  | 
    \catcode`^=\other
  | 
| 
alpar@18
 | 
  4723  | 
    \catcode`_=\other
  | 
| 
alpar@18
 | 
  4724  | 
    \catcode`|=\other
  | 
| 
alpar@18
 | 
  4725  | 
    \catcode`<=\other
  | 
| 
alpar@18
 | 
  4726  | 
    \catcode`>=\other
  | 
| 
alpar@18
 | 
  4727  | 
    \catcode`+=\other
  | 
| 
alpar@18
 | 
  4728  | 
    \parsearg\doverbatiminclude
  | 
| 
alpar@18
 | 
  4729  | 
}
  | 
| 
alpar@18
 | 
  4730  | 
\def\setupverbatiminclude{%
 | 
| 
alpar@18
 | 
  4731  | 
  \begingroup
  | 
| 
alpar@18
 | 
  4732  | 
    \nonfillstart
  | 
| 
alpar@18
 | 
  4733  | 
    \advance\leftskip by -\defbodyindent
  | 
| 
alpar@18
 | 
  4734  | 
    \begingroup\setupverbatim
  | 
| 
alpar@18
 | 
  4735  | 
}
  | 
| 
alpar@18
 | 
  4736  | 
%
  | 
| 
alpar@18
 | 
  4737  | 
\def\doverbatiminclude#1{%
 | 
| 
alpar@18
 | 
  4738  | 
     % Restore active chars for included file.
  | 
| 
alpar@18
 | 
  4739  | 
  \endgroup
  | 
| 
alpar@18
 | 
  4740  | 
  \begingroup
  | 
| 
alpar@18
 | 
  4741  | 
    \let\value=\expandablevalue
  | 
| 
alpar@18
 | 
  4742  | 
    \def\thisfile{#1}%
 | 
| 
alpar@18
 | 
  4743  | 
    \expandafter\expandafter\setupverbatiminclude\input\thisfile
  | 
| 
alpar@18
 | 
  4744  | 
  \endgroup
  | 
| 
alpar@18
 | 
  4745  | 
  \nonfillfinish
  | 
| 
alpar@18
 | 
  4746  | 
  \endgroup
  | 
| 
alpar@18
 | 
  4747  | 
}
  | 
| 
alpar@18
 | 
  4748  | 
  | 
| 
alpar@18
 | 
  4749  | 
% @copying ... @end copying.
  | 
| 
alpar@18
 | 
  4750  | 
% Save the text away for @insertcopying later.  Many commands won't be
  | 
| 
alpar@18
 | 
  4751  | 
% allowed in this context, but that's ok.
  | 
| 
alpar@18
 | 
  4752  | 
%
  | 
| 
alpar@18
 | 
  4753  | 
% We save the uninterpreted tokens, rather than creating a box.
  | 
| 
alpar@18
 | 
  4754  | 
% Saving the text in a box would be much easier, but then all the
  | 
| 
alpar@18
 | 
  4755  | 
% typesetting commands (@smallbook, font changes, etc.) have to be done
  | 
| 
alpar@18
 | 
  4756  | 
% beforehand -- and a) we want @copying to be done first in the source
  | 
| 
alpar@18
 | 
  4757  | 
% file; b) letting users define the frontmatter in as flexible order as
  | 
| 
alpar@18
 | 
  4758  | 
% possible is very desirable.
  | 
| 
alpar@18
 | 
  4759  | 
%
  | 
| 
alpar@18
 | 
  4760  | 
\def\copying{\begingroup
 | 
| 
alpar@18
 | 
  4761  | 
  % Define a command to swallow text until we reach `@end copying'.
  | 
| 
alpar@18
 | 
  4762  | 
  % \ is the escape char in this texinfo.tex file, so it is the
  | 
| 
alpar@18
 | 
  4763  | 
  % delimiter for the command; @ will be the escape char when we read
  | 
| 
alpar@18
 | 
  4764  | 
  % it, but that doesn't matter.
  | 
| 
alpar@18
 | 
  4765  | 
  \long\def\docopying##1\end copying{\gdef\copyingtext{##1}\enddocopying}%
 | 
| 
alpar@18
 | 
  4766  | 
  %
  | 
| 
alpar@18
 | 
  4767  | 
  % We must preserve ^^M's in the input file; see \insertcopying below.
  | 
| 
alpar@18
 | 
  4768  | 
  \catcode`\^^M = \active
  | 
| 
alpar@18
 | 
  4769  | 
  \docopying
  | 
| 
alpar@18
 | 
  4770  | 
}
  | 
| 
alpar@18
 | 
  4771  | 
  | 
| 
alpar@18
 | 
  4772  | 
% What we do to finish off the copying text.
  | 
| 
alpar@18
 | 
  4773  | 
%
  | 
| 
alpar@18
 | 
  4774  | 
\def\enddocopying{\endgroup\ignorespaces}
 | 
| 
alpar@18
 | 
  4775  | 
  | 
| 
alpar@18
 | 
  4776  | 
% @insertcopying.  Here we must play games with ^^M's.  On the one hand,
  | 
| 
alpar@18
 | 
  4777  | 
% we need them to delimit commands such as `@end quotation', so they
  | 
| 
alpar@18
 | 
  4778  | 
% must be active.  On the other hand, we certainly don't want every
  | 
| 
alpar@18
 | 
  4779  | 
% end-of-line to be a \par, as would happen with the normal active
  | 
| 
alpar@18
 | 
  4780  | 
% definition of ^^M.  On the third hand, two ^^M's in a row should still
  | 
| 
alpar@18
 | 
  4781  | 
% generate a \par.
  | 
| 
alpar@18
 | 
  4782  | 
%
  | 
| 
alpar@18
 | 
  4783  | 
% Our approach is to make ^^M insert a space and a penalty1 normally;
  | 
| 
alpar@18
 | 
  4784  | 
% then it can also check if \lastpenalty=1.  If it does, then manually
  | 
| 
alpar@18
 | 
  4785  | 
% do \par.
  | 
| 
alpar@18
 | 
  4786  | 
%
  | 
| 
alpar@18
 | 
  4787  | 
% This messes up the normal definitions of @c[omment], so we redefine
  | 
| 
alpar@18
 | 
  4788  | 
% it.  Similarly for @ignore.  (These commands are used in the gcc
  | 
| 
alpar@18
 | 
  4789  | 
% manual for man page generation.)
  | 
| 
alpar@18
 | 
  4790  | 
%
  | 
| 
alpar@18
 | 
  4791  | 
% Seems pretty fragile, most line-oriented commands will presumably
  | 
| 
alpar@18
 | 
  4792  | 
% fail, but for the limited use of getting the copying text (which
  | 
| 
alpar@18
 | 
  4793  | 
% should be quite simple) inserted, we can hope it's ok.
  | 
| 
alpar@18
 | 
  4794  | 
%
  | 
| 
alpar@18
 | 
  4795  | 
{\catcode`\^^M=\active %
 | 
| 
alpar@18
 | 
  4796  | 
\gdef\insertcopying{\begingroup %
 | 
| 
alpar@18
 | 
  4797  | 
  \parindent = 0pt  % looks wrong on title page
  | 
| 
alpar@18
 | 
  4798  | 
  \def^^M{%
 | 
| 
alpar@18
 | 
  4799  | 
    \ifnum \lastpenalty=1 %
  | 
| 
alpar@18
 | 
  4800  | 
      \par %
  | 
| 
alpar@18
 | 
  4801  | 
    \else %
  | 
| 
alpar@18
 | 
  4802  | 
      \space \penalty 1 %
  | 
| 
alpar@18
 | 
  4803  | 
    \fi %
  | 
| 
alpar@18
 | 
  4804  | 
  }%
  | 
| 
alpar@18
 | 
  4805  | 
  %
  | 
| 
alpar@18
 | 
  4806  | 
  % Fix @c[omment] for catcode 13 ^^M's.
  | 
| 
alpar@18
 | 
  4807  | 
  \def\c##1^^M{\ignorespaces}%
 | 
| 
alpar@18
 | 
  4808  | 
  \let\comment = \c %
  | 
| 
alpar@18
 | 
  4809  | 
  %
  | 
| 
alpar@18
 | 
  4810  | 
  % Don't bother jumping through all the hoops that \doignore does, it
  | 
| 
alpar@18
 | 
  4811  | 
  % would be very hard since the catcodes are already set.
  | 
| 
alpar@18
 | 
  4812  | 
  \long\def\ignore##1\end ignore{\ignorespaces}%
 | 
| 
alpar@18
 | 
  4813  | 
  %
  | 
| 
alpar@18
 | 
  4814  | 
  \copyingtext %
  | 
| 
alpar@18
 | 
  4815  | 
\endgroup}%
  | 
| 
alpar@18
 | 
  4816  | 
}
  | 
| 
alpar@18
 | 
  4817  | 
  | 
| 
alpar@18
 | 
  4818  | 
\message{defuns,}
 | 
| 
alpar@18
 | 
  4819  | 
% @defun etc.
  | 
| 
alpar@18
 | 
  4820  | 
  | 
| 
alpar@18
 | 
  4821  | 
% Allow user to change definition object font (\df) internally
  | 
| 
alpar@18
 | 
  4822  | 
\def\setdeffont#1 {\csname DEF#1\endcsname}
 | 
| 
alpar@18
 | 
  4823  | 
  | 
| 
alpar@18
 | 
  4824  | 
\newskip\defbodyindent \defbodyindent=.4in
  | 
| 
alpar@18
 | 
  4825  | 
\newskip\defargsindent \defargsindent=50pt
  | 
| 
alpar@18
 | 
  4826  | 
\newskip\deflastargmargin \deflastargmargin=18pt
  | 
| 
alpar@18
 | 
  4827  | 
  | 
| 
alpar@18
 | 
  4828  | 
\newcount\parencount
  | 
| 
alpar@18
 | 
  4829  | 
  | 
| 
alpar@18
 | 
  4830  | 
% We want ()&[] to print specially on the defun line.
  | 
| 
alpar@18
 | 
  4831  | 
%
  | 
| 
alpar@18
 | 
  4832  | 
\def\activeparens{%
 | 
| 
alpar@18
 | 
  4833  | 
  \catcode`\(=\active \catcode`\)=\active
  | 
| 
alpar@18
 | 
  4834  | 
  \catcode`\&=\active
  | 
| 
alpar@18
 | 
  4835  | 
  \catcode`\[=\active \catcode`\]=\active
  | 
| 
alpar@18
 | 
  4836  | 
}
  | 
| 
alpar@18
 | 
  4837  | 
  | 
| 
alpar@18
 | 
  4838  | 
% Make control sequences which act like normal parenthesis chars.
  | 
| 
alpar@18
 | 
  4839  | 
\let\lparen = ( \let\rparen = )
  | 
| 
alpar@18
 | 
  4840  | 
  | 
| 
alpar@18
 | 
  4841  | 
{\activeparens % Now, smart parens don't turn on until &foo (see \amprm)
 | 
| 
alpar@18
 | 
  4842  | 
  | 
| 
alpar@18
 | 
  4843  | 
% Be sure that we always have a definition for `(', etc.  For example,
 | 
| 
alpar@18
 | 
  4844  | 
% if the fn name has parens in it, \boldbrax will not be in effect yet,
  | 
| 
alpar@18
 | 
  4845  | 
% so TeX would otherwise complain about undefined control sequence.
  | 
| 
alpar@18
 | 
  4846  | 
\global\let(=\lparen \global\let)=\rparen
  | 
| 
alpar@18
 | 
  4847  | 
\global\let[=\lbrack \global\let]=\rbrack
  | 
| 
alpar@18
 | 
  4848  | 
  | 
| 
alpar@18
 | 
  4849  | 
\gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 }
 | 
| 
alpar@18
 | 
  4850  | 
\gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
 | 
| 
alpar@18
 | 
  4851  | 
% This is used to turn on special parens
  | 
| 
alpar@18
 | 
  4852  | 
% but make & act ordinary (given that it's active).
  | 
| 
alpar@18
 | 
  4853  | 
\gdef\boldbraxnoamp{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb\let&=\ampnr}
 | 
| 
alpar@18
 | 
  4854  | 
  | 
| 
alpar@18
 | 
  4855  | 
% Definitions of (, ) and & used in args for functions.
  | 
| 
alpar@18
 | 
  4856  | 
% This is the definition of ( outside of all parentheses.
  | 
| 
alpar@18
 | 
  4857  | 
\gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested
 | 
| 
alpar@18
 | 
  4858  | 
  \global\advance\parencount by 1
  | 
| 
alpar@18
 | 
  4859  | 
}
  | 
| 
alpar@18
 | 
  4860  | 
%
  | 
| 
alpar@18
 | 
  4861  | 
% This is the definition of ( when already inside a level of parens.
  | 
| 
alpar@18
 | 
  4862  | 
\gdef\opnested{\char`\(\global\advance\parencount by 1 }
 | 
| 
alpar@18
 | 
  4863  | 
%
  | 
| 
alpar@18
 | 
  4864  | 
\gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0.
 | 
| 
alpar@18
 | 
  4865  | 
  % also in that case restore the outer-level definition of (.
  | 
| 
alpar@18
 | 
  4866  | 
  \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
 | 
| 
alpar@18
 | 
  4867  | 
  \global\advance \parencount by -1 }
  | 
| 
alpar@18
 | 
  4868  | 
% If we encounter &foo, then turn on ()-hacking afterwards
  | 
| 
alpar@18
 | 
  4869  | 
\gdef\amprm#1 {{\rm\}\let(=\oprm \let)=\clrm\ }
 | 
| 
alpar@18
 | 
  4870  | 
%
  | 
| 
alpar@18
 | 
  4871  | 
\gdef\normalparens{\boldbrax\let&=\ampnr}
 | 
| 
alpar@18
 | 
  4872  | 
} % End of definition inside \activeparens
  | 
| 
alpar@18
 | 
  4873  | 
%% These parens (in \boldbrax) actually are a little bolder than the
  | 
| 
alpar@18
 | 
  4874  | 
%% contained text.  This is especially needed for [ and ]
  | 
| 
alpar@18
 | 
  4875  | 
\def\opnr{{\sf\char`\(}\global\advance\parencount by 1 }
 | 
| 
alpar@18
 | 
  4876  | 
\def\clnr{{\sf\char`\)}\global\advance\parencount by -1 }
 | 
| 
alpar@18
 | 
  4877  | 
\let\ampnr = \&
  | 
| 
alpar@18
 | 
  4878  | 
\def\lbrb{{\bf\char`\[}}
 | 
| 
alpar@18
 | 
  4879  | 
\def\rbrb{{\bf\char`\]}}
 | 
| 
alpar@18
 | 
  4880  | 
  | 
| 
alpar@18
 | 
  4881  | 
% Active &'s sneak into the index arguments, so make sure it's defined.
  | 
| 
alpar@18
 | 
  4882  | 
{
 | 
| 
alpar@18
 | 
  4883  | 
  \catcode`& = \active
  | 
| 
alpar@18
 | 
  4884  | 
  \global\let& = \ampnr
  | 
| 
alpar@18
 | 
  4885  | 
}
  | 
| 
alpar@18
 | 
  4886  | 
  | 
| 
alpar@18
 | 
  4887  | 
% \defname, which formats the name of the @def (not the args).
  | 
| 
alpar@18
 | 
  4888  | 
% #1 is the function name.
  | 
| 
alpar@18
 | 
  4889  | 
% #2 is the type of definition, such as "Function".
  | 
| 
alpar@18
 | 
  4890  | 
%
  | 
| 
alpar@18
 | 
  4891  | 
\def\defname#1#2{%
 | 
| 
alpar@18
 | 
  4892  | 
  % How we'll output the type name.  Putting it in brackets helps
  | 
| 
alpar@18
 | 
  4893  | 
  % distinguish it from the body text that may end up on the next line
  | 
| 
alpar@18
 | 
  4894  | 
  % just below it.
  | 
| 
alpar@18
 | 
  4895  | 
  \ifempty{#2}%
 | 
| 
alpar@18
 | 
  4896  | 
    \def\defnametype{}%
 | 
| 
alpar@18
 | 
  4897  | 
  \else
  | 
| 
alpar@18
 | 
  4898  | 
    \def\defnametype{[\rm #2]}%
 | 
| 
alpar@18
 | 
  4899  | 
  \fi
  | 
| 
alpar@18
 | 
  4900  | 
  %
  | 
| 
alpar@18
 | 
  4901  | 
  % Get the values of \leftskip and \rightskip as they were outside the @def...
  | 
| 
alpar@18
 | 
  4902  | 
  \dimen2=\leftskip
  | 
| 
alpar@18
 | 
  4903  | 
  \advance\dimen2 by -\defbodyindent
  | 
| 
alpar@18
 | 
  4904  | 
  %
  | 
| 
alpar@18
 | 
  4905  | 
  % Figure out values for the paragraph shape.
  | 
| 
alpar@18
 | 
  4906  | 
  \setbox0=\hbox{\hskip \deflastargmargin{\defnametype}}%
 | 
| 
alpar@18
 | 
  4907  | 
  \dimen0=\hsize \advance \dimen0 by -\wd0  % compute size for first line
  | 
| 
alpar@18
 | 
  4908  | 
  \dimen1=\hsize \advance \dimen1 by -\defargsindent  % size for continuations
  | 
| 
alpar@18
 | 
  4909  | 
  \parshape 2 0in \dimen0 \defargsindent \dimen1
  | 
| 
alpar@18
 | 
  4910  | 
  %
  | 
| 
alpar@18
 | 
  4911  | 
  % Output arg 2 ("Function" or some such) but stuck inside a box of
 | 
| 
alpar@18
 | 
  4912  | 
  % width 0 so it does not interfere with linebreaking.
  | 
| 
alpar@18
 | 
  4913  | 
  \noindent
  | 
| 
alpar@18
 | 
  4914  | 
  %
  | 
| 
alpar@18
 | 
  4915  | 
  {% Adjust \hsize to exclude the ambient margins,
 | 
| 
alpar@18
 | 
  4916  | 
   % so that \rightline will obey them.
  | 
| 
alpar@18
 | 
  4917  | 
   \advance \hsize by -\dimen2
  | 
| 
alpar@18
 | 
  4918  | 
   \dimen3 = 0pt  % was -1.25pc
  | 
| 
alpar@18
 | 
  4919  | 
   \rlap{\rightline{\defnametype\kern\dimen3}}%
 | 
| 
alpar@18
 | 
  4920  | 
  }%
  | 
| 
alpar@18
 | 
  4921  | 
  %
  | 
| 
alpar@18
 | 
  4922  | 
  % Allow all lines to be underfull without complaint:
  | 
| 
alpar@18
 | 
  4923  | 
  \tolerance=10000 \hbadness=10000
  | 
| 
alpar@18
 | 
  4924  | 
  \advance\leftskip by -\defbodyindent
  | 
| 
alpar@18
 | 
  4925  | 
  \exdentamount=\defbodyindent
  | 
| 
alpar@18
 | 
  4926  | 
  {\df #1}\enskip        % output function name
 | 
| 
alpar@18
 | 
  4927  | 
  % \defunargs will be called next to output the arguments, if any.
  | 
| 
alpar@18
 | 
  4928  | 
}
  | 
| 
alpar@18
 | 
  4929  | 
  | 
| 
alpar@18
 | 
  4930  | 
% Common pieces to start any @def...
  | 
| 
alpar@18
 | 
  4931  | 
% #1 is the \E... control sequence to end the definition (which we define).
  | 
| 
alpar@18
 | 
  4932  | 
% #2 is the \...x control sequence (which our caller defines).
  | 
| 
alpar@18
 | 
  4933  | 
% #3 is the control sequence to process the header, such as \defunheader.
  | 
| 
alpar@18
 | 
  4934  | 
%
  | 
| 
alpar@18
 | 
  4935  | 
\def\parsebodycommon#1#2#3{%
 | 
| 
alpar@18
 | 
  4936  | 
  \begingroup\inENV
  | 
| 
alpar@18
 | 
  4937  | 
  % If there are two @def commands in a row, we'll have a \nobreak,
  | 
| 
alpar@18
 | 
  4938  | 
  % which is there to keep the function description together with its
  | 
| 
alpar@18
 | 
  4939  | 
  % header.  But if there's nothing but headers, we want to allow a
  | 
| 
alpar@18
 | 
  4940  | 
  % break after all.  Check for penalty 10002 (inserted by
  | 
| 
alpar@18
 | 
  4941  | 
  % \defargscommonending) instead of 10000, since the sectioning
  | 
| 
alpar@18
 | 
  4942  | 
  % commands insert a \penalty10000, and we don't want to allow a break
  | 
| 
alpar@18
 | 
  4943  | 
  % between a section heading and a defun.
  | 
| 
alpar@18
 | 
  4944  | 
  \ifnum\lastpenalty=10002 \penalty0 \fi
  | 
| 
alpar@18
 | 
  4945  | 
  \medbreak
  | 
| 
alpar@18
 | 
  4946  | 
  %
  | 
| 
alpar@18
 | 
  4947  | 
  % Define the \E... end token that this defining construct specifies
  | 
| 
alpar@18
 | 
  4948  | 
  % so that it will exit this group.
  | 
| 
alpar@18
 | 
  4949  | 
  \def#1{\endgraf\endgroup\medbreak}%
 | 
| 
alpar@18
 | 
  4950  | 
  %
  | 
| 
alpar@18
 | 
  4951  | 
  \parindent=0in
  | 
| 
alpar@18
 | 
  4952  | 
  \advance\leftskip by \defbodyindent
  | 
| 
alpar@18
 | 
  4953  | 
  \exdentamount=\defbodyindent
  | 
| 
alpar@18
 | 
  4954  | 
}
  | 
| 
alpar@18
 | 
  4955  | 
  | 
| 
alpar@18
 | 
  4956  | 
% Common part of the \...x definitions.
  | 
| 
alpar@18
 | 
  4957  | 
%
  | 
| 
alpar@18
 | 
  4958  | 
\def\defxbodycommon{%
 | 
| 
alpar@18
 | 
  4959  | 
  % As with \parsebodycommon above, allow line break if we have multiple
  | 
| 
alpar@18
 | 
  4960  | 
  % x headers in a row.  It's not a great place, though.
  | 
| 
alpar@18
 | 
  4961  | 
  \ifnum\lastpenalty=10000 \penalty1000 \fi
  | 
| 
alpar@18
 | 
  4962  | 
  %
  | 
| 
alpar@18
 | 
  4963  | 
  \begingroup\obeylines
  | 
| 
alpar@18
 | 
  4964  | 
}
  | 
| 
alpar@18
 | 
  4965  | 
  | 
| 
alpar@18
 | 
  4966  | 
% Process body of @defun, @deffn, @defmac, etc.
  | 
| 
alpar@18
 | 
  4967  | 
%
  | 
| 
alpar@18
 | 
  4968  | 
\def\defparsebody#1#2#3{%
 | 
| 
alpar@18
 | 
  4969  | 
  \parsebodycommon{#1}{#2}{#3}%
 | 
| 
alpar@18
 | 
  4970  | 
  \def#2{\defxbodycommon \activeparens \spacesplit#3}%
 | 
| 
alpar@18
 | 
  4971  | 
  \catcode\equalChar=\active
  | 
| 
alpar@18
 | 
  4972  | 
  \begingroup\obeylines\activeparens
  | 
| 
alpar@18
 | 
  4973  | 
  \spacesplit#3%
  | 
| 
alpar@18
 | 
  4974  | 
}
  | 
| 
alpar@18
 | 
  4975  | 
  | 
| 
alpar@18
 | 
  4976  | 
% #1, #2, #3 are the common arguments (see \parsebodycommon above).
  | 
| 
alpar@18
 | 
  4977  | 
% #4, delimited by the space, is the class name.
  | 
| 
alpar@18
 | 
  4978  | 
%
  | 
| 
alpar@18
 | 
  4979  | 
\def\defmethparsebody#1#2#3#4 {%
 | 
| 
alpar@18
 | 
  4980  | 
  \parsebodycommon{#1}{#2}{#3}%
 | 
| 
alpar@18
 | 
  4981  | 
  \def#2##1 {\defxbodycommon \activeparens \spacesplit{#3{##1}}}%
 | 
| 
alpar@18
 | 
  4982  | 
  \begingroup\obeylines\activeparens
  | 
| 
alpar@18
 | 
  4983  | 
  % The \empty here prevents misinterpretation of a construct such as
  | 
| 
alpar@18
 | 
  4984  | 
  %   @deffn {whatever} {Enharmonic comma}
 | 
| 
alpar@18
 | 
  4985  | 
  % See comments at \deftpparsebody, although in our case we don't have
  | 
| 
alpar@18
 | 
  4986  | 
  % to remove the \empty afterwards, since it is empty.
  | 
| 
alpar@18
 | 
  4987  | 
  \spacesplit{#3{#4}}\empty
 | 
| 
alpar@18
 | 
  4988  | 
}
  | 
| 
alpar@18
 | 
  4989  | 
  | 
| 
alpar@18
 | 
  4990  | 
% Used for @deftypemethod and @deftypeivar.
  | 
| 
alpar@18
 | 
  4991  | 
% #1, #2, #3 are the common arguments (see \defparsebody).
  | 
| 
alpar@18
 | 
  4992  | 
% #4, delimited by a space, is the class name.
  | 
| 
alpar@18
 | 
  4993  | 
% #5 is the method's return type.
  | 
| 
alpar@18
 | 
  4994  | 
%
  | 
| 
alpar@18
 | 
  4995  | 
\def\deftypemethparsebody#1#2#3#4 #5 {%
 | 
| 
alpar@18
 | 
  4996  | 
  \parsebodycommon{#1}{#2}{#3}%
 | 
| 
alpar@18
 | 
  4997  | 
  \def#2##1 ##2 {\defxbodycommon \activeparens \spacesplit{#3{##1}{##2}}}%
 | 
| 
alpar@18
 | 
  4998  | 
  \begingroup\obeylines\activeparens
  | 
| 
alpar@18
 | 
  4999  | 
  \spacesplit{#3{#4}{#5}}%
 | 
| 
alpar@18
 | 
  5000  | 
}
  | 
| 
alpar@18
 | 
  5001  | 
  | 
| 
alpar@18
 | 
  5002  | 
% Used for @deftypeop.  The change from \deftypemethparsebody is an
  | 
| 
alpar@18
 | 
  5003  | 
% extra argument at the beginning which is the `category', instead of it
  | 
| 
alpar@18
 | 
  5004  | 
% being the hardwired string `Method' or `Instance Variable'.  We have
  | 
| 
alpar@18
 | 
  5005  | 
% to account for this both in the \...x definition and in parsing the
  | 
| 
alpar@18
 | 
  5006  | 
% input at hand.  Thus also need a control sequence (passed as #5) for
  | 
| 
alpar@18
 | 
  5007  | 
% the \E... definition to assign the category name to.
  | 
| 
alpar@18
 | 
  5008  | 
%
  | 
| 
alpar@18
 | 
  5009  | 
\def\deftypeopparsebody#1#2#3#4#5 #6 {%
 | 
| 
alpar@18
 | 
  5010  | 
  \parsebodycommon{#1}{#2}{#3}%
 | 
| 
alpar@18
 | 
  5011  | 
  \def#2##1 ##2 ##3 {\def#4{##1}%
 | 
| 
alpar@18
 | 
  5012  | 
    \defxbodycommon \activeparens \spacesplit{#3{##2}{##3}}}%
 | 
| 
alpar@18
 | 
  5013  | 
  \begingroup\obeylines\activeparens
  | 
| 
alpar@18
 | 
  5014  | 
  \spacesplit{#3{#5}{#6}}%
 | 
| 
alpar@18
 | 
  5015  | 
}
  | 
| 
alpar@18
 | 
  5016  | 
  | 
| 
alpar@18
 | 
  5017  | 
% For @defop.
  | 
| 
alpar@18
 | 
  5018  | 
\def\defopparsebody #1#2#3#4#5 {%
 | 
| 
alpar@18
 | 
  5019  | 
  \parsebodycommon{#1}{#2}{#3}%
 | 
| 
alpar@18
 | 
  5020  | 
  \def#2##1 ##2 {\def#4{##1}%
 | 
| 
alpar@18
 | 
  5021  | 
    \defxbodycommon \activeparens \spacesplit{#3{##2}}}%
 | 
| 
alpar@18
 | 
  5022  | 
  \begingroup\obeylines\activeparens
  | 
| 
alpar@18
 | 
  5023  | 
  \spacesplit{#3{#5}}%
 | 
| 
alpar@18
 | 
  5024  | 
}
  | 
| 
alpar@18
 | 
  5025  | 
  | 
| 
alpar@18
 | 
  5026  | 
% These parsing functions are similar to the preceding ones
  | 
| 
alpar@18
 | 
  5027  | 
% except that they do not make parens into active characters.
  | 
| 
alpar@18
 | 
  5028  | 
% These are used for "variables" since they have no arguments.
  | 
| 
alpar@18
 | 
  5029  | 
%
  | 
| 
alpar@18
 | 
  5030  | 
\def\defvarparsebody #1#2#3{%
 | 
| 
alpar@18
 | 
  5031  | 
  \parsebodycommon{#1}{#2}{#3}%
 | 
| 
alpar@18
 | 
  5032  | 
  \def#2{\defxbodycommon \spacesplit#3}%
 | 
| 
alpar@18
 | 
  5033  | 
  \catcode\equalChar=\active
  | 
| 
alpar@18
 | 
  5034  | 
  \begingroup\obeylines
  | 
| 
alpar@18
 | 
  5035  | 
  \spacesplit#3%
  | 
| 
alpar@18
 | 
  5036  | 
}
  | 
| 
alpar@18
 | 
  5037  | 
  | 
| 
alpar@18
 | 
  5038  | 
% @defopvar.
  | 
| 
alpar@18
 | 
  5039  | 
\def\defopvarparsebody #1#2#3#4#5 {%
 | 
| 
alpar@18
 | 
  5040  | 
  \parsebodycommon{#1}{#2}{#3}%
 | 
| 
alpar@18
 | 
  5041  | 
  \def#2##1 ##2 {\def#4{##1}%
 | 
| 
alpar@18
 | 
  5042  | 
    \defxbodycommon \spacesplit{#3{##2}}}%
 | 
| 
alpar@18
 | 
  5043  | 
  \begingroup\obeylines
  | 
| 
alpar@18
 | 
  5044  | 
  \spacesplit{#3{#5}}%
 | 
| 
alpar@18
 | 
  5045  | 
}
  | 
| 
alpar@18
 | 
  5046  | 
  | 
| 
alpar@18
 | 
  5047  | 
\def\defvrparsebody#1#2#3#4 {%
 | 
| 
alpar@18
 | 
  5048  | 
  \parsebodycommon{#1}{#2}{#3}%
 | 
| 
alpar@18
 | 
  5049  | 
  \def#2##1 {\defxbodycommon \spacesplit{#3{##1}}}%
 | 
| 
alpar@18
 | 
  5050  | 
  \begingroup\obeylines
  | 
| 
alpar@18
 | 
  5051  | 
  \spacesplit{#3{#4}}%
 | 
| 
alpar@18
 | 
  5052  | 
}
  | 
| 
alpar@18
 | 
  5053  | 
  | 
| 
alpar@18
 | 
  5054  | 
% This loses on `@deftp {Data Type} {struct termios}' -- it thinks the
 | 
| 
alpar@18
 | 
  5055  | 
% type is just `struct', because we lose the braces in `{struct
 | 
| 
alpar@18
 | 
  5056  | 
% termios}' when \spacesplit reads its undelimited argument.  Sigh.
  | 
| 
alpar@18
 | 
  5057  | 
% \let\deftpparsebody=\defvrparsebody
  | 
| 
alpar@18
 | 
  5058  | 
%
  | 
| 
alpar@18
 | 
  5059  | 
% So, to get around this, we put \empty in with the type name.  That
  | 
| 
alpar@18
 | 
  5060  | 
% way, TeX won't find exactly `{...}' as an undelimited argument, and
 | 
| 
alpar@18
 | 
  5061  | 
% won't strip off the braces.
  | 
| 
alpar@18
 | 
  5062  | 
%
  | 
| 
alpar@18
 | 
  5063  | 
\def\deftpparsebody #1#2#3#4 {%
 | 
| 
alpar@18
 | 
  5064  | 
  \parsebodycommon{#1}{#2}{#3}%
 | 
| 
alpar@18
 | 
  5065  | 
  \def#2##1 {\defxbodycommon \spacesplit{#3{##1}}}%
 | 
| 
alpar@18
 | 
  5066  | 
  \begingroup\obeylines
  | 
| 
alpar@18
 | 
  5067  | 
  \spacesplit{\parsetpheaderline{#3{#4}}}\empty
 | 
| 
alpar@18
 | 
  5068  | 
}
  | 
| 
alpar@18
 | 
  5069  | 
  | 
| 
alpar@18
 | 
  5070  | 
% Fine, but then we have to eventually remove the \empty *and* the
  | 
| 
alpar@18
 | 
  5071  | 
% braces (if any).  That's what this does.
  | 
| 
alpar@18
 | 
  5072  | 
%
  | 
| 
alpar@18
 | 
  5073  | 
\def\removeemptybraces\empty#1\relax{#1}
 | 
| 
alpar@18
 | 
  5074  | 
  | 
| 
alpar@18
 | 
  5075  | 
% After \spacesplit has done its work, this is called -- #1 is the final
  | 
| 
alpar@18
 | 
  5076  | 
% thing to call, #2 the type name (which starts with \empty), and #3
  | 
| 
alpar@18
 | 
  5077  | 
% (which might be empty) the arguments.
  | 
| 
alpar@18
 | 
  5078  | 
%
  | 
| 
alpar@18
 | 
  5079  | 
\def\parsetpheaderline#1#2#3{%
 | 
| 
alpar@18
 | 
  5080  | 
  #1{\removeemptybraces#2\relax}{#3}%
 | 
| 
alpar@18
 | 
  5081  | 
}%
  | 
| 
alpar@18
 | 
  5082  | 
  | 
| 
alpar@18
 | 
  5083  | 
% Split up #2 (the rest of the input line) at the first space token.
  | 
| 
alpar@18
 | 
  5084  | 
% call #1 with two arguments:
  | 
| 
alpar@18
 | 
  5085  | 
%  the first is all of #2 before the space token,
  | 
| 
alpar@18
 | 
  5086  | 
%  the second is all of #2 after that space token.
  | 
| 
alpar@18
 | 
  5087  | 
% If #2 contains no space token, all of it is passed as the first arg
  | 
| 
alpar@18
 | 
  5088  | 
% and the second is passed as empty.
  | 
| 
alpar@18
 | 
  5089  | 
%
  | 
| 
alpar@18
 | 
  5090  | 
{\obeylines %
 | 
| 
alpar@18
 | 
  5091  | 
 \gdef\spacesplit#1#2^^M{\endgroup\spacesplitx{#1}#2 \relax\spacesplitx}%
 | 
| 
alpar@18
 | 
  5092  | 
 \long\gdef\spacesplitx#1#2 #3#4\spacesplitx{%
 | 
| 
alpar@18
 | 
  5093  | 
   \ifx\relax #3%
  | 
| 
alpar@18
 | 
  5094  | 
     #1{#2}{}%
 | 
| 
alpar@18
 | 
  5095  | 
   \else %
  | 
| 
alpar@18
 | 
  5096  | 
     #1{#2}{#3#4}%
 | 
| 
alpar@18
 | 
  5097  | 
   \fi}%
  | 
| 
alpar@18
 | 
  5098  | 
}
  | 
| 
alpar@18
 | 
  5099  | 
  | 
| 
alpar@18
 | 
  5100  | 
% Define @defun.
  | 
| 
alpar@18
 | 
  5101  | 
  | 
| 
alpar@18
 | 
  5102  | 
% This is called to end the arguments processing for all the @def... commands.
  | 
| 
alpar@18
 | 
  5103  | 
%
  | 
| 
alpar@18
 | 
  5104  | 
\def\defargscommonending{%
 | 
| 
alpar@18
 | 
  5105  | 
  \interlinepenalty = 10000
  | 
| 
alpar@18
 | 
  5106  | 
  \advance\rightskip by 0pt plus 1fil
  | 
| 
alpar@18
 | 
  5107  | 
  \endgraf
  | 
| 
alpar@18
 | 
  5108  | 
  \nobreak\vskip -\parskip
  | 
| 
alpar@18
 | 
  5109  | 
  \penalty 10002  % signal to \parsebodycommon.
  | 
| 
alpar@18
 | 
  5110  | 
}
  | 
| 
alpar@18
 | 
  5111  | 
  | 
| 
alpar@18
 | 
  5112  | 
% This expands the args and terminates the paragraph they comprise.
  | 
| 
alpar@18
 | 
  5113  | 
%
  | 
| 
alpar@18
 | 
  5114  | 
\def\defunargs#1{\functionparens \sl
 | 
| 
alpar@18
 | 
  5115  | 
% Expand, preventing hyphenation at `-' chars.
  | 
| 
alpar@18
 | 
  5116  | 
% Note that groups don't affect changes in \hyphenchar.
  | 
| 
alpar@18
 | 
  5117  | 
% Set the font temporarily and use \font in case \setfont made \tensl a macro.
  | 
| 
alpar@18
 | 
  5118  | 
{\tensl\hyphenchar\font=0}%
 | 
| 
alpar@18
 | 
  5119  | 
#1%
  | 
| 
alpar@18
 | 
  5120  | 
{\tensl\hyphenchar\font=45}%
 | 
| 
alpar@18
 | 
  5121  | 
\ifnum\parencount=0 \else \errmessage{Unbalanced parentheses in @def}\fi%
 | 
| 
alpar@18
 | 
  5122  | 
  \defargscommonending
  | 
| 
alpar@18
 | 
  5123  | 
}
  | 
| 
alpar@18
 | 
  5124  | 
  | 
| 
alpar@18
 | 
  5125  | 
\def\deftypefunargs #1{%
 | 
| 
alpar@18
 | 
  5126  | 
% Expand, preventing hyphenation at `-' chars.
  | 
| 
alpar@18
 | 
  5127  | 
% Note that groups don't affect changes in \hyphenchar.
  | 
| 
alpar@18
 | 
  5128  | 
% Use \boldbraxnoamp, not \functionparens, so that & is not special.
  | 
| 
alpar@18
 | 
  5129  | 
\boldbraxnoamp
  | 
| 
alpar@18
 | 
  5130  | 
\tclose{#1}% avoid \code because of side effects on active chars
 | 
| 
alpar@18
 | 
  5131  | 
  \defargscommonending
  | 
| 
alpar@18
 | 
  5132  | 
}
  | 
| 
alpar@18
 | 
  5133  | 
  | 
| 
alpar@18
 | 
  5134  | 
% Do complete processing of one @defun or @defunx line already parsed.
  | 
| 
alpar@18
 | 
  5135  | 
  | 
| 
alpar@18
 | 
  5136  | 
% @deffn Command forward-char nchars
  | 
| 
alpar@18
 | 
  5137  | 
  | 
| 
alpar@18
 | 
  5138  | 
\def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader}
 | 
| 
alpar@18
 | 
  5139  | 
  | 
| 
alpar@18
 | 
  5140  | 
\def\deffnheader #1#2#3{\doind {fn}{\code{#2}}%
 | 
| 
alpar@18
 | 
  5141  | 
\begingroup\defname {#2}{#1}\defunargs{#3}\endgroup %
 | 
| 
alpar@18
 | 
  5142  | 
\catcode\equalChar=\other % Turn off change made in \defparsebody
  | 
| 
alpar@18
 | 
  5143  | 
}
  | 
| 
alpar@18
 | 
  5144  | 
  | 
| 
alpar@18
 | 
  5145  | 
% @defun == @deffn Function
  | 
| 
alpar@18
 | 
  5146  | 
  | 
| 
alpar@18
 | 
  5147  | 
\def\defun{\defparsebody\Edefun\defunx\defunheader}
 | 
| 
alpar@18
 | 
  5148  | 
  | 
| 
alpar@18
 | 
  5149  | 
\def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
 | 
| 
alpar@18
 | 
  5150  | 
\begingroup\defname {#1}{\putwordDeffunc}%
 | 
| 
alpar@18
 | 
  5151  | 
\defunargs {#2}\endgroup %
 | 
| 
alpar@18
 | 
  5152  | 
\catcode\equalChar=\other % Turn off change made in \defparsebody
  | 
| 
alpar@18
 | 
  5153  | 
}
  | 
| 
alpar@18
 | 
  5154  | 
  | 
| 
alpar@18
 | 
  5155  | 
% @deftypefun int foobar (int @var{foo}, float @var{bar})
 | 
| 
alpar@18
 | 
  5156  | 
  | 
| 
alpar@18
 | 
  5157  | 
\def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader}
 | 
| 
alpar@18
 | 
  5158  | 
  | 
| 
alpar@18
 | 
  5159  | 
% #1 is the data type.  #2 is the name and args.
  | 
| 
alpar@18
 | 
  5160  | 
\def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax}
 | 
| 
alpar@18
 | 
  5161  | 
% #1 is the data type, #2 the name, #3 the args.
  | 
| 
alpar@18
 | 
  5162  | 
\def\deftypefunheaderx #1#2 #3\relax{%
 | 
| 
alpar@18
 | 
  5163  | 
\doind {fn}{\code{#2}}% Make entry in function index
 | 
| 
alpar@18
 | 
  5164  | 
\begingroup\defname {\defheaderxcond#1\relax$.$#2}{\putwordDeftypefun}%
 | 
| 
alpar@18
 | 
  5165  | 
\deftypefunargs {#3}\endgroup %
 | 
| 
alpar@18
 | 
  5166  | 
\catcode\equalChar=\other % Turn off change made in \defparsebody
  | 
| 
alpar@18
 | 
  5167  | 
}
  | 
| 
alpar@18
 | 
  5168  | 
  | 
| 
alpar@18
 | 
  5169  | 
% @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar})
 | 
| 
alpar@18
 | 
  5170  | 
  | 
| 
alpar@18
 | 
  5171  | 
\def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader}
 | 
| 
alpar@18
 | 
  5172  | 
  | 
| 
alpar@18
 | 
  5173  | 
% \defheaderxcond#1\relax$.$
  | 
| 
alpar@18
 | 
  5174  | 
% puts #1 in @code, followed by a space, but does nothing if #1 is null.
  | 
| 
alpar@18
 | 
  5175  | 
\def\defheaderxcond#1#2$.${\ifx#1\relax\else\code{#1#2} \fi}
 | 
| 
alpar@18
 | 
  5176  | 
  | 
| 
alpar@18
 | 
  5177  | 
% #1 is the classification.  #2 is the data type.  #3 is the name and args.
  | 
| 
alpar@18
 | 
  5178  | 
\def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax}
 | 
| 
alpar@18
 | 
  5179  | 
% #1 is the classification, #2 the data type, #3 the name, #4 the args.
  | 
| 
alpar@18
 | 
  5180  | 
\def\deftypefnheaderx #1#2#3 #4\relax{%
 | 
| 
alpar@18
 | 
  5181  | 
\doind {fn}{\code{#3}}% Make entry in function index
 | 
| 
alpar@18
 | 
  5182  | 
\begingroup
  | 
| 
alpar@18
 | 
  5183  | 
\normalparens % notably, turn off `&' magic, which prevents
  | 
| 
alpar@18
 | 
  5184  | 
%               at least some C++ text from working
  | 
| 
alpar@18
 | 
  5185  | 
\defname {\defheaderxcond#2\relax$.$#3}{#1}%
 | 
| 
alpar@18
 | 
  5186  | 
\deftypefunargs {#4}\endgroup %
 | 
| 
alpar@18
 | 
  5187  | 
\catcode\equalChar=\other % Turn off change made in \defparsebody
  | 
| 
alpar@18
 | 
  5188  | 
}
  | 
| 
alpar@18
 | 
  5189  | 
  | 
| 
alpar@18
 | 
  5190  | 
% @defmac == @deffn Macro
  | 
| 
alpar@18
 | 
  5191  | 
  | 
| 
alpar@18
 | 
  5192  | 
\def\defmac{\defparsebody\Edefmac\defmacx\defmacheader}
 | 
| 
alpar@18
 | 
  5193  | 
  | 
| 
alpar@18
 | 
  5194  | 
\def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
 | 
| 
alpar@18
 | 
  5195  | 
\begingroup\defname {#1}{\putwordDefmac}%
 | 
| 
alpar@18
 | 
  5196  | 
\defunargs {#2}\endgroup %
 | 
| 
alpar@18
 | 
  5197  | 
\catcode\equalChar=\other % Turn off change made in \defparsebody
  | 
| 
alpar@18
 | 
  5198  | 
}
  | 
| 
alpar@18
 | 
  5199  | 
  | 
| 
alpar@18
 | 
  5200  | 
% @defspec == @deffn Special Form
  | 
| 
alpar@18
 | 
  5201  | 
  | 
| 
alpar@18
 | 
  5202  | 
\def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
 | 
| 
alpar@18
 | 
  5203  | 
  | 
| 
alpar@18
 | 
  5204  | 
\def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
 | 
| 
alpar@18
 | 
  5205  | 
\begingroup\defname {#1}{\putwordDefspec}%
 | 
| 
alpar@18
 | 
  5206  | 
\defunargs {#2}\endgroup %
 | 
| 
alpar@18
 | 
  5207  | 
\catcode\equalChar=\other % Turn off change made in \defparsebody
  | 
| 
alpar@18
 | 
  5208  | 
}
  | 
| 
alpar@18
 | 
  5209  | 
  | 
| 
alpar@18
 | 
  5210  | 
% @defop CATEGORY CLASS OPERATION ARG...
  | 
| 
alpar@18
 | 
  5211  | 
%
  | 
| 
alpar@18
 | 
  5212  | 
\def\defop #1 {\def\defoptype{#1}%
 | 
| 
alpar@18
 | 
  5213  | 
\defopparsebody\Edefop\defopx\defopheader\defoptype}
  | 
| 
alpar@18
 | 
  5214  | 
%
  | 
| 
alpar@18
 | 
  5215  | 
\def\defopheader#1#2#3{%
 | 
| 
alpar@18
 | 
  5216  | 
  \dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% function index entry
 | 
| 
alpar@18
 | 
  5217  | 
  \begingroup
  | 
| 
alpar@18
 | 
  5218  | 
    \defname{#2}{\defoptype\ \putwordon\ #1}%
 | 
| 
alpar@18
 | 
  5219  | 
    \defunargs{#3}%
 | 
| 
alpar@18
 | 
  5220  | 
  \endgroup
  | 
| 
alpar@18
 | 
  5221  | 
}
  | 
| 
alpar@18
 | 
  5222  | 
  | 
| 
alpar@18
 | 
  5223  | 
% @deftypeop CATEGORY CLASS TYPE OPERATION ARG...
  | 
| 
alpar@18
 | 
  5224  | 
%
  | 
| 
alpar@18
 | 
  5225  | 
\def\deftypeop #1 {\def\deftypeopcategory{#1}%
 | 
| 
alpar@18
 | 
  5226  | 
  \deftypeopparsebody\Edeftypeop\deftypeopx\deftypeopheader
  | 
| 
alpar@18
 | 
  5227  | 
                       \deftypeopcategory}
  | 
| 
alpar@18
 | 
  5228  | 
%
  | 
| 
alpar@18
 | 
  5229  | 
% #1 is the class name, #2 the data type, #3 the operation name, #4 the args.
  | 
| 
alpar@18
 | 
  5230  | 
\def\deftypeopheader#1#2#3#4{%
 | 
| 
alpar@18
 | 
  5231  | 
  \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index
 | 
| 
alpar@18
 | 
  5232  | 
  \begingroup
  | 
| 
alpar@18
 | 
  5233  | 
    \defname{\defheaderxcond#2\relax$.$#3}
 | 
| 
alpar@18
 | 
  5234  | 
            {\deftypeopcategory\ \putwordon\ \code{#1}}%
 | 
| 
alpar@18
 | 
  5235  | 
    \deftypefunargs{#4}%
 | 
| 
alpar@18
 | 
  5236  | 
  \endgroup
  | 
| 
alpar@18
 | 
  5237  | 
}
  | 
| 
alpar@18
 | 
  5238  | 
  | 
| 
alpar@18
 | 
  5239  | 
% @deftypemethod CLASS TYPE METHOD ARG...
  | 
| 
alpar@18
 | 
  5240  | 
%
  | 
| 
alpar@18
 | 
  5241  | 
\def\deftypemethod{%
 | 
| 
alpar@18
 | 
  5242  | 
  \deftypemethparsebody\Edeftypemethod\deftypemethodx\deftypemethodheader}
  | 
| 
alpar@18
 | 
  5243  | 
%
  | 
| 
alpar@18
 | 
  5244  | 
% #1 is the class name, #2 the data type, #3 the method name, #4 the args.
  | 
| 
alpar@18
 | 
  5245  | 
\def\deftypemethodheader#1#2#3#4{%
 | 
| 
alpar@18
 | 
  5246  | 
  \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index
 | 
| 
alpar@18
 | 
  5247  | 
  \begingroup
  | 
| 
alpar@18
 | 
  5248  | 
    \defname{\defheaderxcond#2\relax$.$#3}{\putwordMethodon\ \code{#1}}%
 | 
| 
alpar@18
 | 
  5249  | 
    \deftypefunargs{#4}%
 | 
| 
alpar@18
 | 
  5250  | 
  \endgroup
  | 
| 
alpar@18
 | 
  5251  | 
}
  | 
| 
alpar@18
 | 
  5252  | 
  | 
| 
alpar@18
 | 
  5253  | 
% @deftypeivar CLASS TYPE VARNAME
  | 
| 
alpar@18
 | 
  5254  | 
%
  | 
| 
alpar@18
 | 
  5255  | 
\def\deftypeivar{%
 | 
| 
alpar@18
 | 
  5256  | 
  \deftypemethparsebody\Edeftypeivar\deftypeivarx\deftypeivarheader}
  | 
| 
alpar@18
 | 
  5257  | 
%
  | 
| 
alpar@18
 | 
  5258  | 
% #1 is the class name, #2 the data type, #3 the variable name.
  | 
| 
alpar@18
 | 
  5259  | 
\def\deftypeivarheader#1#2#3{%
 | 
| 
alpar@18
 | 
  5260  | 
  \dosubind{vr}{\code{#3}}{\putwordof\ \code{#1}}% entry in variable index
 | 
| 
alpar@18
 | 
  5261  | 
  \begingroup
  | 
| 
alpar@18
 | 
  5262  | 
    \defname{\defheaderxcond#2\relax$.$#3}
 | 
| 
alpar@18
 | 
  5263  | 
            {\putwordInstanceVariableof\ \code{#1}}%
 | 
| 
alpar@18
 | 
  5264  | 
    \defvarargs{#3}%
 | 
| 
alpar@18
 | 
  5265  | 
  \endgroup
  | 
| 
alpar@18
 | 
  5266  | 
}
  | 
| 
alpar@18
 | 
  5267  | 
  | 
| 
alpar@18
 | 
  5268  | 
% @defmethod == @defop Method
  | 
| 
alpar@18
 | 
  5269  | 
%
  | 
| 
alpar@18
 | 
  5270  | 
\def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
 | 
| 
alpar@18
 | 
  5271  | 
%
  | 
| 
alpar@18
 | 
  5272  | 
% #1 is the class name, #2 the method name, #3 the args.
  | 
| 
alpar@18
 | 
  5273  | 
\def\defmethodheader#1#2#3{%
 | 
| 
alpar@18
 | 
  5274  | 
  \dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% entry in function index
 | 
| 
alpar@18
 | 
  5275  | 
  \begingroup
  | 
| 
alpar@18
 | 
  5276  | 
    \defname{#2}{\putwordMethodon\ \code{#1}}%
 | 
| 
alpar@18
 | 
  5277  | 
    \defunargs{#3}%
 | 
| 
alpar@18
 | 
  5278  | 
  \endgroup
  | 
| 
alpar@18
 | 
  5279  | 
}
  | 
| 
alpar@18
 | 
  5280  | 
  | 
| 
alpar@18
 | 
  5281  | 
% @defcv {Class Option} foo-class foo-flag
 | 
| 
alpar@18
 | 
  5282  | 
  | 
| 
alpar@18
 | 
  5283  | 
\def\defcv #1 {\def\defcvtype{#1}%
 | 
| 
alpar@18
 | 
  5284  | 
\defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}
  | 
| 
alpar@18
 | 
  5285  | 
  | 
| 
alpar@18
 | 
  5286  | 
\def\defcvarheader #1#2#3{%
 | 
| 
alpar@18
 | 
  5287  | 
  \dosubind{vr}{\code{#2}}{\putwordof\ \code{#1}}% variable index entry
 | 
| 
alpar@18
 | 
  5288  | 
  \begingroup
  | 
| 
alpar@18
 | 
  5289  | 
    \defname{#2}{\defcvtype\ \putwordof\ #1}%
 | 
| 
alpar@18
 | 
  5290  | 
    \defvarargs{#3}%
 | 
| 
alpar@18
 | 
  5291  | 
  \endgroup
  | 
| 
alpar@18
 | 
  5292  | 
}
  | 
| 
alpar@18
 | 
  5293  | 
  | 
| 
alpar@18
 | 
  5294  | 
% @defivar CLASS VARNAME == @defcv {Instance Variable} CLASS VARNAME
 | 
| 
alpar@18
 | 
  5295  | 
%
  | 
| 
alpar@18
 | 
  5296  | 
\def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader}
 | 
| 
alpar@18
 | 
  5297  | 
%
  | 
| 
alpar@18
 | 
  5298  | 
\def\defivarheader#1#2#3{%
 | 
| 
alpar@18
 | 
  5299  | 
  \dosubind{vr}{\code{#2}}{\putwordof\ \code{#1}}% entry in var index
 | 
| 
alpar@18
 | 
  5300  | 
  \begingroup
  | 
| 
alpar@18
 | 
  5301  | 
    \defname{#2}{\putwordInstanceVariableof\ #1}%
 | 
| 
alpar@18
 | 
  5302  | 
    \defvarargs{#3}%
 | 
| 
alpar@18
 | 
  5303  | 
  \endgroup
  | 
| 
alpar@18
 | 
  5304  | 
}
  | 
| 
alpar@18
 | 
  5305  | 
  | 
| 
alpar@18
 | 
  5306  | 
% @defvar
  | 
| 
alpar@18
 | 
  5307  | 
% First, define the processing that is wanted for arguments of @defvar.
  | 
| 
alpar@18
 | 
  5308  | 
% This is actually simple: just print them in roman.
  | 
| 
alpar@18
 | 
  5309  | 
% This must expand the args and terminate the paragraph they make up
  | 
| 
alpar@18
 | 
  5310  | 
\def\defvarargs #1{\normalparens #1%
 | 
| 
alpar@18
 | 
  5311  | 
  \defargscommonending
  | 
| 
alpar@18
 | 
  5312  | 
}
  | 
| 
alpar@18
 | 
  5313  | 
  | 
| 
alpar@18
 | 
  5314  | 
% @defvr Counter foo-count
  | 
| 
alpar@18
 | 
  5315  | 
  | 
| 
alpar@18
 | 
  5316  | 
\def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader}
 | 
| 
alpar@18
 | 
  5317  | 
  | 
| 
alpar@18
 | 
  5318  | 
\def\defvrheader #1#2#3{\doind {vr}{\code{#2}}%
 | 
| 
alpar@18
 | 
  5319  | 
\begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup}
 | 
| 
alpar@18
 | 
  5320  | 
  | 
| 
alpar@18
 | 
  5321  | 
% @defvar == @defvr Variable
  | 
| 
alpar@18
 | 
  5322  | 
  | 
| 
alpar@18
 | 
  5323  | 
\def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader}
 | 
| 
alpar@18
 | 
  5324  | 
  | 
| 
alpar@18
 | 
  5325  | 
\def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
 | 
| 
alpar@18
 | 
  5326  | 
\begingroup\defname {#1}{\putwordDefvar}%
 | 
| 
alpar@18
 | 
  5327  | 
\defvarargs {#2}\endgroup %
 | 
| 
alpar@18
 | 
  5328  | 
}
  | 
| 
alpar@18
 | 
  5329  | 
  | 
| 
alpar@18
 | 
  5330  | 
% @defopt == @defvr {User Option}
 | 
| 
alpar@18
 | 
  5331  | 
  | 
| 
alpar@18
 | 
  5332  | 
\def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader}
 | 
| 
alpar@18
 | 
  5333  | 
  | 
| 
alpar@18
 | 
  5334  | 
\def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
 | 
| 
alpar@18
 | 
  5335  | 
\begingroup\defname {#1}{\putwordDefopt}%
 | 
| 
alpar@18
 | 
  5336  | 
\defvarargs {#2}\endgroup %
 | 
| 
alpar@18
 | 
  5337  | 
}
  | 
| 
alpar@18
 | 
  5338  | 
  | 
| 
alpar@18
 | 
  5339  | 
% @deftypevar int foobar
  | 
| 
alpar@18
 | 
  5340  | 
  | 
| 
alpar@18
 | 
  5341  | 
\def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader}
 | 
| 
alpar@18
 | 
  5342  | 
  | 
| 
alpar@18
 | 
  5343  | 
% #1 is the data type.  #2 is the name, perhaps followed by text that
  | 
| 
alpar@18
 | 
  5344  | 
% is actually part of the data type, which should not be put into the index.
  | 
| 
alpar@18
 | 
  5345  | 
\def\deftypevarheader #1#2{%
 | 
| 
alpar@18
 | 
  5346  | 
\dovarind#2 \relax% Make entry in variables index
  | 
| 
alpar@18
 | 
  5347  | 
\begingroup\defname {\defheaderxcond#1\relax$.$#2}{\putwordDeftypevar}%
 | 
| 
alpar@18
 | 
  5348  | 
  \defargscommonending
  | 
| 
alpar@18
 | 
  5349  | 
\endgroup}
  | 
| 
alpar@18
 | 
  5350  | 
\def\dovarind#1 #2\relax{\doind{vr}{\code{#1}}}
 | 
| 
alpar@18
 | 
  5351  | 
  | 
| 
alpar@18
 | 
  5352  | 
% @deftypevr {Global Flag} int enable
 | 
| 
alpar@18
 | 
  5353  | 
  | 
| 
alpar@18
 | 
  5354  | 
\def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader}
 | 
| 
alpar@18
 | 
  5355  | 
  | 
| 
alpar@18
 | 
  5356  | 
\def\deftypevrheader #1#2#3{\dovarind#3 \relax%
 | 
| 
alpar@18
 | 
  5357  | 
\begingroup\defname {\defheaderxcond#2\relax$.$#3}{#1}
 | 
| 
alpar@18
 | 
  5358  | 
  \defargscommonending
  | 
| 
alpar@18
 | 
  5359  | 
\endgroup}
  | 
| 
alpar@18
 | 
  5360  | 
  | 
| 
alpar@18
 | 
  5361  | 
% Now define @deftp
  | 
| 
alpar@18
 | 
  5362  | 
% Args are printed in bold, a slight difference from @defvar.
  | 
| 
alpar@18
 | 
  5363  | 
  | 
| 
alpar@18
 | 
  5364  | 
\def\deftpargs #1{\bf \defvarargs{#1}}
 | 
| 
alpar@18
 | 
  5365  | 
  | 
| 
alpar@18
 | 
  5366  | 
% @deftp Class window height width ...
  | 
| 
alpar@18
 | 
  5367  | 
  | 
| 
alpar@18
 | 
  5368  | 
\def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader}
 | 
| 
alpar@18
 | 
  5369  | 
  | 
| 
alpar@18
 | 
  5370  | 
\def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
 | 
| 
alpar@18
 | 
  5371  | 
\begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
 | 
| 
alpar@18
 | 
  5372  | 
  | 
| 
alpar@18
 | 
  5373  | 
% These definitions are used if you use @defunx (etc.)
  | 
| 
alpar@18
 | 
  5374  | 
% anywhere other than immediately after a @defun or @defunx.
  | 
| 
alpar@18
 | 
  5375  | 
%
  | 
| 
alpar@18
 | 
  5376  | 
\def\defcvx#1 {\errmessage{@defcvx in invalid context}}
 | 
| 
alpar@18
 | 
  5377  | 
\def\deffnx#1 {\errmessage{@deffnx in invalid context}}
 | 
| 
alpar@18
 | 
  5378  | 
\def\defivarx#1 {\errmessage{@defivarx in invalid context}}
 | 
| 
alpar@18
 | 
  5379  | 
\def\defmacx#1 {\errmessage{@defmacx in invalid context}}
 | 
| 
alpar@18
 | 
  5380  | 
\def\defmethodx#1 {\errmessage{@defmethodx in invalid context}}
 | 
| 
alpar@18
 | 
  5381  | 
\def\defoptx #1 {\errmessage{@defoptx in invalid context}}
 | 
| 
alpar@18
 | 
  5382  | 
\def\defopx#1 {\errmessage{@defopx in invalid context}}
 | 
| 
alpar@18
 | 
  5383  | 
\def\defspecx#1 {\errmessage{@defspecx in invalid context}}
 | 
| 
alpar@18
 | 
  5384  | 
\def\deftpx#1 {\errmessage{@deftpx in invalid context}}
 | 
| 
alpar@18
 | 
  5385  | 
\def\deftypefnx#1 {\errmessage{@deftypefnx in invalid context}}
 | 
| 
alpar@18
 | 
  5386  | 
\def\deftypefunx#1 {\errmessage{@deftypefunx in invalid context}}
 | 
| 
alpar@18
 | 
  5387  | 
\def\deftypeivarx#1 {\errmessage{@deftypeivarx in invalid context}}
 | 
| 
alpar@18
 | 
  5388  | 
\def\deftypemethodx#1 {\errmessage{@deftypemethodx in invalid context}}
 | 
| 
alpar@18
 | 
  5389  | 
\def\deftypeopx#1 {\errmessage{@deftypeopx in invalid context}}
 | 
| 
alpar@18
 | 
  5390  | 
\def\deftypevarx#1 {\errmessage{@deftypevarx in invalid context}}
 | 
| 
alpar@18
 | 
  5391  | 
\def\deftypevrx#1 {\errmessage{@deftypevrx in invalid context}}
 | 
| 
alpar@18
 | 
  5392  | 
\def\defunx#1 {\errmessage{@defunx in invalid context}}
 | 
| 
alpar@18
 | 
  5393  | 
\def\defvarx#1 {\errmessage{@defvarx in invalid context}}
 | 
| 
alpar@18
 | 
  5394  | 
\def\defvrx#1 {\errmessage{@defvrx in invalid context}}
 | 
| 
alpar@18
 | 
  5395  | 
  | 
| 
alpar@18
 | 
  5396  | 
  | 
| 
alpar@18
 | 
  5397  | 
\message{macros,}
 | 
| 
alpar@18
 | 
  5398  | 
% @macro.
  | 
| 
alpar@18
 | 
  5399  | 
  | 
| 
alpar@18
 | 
  5400  | 
% To do this right we need a feature of e-TeX, \scantokens,
  | 
| 
alpar@18
 | 
  5401  | 
% which we arrange to emulate with a temporary file in ordinary TeX.
  | 
| 
alpar@18
 | 
  5402  | 
\ifx\eTeXversion\undefined
  | 
| 
alpar@18
 | 
  5403  | 
 \newwrite\macscribble
  | 
| 
alpar@18
 | 
  5404  | 
 \def\scanmacro#1{%
 | 
| 
alpar@18
 | 
  5405  | 
   \begingroup \newlinechar`\^^M
  | 
| 
alpar@18
 | 
  5406  | 
   % Undo catcode changes of \startcontents and \doprintindex
  | 
| 
alpar@18
 | 
  5407  | 
   \catcode`\@=0 \catcode`\\=\other \escapechar=`\@
  | 
| 
alpar@18
 | 
  5408  | 
   % Append \endinput to make sure that TeX does not see the ending newline.
  | 
| 
alpar@18
 | 
  5409  | 
   \toks0={#1\endinput}%
 | 
| 
alpar@18
 | 
  5410  | 
   \immediate\openout\macscribble=\jobname.tmp
  | 
| 
alpar@18
 | 
  5411  | 
   \immediate\write\macscribble{\the\toks0}%
 | 
| 
alpar@18
 | 
  5412  | 
   \immediate\closeout\macscribble
  | 
| 
alpar@18
 | 
  5413  | 
   \let\xeatspaces\eatspaces
  | 
| 
alpar@18
 | 
  5414  | 
   \input \jobname.tmp
  | 
| 
alpar@18
 | 
  5415  | 
   \endgroup
  | 
| 
alpar@18
 | 
  5416  | 
}
  | 
| 
alpar@18
 | 
  5417  | 
\else
  | 
| 
alpar@18
 | 
  5418  | 
\def\scanmacro#1{%
 | 
| 
alpar@18
 | 
  5419  | 
\begingroup \newlinechar`\^^M
  | 
| 
alpar@18
 | 
  5420  | 
% Undo catcode changes of \startcontents and \doprintindex
  | 
| 
alpar@18
 | 
  5421  | 
\catcode`\@=0 \catcode`\\=\other \escapechar=`\@
  | 
| 
alpar@18
 | 
  5422  | 
\let\xeatspaces\eatspaces\scantokens{#1\endinput}\endgroup}
 | 
| 
alpar@18
 | 
  5423  | 
\fi
  | 
| 
alpar@18
 | 
  5424  | 
  | 
| 
alpar@18
 | 
  5425  | 
\newcount\paramno   % Count of parameters
  | 
| 
alpar@18
 | 
  5426  | 
\newtoks\macname    % Macro name
  | 
| 
alpar@18
 | 
  5427  | 
\newif\ifrecursive  % Is it recursive?
  | 
| 
alpar@18
 | 
  5428  | 
\def\macrolist{}    % List of all defined macros in the form
 | 
| 
alpar@18
 | 
  5429  | 
                    % \do\macro1\do\macro2...
  | 
| 
alpar@18
 | 
  5430  | 
  | 
| 
alpar@18
 | 
  5431  | 
% Utility routines.
  | 
| 
alpar@18
 | 
  5432  | 
% Thisdoes \let #1 = #2, except with \csnames.
  | 
| 
alpar@18
 | 
  5433  | 
\def\cslet#1#2{%
 | 
| 
alpar@18
 | 
  5434  | 
\expandafter\expandafter
  | 
| 
alpar@18
 | 
  5435  | 
\expandafter\let
  | 
| 
alpar@18
 | 
  5436  | 
\expandafter\expandafter
  | 
| 
alpar@18
 | 
  5437  | 
\csname#1\endcsname
  | 
| 
alpar@18
 | 
  5438  | 
\csname#2\endcsname}
  | 
| 
alpar@18
 | 
  5439  | 
  | 
| 
alpar@18
 | 
  5440  | 
% Trim leading and trailing spaces off a string.
  | 
| 
alpar@18
 | 
  5441  | 
% Concepts from aro-bend problem 15 (see CTAN).
  | 
| 
alpar@18
 | 
  5442  | 
{\catcode`\@=11
 | 
| 
alpar@18
 | 
  5443  | 
\gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
 | 
| 
alpar@18
 | 
  5444  | 
\gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
 | 
| 
alpar@18
 | 
  5445  | 
\gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
 | 
| 
alpar@18
 | 
  5446  | 
\def\unbrace#1{#1}
 | 
| 
alpar@18
 | 
  5447  | 
\unbrace{\gdef\trim@@@ #1 } #2@{#1}
 | 
| 
alpar@18
 | 
  5448  | 
}
  | 
| 
alpar@18
 | 
  5449  | 
  | 
| 
alpar@18
 | 
  5450  | 
% Trim a single trailing ^^M off a string.
  | 
| 
alpar@18
 | 
  5451  | 
{\catcode`\^^M=\other \catcode`\Q=3%
 | 
| 
alpar@18
 | 
  5452  | 
\gdef\eatcr #1{\eatcra #1Q^^MQ}%
 | 
| 
alpar@18
 | 
  5453  | 
\gdef\eatcra#1^^MQ{\eatcrb#1Q}%
 | 
| 
alpar@18
 | 
  5454  | 
\gdef\eatcrb#1Q#2Q{#1}%
 | 
| 
alpar@18
 | 
  5455  | 
}
  | 
| 
alpar@18
 | 
  5456  | 
  | 
| 
alpar@18
 | 
  5457  | 
% Macro bodies are absorbed as an argument in a context where
  | 
| 
alpar@18
 | 
  5458  | 
% all characters are catcode 10, 11 or 12, except \ which is active
  | 
| 
alpar@18
 | 
  5459  | 
% (as in normal texinfo). It is necessary to change the definition of \.
  | 
| 
alpar@18
 | 
  5460  | 
  | 
| 
alpar@18
 | 
  5461  | 
% It's necessary to have hard CRs when the macro is executed. This is
  | 
| 
alpar@18
 | 
  5462  | 
% done by  making ^^M (\endlinechar) catcode 12 when reading the macro
  | 
| 
alpar@18
 | 
  5463  | 
% body, and then making it the \newlinechar in \scanmacro.
  | 
| 
alpar@18
 | 
  5464  | 
  | 
| 
alpar@18
 | 
  5465  | 
\def\macrobodyctxt{%
 | 
| 
alpar@18
 | 
  5466  | 
  \catcode`\~=\other
  | 
| 
alpar@18
 | 
  5467  | 
  \catcode`\^=\other
  | 
| 
alpar@18
 | 
  5468  | 
  \catcode`\_=\other
  | 
| 
alpar@18
 | 
  5469  | 
  \catcode`\|=\other
  | 
| 
alpar@18
 | 
  5470  | 
  \catcode`\<=\other
  | 
| 
alpar@18
 | 
  5471  | 
  \catcode`\>=\other
  | 
| 
alpar@18
 | 
  5472  | 
  \catcode`\+=\other
  | 
| 
alpar@18
 | 
  5473  | 
  \catcode`\{=\other
 | 
| 
alpar@18
 | 
  5474  | 
  \catcode`\}=\other
  | 
| 
alpar@18
 | 
  5475  | 
  \catcode`\@=\other
  | 
| 
alpar@18
 | 
  5476  | 
  \catcode`\^^M=\other
  | 
| 
alpar@18
 | 
  5477  | 
  \usembodybackslash}
  | 
| 
alpar@18
 | 
  5478  | 
  | 
| 
alpar@18
 | 
  5479  | 
\def\macroargctxt{%
 | 
| 
alpar@18
 | 
  5480  | 
  \catcode`\~=\other
  | 
| 
alpar@18
 | 
  5481  | 
  \catcode`\^=\other
  | 
| 
alpar@18
 | 
  5482  | 
  \catcode`\_=\other
  | 
| 
alpar@18
 | 
  5483  | 
  \catcode`\|=\other
  | 
| 
alpar@18
 | 
  5484  | 
  \catcode`\<=\other
  | 
| 
alpar@18
 | 
  5485  | 
  \catcode`\>=\other
  | 
| 
alpar@18
 | 
  5486  | 
  \catcode`\+=\other
  | 
| 
alpar@18
 | 
  5487  | 
  \catcode`\@=\other
  | 
| 
alpar@18
 | 
  5488  | 
  \catcode`\\=\other}
  | 
| 
alpar@18
 | 
  5489  | 
  | 
| 
alpar@18
 | 
  5490  | 
% \mbodybackslash is the definition of \ in @macro bodies.
  | 
| 
alpar@18
 | 
  5491  | 
% It maps \foo\ => \csname macarg.foo\endcsname => #N
  | 
| 
alpar@18
 | 
  5492  | 
% where N is the macro parameter number.
  | 
| 
alpar@18
 | 
  5493  | 
% We define \csname macarg.\endcsname to be \realbackslash, so
  | 
| 
alpar@18
 | 
  5494  | 
% \\ in macro replacement text gets you a backslash.
  | 
| 
alpar@18
 | 
  5495  | 
  | 
| 
alpar@18
 | 
  5496  | 
{\catcode`@=0 @catcode`@\=@active
 | 
| 
alpar@18
 | 
  5497  | 
 @gdef@usembodybackslash{@let\=@mbodybackslash}
 | 
| 
alpar@18
 | 
  5498  | 
 @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
 | 
| 
alpar@18
 | 
  5499  | 
}
  | 
| 
alpar@18
 | 
  5500  | 
\expandafter\def\csname macarg.\endcsname{\realbackslash}
 | 
| 
alpar@18
 | 
  5501  | 
  | 
| 
alpar@18
 | 
  5502  | 
\def\macro{\recursivefalse\parsearg\macroxxx}
 | 
| 
alpar@18
 | 
  5503  | 
\def\rmacro{\recursivetrue\parsearg\macroxxx}
 | 
| 
alpar@18
 | 
  5504  | 
  | 
| 
alpar@18
 | 
  5505  | 
\def\macroxxx#1{%
 | 
| 
alpar@18
 | 
  5506  | 
  \getargs{#1}%           now \macname is the macname and \argl the arglist
 | 
| 
alpar@18
 | 
  5507  | 
  \ifx\argl\empty       % no arguments
  | 
| 
alpar@18
 | 
  5508  | 
     \paramno=0%
  | 
| 
alpar@18
 | 
  5509  | 
  \else
  | 
| 
alpar@18
 | 
  5510  | 
     \expandafter\parsemargdef \argl;%
  | 
| 
alpar@18
 | 
  5511  | 
  \fi
  | 
| 
alpar@18
 | 
  5512  | 
  \if1\csname ismacro.\the\macname\endcsname
  | 
| 
alpar@18
 | 
  5513  | 
     \message{Warning: redefining \the\macname}%
 | 
| 
alpar@18
 | 
  5514  | 
  \else
  | 
| 
alpar@18
 | 
  5515  | 
     \expandafter\ifx\csname \the\macname\endcsname \relax
  | 
| 
alpar@18
 | 
  5516  | 
     \else \errmessage{Macro name \the\macname\space already defined}\fi
 | 
| 
alpar@18
 | 
  5517  | 
     \global\cslet{macsave.\the\macname}{\the\macname}%
 | 
| 
alpar@18
 | 
  5518  | 
     \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
  | 
| 
alpar@18
 | 
  5519  | 
     % Add the macroname to \macrolist
  | 
| 
alpar@18
 | 
  5520  | 
     \toks0 = \expandafter{\macrolist\do}%
 | 
| 
alpar@18
 | 
  5521  | 
     \xdef\macrolist{\the\toks0
 | 
| 
alpar@18
 | 
  5522  | 
       \expandafter\noexpand\csname\the\macname\endcsname}%
  | 
| 
alpar@18
 | 
  5523  | 
  \fi
  | 
| 
alpar@18
 | 
  5524  | 
  \begingroup \macrobodyctxt
  | 
| 
alpar@18
 | 
  5525  | 
  \ifrecursive \expandafter\parsermacbody
  | 
| 
alpar@18
 | 
  5526  | 
  \else \expandafter\parsemacbody
  | 
| 
alpar@18
 | 
  5527  | 
  \fi}
  | 
| 
alpar@18
 | 
  5528  | 
  | 
| 
alpar@18
 | 
  5529  | 
\def\unmacro{\parsearg\dounmacro}
 | 
| 
alpar@18
 | 
  5530  | 
\def\dounmacro#1{%
 | 
| 
alpar@18
 | 
  5531  | 
  \if1\csname ismacro.#1\endcsname
  | 
| 
alpar@18
 | 
  5532  | 
    \global\cslet{#1}{macsave.#1}%
 | 
| 
alpar@18
 | 
  5533  | 
    \global\expandafter\let \csname ismacro.#1\endcsname=0%
  | 
| 
alpar@18
 | 
  5534  | 
    % Remove the macro name from \macrolist:
  | 
| 
alpar@18
 | 
  5535  | 
    \begingroup
  | 
| 
alpar@18
 | 
  5536  | 
      \expandafter\let\csname#1\endcsname \relax
  | 
| 
alpar@18
 | 
  5537  | 
      \let\do\unmacrodo
  | 
| 
alpar@18
 | 
  5538  | 
      \xdef\macrolist{\macrolist}%
 | 
| 
alpar@18
 | 
  5539  | 
    \endgroup
  | 
| 
alpar@18
 | 
  5540  | 
  \else
  | 
| 
alpar@18
 | 
  5541  | 
    \errmessage{Macro #1 not defined}%
 | 
| 
alpar@18
 | 
  5542  | 
  \fi
  | 
| 
alpar@18
 | 
  5543  | 
}
  | 
| 
alpar@18
 | 
  5544  | 
  | 
| 
alpar@18
 | 
  5545  | 
% Called by \do from \dounmacro on each macro.  The idea is to omit any
  | 
| 
alpar@18
 | 
  5546  | 
% macro definitions that have been changed to \relax.
  | 
| 
alpar@18
 | 
  5547  | 
%
  | 
| 
alpar@18
 | 
  5548  | 
\def\unmacrodo#1{%
 | 
| 
alpar@18
 | 
  5549  | 
  \ifx#1\relax
  | 
| 
alpar@18
 | 
  5550  | 
    % remove this
  | 
| 
alpar@18
 | 
  5551  | 
  \else
  | 
| 
alpar@18
 | 
  5552  | 
    \noexpand\do \noexpand #1%
  | 
| 
alpar@18
 | 
  5553  | 
  \fi
  | 
| 
alpar@18
 | 
  5554  | 
}
  | 
| 
alpar@18
 | 
  5555  | 
  | 
| 
alpar@18
 | 
  5556  | 
% This makes use of the obscure feature that if the last token of a
  | 
| 
alpar@18
 | 
  5557  | 
% <parameter list> is #, then the preceding argument is delimited by
  | 
| 
alpar@18
 | 
  5558  | 
% an opening brace, and that opening brace is not consumed.
  | 
| 
alpar@18
 | 
  5559  | 
\def\getargs#1{\getargsxxx#1{}}
 | 
| 
alpar@18
 | 
  5560  | 
\def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
 | 
| 
alpar@18
 | 
  5561  | 
\def\getmacname #1 #2\relax{\macname={#1}}
 | 
| 
alpar@18
 | 
  5562  | 
\def\getmacargs#1{\def\argl{#1}}
 | 
| 
alpar@18
 | 
  5563  | 
  | 
| 
alpar@18
 | 
  5564  | 
% Parse the optional {params} list.  Set up \paramno and \paramlist
 | 
| 
alpar@18
 | 
  5565  | 
% so \defmacro knows what to do.  Define \macarg.blah for each blah
  | 
| 
alpar@18
 | 
  5566  | 
% in the params list, to be ##N where N is the position in that list.
  | 
| 
alpar@18
 | 
  5567  | 
% That gets used by \mbodybackslash (above).
  | 
| 
alpar@18
 | 
  5568  | 
  | 
| 
alpar@18
 | 
  5569  | 
% We need to get `macro parameter char #' into several definitions.
  | 
| 
alpar@18
 | 
  5570  | 
% The technique used is stolen from LaTeX:  let \hash be something
  | 
| 
alpar@18
 | 
  5571  | 
% unexpandable, insert that wherever you need a #, and then redefine
  | 
| 
alpar@18
 | 
  5572  | 
% it to # just before using the token list produced.
  | 
| 
alpar@18
 | 
  5573  | 
%
  | 
| 
alpar@18
 | 
  5574  | 
% The same technique is used to protect \eatspaces till just before
  | 
| 
alpar@18
 | 
  5575  | 
% the macro is used.
  | 
| 
alpar@18
 | 
  5576  | 
  | 
| 
alpar@18
 | 
  5577  | 
\def\parsemargdef#1;{\paramno=0\def\paramlist{}%
 | 
| 
alpar@18
 | 
  5578  | 
        \let\hash\relax\let\xeatspaces\relax\parsemargdefxxx#1,;,}
  | 
| 
alpar@18
 | 
  5579  | 
\def\parsemargdefxxx#1,{%
 | 
| 
alpar@18
 | 
  5580  | 
  \if#1;\let\next=\relax
  | 
| 
alpar@18
 | 
  5581  | 
  \else \let\next=\parsemargdefxxx
  | 
| 
alpar@18
 | 
  5582  | 
    \advance\paramno by 1%
  | 
| 
alpar@18
 | 
  5583  | 
    \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
 | 
| 
alpar@18
 | 
  5584  | 
        {\xeatspaces{\hash\the\paramno}}%
 | 
| 
alpar@18
 | 
  5585  | 
    \edef\paramlist{\paramlist\hash\the\paramno,}%
 | 
| 
alpar@18
 | 
  5586  | 
  \fi\next}
  | 
| 
alpar@18
 | 
  5587  | 
  | 
| 
alpar@18
 | 
  5588  | 
% These two commands read recursive and nonrecursive macro bodies.
  | 
| 
alpar@18
 | 
  5589  | 
% (They're different since rec and nonrec macros end differently.)
  | 
| 
alpar@18
 | 
  5590  | 
  | 
| 
alpar@18
 | 
  5591  | 
\long\def\parsemacbody#1@end macro%
  | 
| 
alpar@18
 | 
  5592  | 
{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
 | 
| 
alpar@18
 | 
  5593  | 
\long\def\parsermacbody#1@end rmacro%
  | 
| 
alpar@18
 | 
  5594  | 
{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
 | 
| 
alpar@18
 | 
  5595  | 
  | 
| 
alpar@18
 | 
  5596  | 
% This defines the macro itself. There are six cases: recursive and
  | 
| 
alpar@18
 | 
  5597  | 
% nonrecursive macros of zero, one, and many arguments.
  | 
| 
alpar@18
 | 
  5598  | 
% Much magic with \expandafter here.
  | 
| 
alpar@18
 | 
  5599  | 
% \xdef is used so that macro definitions will survive the file
  | 
| 
alpar@18
 | 
  5600  | 
% they're defined in; @include reads the file inside a group.
  | 
| 
alpar@18
 | 
  5601  | 
\def\defmacro{%
 | 
| 
alpar@18
 | 
  5602  | 
  \let\hash=##% convert placeholders to macro parameter chars
  | 
| 
alpar@18
 | 
  5603  | 
  \ifrecursive
  | 
| 
alpar@18
 | 
  5604  | 
    \ifcase\paramno
  | 
| 
alpar@18
 | 
  5605  | 
    % 0
  | 
| 
alpar@18
 | 
  5606  | 
      \expandafter\xdef\csname\the\macname\endcsname{%
 | 
| 
alpar@18
 | 
  5607  | 
        \noexpand\scanmacro{\temp}}%
 | 
| 
alpar@18
 | 
  5608  | 
    \or % 1
  | 
| 
alpar@18
 | 
  5609  | 
      \expandafter\xdef\csname\the\macname\endcsname{%
 | 
| 
alpar@18
 | 
  5610  | 
         \bgroup\noexpand\macroargctxt
  | 
| 
alpar@18
 | 
  5611  | 
         \noexpand\braceorline
  | 
| 
alpar@18
 | 
  5612  | 
         \expandafter\noexpand\csname\the\macname xxx\endcsname}%
  | 
| 
alpar@18
 | 
  5613  | 
      \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
 | 
| 
alpar@18
 | 
  5614  | 
         \egroup\noexpand\scanmacro{\temp}}%
 | 
| 
alpar@18
 | 
  5615  | 
    \else % many
  | 
| 
alpar@18
 | 
  5616  | 
      \expandafter\xdef\csname\the\macname\endcsname{%
 | 
| 
alpar@18
 | 
  5617  | 
         \bgroup\noexpand\macroargctxt
  | 
| 
alpar@18
 | 
  5618  | 
         \noexpand\csname\the\macname xx\endcsname}%
  | 
| 
alpar@18
 | 
  5619  | 
      \expandafter\xdef\csname\the\macname xx\endcsname##1{%
 | 
| 
alpar@18
 | 
  5620  | 
          \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
  | 
| 
alpar@18
 | 
  5621  | 
      \expandafter\expandafter
  | 
| 
alpar@18
 | 
  5622  | 
      \expandafter\xdef
  | 
| 
alpar@18
 | 
  5623  | 
      \expandafter\expandafter
  | 
| 
alpar@18
 | 
  5624  | 
        \csname\the\macname xxx\endcsname
  | 
| 
alpar@18
 | 
  5625  | 
          \paramlist{\egroup\noexpand\scanmacro{\temp}}%
 | 
| 
alpar@18
 | 
  5626  | 
    \fi
  | 
| 
alpar@18
 | 
  5627  | 
  \else
  | 
| 
alpar@18
 | 
  5628  | 
    \ifcase\paramno
  | 
| 
alpar@18
 | 
  5629  | 
    % 0
  | 
| 
alpar@18
 | 
  5630  | 
      \expandafter\xdef\csname\the\macname\endcsname{%
 | 
| 
alpar@18
 | 
  5631  | 
        \noexpand\norecurse{\the\macname}%
 | 
| 
alpar@18
 | 
  5632  | 
        \noexpand\scanmacro{\temp}\egroup}%
 | 
| 
alpar@18
 | 
  5633  | 
    \or % 1
  | 
| 
alpar@18
 | 
  5634  | 
      \expandafter\xdef\csname\the\macname\endcsname{%
 | 
| 
alpar@18
 | 
  5635  | 
         \bgroup\noexpand\macroargctxt
  | 
| 
alpar@18
 | 
  5636  | 
         \noexpand\braceorline
  | 
| 
alpar@18
 | 
  5637  | 
         \expandafter\noexpand\csname\the\macname xxx\endcsname}%
  | 
| 
alpar@18
 | 
  5638  | 
      \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
 | 
| 
alpar@18
 | 
  5639  | 
        \egroup
  | 
| 
alpar@18
 | 
  5640  | 
        \noexpand\norecurse{\the\macname}%
 | 
| 
alpar@18
 | 
  5641  | 
        \noexpand\scanmacro{\temp}\egroup}%
 | 
| 
alpar@18
 | 
  5642  | 
    \else % many
  | 
| 
alpar@18
 | 
  5643  | 
      \expandafter\xdef\csname\the\macname\endcsname{%
 | 
| 
alpar@18
 | 
  5644  | 
         \bgroup\noexpand\macroargctxt
  | 
| 
alpar@18
 | 
  5645  | 
         \expandafter\noexpand\csname\the\macname xx\endcsname}%
  | 
| 
alpar@18
 | 
  5646  | 
      \expandafter\xdef\csname\the\macname xx\endcsname##1{%
 | 
| 
alpar@18
 | 
  5647  | 
          \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
  | 
| 
alpar@18
 | 
  5648  | 
      \expandafter\expandafter
  | 
| 
alpar@18
 | 
  5649  | 
      \expandafter\xdef
  | 
| 
alpar@18
 | 
  5650  | 
      \expandafter\expandafter
  | 
| 
alpar@18
 | 
  5651  | 
      \csname\the\macname xxx\endcsname
  | 
| 
alpar@18
 | 
  5652  | 
      \paramlist{%
 | 
| 
alpar@18
 | 
  5653  | 
          \egroup
  | 
| 
alpar@18
 | 
  5654  | 
          \noexpand\norecurse{\the\macname}%
 | 
| 
alpar@18
 | 
  5655  | 
          \noexpand\scanmacro{\temp}\egroup}%
 | 
| 
alpar@18
 | 
  5656  | 
    \fi
  | 
| 
alpar@18
 | 
  5657  | 
  \fi}
  | 
| 
alpar@18
 | 
  5658  | 
  | 
| 
alpar@18
 | 
  5659  | 
\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
 | 
| 
alpar@18
 | 
  5660  | 
  | 
| 
alpar@18
 | 
  5661  | 
% \braceorline decides whether the next nonwhitespace character is a
  | 
| 
alpar@18
 | 
  5662  | 
% {.  If so it reads up to the closing }, if not, it reads the whole
 | 
| 
alpar@18
 | 
  5663  | 
% line.  Whatever was read is then fed to the next control sequence
  | 
| 
alpar@18
 | 
  5664  | 
% as an argument (by \parsebrace or \parsearg)
  | 
| 
alpar@18
 | 
  5665  | 
\def\braceorline#1{\let\next=#1\futurelet\nchar\braceorlinexxx}
 | 
| 
alpar@18
 | 
  5666  | 
\def\braceorlinexxx{%
 | 
| 
alpar@18
 | 
  5667  | 
  \ifx\nchar\bgroup\else
  | 
| 
alpar@18
 | 
  5668  | 
    \expandafter\parsearg
  | 
| 
alpar@18
 | 
  5669  | 
  \fi \next}
  | 
| 
alpar@18
 | 
  5670  | 
  | 
| 
alpar@18
 | 
  5671  | 
% We mant to disable all macros during \shipout so that they are not
  | 
| 
alpar@18
 | 
  5672  | 
% expanded by \write.
  | 
| 
alpar@18
 | 
  5673  | 
\def\turnoffmacros{\begingroup \def\do##1{\let\noexpand##1=\relax}%
 | 
| 
alpar@18
 | 
  5674  | 
  \edef\next{\macrolist}\expandafter\endgroup\next}
 | 
| 
alpar@18
 | 
  5675  | 
  | 
| 
alpar@18
 | 
  5676  | 
  | 
| 
alpar@18
 | 
  5677  | 
% @alias.
  | 
| 
alpar@18
 | 
  5678  | 
% We need some trickery to remove the optional spaces around the equal
  | 
| 
alpar@18
 | 
  5679  | 
% sign.  Just make them active and then expand them all to nothing.
  | 
| 
alpar@18
 | 
  5680  | 
\def\alias{\begingroup\obeyspaces\parsearg\aliasxxx}
 | 
| 
alpar@18
 | 
  5681  | 
\def\aliasxxx #1{\aliasyyy#1\relax}
 | 
| 
alpar@18
 | 
  5682  | 
\def\aliasyyy #1=#2\relax{\ignoreactivespaces
 | 
| 
alpar@18
 | 
  5683  | 
\edef\next{\global\let\expandafter\noexpand\csname#1\endcsname=%
 | 
| 
alpar@18
 | 
  5684  | 
           \expandafter\noexpand\csname#2\endcsname}%
  | 
| 
alpar@18
 | 
  5685  | 
\expandafter\endgroup\next}
  | 
| 
alpar@18
 | 
  5686  | 
  | 
| 
alpar@18
 | 
  5687  | 
  | 
| 
alpar@18
 | 
  5688  | 
\message{cross references,}
 | 
| 
alpar@18
 | 
  5689  | 
% @xref etc.
  | 
| 
alpar@18
 | 
  5690  | 
  | 
| 
alpar@18
 | 
  5691  | 
\newwrite\auxfile
  | 
| 
alpar@18
 | 
  5692  | 
  | 
| 
alpar@18
 | 
  5693  | 
\newif\ifhavexrefs    % True if xref values are known.
  | 
| 
alpar@18
 | 
  5694  | 
\newif\ifwarnedxrefs  % True if we warned once that they aren't known.
  | 
| 
alpar@18
 | 
  5695  | 
  | 
| 
alpar@18
 | 
  5696  | 
% @inforef is relatively simple.
  | 
| 
alpar@18
 | 
  5697  | 
\def\inforef #1{\inforefzzz #1,,,,**}
 | 
| 
alpar@18
 | 
  5698  | 
\def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
 | 
| 
alpar@18
 | 
  5699  | 
  node \samp{\ignorespaces#1{}}}
 | 
| 
alpar@18
 | 
  5700  | 
  | 
| 
alpar@18
 | 
  5701  | 
% @node's job is to define \lastnode.
  | 
| 
alpar@18
 | 
  5702  | 
\def\node{\ENVcheck\parsearg\nodezzz}
 | 
| 
alpar@18
 | 
  5703  | 
\def\nodezzz#1{\nodexxx #1,\finishnodeparse}
 | 
| 
alpar@18
 | 
  5704  | 
\def\nodexxx#1,#2\finishnodeparse{\gdef\lastnode{#1}}
 | 
| 
alpar@18
 | 
  5705  | 
\let\nwnode=\node
  | 
| 
alpar@18
 | 
  5706  | 
\let\lastnode=\relax
  | 
| 
alpar@18
 | 
  5707  | 
  | 
| 
alpar@18
 | 
  5708  | 
% The sectioning commands (@chapter, etc.) call these.
  | 
| 
alpar@18
 | 
  5709  | 
\def\donoderef{%
 | 
| 
alpar@18
 | 
  5710  | 
  \ifx\lastnode\relax\else
  | 
| 
alpar@18
 | 
  5711  | 
    \expandafter\expandafter\expandafter\setref{\lastnode}%
 | 
| 
alpar@18
 | 
  5712  | 
      {Ysectionnumberandtype}%
 | 
| 
alpar@18
 | 
  5713  | 
    \global\let\lastnode=\relax
  | 
| 
alpar@18
 | 
  5714  | 
  \fi
  | 
| 
alpar@18
 | 
  5715  | 
}
  | 
| 
alpar@18
 | 
  5716  | 
\def\unnumbnoderef{%
 | 
| 
alpar@18
 | 
  5717  | 
  \ifx\lastnode\relax\else
  | 
| 
alpar@18
 | 
  5718  | 
    \expandafter\expandafter\expandafter\setref{\lastnode}{Ynothing}%
 | 
| 
alpar@18
 | 
  5719  | 
    \global\let\lastnode=\relax
  | 
| 
alpar@18
 | 
  5720  | 
  \fi
  | 
| 
alpar@18
 | 
  5721  | 
}
  | 
| 
alpar@18
 | 
  5722  | 
\def\appendixnoderef{%
 | 
| 
alpar@18
 | 
  5723  | 
  \ifx\lastnode\relax\else
  | 
| 
alpar@18
 | 
  5724  | 
    \expandafter\expandafter\expandafter\setref{\lastnode}%
 | 
| 
alpar@18
 | 
  5725  | 
      {Yappendixletterandtype}%
 | 
| 
alpar@18
 | 
  5726  | 
    \global\let\lastnode=\relax
  | 
| 
alpar@18
 | 
  5727  | 
  \fi
  | 
| 
alpar@18
 | 
  5728  | 
}
  | 
| 
alpar@18
 | 
  5729  | 
  | 
| 
alpar@18
 | 
  5730  | 
  | 
| 
alpar@18
 | 
  5731  | 
% @anchor{NAME} -- define xref target at arbitrary point.
 | 
| 
alpar@18
 | 
  5732  | 
%
  | 
| 
alpar@18
 | 
  5733  | 
\newcount\savesfregister
  | 
| 
alpar@18
 | 
  5734  | 
\gdef\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
 | 
| 
alpar@18
 | 
  5735  | 
\gdef\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
 | 
| 
alpar@18
 | 
  5736  | 
\gdef\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
 | 
| 
alpar@18
 | 
  5737  | 
  | 
| 
alpar@18
 | 
  5738  | 
% \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
 | 
| 
alpar@18
 | 
  5739  | 
% anchor), namely NAME-title (the corresponding @chapter/etc. name),
  | 
| 
alpar@18
 | 
  5740  | 
% NAME-pg (the page number), and NAME-snt (section number and type).
  | 
| 
alpar@18
 | 
  5741  | 
% Called from \foonoderef.
  | 
| 
alpar@18
 | 
  5742  | 
%
  | 
| 
alpar@18
 | 
  5743  | 
% We have to set \indexdummies so commands such as @code in a section
  | 
| 
alpar@18
 | 
  5744  | 
% title aren't expanded.  It would be nicer not to expand the titles in
  | 
| 
alpar@18
 | 
  5745  | 
% the first place, but there's so many layers that that is hard to do.
  | 
| 
alpar@18
 | 
  5746  | 
%
  | 
| 
alpar@18
 | 
  5747  | 
% Likewise, use \turnoffactive so that punctuation chars such as underscore
  | 
| 
alpar@18
 | 
  5748  | 
% and backslash work in node names.
  | 
| 
alpar@18
 | 
  5749  | 
%
  | 
| 
alpar@18
 | 
  5750  | 
\def\setref#1#2{{%
 | 
| 
alpar@18
 | 
  5751  | 
  \atdummies
  | 
| 
alpar@18
 | 
  5752  | 
  \pdfmkdest{#1}%
 | 
| 
alpar@18
 | 
  5753  | 
  %
  | 
| 
alpar@18
 | 
  5754  | 
  \turnoffactive
  | 
| 
alpar@18
 | 
  5755  | 
  \dosetq{#1-title}{Ytitle}%
 | 
| 
alpar@18
 | 
  5756  | 
  \dosetq{#1-pg}{Ypagenumber}%
 | 
| 
alpar@18
 | 
  5757  | 
  \dosetq{#1-snt}{#2}%
 | 
| 
alpar@18
 | 
  5758  | 
}}
  | 
| 
alpar@18
 | 
  5759  | 
  | 
| 
alpar@18
 | 
  5760  | 
% @xref, @pxref, and @ref generate cross-references.  For \xrefX, #1 is
  | 
| 
alpar@18
 | 
  5761  | 
% the node name, #2 the name of the Info cross-reference, #3 the printed
  | 
| 
alpar@18
 | 
  5762  | 
% node name, #4 the name of the Info file, #5 the name of the printed
  | 
| 
alpar@18
 | 
  5763  | 
% manual.  All but the node name can be omitted.
  | 
| 
alpar@18
 | 
  5764  | 
%
  | 
| 
alpar@18
 | 
  5765  | 
\def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]}
 | 
| 
alpar@18
 | 
  5766  | 
\def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]}
 | 
| 
alpar@18
 | 
  5767  | 
\def\ref#1{\xrefX[#1,,,,,,,]}
 | 
| 
alpar@18
 | 
  5768  | 
\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
 | 
| 
alpar@18
 | 
  5769  | 
  \unsepspaces
  | 
| 
alpar@18
 | 
  5770  | 
  \def\printedmanual{\ignorespaces #5}%
 | 
| 
alpar@18
 | 
  5771  | 
  \def\printednodename{\ignorespaces #3}%
 | 
| 
alpar@18
 | 
  5772  | 
  \setbox1=\hbox{\printedmanual}%
 | 
| 
alpar@18
 | 
  5773  | 
  \setbox0=\hbox{\printednodename}%
 | 
| 
alpar@18
 | 
  5774  | 
  \ifdim \wd0 = 0pt
  | 
| 
alpar@18
 | 
  5775  | 
    % No printed node name was explicitly given.
  | 
| 
alpar@18
 | 
  5776  | 
    \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax
  | 
| 
alpar@18
 | 
  5777  | 
      % Use the node name inside the square brackets.
  | 
| 
alpar@18
 | 
  5778  | 
      \def\printednodename{\ignorespaces #1}%
 | 
| 
alpar@18
 | 
  5779  | 
    \else
  | 
| 
alpar@18
 | 
  5780  | 
      % Use the actual chapter/section title appear inside
  | 
| 
alpar@18
 | 
  5781  | 
      % the square brackets.  Use the real section title if we have it.
  | 
| 
alpar@18
 | 
  5782  | 
      \ifdim \wd1 > 0pt
  | 
| 
alpar@18
 | 
  5783  | 
        % It is in another manual, so we don't have it.
  | 
| 
alpar@18
 | 
  5784  | 
        \def\printednodename{\ignorespaces #1}%
 | 
| 
alpar@18
 | 
  5785  | 
      \else
  | 
| 
alpar@18
 | 
  5786  | 
        \ifhavexrefs
  | 
| 
alpar@18
 | 
  5787  | 
          % We know the real title if we have the xref values.
  | 
| 
alpar@18
 | 
  5788  | 
          \def\printednodename{\refx{#1-title}{}}%
 | 
| 
alpar@18
 | 
  5789  | 
        \else
  | 
| 
alpar@18
 | 
  5790  | 
          % Otherwise just copy the Info node name.
  | 
| 
alpar@18
 | 
  5791  | 
          \def\printednodename{\ignorespaces #1}%
 | 
| 
alpar@18
 | 
  5792  | 
        \fi%
  | 
| 
alpar@18
 | 
  5793  | 
      \fi
  | 
| 
alpar@18
 | 
  5794  | 
    \fi
  | 
| 
alpar@18
 | 
  5795  | 
  \fi
  | 
| 
alpar@18
 | 
  5796  | 
  %
  | 
| 
alpar@18
 | 
  5797  | 
  % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not
  | 
| 
alpar@18
 | 
  5798  | 
  % insert empty discretionaries after hyphens, which means that it will
  | 
| 
alpar@18
 | 
  5799  | 
  % not find a line break at a hyphen in a node names.  Since some manuals
  | 
| 
alpar@18
 | 
  5800  | 
  % are best written with fairly long node names, containing hyphens, this
  | 
| 
alpar@18
 | 
  5801  | 
  % is a loss.  Therefore, we give the text of the node name again, so it
  | 
| 
alpar@18
 | 
  5802  | 
  % is as if TeX is seeing it for the first time.
  | 
| 
alpar@18
 | 
  5803  | 
  \ifpdf
  | 
| 
alpar@18
 | 
  5804  | 
    \leavevmode
  | 
| 
alpar@18
 | 
  5805  | 
    \getfilename{#4}%
 | 
| 
alpar@18
 | 
  5806  | 
    {\turnoffactive \otherbackslash
 | 
| 
alpar@18
 | 
  5807  | 
     \ifnum\filenamelength>0
  | 
| 
alpar@18
 | 
  5808  | 
       \startlink attr{/Border [0 0 0]}%
 | 
| 
alpar@18
 | 
  5809  | 
         goto file{\the\filename.pdf} name{#1}%
 | 
| 
alpar@18
 | 
  5810  | 
     \else
  | 
| 
alpar@18
 | 
  5811  | 
       \startlink attr{/Border [0 0 0]}%
 | 
| 
alpar@18
 | 
  5812  | 
         goto name{#1}%
 | 
| 
alpar@18
 | 
  5813  | 
     \fi
  | 
| 
alpar@18
 | 
  5814  | 
    }%
  | 
| 
alpar@18
 | 
  5815  | 
    \linkcolor
  | 
| 
alpar@18
 | 
  5816  | 
  \fi
  | 
| 
alpar@18
 | 
  5817  | 
  %
  | 
| 
alpar@18
 | 
  5818  | 
  \ifdim \wd1 > 0pt
  | 
| 
alpar@18
 | 
  5819  | 
    \putwordsection{} ``\printednodename'' \putwordin{} \cite{\printedmanual}%
 | 
| 
alpar@18
 | 
  5820  | 
  \else
  | 
| 
alpar@18
 | 
  5821  | 
    % _ (for example) has to be the character _ for the purposes of the
  | 
| 
alpar@18
 | 
  5822  | 
    % control sequence corresponding to the node, but it has to expand
  | 
| 
alpar@18
 | 
  5823  | 
    % into the usual \leavevmode...\vrule stuff for purposes of
  | 
| 
alpar@18
 | 
  5824  | 
    % printing. So we \turnoffactive for the \refx-snt, back on for the
  | 
| 
alpar@18
 | 
  5825  | 
    % printing, back off for the \refx-pg.
  | 
| 
alpar@18
 | 
  5826  | 
    {\turnoffactive \otherbackslash
 | 
| 
alpar@18
 | 
  5827  | 
     % Only output a following space if the -snt ref is nonempty; for
  | 
| 
alpar@18
 | 
  5828  | 
     % @unnumbered and @anchor, it won't be.
  | 
| 
alpar@18
 | 
  5829  | 
     \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
 | 
| 
alpar@18
 | 
  5830  | 
     \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
 | 
| 
alpar@18
 | 
  5831  | 
    }%
  | 
| 
alpar@18
 | 
  5832  | 
    % output the `[mynode]' via a macro.
  | 
| 
alpar@18
 | 
  5833  | 
    \xrefprintnodename\printednodename
  | 
| 
alpar@18
 | 
  5834  | 
    %
  | 
| 
alpar@18
 | 
  5835  | 
    % But we always want a comma and a space:
  | 
| 
alpar@18
 | 
  5836  | 
    ,\space
  | 
| 
alpar@18
 | 
  5837  | 
    %
  | 
| 
alpar@18
 | 
  5838  | 
    % output the `page 3'.
  | 
| 
alpar@18
 | 
  5839  | 
    \turnoffactive \otherbackslash \putwordpage\tie\refx{#1-pg}{}%
 | 
| 
alpar@18
 | 
  5840  | 
  \fi
  | 
| 
alpar@18
 | 
  5841  | 
  \endlink
  | 
| 
alpar@18
 | 
  5842  | 
\endgroup}
  | 
| 
alpar@18
 | 
  5843  | 
  | 
| 
alpar@18
 | 
  5844  | 
% This macro is called from \xrefX for the `[nodename]' part of xref
  | 
| 
alpar@18
 | 
  5845  | 
% output.  It's a separate macro only so it can be changed more easily,
  | 
| 
alpar@18
 | 
  5846  | 
% since not square brackets don't work in some documents.  Particularly
  | 
| 
alpar@18
 | 
  5847  | 
% one that Bob is working on :).
  | 
| 
alpar@18
 | 
  5848  | 
%
  | 
| 
alpar@18
 | 
  5849  | 
\def\xrefprintnodename#1{[#1]}
 | 
| 
alpar@18
 | 
  5850  | 
  | 
| 
alpar@18
 | 
  5851  | 
% \dosetq is called from \setref to do the actual \write (\iflinks).
  | 
| 
alpar@18
 | 
  5852  | 
%
  | 
| 
alpar@18
 | 
  5853  | 
\def\dosetq#1#2{%
 | 
| 
alpar@18
 | 
  5854  | 
  {\let\folio=0%
 | 
| 
alpar@18
 | 
  5855  | 
   \edef\next{\write\auxfile{\internalsetq{#1}{#2}}}%
 | 
| 
alpar@18
 | 
  5856  | 
   \iflinks \next \fi
  | 
| 
alpar@18
 | 
  5857  | 
  }%
  | 
| 
alpar@18
 | 
  5858  | 
}
  | 
| 
alpar@18
 | 
  5859  | 
  | 
| 
alpar@18
 | 
  5860  | 
% \internalsetq{foo}{page} expands into
 | 
| 
alpar@18
 | 
  5861  | 
%   CHARACTERS @xrdef{foo}{...expansion of \page...}
 | 
| 
alpar@18
 | 
  5862  | 
\def\internalsetq#1#2{@xrdef{#1}{\csname #2\endcsname}}
 | 
| 
alpar@18
 | 
  5863  | 
  | 
| 
alpar@18
 | 
  5864  | 
% Things to be expanded by \internalsetq.
  | 
| 
alpar@18
 | 
  5865  | 
%
  | 
| 
alpar@18
 | 
  5866  | 
\def\Ypagenumber{\folio}
 | 
| 
alpar@18
 | 
  5867  | 
\def\Ytitle{\thissection}
 | 
| 
alpar@18
 | 
  5868  | 
\def\Ynothing{}
 | 
| 
alpar@18
 | 
  5869  | 
\def\Ysectionnumberandtype{%
 | 
| 
alpar@18
 | 
  5870  | 
  \ifnum\secno=0
  | 
| 
alpar@18
 | 
  5871  | 
    \putwordChapter@tie \the\chapno
  | 
| 
alpar@18
 | 
  5872  | 
  \else \ifnum\subsecno=0
  | 
| 
alpar@18
 | 
  5873  | 
    \putwordSection@tie \the\chapno.\the\secno
  | 
| 
alpar@18
 | 
  5874  | 
  \else \ifnum\subsubsecno=0
  | 
| 
alpar@18
 | 
  5875  | 
    \putwordSection@tie \the\chapno.\the\secno.\the\subsecno
  | 
| 
alpar@18
 | 
  5876  | 
  \else
  | 
| 
alpar@18
 | 
  5877  | 
    \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno
  | 
| 
alpar@18
 | 
  5878  | 
  \fi\fi\fi
  | 
| 
alpar@18
 | 
  5879  | 
}
  | 
| 
alpar@18
 | 
  5880  | 
  | 
| 
alpar@18
 | 
  5881  | 
\def\Yappendixletterandtype{%
 | 
| 
alpar@18
 | 
  5882  | 
  \ifnum\secno=0
  | 
| 
alpar@18
 | 
  5883  | 
     \putwordAppendix@tie @char\the\appendixno{}%
 | 
| 
alpar@18
 | 
  5884  | 
  \else \ifnum\subsecno=0
  | 
| 
alpar@18
 | 
  5885  | 
     \putwordSection@tie @char\the\appendixno.\the\secno
  | 
| 
alpar@18
 | 
  5886  | 
  \else \ifnum\subsubsecno=0
  | 
| 
alpar@18
 | 
  5887  | 
    \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno
  | 
| 
alpar@18
 | 
  5888  | 
  \else
  | 
| 
alpar@18
 | 
  5889  | 
    \putwordSection@tie
  | 
| 
alpar@18
 | 
  5890  | 
      @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno
  | 
| 
alpar@18
 | 
  5891  | 
  \fi\fi\fi
  | 
| 
alpar@18
 | 
  5892  | 
}
  | 
| 
alpar@18
 | 
  5893  | 
  | 
| 
alpar@18
 | 
  5894  | 
% Use TeX 3.0's \inputlineno to get the line number, for better error
  | 
| 
alpar@18
 | 
  5895  | 
% messages, but if we're using an old version of TeX, don't do anything.
  | 
| 
alpar@18
 | 
  5896  | 
%
  | 
| 
alpar@18
 | 
  5897  | 
\ifx\inputlineno\thisisundefined
  | 
| 
alpar@18
 | 
  5898  | 
  \let\linenumber = \empty % Pre-3.0.
  | 
| 
alpar@18
 | 
  5899  | 
\else
  | 
| 
alpar@18
 | 
  5900  | 
  \def\linenumber{\the\inputlineno:\space}
 | 
| 
alpar@18
 | 
  5901  | 
\fi
  | 
| 
alpar@18
 | 
  5902  | 
  | 
| 
alpar@18
 | 
  5903  | 
% Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
 | 
| 
alpar@18
 | 
  5904  | 
% If its value is nonempty, SUFFIX is output afterward.
  | 
| 
alpar@18
 | 
  5905  | 
%
  | 
| 
alpar@18
 | 
  5906  | 
\def\refx#1#2{%
 | 
| 
alpar@18
 | 
  5907  | 
  {%
 | 
| 
alpar@18
 | 
  5908  | 
    \indexnofonts
  | 
| 
alpar@18
 | 
  5909  | 
    \otherbackslash
  | 
| 
alpar@18
 | 
  5910  | 
    \expandafter\global\expandafter\let\expandafter\thisrefX
  | 
| 
alpar@18
 | 
  5911  | 
      \csname X#1\endcsname
  | 
| 
alpar@18
 | 
  5912  | 
  }%
  | 
| 
alpar@18
 | 
  5913  | 
  \ifx\thisrefX\relax
  | 
| 
alpar@18
 | 
  5914  | 
    % If not defined, say something at least.
  | 
| 
alpar@18
 | 
  5915  | 
    \angleleft un\-de\-fined\angleright
  | 
| 
alpar@18
 | 
  5916  | 
    \iflinks
  | 
| 
alpar@18
 | 
  5917  | 
      \ifhavexrefs
  | 
| 
alpar@18
 | 
  5918  | 
        \message{\linenumber Undefined cross reference `#1'.}%
 | 
| 
alpar@18
 | 
  5919  | 
      \else
  | 
| 
alpar@18
 | 
  5920  | 
        \ifwarnedxrefs\else
  | 
| 
alpar@18
 | 
  5921  | 
          \global\warnedxrefstrue
  | 
| 
alpar@18
 | 
  5922  | 
          \message{Cross reference values unknown; you must run TeX again.}%
 | 
| 
alpar@18
 | 
  5923  | 
        \fi
  | 
| 
alpar@18
 | 
  5924  | 
      \fi
  | 
| 
alpar@18
 | 
  5925  | 
    \fi
  | 
| 
alpar@18
 | 
  5926  | 
  \else
  | 
| 
alpar@18
 | 
  5927  | 
    % It's defined, so just use it.
  | 
| 
alpar@18
 | 
  5928  | 
    \thisrefX
  | 
| 
alpar@18
 | 
  5929  | 
  \fi
  | 
| 
alpar@18
 | 
  5930  | 
  #2% Output the suffix in any case.
  | 
| 
alpar@18
 | 
  5931  | 
}
  | 
| 
alpar@18
 | 
  5932  | 
  | 
| 
alpar@18
 | 
  5933  | 
% This is the macro invoked by entries in the aux file.
  | 
| 
alpar@18
 | 
  5934  | 
%
  | 
| 
alpar@18
 | 
  5935  | 
\def\xrdef#1{\expandafter\gdef\csname X#1\endcsname}
 | 
| 
alpar@18
 | 
  5936  | 
  | 
| 
alpar@18
 | 
  5937  | 
% Read the last existing aux file, if any.  No error if none exists.
  | 
| 
alpar@18
 | 
  5938  | 
\def\readauxfile{\begingroup
 | 
| 
alpar@18
 | 
  5939  | 
  \catcode`\^^@=\other
  | 
| 
alpar@18
 | 
  5940  | 
  \catcode`\^^A=\other
  | 
| 
alpar@18
 | 
  5941  | 
  \catcode`\^^B=\other
  | 
| 
alpar@18
 | 
  5942  | 
  \catcode`\^^C=\other
  | 
| 
alpar@18
 | 
  5943  | 
  \catcode`\^^D=\other
  | 
| 
alpar@18
 | 
  5944  | 
  \catcode`\^^E=\other
  | 
| 
alpar@18
 | 
  5945  | 
  \catcode`\^^F=\other
  | 
| 
alpar@18
 | 
  5946  | 
  \catcode`\^^G=\other
  | 
| 
alpar@18
 | 
  5947  | 
  \catcode`\^^H=\other
  | 
| 
alpar@18
 | 
  5948  | 
  \catcode`\^^K=\other
  | 
| 
alpar@18
 | 
  5949  | 
  \catcode`\^^L=\other
  | 
| 
alpar@18
 | 
  5950  | 
  \catcode`\^^N=\other
  | 
| 
alpar@18
 | 
  5951  | 
  \catcode`\^^P=\other
  | 
| 
alpar@18
 | 
  5952  | 
  \catcode`\^^Q=\other
  | 
| 
alpar@18
 | 
  5953  | 
  \catcode`\^^R=\other
  | 
| 
alpar@18
 | 
  5954  | 
  \catcode`\^^S=\other
  | 
| 
alpar@18
 | 
  5955  | 
  \catcode`\^^T=\other
  | 
| 
alpar@18
 | 
  5956  | 
  \catcode`\^^U=\other
  | 
| 
alpar@18
 | 
  5957  | 
  \catcode`\^^V=\other
  | 
| 
alpar@18
 | 
  5958  | 
  \catcode`\^^W=\other
  | 
| 
alpar@18
 | 
  5959  | 
  \catcode`\^^X=\other
  | 
| 
alpar@18
 | 
  5960  | 
  \catcode`\^^Z=\other
  | 
| 
alpar@18
 | 
  5961  | 
  \catcode`\^^[=\other
  | 
| 
alpar@18
 | 
  5962  | 
  \catcode`\^^\=\other
  | 
| 
alpar@18
 | 
  5963  | 
  \catcode`\^^]=\other
  | 
| 
alpar@18
 | 
  5964  | 
  \catcode`\^^^=\other
  | 
| 
alpar@18
 | 
  5965  | 
  \catcode`\^^_=\other
  | 
| 
alpar@18
 | 
  5966  | 
  % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc.
  | 
| 
alpar@18
 | 
  5967  | 
  % in xref tags, i.e., node names.  But since ^^e4 notation isn't
  | 
| 
alpar@18
 | 
  5968  | 
  % supported in the main text, it doesn't seem desirable.  Furthermore,
  | 
| 
alpar@18
 | 
  5969  | 
  % that is not enough: for node names that actually contain a ^
  | 
| 
alpar@18
 | 
  5970  | 
  % character, we would end up writing a line like this: 'xrdef {'hat
 | 
| 
alpar@18
 | 
  5971  | 
  % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
 | 
| 
alpar@18
 | 
  5972  | 
  % argument, and \hat is not an expandable control sequence.  It could
  | 
| 
alpar@18
 | 
  5973  | 
  % all be worked out, but why?  Either we support ^^ or we don't.
  | 
| 
alpar@18
 | 
  5974  | 
  %
  | 
| 
alpar@18
 | 
  5975  | 
  % The other change necessary for this was to define \auxhat:
  | 
| 
alpar@18
 | 
  5976  | 
  % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
 | 
| 
alpar@18
 | 
  5977  | 
  % and then to call \auxhat in \setq.
  | 
| 
alpar@18
 | 
  5978  | 
  %
  | 
| 
alpar@18
 | 
  5979  | 
  \catcode`\^=\other
  | 
| 
alpar@18
 | 
  5980  | 
  %
  | 
| 
alpar@18
 | 
  5981  | 
  % Special characters.  Should be turned off anyway, but...
  | 
| 
alpar@18
 | 
  5982  | 
  \catcode`\~=\other
  | 
| 
alpar@18
 | 
  5983  | 
  \catcode`\[=\other
  | 
| 
alpar@18
 | 
  5984  | 
  \catcode`\]=\other
  | 
| 
alpar@18
 | 
  5985  | 
  \catcode`\"=\other
  | 
| 
alpar@18
 | 
  5986  | 
  \catcode`\_=\other
  | 
| 
alpar@18
 | 
  5987  | 
  \catcode`\|=\other
  | 
| 
alpar@18
 | 
  5988  | 
  \catcode`\<=\other
  | 
| 
alpar@18
 | 
  5989  | 
  \catcode`\>=\other
  | 
| 
alpar@18
 | 
  5990  | 
  \catcode`\$=\other
  | 
| 
alpar@18
 | 
  5991  | 
  \catcode`\#=\other
  | 
| 
alpar@18
 | 
  5992  | 
  \catcode`\&=\other
  | 
| 
alpar@18
 | 
  5993  | 
  \catcode`\%=\other
  | 
| 
alpar@18
 | 
  5994  | 
  \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
  | 
| 
alpar@18
 | 
  5995  | 
  %
  | 
| 
alpar@18
 | 
  5996  | 
  % Make the characters 128-255 be printing characters
  | 
| 
alpar@18
 | 
  5997  | 
  {%
 | 
| 
alpar@18
 | 
  5998  | 
    \count 1=128
  | 
| 
alpar@18
 | 
  5999  | 
    \def\loop{%
 | 
| 
alpar@18
 | 
  6000  | 
      \catcode\count 1=\other
  | 
| 
alpar@18
 | 
  6001  | 
      \advance\count 1 by 1
  | 
| 
alpar@18
 | 
  6002  | 
      \ifnum \count 1<256 \loop \fi
  | 
| 
alpar@18
 | 
  6003  | 
    }%
  | 
| 
alpar@18
 | 
  6004  | 
  }%
  | 
| 
alpar@18
 | 
  6005  | 
  %
  | 
| 
alpar@18
 | 
  6006  | 
  % Turn off \ as an escape so we do not lose on
  | 
| 
alpar@18
 | 
  6007  | 
  % entries which were dumped with control sequences in their names.
  | 
| 
alpar@18
 | 
  6008  | 
  % For example, @xrdef{$\leq $-fun}{page ...} made by @defun ^^
 | 
| 
alpar@18
 | 
  6009  | 
  % Reference to such entries still does not work the way one would wish,
  | 
| 
alpar@18
 | 
  6010  | 
  % but at least they do not bomb out when the aux file is read in.
  | 
| 
alpar@18
 | 
  6011  | 
  \catcode`\\=\other
  | 
| 
alpar@18
 | 
  6012  | 
  %
  | 
| 
alpar@18
 | 
  6013  | 
  % @ is our escape character in .aux files.
  | 
| 
alpar@18
 | 
  6014  | 
  \catcode`\{=1
 | 
| 
alpar@18
 | 
  6015  | 
  \catcode`\}=2
  | 
| 
alpar@18
 | 
  6016  | 
  \catcode`\@=0
  | 
| 
alpar@18
 | 
  6017  | 
  %
  | 
| 
alpar@18
 | 
  6018  | 
  \openin 1 \jobname.aux
  | 
| 
alpar@18
 | 
  6019  | 
  \ifeof 1 \else
  | 
| 
alpar@18
 | 
  6020  | 
    \closein 1
  | 
| 
alpar@18
 | 
  6021  | 
    \input \jobname.aux
  | 
| 
alpar@18
 | 
  6022  | 
    \global\havexrefstrue
  | 
| 
alpar@18
 | 
  6023  | 
  \fi
  | 
| 
alpar@18
 | 
  6024  | 
  % Open the new aux file.  TeX will close it automatically at exit.
  | 
| 
alpar@18
 | 
  6025  | 
  \openout\auxfile=\jobname.aux
  | 
| 
alpar@18
 | 
  6026  | 
\endgroup}
  | 
| 
alpar@18
 | 
  6027  | 
  | 
| 
alpar@18
 | 
  6028  | 
  | 
| 
alpar@18
 | 
  6029  | 
% Footnotes.
  | 
| 
alpar@18
 | 
  6030  | 
  | 
| 
alpar@18
 | 
  6031  | 
\newcount \footnoteno
  | 
| 
alpar@18
 | 
  6032  | 
  | 
| 
alpar@18
 | 
  6033  | 
% The trailing space in the following definition for supereject is
  | 
| 
alpar@18
 | 
  6034  | 
% vital for proper filling; pages come out unaligned when you do a
  | 
| 
alpar@18
 | 
  6035  | 
% pagealignmacro call if that space before the closing brace is
  | 
| 
alpar@18
 | 
  6036  | 
% removed. (Generally, numeric constants should always be followed by a
  | 
| 
alpar@18
 | 
  6037  | 
% space to prevent strange expansion errors.)
  | 
| 
alpar@18
 | 
  6038  | 
\def\supereject{\par\penalty -20000\footnoteno =0 }
 | 
| 
alpar@18
 | 
  6039  | 
  | 
| 
alpar@18
 | 
  6040  | 
% @footnotestyle is meaningful for info output only.
  | 
| 
alpar@18
 | 
  6041  | 
\let\footnotestyle=\comment
  | 
| 
alpar@18
 | 
  6042  | 
  | 
| 
alpar@18
 | 
  6043  | 
\let\ptexfootnote=\footnote
  | 
| 
alpar@18
 | 
  6044  | 
  | 
| 
alpar@18
 | 
  6045  | 
{\catcode `\@=11
 | 
| 
alpar@18
 | 
  6046  | 
%
  | 
| 
alpar@18
 | 
  6047  | 
% Auto-number footnotes.  Otherwise like plain.
  | 
| 
alpar@18
 | 
  6048  | 
\gdef\footnote{%
 | 
| 
alpar@18
 | 
  6049  | 
  \let\indent=\ptexindent
  | 
| 
alpar@18
 | 
  6050  | 
  \global\advance\footnoteno by \@ne
  | 
| 
alpar@18
 | 
  6051  | 
  \edef\thisfootno{$^{\the\footnoteno}$}%
 | 
| 
alpar@18
 | 
  6052  | 
  %
  | 
| 
alpar@18
 | 
  6053  | 
  % In case the footnote comes at the end of a sentence, preserve the
  | 
| 
alpar@18
 | 
  6054  | 
  % extra spacing after we do the footnote number.
  | 
| 
alpar@18
 | 
  6055  | 
  \let\@sf\empty
  | 
| 
alpar@18
 | 
  6056  | 
  \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi
 | 
| 
alpar@18
 | 
  6057  | 
  %
  | 
| 
alpar@18
 | 
  6058  | 
  % Remove inadvertent blank space before typesetting the footnote number.
  | 
| 
alpar@18
 | 
  6059  | 
  \unskip
  | 
| 
alpar@18
 | 
  6060  | 
  \thisfootno\@sf
  | 
| 
alpar@18
 | 
  6061  | 
  \dofootnote
  | 
| 
alpar@18
 | 
  6062  | 
}%
  | 
| 
alpar@18
 | 
  6063  | 
  | 
| 
alpar@18
 | 
  6064  | 
% Don't bother with the trickery in plain.tex to not require the
  | 
| 
alpar@18
 | 
  6065  | 
% footnote text as a parameter.  Our footnotes don't need to be so general.
  | 
| 
alpar@18
 | 
  6066  | 
%
  | 
| 
alpar@18
 | 
  6067  | 
% Oh yes, they do; otherwise, @ifset and anything else that uses
  | 
| 
alpar@18
 | 
  6068  | 
% \parseargline fail inside footnotes because the tokens are fixed when
  | 
| 
alpar@18
 | 
  6069  | 
% the footnote is read.  --karl, 16nov96.
  | 
| 
alpar@18
 | 
  6070  | 
%
  | 
| 
alpar@18
 | 
  6071  | 
% The start of the footnote looks usually like this:
  | 
| 
alpar@18
 | 
  6072  | 
\gdef\startfootins{\insert\footins\bgroup}
 | 
| 
alpar@18
 | 
  6073  | 
%
  | 
| 
alpar@18
 | 
  6074  | 
% ... but this macro is redefined inside @multitable.
  | 
| 
alpar@18
 | 
  6075  | 
%
  | 
| 
alpar@18
 | 
  6076  | 
\gdef\dofootnote{%
 | 
| 
alpar@18
 | 
  6077  | 
  \startfootins
  | 
| 
alpar@18
 | 
  6078  | 
  % We want to typeset this text as a normal paragraph, even if the
  | 
| 
alpar@18
 | 
  6079  | 
  % footnote reference occurs in (for example) a display environment.
  | 
| 
alpar@18
 | 
  6080  | 
  % So reset some parameters.
  | 
| 
alpar@18
 | 
  6081  | 
  \hsize=\pagewidth
  | 
| 
alpar@18
 | 
  6082  | 
  \interlinepenalty\interfootnotelinepenalty
  | 
| 
alpar@18
 | 
  6083  | 
  \splittopskip\ht\strutbox % top baseline for broken footnotes
  | 
| 
alpar@18
 | 
  6084  | 
  \splitmaxdepth\dp\strutbox
  | 
| 
alpar@18
 | 
  6085  | 
  \floatingpenalty\@MM
  | 
| 
alpar@18
 | 
  6086  | 
  \leftskip\z@skip
  | 
| 
alpar@18
 | 
  6087  | 
  \rightskip\z@skip
  | 
| 
alpar@18
 | 
  6088  | 
  \spaceskip\z@skip
  | 
| 
alpar@18
 | 
  6089  | 
  \xspaceskip\z@skip
  | 
| 
alpar@18
 | 
  6090  | 
  \parindent\defaultparindent
  | 
| 
alpar@18
 | 
  6091  | 
  %
  | 
| 
alpar@18
 | 
  6092  | 
  \smallfonts \rm
  | 
| 
alpar@18
 | 
  6093  | 
  %
  | 
| 
alpar@18
 | 
  6094  | 
  % Because we use hanging indentation in footnotes, a @noindent appears
  | 
| 
alpar@18
 | 
  6095  | 
  % to exdent this text, so make it be a no-op.  makeinfo does not use
  | 
| 
alpar@18
 | 
  6096  | 
  % hanging indentation so @noindent can still be needed within footnote
  | 
| 
alpar@18
 | 
  6097  | 
  % text after an @example or the like (not that this is good style).
  | 
| 
alpar@18
 | 
  6098  | 
  \let\noindent = \relax
  | 
| 
alpar@18
 | 
  6099  | 
  %
  | 
| 
alpar@18
 | 
  6100  | 
  % Hang the footnote text off the number.  Use \everypar in case the
  | 
| 
alpar@18
 | 
  6101  | 
  % footnote extends for more than one paragraph.
  | 
| 
alpar@18
 | 
  6102  | 
  \everypar = {\hang}%
 | 
| 
alpar@18
 | 
  6103  | 
  \textindent{\thisfootno}%
 | 
| 
alpar@18
 | 
  6104  | 
  %
  | 
| 
alpar@18
 | 
  6105  | 
  % Don't crash into the line above the footnote text.  Since this
  | 
| 
alpar@18
 | 
  6106  | 
  % expands into a box, it must come within the paragraph, lest it
  | 
| 
alpar@18
 | 
  6107  | 
  % provide a place where TeX can split the footnote.
  | 
| 
alpar@18
 | 
  6108  | 
  \footstrut
  | 
| 
alpar@18
 | 
  6109  | 
  \futurelet\next\fo@t
  | 
| 
alpar@18
 | 
  6110  | 
}
  | 
| 
alpar@18
 | 
  6111  | 
}%end \catcode `\@=11
  | 
| 
alpar@18
 | 
  6112  | 
  | 
| 
alpar@18
 | 
  6113  | 
% @| inserts a changebar to the left of the current line.  It should
  | 
| 
alpar@18
 | 
  6114  | 
% surround any changed text.  This approach does *not* work if the
  | 
| 
alpar@18
 | 
  6115  | 
% change spans more than two lines of output.  To handle that, we would
  | 
| 
alpar@18
 | 
  6116  | 
% have adopt a much more difficult approach (putting marks into the main
  | 
| 
alpar@18
 | 
  6117  | 
% vertical list for the beginning and end of each change).
  | 
| 
alpar@18
 | 
  6118  | 
%
  | 
| 
alpar@18
 | 
  6119  | 
\def\|{%
 | 
| 
alpar@18
 | 
  6120  | 
  % \vadjust can only be used in horizontal mode.
  | 
| 
alpar@18
 | 
  6121  | 
  \leavevmode
  | 
| 
alpar@18
 | 
  6122  | 
  %
  | 
| 
alpar@18
 | 
  6123  | 
  % Append this vertical mode material after the current line in the output.
  | 
| 
alpar@18
 | 
  6124  | 
  \vadjust{%
 | 
| 
alpar@18
 | 
  6125  | 
    % We want to insert a rule with the height and depth of the current
  | 
| 
alpar@18
 | 
  6126  | 
    % leading; that is exactly what \strutbox is supposed to record.
  | 
| 
alpar@18
 | 
  6127  | 
    \vskip-\baselineskip
  | 
| 
alpar@18
 | 
  6128  | 
    %
  | 
| 
alpar@18
 | 
  6129  | 
    % \vadjust-items are inserted at the left edge of the type.  So
  | 
| 
alpar@18
 | 
  6130  | 
    % the \llap here moves out into the left-hand margin.
  | 
| 
alpar@18
 | 
  6131  | 
    \llap{%
 | 
| 
alpar@18
 | 
  6132  | 
      %
  | 
| 
alpar@18
 | 
  6133  | 
      % For a thicker or thinner bar, change the `1pt'.
  | 
| 
alpar@18
 | 
  6134  | 
      \vrule height\baselineskip width1pt
  | 
| 
alpar@18
 | 
  6135  | 
      %
  | 
| 
alpar@18
 | 
  6136  | 
      % This is the space between the bar and the text.
  | 
| 
alpar@18
 | 
  6137  | 
      \hskip 12pt
  | 
| 
alpar@18
 | 
  6138  | 
    }%
  | 
| 
alpar@18
 | 
  6139  | 
  }%
  | 
| 
alpar@18
 | 
  6140  | 
}
  | 
| 
alpar@18
 | 
  6141  | 
  | 
| 
alpar@18
 | 
  6142  | 
% For a final copy, take out the rectangles
  | 
| 
alpar@18
 | 
  6143  | 
% that mark overfull boxes (in case you have decided
  | 
| 
alpar@18
 | 
  6144  | 
% that the text looks ok even though it passes the margin).
  | 
| 
alpar@18
 | 
  6145  | 
%
  | 
| 
alpar@18
 | 
  6146  | 
\def\finalout{\overfullrule=0pt}
 | 
| 
alpar@18
 | 
  6147  | 
  | 
| 
alpar@18
 | 
  6148  | 
% @image.  We use the macros from epsf.tex to support this.
  | 
| 
alpar@18
 | 
  6149  | 
% If epsf.tex is not installed and @image is used, we complain.
  | 
| 
alpar@18
 | 
  6150  | 
%
  | 
| 
alpar@18
 | 
  6151  | 
% Check for and read epsf.tex up front.  If we read it only at @image
  | 
| 
alpar@18
 | 
  6152  | 
% time, we might be inside a group, and then its definitions would get
  | 
| 
alpar@18
 | 
  6153  | 
% undone and the next image would fail.
  | 
| 
alpar@18
 | 
  6154  | 
\openin 1 = epsf.tex
  | 
| 
alpar@18
 | 
  6155  | 
\ifeof 1 \else
  | 
| 
alpar@18
 | 
  6156  | 
  \closein 1
  | 
| 
alpar@18
 | 
  6157  | 
  % Do not bother showing banner with epsf.tex v2.7k (available in
  | 
| 
alpar@18
 | 
  6158  | 
  % doc/epsf.tex and on ctan).
  | 
| 
alpar@18
 | 
  6159  | 
  \def\epsfannounce{\toks0 = }%
 | 
| 
alpar@18
 | 
  6160  | 
  \input epsf.tex
  | 
| 
alpar@18
 | 
  6161  | 
\fi
  | 
| 
alpar@18
 | 
  6162  | 
%
  | 
| 
alpar@18
 | 
  6163  | 
% We will only complain once about lack of epsf.tex.
  | 
| 
alpar@18
 | 
  6164  | 
\newif\ifwarnednoepsf
  | 
| 
alpar@18
 | 
  6165  | 
\newhelp\noepsfhelp{epsf.tex must be installed for images to
 | 
| 
alpar@18
 | 
  6166  | 
  work.  It is also included in the Texinfo distribution, or you can get
  | 
| 
alpar@18
 | 
  6167  | 
  it from ftp://tug.org/tex/epsf.tex.}
  | 
| 
alpar@18
 | 
  6168  | 
%
  | 
| 
alpar@18
 | 
  6169  | 
\def\image#1{%
 | 
| 
alpar@18
 | 
  6170  | 
  \ifx\epsfbox\undefined
  | 
| 
alpar@18
 | 
  6171  | 
    \ifwarnednoepsf \else
  | 
| 
alpar@18
 | 
  6172  | 
      \errhelp = \noepsfhelp
  | 
| 
alpar@18
 | 
  6173  | 
      \errmessage{epsf.tex not found, images will be ignored}%
 | 
| 
alpar@18
 | 
  6174  | 
      \global\warnednoepsftrue
  | 
| 
alpar@18
 | 
  6175  | 
    \fi
  | 
| 
alpar@18
 | 
  6176  | 
  \else
  | 
| 
alpar@18
 | 
  6177  | 
    \imagexxx #1,,,,,\finish
  | 
| 
alpar@18
 | 
  6178  | 
  \fi
  | 
| 
alpar@18
 | 
  6179  | 
}
  | 
| 
alpar@18
 | 
  6180  | 
%
  | 
| 
alpar@18
 | 
  6181  | 
% Arguments to @image:
  | 
| 
alpar@18
 | 
  6182  | 
% #1 is (mandatory) image filename; we tack on .eps extension.
  | 
| 
alpar@18
 | 
  6183  | 
% #2 is (optional) width, #3 is (optional) height.
  | 
| 
alpar@18
 | 
  6184  | 
% #4 is (ignored optional) html alt text.
  | 
| 
alpar@18
 | 
  6185  | 
% #5 is (ignored optional) extension.
  | 
| 
alpar@18
 | 
  6186  | 
% #6 is just the usual extra ignored arg for parsing this stuff.
  | 
| 
alpar@18
 | 
  6187  | 
\newif\ifimagevmode
  | 
| 
alpar@18
 | 
  6188  | 
\def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
 | 
| 
alpar@18
 | 
  6189  | 
  \catcode`\^^M = 5     % in case we're inside an example
  | 
| 
alpar@18
 | 
  6190  | 
  \normalturnoffactive  % allow _ et al. in names
  | 
| 
alpar@18
 | 
  6191  | 
  % If the image is by itself, center it.
  | 
| 
alpar@18
 | 
  6192  | 
  \ifvmode
  | 
| 
alpar@18
 | 
  6193  | 
    \imagevmodetrue
  | 
| 
alpar@18
 | 
  6194  | 
    \nobreak\bigskip
  | 
| 
alpar@18
 | 
  6195  | 
    % Usually we'll have text after the image which will insert
  | 
| 
alpar@18
 | 
  6196  | 
    % \parskip glue, so insert it here too to equalize the space
  | 
| 
alpar@18
 | 
  6197  | 
    % above and below.
  | 
| 
alpar@18
 | 
  6198  | 
    \nobreak\vskip\parskip
  | 
| 
alpar@18
 | 
  6199  | 
    \nobreak
  | 
| 
alpar@18
 | 
  6200  | 
    \line\bgroup\hss
  | 
| 
alpar@18
 | 
  6201  | 
  \fi
  | 
| 
alpar@18
 | 
  6202  | 
  %
  | 
| 
alpar@18
 | 
  6203  | 
  % Output the image.
  | 
| 
alpar@18
 | 
  6204  | 
  \ifpdf
  | 
| 
alpar@18
 | 
  6205  | 
    \dopdfimage{#1}{#2}{#3}%
 | 
| 
alpar@18
 | 
  6206  | 
  \else
  | 
| 
alpar@18
 | 
  6207  | 
    % \epsfbox itself resets \epsf?size at each figure.
  | 
| 
alpar@18
 | 
  6208  | 
    \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
 | 
| 
alpar@18
 | 
  6209  | 
    \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
 | 
| 
alpar@18
 | 
  6210  | 
    \epsfbox{#1.eps}%
 | 
| 
alpar@18
 | 
  6211  | 
  \fi
  | 
| 
alpar@18
 | 
  6212  | 
  %
  | 
| 
alpar@18
 | 
  6213  | 
  \ifimagevmode \hss \egroup \bigbreak \fi  % space after the image
  | 
| 
alpar@18
 | 
  6214  | 
\endgroup}
  | 
| 
alpar@18
 | 
  6215  | 
  | 
| 
alpar@18
 | 
  6216  | 
  | 
| 
alpar@18
 | 
  6217  | 
\message{localization,}
 | 
| 
alpar@18
 | 
  6218  | 
% and i18n.
  | 
| 
alpar@18
 | 
  6219  | 
  | 
| 
alpar@18
 | 
  6220  | 
% @documentlanguage is usually given very early, just after
  | 
| 
alpar@18
 | 
  6221  | 
% @setfilename.  If done too late, it may not override everything
  | 
| 
alpar@18
 | 
  6222  | 
% properly.  Single argument is the language abbreviation.
  | 
| 
alpar@18
 | 
  6223  | 
% It would be nice if we could set up a hyphenation file here.
  | 
| 
alpar@18
 | 
  6224  | 
%
  | 
| 
alpar@18
 | 
  6225  | 
\def\documentlanguage{\parsearg\dodocumentlanguage}
 | 
| 
alpar@18
 | 
  6226  | 
\def\dodocumentlanguage#1{%
 | 
| 
alpar@18
 | 
  6227  | 
  \tex % read txi-??.tex file in plain TeX.
  | 
| 
alpar@18
 | 
  6228  | 
  % Read the file if it exists.
  | 
| 
alpar@18
 | 
  6229  | 
  \openin 1 txi-#1.tex
  | 
| 
alpar@18
 | 
  6230  | 
  \ifeof1
  | 
| 
alpar@18
 | 
  6231  | 
    \errhelp = \nolanghelp
  | 
| 
alpar@18
 | 
  6232  | 
    \errmessage{Cannot read language file txi-#1.tex}%
 | 
| 
alpar@18
 | 
  6233  | 
    \let\temp = \relax
  | 
| 
alpar@18
 | 
  6234  | 
  \else
  | 
| 
alpar@18
 | 
  6235  | 
    \def\temp{\input txi-#1.tex }%
 | 
| 
alpar@18
 | 
  6236  | 
  \fi
  | 
| 
alpar@18
 | 
  6237  | 
  \temp
  | 
| 
alpar@18
 | 
  6238  | 
  \endgroup
  | 
| 
alpar@18
 | 
  6239  | 
}
  | 
| 
alpar@18
 | 
  6240  | 
\newhelp\nolanghelp{The given language definition file cannot be found or
 | 
| 
alpar@18
 | 
  6241  | 
is empty.  Maybe you need to install it?  In the current directory
  | 
| 
alpar@18
 | 
  6242  | 
should work if nowhere else does.}
  | 
| 
alpar@18
 | 
  6243  | 
  | 
| 
alpar@18
 | 
  6244  | 
  | 
| 
alpar@18
 | 
  6245  | 
% @documentencoding should change something in TeX eventually, most
  | 
| 
alpar@18
 | 
  6246  | 
% likely, but for now just recognize it.
  | 
| 
alpar@18
 | 
  6247  | 
\let\documentencoding = \comment
  | 
| 
alpar@18
 | 
  6248  | 
  | 
| 
alpar@18
 | 
  6249  | 
  | 
| 
alpar@18
 | 
  6250  | 
% Page size parameters.
  | 
| 
alpar@18
 | 
  6251  | 
%
  | 
| 
alpar@18
 | 
  6252  | 
\newdimen\defaultparindent \defaultparindent = 15pt
  | 
| 
alpar@18
 | 
  6253  | 
  | 
| 
alpar@18
 | 
  6254  | 
\chapheadingskip = 15pt plus 4pt minus 2pt
  | 
| 
alpar@18
 | 
  6255  | 
\secheadingskip = 12pt plus 3pt minus 2pt
  | 
| 
alpar@18
 | 
  6256  | 
\subsecheadingskip = 9pt plus 2pt minus 2pt
  | 
| 
alpar@18
 | 
  6257  | 
  | 
| 
alpar@18
 | 
  6258  | 
% Prevent underfull vbox error messages.
  | 
| 
alpar@18
 | 
  6259  | 
\vbadness = 10000
  | 
| 
alpar@18
 | 
  6260  | 
  | 
| 
alpar@18
 | 
  6261  | 
% Don't be so finicky about underfull hboxes, either.
  | 
| 
alpar@18
 | 
  6262  | 
\hbadness = 2000
  | 
| 
alpar@18
 | 
  6263  | 
  | 
| 
alpar@18
 | 
  6264  | 
% Following George Bush, just get rid of widows and orphans.
  | 
| 
alpar@18
 | 
  6265  | 
\widowpenalty=10000
  | 
| 
alpar@18
 | 
  6266  | 
\clubpenalty=10000
  | 
| 
alpar@18
 | 
  6267  | 
  | 
| 
alpar@18
 | 
  6268  | 
% Use TeX 3.0's \emergencystretch to help line breaking, but if we're
  | 
| 
alpar@18
 | 
  6269  | 
% using an old version of TeX, don't do anything.  We want the amount of
  | 
| 
alpar@18
 | 
  6270  | 
% stretch added to depend on the line length, hence the dependence on
  | 
| 
alpar@18
 | 
  6271  | 
% \hsize.  We call this whenever the paper size is set.
  | 
| 
alpar@18
 | 
  6272  | 
%
  | 
| 
alpar@18
 | 
  6273  | 
\def\setemergencystretch{%
 | 
| 
alpar@18
 | 
  6274  | 
  \ifx\emergencystretch\thisisundefined
  | 
| 
alpar@18
 | 
  6275  | 
    % Allow us to assign to \emergencystretch anyway.
  | 
| 
alpar@18
 | 
  6276  | 
    \def\emergencystretch{\dimen0}%
 | 
| 
alpar@18
 | 
  6277  | 
  \else
  | 
| 
alpar@18
 | 
  6278  | 
    \emergencystretch = .15\hsize
  | 
| 
alpar@18
 | 
  6279  | 
  \fi
  | 
| 
alpar@18
 | 
  6280  | 
}
  | 
| 
alpar@18
 | 
  6281  | 
  | 
| 
alpar@18
 | 
  6282  | 
% Parameters in order: 1) textheight; 2) textwidth; 3) voffset;
  | 
| 
alpar@18
 | 
  6283  | 
% 4) hoffset; 5) binding offset; 6) topskip; 7) physical page height; 8)
  | 
| 
alpar@18
 | 
  6284  | 
% physical page width.
  | 
| 
alpar@18
 | 
  6285  | 
%
  | 
| 
alpar@18
 | 
  6286  | 
% We also call \setleading{\textleading}, so the caller should define
 | 
| 
alpar@18
 | 
  6287  | 
% \textleading.  The caller should also set \parskip.
  | 
| 
alpar@18
 | 
  6288  | 
%
  | 
| 
alpar@18
 | 
  6289  | 
\def\internalpagesizes#1#2#3#4#5#6#7#8{%
 | 
| 
alpar@18
 | 
  6290  | 
  \voffset = #3\relax
  | 
| 
alpar@18
 | 
  6291  | 
  \topskip = #6\relax
  | 
| 
alpar@18
 | 
  6292  | 
  \splittopskip = \topskip
  | 
| 
alpar@18
 | 
  6293  | 
  %
  | 
| 
alpar@18
 | 
  6294  | 
  \vsize = #1\relax
  | 
| 
alpar@18
 | 
  6295  | 
  \advance\vsize by \topskip
  | 
| 
alpar@18
 | 
  6296  | 
  \outervsize = \vsize
  | 
| 
alpar@18
 | 
  6297  | 
  \advance\outervsize by 2\topandbottommargin
  | 
| 
alpar@18
 | 
  6298  | 
  \pageheight = \vsize
  | 
| 
alpar@18
 | 
  6299  | 
  %
  | 
| 
alpar@18
 | 
  6300  | 
  \hsize = #2\relax
  | 
| 
alpar@18
 | 
  6301  | 
  \outerhsize = \hsize
  | 
| 
alpar@18
 | 
  6302  | 
  \advance\outerhsize by 0.5in
  | 
| 
alpar@18
 | 
  6303  | 
  \pagewidth = \hsize
  | 
| 
alpar@18
 | 
  6304  | 
  %
  | 
| 
alpar@18
 | 
  6305  | 
  \normaloffset = #4\relax
  | 
| 
alpar@18
 | 
  6306  | 
  \bindingoffset = #5\relax
  | 
| 
alpar@18
 | 
  6307  | 
  %
  | 
| 
alpar@18
 | 
  6308  | 
  \ifpdf
  | 
| 
alpar@18
 | 
  6309  | 
    \pdfpageheight #7\relax
  | 
| 
alpar@18
 | 
  6310  | 
    \pdfpagewidth #8\relax
  | 
| 
alpar@18
 | 
  6311  | 
  \fi
  | 
| 
alpar@18
 | 
  6312  | 
  %
  | 
| 
alpar@18
 | 
  6313  | 
  \setleading{\textleading}
 | 
| 
alpar@18
 | 
  6314  | 
  %
  | 
| 
alpar@18
 | 
  6315  | 
  \parindent = \defaultparindent
  | 
| 
alpar@18
 | 
  6316  | 
  \setemergencystretch
  | 
| 
alpar@18
 | 
  6317  | 
}
  | 
| 
alpar@18
 | 
  6318  | 
  | 
| 
alpar@18
 | 
  6319  | 
% @letterpaper (the default).
  | 
| 
alpar@18
 | 
  6320  | 
\def\letterpaper{{\globaldefs = 1
 | 
| 
alpar@18
 | 
  6321  | 
  \parskip = 3pt plus 2pt minus 1pt
  | 
| 
alpar@18
 | 
  6322  | 
  \textleading = 13.2pt
  | 
| 
alpar@18
 | 
  6323  | 
  %
  | 
| 
alpar@18
 | 
  6324  | 
  % If page is nothing but text, make it come out even.
  | 
| 
alpar@18
 | 
  6325  | 
  \internalpagesizes{46\baselineskip}{6in}%
 | 
| 
alpar@18
 | 
  6326  | 
                    {\voffset}{.25in}%
 | 
| 
alpar@18
 | 
  6327  | 
                    {\bindingoffset}{36pt}%
 | 
| 
alpar@18
 | 
  6328  | 
                    {11in}{8.5in}%
 | 
| 
alpar@18
 | 
  6329  | 
}}
  | 
| 
alpar@18
 | 
  6330  | 
  | 
| 
alpar@18
 | 
  6331  | 
% Use @smallbook to reset parameters for 7x9.5 (or so) format.
  | 
| 
alpar@18
 | 
  6332  | 
\def\smallbook{{\globaldefs = 1
 | 
| 
alpar@18
 | 
  6333  | 
  \parskip = 2pt plus 1pt
  | 
| 
alpar@18
 | 
  6334  | 
  \textleading = 12pt
  | 
| 
alpar@18
 | 
  6335  | 
  %
  | 
| 
alpar@18
 | 
  6336  | 
  \internalpagesizes{7.5in}{5in}%
 | 
| 
alpar@18
 | 
  6337  | 
                    {\voffset}{.25in}%
 | 
| 
alpar@18
 | 
  6338  | 
                    {\bindingoffset}{16pt}%
 | 
| 
alpar@18
 | 
  6339  | 
                    {9.25in}{7in}%
 | 
| 
alpar@18
 | 
  6340  | 
  %
  | 
| 
alpar@18
 | 
  6341  | 
  \lispnarrowing = 0.3in
  | 
| 
alpar@18
 | 
  6342  | 
  \tolerance = 700
  | 
| 
alpar@18
 | 
  6343  | 
  \hfuzz = 1pt
  | 
| 
alpar@18
 | 
  6344  | 
  \contentsrightmargin = 0pt
  | 
| 
alpar@18
 | 
  6345  | 
  \defbodyindent = .5cm
  | 
| 
alpar@18
 | 
  6346  | 
}}
  | 
| 
alpar@18
 | 
  6347  | 
  | 
| 
alpar@18
 | 
  6348  | 
% Use @afourpaper to print on European A4 paper.
  | 
| 
alpar@18
 | 
  6349  | 
\def\afourpaper{{\globaldefs = 1
 | 
| 
alpar@18
 | 
  6350  | 
  \parskip = 3pt plus 2pt minus 1pt
  | 
| 
alpar@18
 | 
  6351  | 
  \textleading = 13.2pt
  | 
| 
alpar@18
 | 
  6352  | 
  %
  | 
| 
alpar@18
 | 
  6353  | 
  % Double-side printing via postscript on Laserjet 4050
  | 
| 
alpar@18
 | 
  6354  | 
  % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm.
  | 
| 
alpar@18
 | 
  6355  | 
  % To change the settings for a different printer or situation, adjust
  | 
| 
alpar@18
 | 
  6356  | 
  % \normaloffset until the front-side and back-side texts align.  Then
  | 
| 
alpar@18
 | 
  6357  | 
  % do the same for \bindingoffset.  You can set these for testing in
  | 
| 
alpar@18
 | 
  6358  | 
  % your texinfo source file like this:
  | 
| 
alpar@18
 | 
  6359  | 
  % @tex
  | 
| 
alpar@18
 | 
  6360  | 
  % \global\normaloffset = -6mm
  | 
| 
alpar@18
 | 
  6361  | 
  % \global\bindingoffset = 10mm
  | 
| 
alpar@18
 | 
  6362  | 
  % @end tex
  | 
| 
alpar@18
 | 
  6363  | 
  \internalpagesizes{51\baselineskip}{160mm}
 | 
| 
alpar@18
 | 
  6364  | 
                    {\voffset}{\hoffset}%
 | 
| 
alpar@18
 | 
  6365  | 
                    {\bindingoffset}{44pt}%
 | 
| 
alpar@18
 | 
  6366  | 
                    {297mm}{210mm}%
 | 
| 
alpar@18
 | 
  6367  | 
  %
  | 
| 
alpar@18
 | 
  6368  | 
  \tolerance = 700
  | 
| 
alpar@18
 | 
  6369  | 
  \hfuzz = 1pt
  | 
| 
alpar@18
 | 
  6370  | 
  \contentsrightmargin = 0pt
  | 
| 
alpar@18
 | 
  6371  | 
  \defbodyindent = 5mm
  | 
| 
alpar@18
 | 
  6372  | 
}}
  | 
| 
alpar@18
 | 
  6373  | 
  | 
| 
alpar@18
 | 
  6374  | 
% Use @afivepaper to print on European A5 paper.
  | 
| 
alpar@18
 | 
  6375  | 
% From romildo@urano.iceb.ufop.br, 2 July 2000.
  | 
| 
alpar@18
 | 
  6376  | 
% He also recommends making @example and @lisp be small.
  | 
| 
alpar@18
 | 
  6377  | 
\def\afivepaper{{\globaldefs = 1
 | 
| 
alpar@18
 | 
  6378  | 
  \parskip = 2pt plus 1pt minus 0.1pt
  | 
| 
alpar@18
 | 
  6379  | 
  \textleading = 12.5pt
  | 
| 
alpar@18
 | 
  6380  | 
  %
  | 
| 
alpar@18
 | 
  6381  | 
  \internalpagesizes{160mm}{120mm}%
 | 
| 
alpar@18
 | 
  6382  | 
                    {\voffset}{\hoffset}%
 | 
| 
alpar@18
 | 
  6383  | 
                    {\bindingoffset}{8pt}%
 | 
| 
alpar@18
 | 
  6384  | 
                    {210mm}{148mm}%
 | 
| 
alpar@18
 | 
  6385  | 
  %
  | 
| 
alpar@18
 | 
  6386  | 
  \lispnarrowing = 0.2in
  | 
| 
alpar@18
 | 
  6387  | 
  \tolerance = 800
  | 
| 
alpar@18
 | 
  6388  | 
  \hfuzz = 1.2pt
  | 
| 
alpar@18
 | 
  6389  | 
  \contentsrightmargin = 0pt
  | 
| 
alpar@18
 | 
  6390  | 
  \defbodyindent = 2mm
  | 
| 
alpar@18
 | 
  6391  | 
  \tableindent = 12mm
  | 
| 
alpar@18
 | 
  6392  | 
}}
  | 
| 
alpar@18
 | 
  6393  | 
  | 
| 
alpar@18
 | 
  6394  | 
% A specific text layout, 24x15cm overall, intended for A4 paper.
  | 
| 
alpar@18
 | 
  6395  | 
\def\afourlatex{{\globaldefs = 1
 | 
| 
alpar@18
 | 
  6396  | 
  \afourpaper
  | 
| 
alpar@18
 | 
  6397  | 
  \internalpagesizes{237mm}{150mm}%
 | 
| 
alpar@18
 | 
  6398  | 
                    {\voffset}{4.6mm}%
 | 
| 
alpar@18
 | 
  6399  | 
                    {\bindingoffset}{7mm}%
 | 
| 
alpar@18
 | 
  6400  | 
                    {297mm}{210mm}%
 | 
| 
alpar@18
 | 
  6401  | 
  %
  | 
| 
alpar@18
 | 
  6402  | 
  % Must explicitly reset to 0 because we call \afourpaper.
  | 
| 
alpar@18
 | 
  6403  | 
  \globaldefs = 0
  | 
| 
alpar@18
 | 
  6404  | 
}}
  | 
| 
alpar@18
 | 
  6405  | 
  | 
| 
alpar@18
 | 
  6406  | 
% Use @afourwide to print on A4 paper in landscape format.
  | 
| 
alpar@18
 | 
  6407  | 
\def\afourwide{{\globaldefs = 1
 | 
| 
alpar@18
 | 
  6408  | 
  \afourpaper
  | 
| 
alpar@18
 | 
  6409  | 
  \internalpagesizes{241mm}{165mm}%
 | 
| 
alpar@18
 | 
  6410  | 
                    {\voffset}{-2.95mm}%
 | 
| 
alpar@18
 | 
  6411  | 
                    {\bindingoffset}{7mm}%
 | 
| 
alpar@18
 | 
  6412  | 
                    {297mm}{210mm}%
 | 
| 
alpar@18
 | 
  6413  | 
  \globaldefs = 0
  | 
| 
alpar@18
 | 
  6414  | 
}}
  | 
| 
alpar@18
 | 
  6415  | 
  | 
| 
alpar@18
 | 
  6416  | 
% @pagesizes TEXTHEIGHT[,TEXTWIDTH]
  | 
| 
alpar@18
 | 
  6417  | 
% Perhaps we should allow setting the margins, \topskip, \parskip,
  | 
| 
alpar@18
 | 
  6418  | 
% and/or leading, also. Or perhaps we should compute them somehow.
  | 
| 
alpar@18
 | 
  6419  | 
%
  | 
| 
alpar@18
 | 
  6420  | 
\def\pagesizes{\parsearg\pagesizesxxx}
 | 
| 
alpar@18
 | 
  6421  | 
\def\pagesizesxxx#1{\pagesizesyyy #1,,\finish}
 | 
| 
alpar@18
 | 
  6422  | 
\def\pagesizesyyy#1,#2,#3\finish{{%
 | 
| 
alpar@18
 | 
  6423  | 
  \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
 | 
| 
alpar@18
 | 
  6424  | 
  \globaldefs = 1
  | 
| 
alpar@18
 | 
  6425  | 
  %
  | 
| 
alpar@18
 | 
  6426  | 
  \parskip = 3pt plus 2pt minus 1pt
  | 
| 
alpar@18
 | 
  6427  | 
  \setleading{\textleading}%
 | 
| 
alpar@18
 | 
  6428  | 
  %
  | 
| 
alpar@18
 | 
  6429  | 
  \dimen0 = #1
  | 
| 
alpar@18
 | 
  6430  | 
  \advance\dimen0 by \voffset
  | 
| 
alpar@18
 | 
  6431  | 
  %
  | 
| 
alpar@18
 | 
  6432  | 
  \dimen2 = \hsize
  | 
| 
alpar@18
 | 
  6433  | 
  \advance\dimen2 by \normaloffset
  | 
| 
alpar@18
 | 
  6434  | 
  %
  | 
| 
alpar@18
 | 
  6435  | 
  \internalpagesizes{#1}{\hsize}%
 | 
| 
alpar@18
 | 
  6436  | 
                    {\voffset}{\normaloffset}%
 | 
| 
alpar@18
 | 
  6437  | 
                    {\bindingoffset}{44pt}%
 | 
| 
alpar@18
 | 
  6438  | 
                    {\dimen0}{\dimen2}%
 | 
| 
alpar@18
 | 
  6439  | 
}}
  | 
| 
alpar@18
 | 
  6440  | 
  | 
| 
alpar@18
 | 
  6441  | 
% Set default to letter.
  | 
| 
alpar@18
 | 
  6442  | 
%
  | 
| 
alpar@18
 | 
  6443  | 
\letterpaper
  | 
| 
alpar@18
 | 
  6444  | 
  | 
| 
alpar@18
 | 
  6445  | 
  | 
| 
alpar@18
 | 
  6446  | 
\message{and turning on texinfo input format.}
 | 
| 
alpar@18
 | 
  6447  | 
  | 
| 
alpar@18
 | 
  6448  | 
% Define macros to output various characters with catcode for normal text.
  | 
| 
alpar@18
 | 
  6449  | 
\catcode`\"=\other
  | 
| 
alpar@18
 | 
  6450  | 
\catcode`\~=\other
  | 
| 
alpar@18
 | 
  6451  | 
\catcode`\^=\other
  | 
| 
alpar@18
 | 
  6452  | 
\catcode`\_=\other
  | 
| 
alpar@18
 | 
  6453  | 
\catcode`\|=\other
  | 
| 
alpar@18
 | 
  6454  | 
\catcode`\<=\other
  | 
| 
alpar@18
 | 
  6455  | 
\catcode`\>=\other
  | 
| 
alpar@18
 | 
  6456  | 
\catcode`\+=\other
  | 
| 
alpar@18
 | 
  6457  | 
\catcode`\$=\other
  | 
| 
alpar@18
 | 
  6458  | 
\def\normaldoublequote{"}
 | 
| 
alpar@18
 | 
  6459  | 
\def\normaltilde{~}
 | 
| 
alpar@18
 | 
  6460  | 
\def\normalcaret{^}
 | 
| 
alpar@18
 | 
  6461  | 
\def\normalunderscore{_}
 | 
| 
alpar@18
 | 
  6462  | 
\def\normalverticalbar{|}
 | 
| 
alpar@18
 | 
  6463  | 
\def\normalless{<}
 | 
| 
alpar@18
 | 
  6464  | 
\def\normalgreater{>}
 | 
| 
alpar@18
 | 
  6465  | 
\def\normalplus{+}
 | 
| 
alpar@18
 | 
  6466  | 
\def\normaldollar{$}%$ font-lock fix
 | 
| 
alpar@18
 | 
  6467  | 
  | 
| 
alpar@18
 | 
  6468  | 
% This macro is used to make a character print one way in ttfont
  | 
| 
alpar@18
 | 
  6469  | 
% where it can probably just be output, and another way in other fonts,
  | 
| 
alpar@18
 | 
  6470  | 
% where something hairier probably needs to be done.
  | 
| 
alpar@18
 | 
  6471  | 
%
  | 
| 
alpar@18
 | 
  6472  | 
% #1 is what to print if we are indeed using \tt; #2 is what to print
  | 
| 
alpar@18
 | 
  6473  | 
% otherwise.  Since all the Computer Modern typewriter fonts have zero
  | 
| 
alpar@18
 | 
  6474  | 
% interword stretch (and shrink), and it is reasonable to expect all
  | 
| 
alpar@18
 | 
  6475  | 
% typewriter fonts to have this, we can check that font parameter.
  | 
| 
alpar@18
 | 
  6476  | 
%
  | 
| 
alpar@18
 | 
  6477  | 
\def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
 | 
| 
alpar@18
 | 
  6478  | 
  | 
| 
alpar@18
 | 
  6479  | 
% Same as above, but check for italic font.  Actually this also catches
  | 
| 
alpar@18
 | 
  6480  | 
% non-italic slanted fonts since it is impossible to distinguish them from
  | 
| 
alpar@18
 | 
  6481  | 
% italic fonts.  But since this is only used by $ and it uses \sl anyway
  | 
| 
alpar@18
 | 
  6482  | 
% this is not a problem.
  | 
| 
alpar@18
 | 
  6483  | 
\def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
 | 
| 
alpar@18
 | 
  6484  | 
  | 
| 
alpar@18
 | 
  6485  | 
% Turn off all special characters except @
  | 
| 
alpar@18
 | 
  6486  | 
% (and those which the user can use as if they were ordinary).
  | 
| 
alpar@18
 | 
  6487  | 
% Most of these we simply print from the \tt font, but for some, we can
  | 
| 
alpar@18
 | 
  6488  | 
% use math or other variants that look better in normal text.
  | 
| 
alpar@18
 | 
  6489  | 
  | 
| 
alpar@18
 | 
  6490  | 
\catcode`\"=\active
  | 
| 
alpar@18
 | 
  6491  | 
\def\activedoublequote{{\tt\char34}}
 | 
| 
alpar@18
 | 
  6492  | 
\let"=\activedoublequote
  | 
| 
alpar@18
 | 
  6493  | 
\catcode`\~=\active
  | 
| 
alpar@18
 | 
  6494  | 
\def~{{\tt\char126}}
 | 
| 
alpar@18
 | 
  6495  | 
\chardef\hat=`\^
  | 
| 
alpar@18
 | 
  6496  | 
\catcode`\^=\active
  | 
| 
alpar@18
 | 
  6497  | 
\def^{{\tt \hat}}
 | 
| 
alpar@18
 | 
  6498  | 
  | 
| 
alpar@18
 | 
  6499  | 
\catcode`\_=\active
  | 
| 
alpar@18
 | 
  6500  | 
\def_{\ifusingtt\normalunderscore\_}
 | 
| 
alpar@18
 | 
  6501  | 
% Subroutine for the previous macro.
  | 
| 
alpar@18
 | 
  6502  | 
\def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }
 | 
| 
alpar@18
 | 
  6503  | 
  | 
| 
alpar@18
 | 
  6504  | 
\catcode`\|=\active
  | 
| 
alpar@18
 | 
  6505  | 
\def|{{\tt\char124}}
 | 
| 
alpar@18
 | 
  6506  | 
\chardef \less=`\<
  | 
| 
alpar@18
 | 
  6507  | 
\catcode`\<=\active
  | 
| 
alpar@18
 | 
  6508  | 
\def<{{\tt \less}}
 | 
| 
alpar@18
 | 
  6509  | 
\chardef \gtr=`\>
  | 
| 
alpar@18
 | 
  6510  | 
\catcode`\>=\active
  | 
| 
alpar@18
 | 
  6511  | 
\def>{{\tt \gtr}}
 | 
| 
alpar@18
 | 
  6512  | 
\catcode`\+=\active
  | 
| 
alpar@18
 | 
  6513  | 
\def+{{\tt \char 43}}
 | 
| 
alpar@18
 | 
  6514  | 
\catcode`\$=\active
  | 
| 
alpar@18
 | 
  6515  | 
\def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
 | 
| 
alpar@18
 | 
  6516  | 
  | 
| 
alpar@18
 | 
  6517  | 
% Set up an active definition for =, but don't enable it most of the time.
  | 
| 
alpar@18
 | 
  6518  | 
{\catcode`\==\active
 | 
| 
alpar@18
 | 
  6519  | 
\global\def={{\tt \char 61}}}
 | 
| 
alpar@18
 | 
  6520  | 
  | 
| 
alpar@18
 | 
  6521  | 
\catcode`+=\active
  | 
| 
alpar@18
 | 
  6522  | 
\catcode`\_=\active
  | 
| 
alpar@18
 | 
  6523  | 
  | 
| 
alpar@18
 | 
  6524  | 
% If a .fmt file is being used, characters that might appear in a file
  | 
| 
alpar@18
 | 
  6525  | 
% name cannot be active until we have parsed the command line.
  | 
| 
alpar@18
 | 
  6526  | 
% So turn them off again, and have \everyjob (or @setfilename) turn them on.
  | 
| 
alpar@18
 | 
  6527  | 
% \otherifyactive is called near the end of this file.
  | 
| 
alpar@18
 | 
  6528  | 
\def\otherifyactive{\catcode`+=\other \catcode`\_=\other}
 | 
| 
alpar@18
 | 
  6529  | 
  | 
| 
alpar@18
 | 
  6530  | 
\catcode`\@=0
  | 
| 
alpar@18
 | 
  6531  | 
  | 
| 
alpar@18
 | 
  6532  | 
% \rawbackslashxx outputs one backslash character in current font,
  | 
| 
alpar@18
 | 
  6533  | 
% as in \char`\\.
  | 
| 
alpar@18
 | 
  6534  | 
\global\chardef\rawbackslashxx=`\\
  | 
| 
alpar@18
 | 
  6535  | 
  | 
| 
alpar@18
 | 
  6536  | 
% \rawbackslash defines an active \ to do \rawbackslashxx.
  | 
| 
alpar@18
 | 
  6537  | 
% \otherbackslash defines an active \ to be a literal `\' character with
  | 
| 
alpar@18
 | 
  6538  | 
% catcode other.
  | 
| 
alpar@18
 | 
  6539  | 
{\catcode`\\=\active
 | 
| 
alpar@18
 | 
  6540  | 
 @gdef@rawbackslash{@let\=@rawbackslashxx}
 | 
| 
alpar@18
 | 
  6541  | 
 @gdef@otherbackslash{@let\=@realbackslash}
 | 
| 
alpar@18
 | 
  6542  | 
}
  | 
| 
alpar@18
 | 
  6543  | 
  | 
| 
alpar@18
 | 
  6544  | 
% \realbackslash is an actual character `\' with catcode other.
  | 
| 
alpar@18
 | 
  6545  | 
{\catcode`\\=\other @gdef@realbackslash{\}}
 | 
| 
alpar@18
 | 
  6546  | 
  | 
| 
alpar@18
 | 
  6547  | 
% \normalbackslash outputs one backslash in fixed width font.
  | 
| 
alpar@18
 | 
  6548  | 
\def\normalbackslash{{\tt\rawbackslashxx}}
 | 
| 
alpar@18
 | 
  6549  | 
  | 
| 
alpar@18
 | 
  6550  | 
\catcode`\\=\active
  | 
| 
alpar@18
 | 
  6551  | 
  | 
| 
alpar@18
 | 
  6552  | 
% Used sometimes to turn off (effectively) the active characters
  | 
| 
alpar@18
 | 
  6553  | 
% even after parsing them.
  | 
| 
alpar@18
 | 
  6554  | 
@def@turnoffactive{%
 | 
| 
alpar@18
 | 
  6555  | 
  @let"=@normaldoublequote
  | 
| 
alpar@18
 | 
  6556  | 
  @let\=@realbackslash
  | 
| 
alpar@18
 | 
  6557  | 
  @let~=@normaltilde
  | 
| 
alpar@18
 | 
  6558  | 
  @let^=@normalcaret
  | 
| 
alpar@18
 | 
  6559  | 
  @let_=@normalunderscore
  | 
| 
alpar@18
 | 
  6560  | 
  @let|=@normalverticalbar
  | 
| 
alpar@18
 | 
  6561  | 
  @let<=@normalless
  | 
| 
alpar@18
 | 
  6562  | 
  @let>=@normalgreater
  | 
| 
alpar@18
 | 
  6563  | 
  @let+=@normalplus
  | 
| 
alpar@18
 | 
  6564  | 
  @let$=@normaldollar %$ font-lock fix
  | 
| 
alpar@18
 | 
  6565  | 
}
  | 
| 
alpar@18
 | 
  6566  | 
  | 
| 
alpar@18
 | 
  6567  | 
% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
 | 
| 
alpar@18
 | 
  6568  | 
% the literal character `\'.  (Thus, \ is not expandable when this is in
  | 
| 
alpar@18
 | 
  6569  | 
% effect.)
  | 
| 
alpar@18
 | 
  6570  | 
%
  | 
| 
alpar@18
 | 
  6571  | 
@def@normalturnoffactive{@turnoffactive @let\=@normalbackslash}
 | 
| 
alpar@18
 | 
  6572  | 
  | 
| 
alpar@18
 | 
  6573  | 
% Make _ and + \other characters, temporarily.
  | 
| 
alpar@18
 | 
  6574  | 
% This is canceled by @fixbackslash.
  | 
| 
alpar@18
 | 
  6575  | 
@otherifyactive
  | 
| 
alpar@18
 | 
  6576  | 
  | 
| 
alpar@18
 | 
  6577  | 
% If a .fmt file is being used, we don't want the `\input texinfo' to show up.
  | 
| 
alpar@18
 | 
  6578  | 
% That is what \eatinput is for; after that, the `\' should revert to printing
  | 
| 
alpar@18
 | 
  6579  | 
% a backslash.
  | 
| 
alpar@18
 | 
  6580  | 
%
  | 
| 
alpar@18
 | 
  6581  | 
@gdef@eatinput input texinfo{@fixbackslash}
 | 
| 
alpar@18
 | 
  6582  | 
@global@let\ = @eatinput
  | 
| 
alpar@18
 | 
  6583  | 
  | 
| 
alpar@18
 | 
  6584  | 
% On the other hand, perhaps the file did not have a `\input texinfo'. Then
  | 
| 
alpar@18
 | 
  6585  | 
% the first `\{ in the file would cause an error. This macro tries to fix
 | 
| 
alpar@18
 | 
  6586  | 
% that, assuming it is called before the first `\' could plausibly occur.
  | 
| 
alpar@18
 | 
  6587  | 
% Also back turn on active characters that might appear in the input
  | 
| 
alpar@18
 | 
  6588  | 
% file name, in case not using a pre-dumped format.
  | 
| 
alpar@18
 | 
  6589  | 
%
  | 
| 
alpar@18
 | 
  6590  | 
@gdef@fixbackslash{%
 | 
| 
alpar@18
 | 
  6591  | 
  @ifx\@eatinput @let\ = @normalbackslash @fi
  | 
| 
alpar@18
 | 
  6592  | 
  @catcode`+=@active
  | 
| 
alpar@18
 | 
  6593  | 
  @catcode`@_=@active
  | 
| 
alpar@18
 | 
  6594  | 
}
  | 
| 
alpar@18
 | 
  6595  | 
  | 
| 
alpar@18
 | 
  6596  | 
% Say @foo, not \foo, in error messages.
  | 
| 
alpar@18
 | 
  6597  | 
@escapechar = `@@
  | 
| 
alpar@18
 | 
  6598  | 
  | 
| 
alpar@18
 | 
  6599  | 
% These look ok in all fonts, so just make them not special.
  | 
| 
alpar@18
 | 
  6600  | 
@catcode`@& = @other
  | 
| 
alpar@18
 | 
  6601  | 
@catcode`@# = @other
  | 
| 
alpar@18
 | 
  6602  | 
@catcode`@% = @other
  | 
| 
alpar@18
 | 
  6603  | 
  | 
| 
alpar@18
 | 
  6604  | 
@c Set initial fonts.
  | 
| 
alpar@18
 | 
  6605  | 
@textfonts
  | 
| 
alpar@18
 | 
  6606  | 
@rm
  | 
| 
alpar@18
 | 
  6607  | 
  | 
| 
alpar@18
 | 
  6608  | 
  | 
| 
alpar@18
 | 
  6609  | 
@c Local variables:
  | 
| 
alpar@18
 | 
  6610  | 
@c eval: (add-hook 'write-file-hooks 'time-stamp)
  | 
| 
alpar@18
 | 
  6611  | 
@c page-delimiter: "^\\\\message"
  | 
| 
alpar@18
 | 
  6612  | 
@c time-stamp-start: "def\\\\texinfoversion{"
 | 
| 
alpar@18
 | 
  6613  | 
@c time-stamp-format: "%:y-%02m-%02d.%02H"
  | 
| 
alpar@18
 | 
  6614  | 
@c time-stamp-end: "}"
  | 
| 
alpar@18
 | 
  6615  | 
@c End:
  |