automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FYI: update texinfo.tex


From: Alexandre Duret-Lutz
Subject: FYI: update texinfo.tex
Date: Sun, 04 Jan 2004 13:52:49 +0100
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux)

Installed on HEAD and branch-1-8.

2004-01-04  Alexandre Duret-Lutz  <address@hidden>

        * lib/texinfo.tex: New upstream version.

Index: lib/texinfo.tex
===================================================================
RCS file: /cvs/automake/automake/lib/texinfo.tex,v
retrieving revision 1.34
diff -u -r1.34 texinfo.tex
--- lib/texinfo.tex     10 Dec 2003 18:03:58 -0000      1.34
+++ lib/texinfo.tex     4 Jan 2004 12:48:29 -0000
@@ -3,10 +3,11 @@
 % Load plain if necessary, i.e., if running under initex.
 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
 %
-\def\texinfoversion{2003-12-04.17}
+\def\texinfoversion{2004-01-03.14}
 %
 % Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
-% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
+% Foundation, Inc.
 %
 % This texinfo.tex file is free software; you can redistribute it and/or
 % modify it under the terms of the GNU General Public License as
@@ -102,6 +103,15 @@
 % starts a new line in the output.
 \newlinechar = `^^J
 
+% Use TeX 3.0's \inputlineno to get the line number, for better error
+% messages, but if we're using an old version of TeX, don't do anything.
+%
+\ifx\inputlineno\thisisundefined
+  \let\linenumber = \empty % Pre-3.0.
+\else
+  \def\linenumber{l.\the\inputlineno:\space}
+\fi
+
 % Set up fixed words for English if not already set.
 \ifx\putwordAppendix\undefined  \gdef\putwordAppendix{Appendix}\fi
 \ifx\putwordChapter\undefined   \gdef\putwordChapter{Chapter}\fi
@@ -150,9 +160,12 @@
 \chardef\exclamChar= `\!
 \chardef\questChar = `\?
 \chardef\semiChar  = `\;
-\chardef\spaceChar = `\ %
 \chardef\underChar = `\_
 
+\chardef\spaceChar = `\ %
+\chardef\spacecat = 10
+\def\spaceisspace{\catcode\spaceChar=\spacecat}
+
 % Ignore a token.
 %
 \def\gobble#1{}
@@ -160,19 +173,6 @@
 % The following is used inside several \edef's.
 \def\makecsname#1{\expandafter\noexpand\csname#1\endcsname}
 
-% Make an outer definition into an inner one (due to Chris Thompson).
-% The arguments should be the control sequence to be defined, and the
-% new of the \outer control sequence, as characters; the control
-% sequence #1 is defined to be just the same as \csname#2\endcsname, but
-% not \outer.
-% 
-% For example, \innerdef\innernewcount{newcount} defines \innernewcount
-% to be a non-outer version of \newcount.
-%
-\def\innerdef#1#2{\edef#1{\expandafter\noexpand\csname #2\endcsname}}%
-%
-\innerdef\innernewcount{newcount}%
-
 % Hyphenation fixes.
 \hyphenation{ap-pen-dix}
 \hyphenation{eshell}
@@ -244,7 +244,7 @@
     \tracingassigns1
   \fi
   \tracingcommands3  % 3 gives us more in etex
-  \errorcontextlines\maxdimen
+  \errorcontextlines16
 }%
 
 % add check for \lastpenalty to plain's definitions.  If the last thing
@@ -388,7 +388,7 @@
   \def\next{#2}%
   \begingroup
     \obeylines
-    \catcode`\ =10
+    \spaceisspace
     #1%
     \parseargline\empty% Insert the \empty token, see \finishparsearg below.
 }
@@ -402,21 +402,43 @@
 
 % First remove any @comment, then any @c comment.
 \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
-\def\argremovec#1\c#2\ArgTerm{\argremovespace#1$ $\ArgTerm}
-% \argremovec might leave us with trailing space, though; e.g.,
+\def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
+
+% Each occurence of `\^^M' or `<space>\^^M' is replaced by a single space.
+%
+% \argremovec might leave us with trailing space, e.g.,
 %    @end itemize  @c foo
-% Note that the argument cannot contain the TeX $, as its catcode is
-% changed to \other when Texinfo source is read.
-\def\argremovespace#1 $#2\ArgTerm{\finishparsearg#1$\ArgTerm}
+% This space token undergoes the same procedure and is eventually removed
+% by \finishparsearg.
+%
+\def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M}
+\def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M}
+\def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{%
+  \def\temp{#3}%
+  \ifx\temp\empty
+    % We cannot use \next here, as it holds the macro to run;
+    % thus we reuse \temp.
+    \let\temp\finishparsearg
+  \else
+    \let\temp\argcheckspaces
+  \fi
+  % Put the space token in:
+  \temp#1 #3\ArgTerm
+}
 
 % If a _delimited_ argument is enclosed in braces, they get stripped; so
 % to get _exactly_ the rest of the line, we had to prevent such situation.
-% We prepended an \empty token at the very beginning and we expand it
+% We prepended an \empty token at the very beginning and we expand it now,
 % just before passing the control to \next.
-% (But first, we have to spend the remaining $ or two.)
-\def\finishparsearg#1$#2\ArgTerm{\expandafter\next\expandafter{#1}}
+% (Similarily, we have to think about #3 of \argcheckspacesY above: it is
+% either the null string, or it ends with \^^M---thus there is no danger
+% that a pair of braces would be stripped.
+%
+% But first, we have to remove the trailing space token.
+%
+\def\finishparsearg#1 \ArgTerm{\expandafter\next\expandafter{#1}}
 
-% \defparsearg\foo{...}
+% \parseargdef\foo{...}
 %      is roughly equivalent to
 % \def\foo{\parsearg\Xfoo}
 % \def\Xfoo#1{...}
@@ -424,10 +446,10 @@
 % Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my
 % favourite TeX trick.  --kasal, 16nov03
 
-\def\defparsearg#1{%
-  \expandafter \dodefparsearg \csname\string#1\endcsname #1%
+\def\parseargdef#1{%
+  \expandafter \doparseargdef \csname\string#1\endcsname #1%
 }
-\def\dodefparsearg#1#2{%
+\def\doparseargdef#1#2{%
   \def#2{\parsearg#1}%
   \def#1##1%
 }
@@ -453,46 +475,66 @@
 
 \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
 
+% Define the framework for environments in texinfo.tex.  It's used like this:
+% 
+%   \envdef\foo{...}
+%   \def\Efoo{...}
+%   
+% It's the responsibility of \envdef to insert \begingroup before the
+% actual body; @end closes the group after calling \Efoo.  \envdef also
+% defines \thisenv, so the current environment is known; @end checks
+% whether the environment name matches.  The \checkenv macro can also be
+% used to check whether the current environment is the one expected.
+% 
+% Non-false conditionals (@iftex, @ifset) don't fit into this, so they
+% are not treated as enviroments; they don't open a group.  (The
+% implementation of @end takes care not to call \endgroup in this
+% special case.)
+
+
+% At runtime, environments start with this:
+\def\startenvironment#1{\begingroup\def\thisenv{#1}}
+% initialize
+\let\thisenv\empty
+
+% ... but they get defined via ``\envdef\foo{...}'':
+\long\def\envdef#1#2{\def#1{\startenvironment#1#2}}
+\def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}}
 
-%% These are used to keep @begin/@end levels from running away
-%% Call \inENV within environments (after a \begingroup)
-\newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
-\def\ENVcheck{%
-\ifENV\errmessage{Still within an environment; press RETURN to continue}
-\endgroup\fi} % This is not perfect, but it should reduce lossage
-
-% @end foo executes the definition of \Efoo.
-%
-\defparsearg\end{%
-  \expandafter\ifx\csname E#1\endcsname\relax
-    \badenderror{#1}%
+% Check whether we're in the right environment:
+\def\checkenv#1{%
+  \def\temp{#1}%
+  \ifx\thisenv\temp
   \else
-    % Everything's ok; the right environment has been started.
-    \csname E#1\endcsname
+    \badenverr
   \fi
 }
 
-\def\badenderror#1{%
-  \expandafter\ifx\csname#1\endcsname\relax
-    % There's no \foo, i.e., no ``environment'' foo.
-    \errhelp = \EMsimple
-    \errmessage{Undefined command address@hidden #1'}%
+% Evironment mismatch, #1 expected:
+\def\badenverr{%
+  \errhelp = \EMsimple
+  \errmessage{This command can appear only \inenvironment\temp,
+    not \inenvironment\thisenv}%
+}
+\def\inenvironment#1{%
+  \ifx#1\empty
+    out of any environment%
   \else
-    \unmatchedenderror{#1}%
+    in environment \expandafter\string#1%
   \fi
 }
 
-% There is an environment #1, but it hasn't been started.  Give an error.
-%
-\def\unmatchedenderror#1{%
-  \errhelp = \EMsimple
-  \errmessage{This address@hidden #1' doesn't have a matching address@hidden'}%
-}
-
-% Define the control sequence \E#1 to give an unmatched @end error.
+% @end foo executes the definition of \Efoo.
+% But first, it executes a specialized version of \checkenv
 %
-\def\defineunmatchedend#1{%
-  \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}%
+\parseargdef\end{%
+  \if 1\csname iscond.#1\endcsname
+  \else
+    % The general wording of \badenverr may not be ideal, but... --kasal, 
06nov03
+    \expandafter\checkenv\csname#1\endcsname
+    \csname E#1\endcsname
+    \endgroup
+  \fi
 }
 
 \newhelp\EMsimple{Press RETURN to continue.}
@@ -528,6 +570,9 @@
   address@hidden
 !endgroup
 
+% @comma{} to avoid , parsing problems.
+\let\comma = ,
+
 % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
 % Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
 \let\, = \c
@@ -537,10 +582,12 @@
 \let\ubaraccent = \b
 \let\udotaccent = \d
 
-% Other special characters: @questiondown @exclamdown
+% Other special characters: @questiondown @exclamdown @ordf @ordm
 % Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
 \def\questiondown{?`}
 \def\exclamdown{!`}
+\def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}}
+\def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}}
 
 % Dotless i and dotless j, used for accents.
 \def\imacro{i}
@@ -553,6 +600,25 @@
   \fi\fi
 }
 
+% The \TeX{} logo, as in plain, but resetting the spacing so that a
+% period following counts as ending a sentence.  (Idea found in latex.)
+% 
+\def\TeX{T\kern-.1667em\lower.5ex\hbox{E}\kern-.125emX\spacefactor=3000 }
+
+% @LaTeX{} logo.  Not quite the same results as the definition in
+% latex.ltx, since we use a different font for the raised A; it's most
+% convenient for us to use an explicitly smaller font, rather than using
+% the \scriptstyle font (since we don't reset \scriptstyle and
+% \scriptscriptstyle).
+% 
+\def\LaTeX{%
+  L\kern-.36em
+  {\setbox0=\hbox{T}%
+   \vbox to \ht0{\hbox{\selectfonts\lllsize A}\vss}}%
+  \kern-.15em
+  \TeX
+}
+
 % Be sure we're in horizontal mode when doing a tie, since we make space
 % equivalent to this in @example-like environments. Otherwise, a space
 % at the beginning of a line will start with \penalty -- and
@@ -606,61 +672,14 @@
 \newbox\groupbox
 \def\vfilllimit{0.7}
 %
-\def\group{\begingroup
+\envdef\group{%
   \ifnum\catcode`\^^M=\active \else
     \errhelp = \groupinvalidhelp
     address@hidden invalid in context where filling is enabled}%
   \fi
   \startsavinginserts
   %
-  % The \vtop we start below produces a box with normal height and large
-  % depth; thus, TeX puts \baselineskip glue before it, and (when the
-  % next line of text is done) \lineskip glue after it.  (See p.82 of
-  % the TeXbook.)  Thus, space below is not quite equal to space
-  % above.  But it's pretty close.
-  \def\Egroup{%
-    \egroup           % End the \vtop.
-    % \dimen0 is the vertical size of the group's box.
-    \dimen0 = \ht\groupbox  \advance\dimen0 by \dp\groupbox
-    % \dimen2 is how much space is left on the page (more or less).
-    \dimen2 = \pageheight   \advance\dimen2 by -\pagetotal
-    % if the group doesn't fit on the current page, and it's a big big
-    % group, force a page break.
-    \ifdim \dimen0 > \dimen2
-      \ifdim \pagetotal < \vfilllimit\pageheight
-        \page
-      \fi
-    \fi
-    \box\groupbox
-    \checkinserts
-    \endgroup         % End the \group.
-  }%
-  %
   \setbox\groupbox = \vtop\bgroup
-    % We have to put a strut on the last line in case the @group is in
-    % the midst of an example, rather than completely enclosing it.
-    % Otherwise, the interline space between the last line of the group
-    % and the first line afterwards is too small.  But we can't put the
-    % strut in \Egroup, since there it would be on a line by itself.
-    % Hence this just inserts a strut at the beginning of each line.
-    \everypar = {\strut}%
-    %
-    % Since we have a strut on every line, we don't need any of TeX's
-    % normal interline spacing.
-    \offinterlineskip
-    %
-    % OK, but now we have to do something about blank
-    % lines in the input in @example-like environments, which normally
-    % just turn into \lisppar, which will insert no space now that we've
-    % turned off the interline space.  Simplest is to make them be an
-    % empty paragraph.
-    \ifx\par\lisppar
-      \edef\par{\leavevmode \par}%
-      %
-      % Reset ^^M's definition to new definition of \par.
-      \obeylines
-    \fi
-    %
     % Do @comment since we are called inside an environment such as
     % @example, where each end-of-line in the input causes an
     % end-of-line in the output.  We don't want the end-of-line after
@@ -670,6 +689,32 @@
     \comment
 }
 %
+% The \vtop produces a box with normal height and large depth; thus, TeX puts
+% \baselineskip glue before it, and (when the next line of text is done)
+% \lineskip glue after it.  Thus, space below is not quite equal to space
+% above.  But it's pretty close.
+\def\Egroup{%
+    % To get correct interline space between the last line of the group
+    % and the first line afterwards, we have to propagate \prevdepth.
+    \endgraf % Not \par, as it may have been set to \lisppar.
+    \global\dimen1 = \prevdepth
+  \egroup           % End the \vtop.
+  % \dimen0 is the vertical size of the group's box.
+  \dimen0 = \ht\groupbox  \advance\dimen0 by \dp\groupbox
+  % \dimen2 is how much space is left on the page (more or less).
+  \dimen2 = \pageheight   \advance\dimen2 by -\pagetotal
+  % if the group doesn't fit on the current page, and it's a big big
+  % group, force a page break.
+  \ifdim \dimen0 > \dimen2
+    \ifdim \pagetotal < \vfilllimit\pageheight
+      \page
+    \fi
+  \fi
+  \box\groupbox
+  \prevdepth = \dimen1
+  \checkinserts
+}
+%
 % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
 % message, so this ends up printing address@hidden can only ...'.
 %
@@ -683,7 +728,7 @@
 \newdimen\mil  \mil=0.001in
 
 % Old definition--didn't work.
-%\defparsearg\need{\par %
+%\parseargdef\need{\par %
 %% This method tries to make TeX break the page naturally
 %% if the depth of the box does not fit.
 %{\baselineskip=0pt%
@@ -691,7 +736,7 @@
 %\prevdepth=-1000pt
 %}}
 
-\defparsearg\need{%
+\parseargdef\need{%
   % Ensure vertical mode, so we don't make a big box in the middle of a
   % paragraph.
   \par
@@ -730,35 +775,10 @@
   \fi
 }
 
-% @br   forces paragraph break
+% @br   forces paragraph break (and is undocumented).
 
 \let\br = \par
 
-% @dots{} output an ellipsis using the current font.
-% We do .5em per period so that it has the same spacing in a typewriter
-% font as three actual period characters.
-%
-\def\dots{%
-  \leavevmode
-  \hbox to 1.5em{%
-    \hskip 0pt plus 0.25fil minus 0.25fil
-    .\hss.\hss.%
-    \hskip 0pt plus 0.5fil minus 0.5fil
-  }%
-}
-
-% @enddots{} is an end-of-sentence ellipsis.
-%
-\def\enddots{%
-  \leavevmode
-  \hbox to 2em{%
-    \hskip 0pt plus 0.25fil minus 0.25fil
-    .\hss.\hss.\hss.%
-    \hskip 0pt plus 0.5fil minus 0.5fil
-  }%
-  \spacefactor=3000
-}
-
 % @page forces the start of a new page.
 %
 \def\page{\par\vfill\supereject}
@@ -771,10 +791,10 @@
 \newskip\exdentamount
 
 % This defn is used inside fill environments such as @defun.
-\defparsearg\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}
+\parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}
 
 % This defn is used inside nofill environments such as @example.
-\defparsearg\nofillexdent{{\advance \leftskip by -\exdentamount
+\parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount
   \leftline{\hskip\leftskip{\rm#1}}}}
 
 % @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
@@ -870,19 +890,28 @@
 % @center line
 % outputs that line, centered.
 %
-\defparsearg\center{%
-  \ifhmode \hfil\break \fi
+\parseargdef\center{%
+  \ifhmode
+    \let\next\centerH
+  \else
+    \let\next\centerV
+  \fi
+  \next{\hfil \ignorespaces#1\unskip \hfil}%
+}
+\def\centerH#1{%
   {%
+    \hfil\break
     \advance\hsize by -\leftskip
     \advance\hsize by -\rightskip
-    \line{\hfil \ignorespaces#1\unskip \hfil}%
+    \line{#1}%
+    \break
   }%
-  \ifhmode \break \fi
 }
+\def\centerV#1{\line{\kern\leftskip #1\kern\rightskip}}
 
 % @sp n   outputs n lines of vertical space
 
-\defparsearg\sp{\vskip #1\baselineskip}
+\parseargdef\sp{\vskip #1\baselineskip}
 
 % @comment ...line which is ignored...
 % @c is the same as @comment
@@ -903,7 +932,7 @@
 \def\asisword{asis} % no translation, these are keywords
 \def\noneword{none}
 %
-\defparsearg\paragraphindent{%
+\parseargdef\paragraphindent{%
   \def\temp{#1}%
   \ifx\temp\asisword
   \else
@@ -920,7 +949,7 @@
 % We'll use ems for NCHARS like @paragraphindent.
 % It seems @exampleindent asis isn't necessary, but
 % I preserve it to make it similar to @paragraphindent.
-\defparsearg\exampleindent{%
+\parseargdef\exampleindent{%
   \def\temp{#1}%
   \ifx\temp\asisword
   \else
@@ -947,7 +976,7 @@
 %
 \def\insertword{insert}
 %
-\defparsearg\firstparagraphindent{%
+\parseargdef\firstparagraphindent{%
   \def\temp{#1}%
   \ifx\temp\noneword
     \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
@@ -1019,7 +1048,7 @@
   \mathactive
   $\finishmath
 }
-\def\finishmath#1{#1$\Etex}
+\def\finishmath#1{#1$\endgroup}  % Close the group opened by \tex.
 
 % Some active characters (such as <) are spaced differently in math.
 % We have to reset their definitions in case the @math was an argument
@@ -1042,6 +1071,31 @@
 \def\bullet{$\ptexbullet$}
 \def\minus{$-$}
 
+% @dots{} outputs an ellipsis using the current font.
+% We do .5em per period so that it has the same spacing in a typewriter
+% font as three actual period characters.
+%
+\def\dots{%
+  \leavevmode
+  \hbox to 1.5em{%
+    \hskip 0pt plus 0.25fil
+    .\hfil.\hfil.%
+    \hskip 0pt plus 0.5fil
+  }%
+}
+
+% @enddots{} is an end-of-sentence ellipsis.
+%
+\def\enddots{%
+  \dots
+  \spacefactor=3000
+}
+
+% @comma{} is so commas can be inserted into text without messing up
+% Texinfo's parsing.
+% 
+\let\comma = ,
+
 % @refill is a no-op.
 \let\refill=\relax
 
@@ -1057,7 +1111,9 @@
 % This makes it possible to make a .fmt file for texinfo.
 \def\setfilename{%
    \iflinks
-     \readauxfile
+     \tryauxfile
+     % Open the new aux file.  TeX will close it automatically at exit.
+     \immediate\openout\auxfile=\jobname.aux
    \fi % \openindices needs to do some work in any case.
    \openindices
    \fixbackslash  % Turn off hack to swallow `\input texinfo'.
@@ -1065,11 +1121,9 @@
    %
    % If texinfo.cnf is present on the system, read it.
    % Useful for site-wide @afourpaper, etc.
-   % Just to be on the safe side, close the input stream before the \input.
    \openin 1 texinfo.cnf
-   \ifeof1 \let\temp=\relax \else \def\temp{\input texinfo.cnf }\fi
-   \closein1
-   \temp
+   \ifeof 1 \else \input texinfo.cnf \fi
+   \closein 1
    %
    \comment % Ignore the actual filename.
 }
@@ -1172,22 +1226,32 @@
   }
   %
   \def\pdfmakeoutlines{%
-    \openin 1 \jobname.toc
-    \ifeof 1\else\begingroup
-      \closein 1
+    \begingroup
       % Thanh's hack / proper braces in bookmarks
       \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace
       \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace
       %
       % Read toc silently, to get counts of subentries for \pdfoutline.
-      \def\numchapentry##1##2##3##4{\def\thischapnum{##2}}%
+      \def\numchapentry##1##2##3##4{%
+       \def\thischapnum{##2}%
+       \let\thissecnum\empty
+       \let\thissubsecnum\empty
+      }%
       \def\numsecentry##1##2##3##4{%
-        \def\thissecnum{##2}%
-        \advancenumber{chap\thischapnum}}%
+       \advancenumber{chap\thischapnum}%
+       \def\thissecnum{##2}%
+       \let\thissubsecnum\empty
+      }%
       \def\numsubsecentry##1##2##3##4{%
-        \def\thissubsecnum{##2}%
-        \advancenumber{sec\thissecnum}}%
-      \def\numsubsubsecentry##1##2##3##4{\advancenumber{subsec\thissubsecnum}}%
+       \advancenumber{sec\thissecnum}%
+       \def\thissubsecnum{##2}%
+      }%
+      \def\numsubsubsecentry##1##2##3##4{%
+       \advancenumber{subsec\thissubsecnum}%
+      }%
+      \let\thischapnum\empty
+      \let\thissecnum\empty
+      \let\thissubsecnum\empty
       %
       % use \def rather than \let here because we redefine \chapentry et
       % al. a second time, below.
@@ -1219,7 +1283,7 @@
       \indexnofonts
       \turnoffactive
       \input \jobname.toc
-    \endgroup\fi
+    \endgroup
   }
   %
   \def\makelinks #1,{%
@@ -1305,16 +1369,34 @@
 
 
 \message{fonts,}
-% Font-change commands.
+
+% Change the current font style to #1, remembering it in \curfontstyle.
+% For now, we do not accumulate font styles: @address@hidden prints foo in
+% italics, not bold italics.
+% 
+\def\setfontstyle#1{%
+  \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd.
+  \csname ten#1\endcsname  % change the current font
+}
+
+% Select #1 fonts with the current style.
+% 
+\def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname}
+
+\def\rm{\fam=0 \setfontstyle{rm}}
+\def\it{\fam=\itfam \setfontstyle{it}}
+\def\sl{\fam=\slfam \setfontstyle{sl}}
+\def\bf{\fam=\bffam \setfontstyle{bf}}
+\def\tt{\fam=\ttfam \setfontstyle{tt}}
 
 % Texinfo sort of supports the sans serif font style, which plain TeX does not.
-% So we set up a \sf analogous to plain's \rm, etc.
+% So we set up a \sf.
 \newfam\sffam
-\def\sf{\fam=\sffam \tensf}
+\def\sf{\fam=\sffam \setfontstyle{sf}}
 \let\li = \sf % Sometimes we call it \li, not \sf.
 
-% We don't need math for this one.
-\def\ttsl{\tenttsl}
+% We don't need math for this font style.
+\def\ttsl{\setfontstyle{ttsl}}
 
 % Default leading.
 \newdimen\textleading  \textleading = 13.2pt
@@ -1365,6 +1447,7 @@
 \def\scshape{csc}
 \def\scbshape{csc}
 
+% Text fonts (11.2pt, magstep1).
 \newcount\mainmagstep
 \ifx\bigger\relax
   % not really supported.
@@ -1415,7 +1498,7 @@
 \font\smalleri=cmmi8
 \font\smallersy=cmsy8
 
-% Fonts for title page:
+% Fonts for title page (20.4pt):
 \setfont\titlerm\rmbshape{12}{\magstep3}
 \setfont\titleit\itbshape{10}{\magstep4}
 \setfont\titlesl\slbshape{10}{\magstep4}
@@ -1461,11 +1544,21 @@
 \setfont\ssecttsl\ttslshape{10}{1315}
 \setfont\ssecsf\sfbshape{12}{\magstephalf}
 \let\ssecbf\ssecrm
-\setfont\ssecsc\scbshape{10}{\magstep1}
+\setfont\ssecsc\scbshape{10}{1315}
 \font\sseci=cmmi12 scaled \magstephalf
 \font\ssecsy=cmsy10 scaled 1315
-% The smallcaps and symbol fonts should actually be scaled \magstep1.5,
-% but that is not a standard magnification.
+
+% Reduced fonts for @acro in text (10pt).
+\setfont\reducedrm\rmshape{10}{1000}
+\setfont\reducedtt\ttshape{10}{1000}
+\setfont\reducedbf\bfshape{10}{1000}
+\setfont\reducedit\itshape{10}{1000}
+\setfont\reducedsl\slshape{10}{1000}
+\setfont\reducedsf\sfshape{10}{1000}
+\setfont\reducedsc\scshape{10}{1000}
+\setfont\reducedttsl\ttslshape{10}{1000}
+\font\reducedi=cmmi10
+\font\reducedsy=cmsy10
 
 % In order for the font changes to affect most math symbols and letters,
 % we have to define the \textfont of the standard families.  Since
@@ -1480,50 +1573,72 @@
 }
 
 % The font-changing commands redefine the meanings of \tenSTYLE, instead
-% of just \STYLE.  We do this so that font changes will continue to work
-% in math mode, where it is the current \fam that is relevant in most
-% cases, not the current font.  Plain TeX does \def\bf{\fam=\bffam
-% \tenbf}, for example.  By redefining \tenbf, we obviate the need to
-% redefine \bf itself.
+% of just \STYLE.  We do this because \STYLE needs to also set the
+% current \fam for math mode.  Our \STYLE (e.g., \rm) commands hardwire
+% \tenSTYLE to set the current font.
+% 
+% Each font-changing command also sets the names \lsize (one size lower)
+% and \lllsize (three sizes lower).  These relative commands are used in
+% the LaTeX logo and acronyms.
+% 
+% This all needs generalizing, badly.
+% 
 \def\textfonts{%
   \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
   \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
-  \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl
+  \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy
+  \let\tenttsl=\textttsl
+  \def\lsize{reduced}\def\lllsize{smaller}%
   \resetmathfonts \setleading{\textleading}}
 \def\titlefonts{%
   \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl
   \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc
   \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
   \let\tenttsl=\titlettsl
+  \def\lsize{chap}\def\lllsize{subsec}%
   \resetmathfonts \setleading{25pt}}
 \def\titlefont#1{{\titlefonts\rm #1}}
 \def\chapfonts{%
   \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
   \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
   \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl
+  \def\lsize{sec}\def\lllsize{text}%
   \resetmathfonts \setleading{19pt}}
 \def\secfonts{%
   \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
   \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
-  \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl
+  \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy
+  \let\tenttsl=\secttsl
+  \def\lsize{subsec}\def\lllsize{reduced}%
   \resetmathfonts \setleading{16pt}}
 \def\subsecfonts{%
   \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
   \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
-  \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl
+  \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy
+  \let\tenttsl=\ssecttsl
+  \def\lsize{text}\def\lllsize{small}%
   \resetmathfonts \setleading{15pt}}
-\let\subsubsecfonts = \subsecfonts % Maybe make sssec fonts scaled magstephalf?
+\let\subsubsecfonts = \subsecfonts
+\def\reducedfonts{%
+  \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl
+  \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc
+  \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy
+  \let\tenttsl=\reducedttsl
+  \def\lsize{small}\def\lllsize{smaller}%
+  \resetmathfonts \setleading{10.5pt}}
 \def\smallfonts{%
   \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl
   \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc
   \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy
   \let\tenttsl=\smallttsl
+  \def\lsize{smaller}\def\lllsize{smaller}%
   \resetmathfonts \setleading{10.5pt}}
 \def\smallerfonts{%
   \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl
   \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc
   \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy
   \let\tenttsl=\smallerttsl
+  \def\lsize{smaller}\def\lllsize{smaller}%
   \resetmathfonts \setleading{9.5pt}}
 
 % Set the fonts to use with the @small... environments.
@@ -1532,7 +1647,7 @@
 % About \smallexamplefonts.  If we use \smallfonts (9pt), @smallexample
 % can fit this many characters:
 %   8.5x11=86   smallbook=72  a4=90  a5=69
-% If we use \smallerfonts (8pt), then we can fit this many characters:
+% If we use \scriptfonts (8pt), then we can fit this many characters:
 %   8.5x11=90+  smallbook=80  a4=90+  a5=77
 % For me, subjectively, the few extra characters that fit aren't worth
 % the additional smallness of 8pt.  So I'm making the default 9pt.
@@ -1540,14 +1655,13 @@
 % By the way, for comparison, here's what fits with @example (10pt):
 %   8.5x11=71  smallbook=60  a4=75  a5=58
 %
-% I wish we used A4 paper on this side of the Atlantic.
-%
+% I wish the USA used A4 paper.
 % --karl, 24jan03.
 
 
 % Set up the default fonts, so we can use them for creating boxes.
 %
-\textfonts
+\textfonts \rm
 
 % Define these so they can be easily changed for other fonts.
 \def\angleleft{$\langle$}
@@ -1610,7 +1724,6 @@
   {\tt \rawbackslash \frenchspacing #1}%
   \null
 }
-\let\ttfont=\t
 \def\samp#1{`\tclose{#1}'\null}
 \setfont\keyrm\rmshape{8}{1000}
 \font\keysy=cmsy9
@@ -1651,7 +1764,7 @@
   \null
 }
 
-% We *must* turn on hyphenation at `-' and `_' in \code.
+% We *must* turn on hyphenation at `-' and `_' in @code.
 % Otherwise, it is too hard to avoid overfull hboxes
 % in the Emacs manual, the Library manual, etc.
 
@@ -1692,7 +1805,7 @@
 % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
 %   `example' (@kbd uses ttsl only inside of @example and friends),
 %   or `code' (@kbd uses normal tty font always).
-\defparsearg\kbdinputstyle{%
+\parseargdef\kbdinputstyle{%
   \def\arg{#1}%
   \ifx\arg\worddistinct
     \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
@@ -1792,20 +1905,26 @@
 \def\sc#1{{\smallcaps#1}}       % smallcaps font
 \def\ii#1{{\it #1}}             % italic font
 
-% @acronym downcases the argument and prints in smallcaps.
-% It would be nicer to go one point size down.
-\def\acronym#1{{\smallcaps \lowercase{#1}}}
+\def\acronym#1{\doacronym #1,,\finish}
+\def\doacronym#1,#2,#3\finish{%
+  {\selectfonts\lsize #1}%
+  \def\temp{#2}%
+  \ifx\temp\empty \else
+    \space ({\unsepspaces \ignorespaces \temp \unskip})%
+  \fi
+}
 
-% @pounds{} is a sterling sign.
+% @pounds{} is a sterling sign, which is in the CM italic font.
+% 
 \def\pounds{{\it\$}}
 
-% @registeredsymbol - R in a circle.  For now, only works in text size;
-% we'd have to redo the font mechanism to change the \scriptstyle and
-% \scriptscriptstyle font sizes to make it look right in headings.
+% @registeredsymbol - R in a circle.  The font for the R should really
+% be smaller yet, but lllsize is the best we can do for now.
 % Adapted from the plain.tex definition of \copyright.
 %
 \def\registeredsymbol{%
-  $^{{\ooalign{\hfil\raise.07ex\hbox{$\scriptstyle\rm R$}\hfil\crcr\Orb}}%
+  $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}%
+               \hfil\crcr\Orb}}%
     }$%
 }
 
@@ -1827,63 +1946,65 @@
 \newif\ifsetshortcontentsaftertitlepage
  \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue
 
-\defparsearg\shorttitlepage{\begingroup\hbox{}\vskip 1.5in \chaprm 
\centerline{#1}%
+\parseargdef\shorttitlepage{\begingroup\hbox{}\vskip 1.5in \chaprm 
\centerline{#1}%
         \endgroup\page\hbox{}\page}
 
-\def\titlepage{%
-  \begingroup \parindent=0pt \textfonts
-  % Leave some space at the very top of the page.
-  \vglue\titlepagetopglue
-  % No rule at page bottom unless we print one at the top with @title.
-  \finishedtitlepagetrue
-  %
-  % Most title ``pages'' are actually two pages long, with space
-  % at the top of the second.  We don't want the ragged left on the second.
-  \let\oldpage = \page
-  \def\page{%
-    \iffinishedtitlepage\else
-       \finishtitlepage
-    \fi
-    \let\page = \oldpage
-    \page
-    \null
-  }%
+\envdef\titlepage{%
+  % Open one extra group, as we want to close it in the middle of \Etitlepage.
+  \begingroup
+    \parindent=0pt \textfonts
+    % Leave some space at the very top of the page.
+    \vglue\titlepagetopglue
+    % No rule at page bottom unless we print one at the top with @title.
+    \finishedtitlepagetrue
+    %
+    % Most title ``pages'' are actually two pages long, with space
+    % at the top of the second.  We don't want the ragged left on the second.
+    \let\oldpage = \page
+    \def\page{%
+      \iffinishedtitlepage\else
+        \finishtitlepage
+      \fi
+      \let\page = \oldpage
+      \page
+      \null
+    }%
 }
 
 \def\Etitlepage{%
-   \iffinishedtitlepage\else
-      \finishtitlepage
-   \fi
-   % It is important to do the page break before ending the group,
-   % because the headline and footline are only empty inside the group.
-   % If we use the new definition of \page, we always get a blank page
-   % after the title page, which we certainly don't want.
-   \oldpage
-   \endgroup
-   %
-   % Need this before the \...aftertitlepage checks so that if they are
-   % in effect the toc pages will come out with page numbers.
-   \HEADINGSon
-   %
-   % If they want short, they certainly want long too.
-   \ifsetshortcontentsaftertitlepage
-     \shortcontents
-     \contents
-     \global\let\shortcontents = \relax
-     \global\let\contents = \relax
-   \fi
-   %
-   \ifsetcontentsaftertitlepage
-     \contents
-     \global\let\contents = \relax
-     \global\let\shortcontents = \relax
-   \fi
+    \iffinishedtitlepage\else
+       \finishtitlepage
+    \fi
+    % It is important to do the page break before ending the group,
+    % because the headline and footline are only empty inside the group.
+    % If we use the new definition of \page, we always get a blank page
+    % after the title page, which we certainly don't want.
+    \oldpage
+  \endgroup
+  %
+  % Need this before the \...aftertitlepage checks so that if they are
+  % in effect the toc pages will come out with page numbers.
+  \HEADINGSon
+  %
+  % If they want short, they certainly want long too.
+  \ifsetshortcontentsaftertitlepage
+    \shortcontents
+    \contents
+    \global\let\shortcontents = \relax
+    \global\let\contents = \relax
+  \fi
+  %
+  \ifsetcontentsaftertitlepage
+    \contents
+    \global\let\contents = \relax
+    \global\let\shortcontents = \relax
+  \fi
 }
 
 \def\finishtitlepage{%
-   \vskip4pt \hrule height 2pt width \hsize
-   \vskip\titlepagebottomglue
-   \finishedtitlepagetrue
+  \vskip4pt \hrule height 2pt width \hsize
+  \vskip\titlepagebottomglue
+  \finishedtitlepagetrue
 }
 
 %%% Macros to be used within @titlepage:
@@ -1894,16 +2015,31 @@
 \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines
                \let\tt=\authortt}
 
-\defparsearg\title{\leftline{\titlefonts\rm #1}
-               % print a rule at the page bottom also.
-               \finishedtitlepagefalse
-               \vskip4pt \hrule height 4pt width \hsize \vskip4pt}
+\parseargdef\title{%
+  \checkenv\titlepage
+  \leftline{\titlefonts\rm #1}
+  % print a rule at the page bottom also.
+  \finishedtitlepagefalse
+  \vskip4pt \hrule height 4pt width \hsize \vskip4pt
+}
 
-\defparsearg\subtitle{{\subtitlefont \rightline{#1}}}
+\parseargdef\subtitle{%
+  \checkenv\titlepage
+  {\subtitlefont \rightline{#1}}%
+}
 
 % @author should come last, but may come many times.
-\defparsearg\author{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
-  {\authorfont \leftline{#1}}}
+\parseargdef\author{%
+  \def\temp{\quotation}%
+  \ifx\thisenv\temp
+    This edition of the manual is dedicated to Karl Berry who should
+    really make affiliations work.
+  \else
+    \checkenv\titlepage
+    \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi
+    {\authorfont \leftline{#1}}%
+  \fi
+}
 
 
 %%% Set up page headings and footings.
@@ -1940,7 +2076,7 @@
 \def\oddheadingyyy #1\|#2\|#3\|#4\finish{%
 \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
 
-\defparsearg\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
+\parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
 
 \def\evenfooting{\parsearg\evenfootingxxx}
 \def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish}
@@ -1958,7 +2094,7 @@
   \global\advance\vsize by -\baselineskip
 }
 
-\defparsearg\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}}
+\parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}}
 
 
 % @headings double      turns headings on for double-sided printing.
@@ -2130,18 +2266,15 @@
 address@hidden while not in a list environment}}
 
 % @table, @ftable, @vtable.
-\def\table{%
-  \begingroup\inENV
+\envdef\table{%
   \let\itemindex\gobble
   \tablex
 }
-\def\ftable{%
-  \begingroup\inENV
+\envdef\ftable{%
   \def\itemindex ##1{\doind {fn}{\code{##1}}}%
   \tablex
 }
-\def\vtable{%
-  \begingroup\inENV
+\envdef\vtable{%
   \def\itemindex ##1{\doind {vr}{\code{##1}}}%
   \tablex
 }
@@ -2171,20 +2304,21 @@
   \let\item = \internalBitem
   \let\itemx = \internalBitemx
 }
-\def\Etable{\endgraf\afterenvbreak\endgroup}
+\def\Etable{\endgraf\afterenvbreak}
 \let\Eftable\Etable
 \let\Evtable\Etable
+\let\Eitemize\Etable
+\let\Eenumerate\Etable
 
 % This is the counter used by @enumerate, which is really @itemize
 
 \newcount \itemno
 
-\defparsearg\itemize{%
-  \begingroup % ended by the @end itemize
-  \itemizey {#1}{\Eitemize}
+\envdef\itemize{%
+  \parsearg\itemizey
 }
 
-\def\itemizey#1#2{%
+\def\itemizey#1{%
   \aboveenvbreak
   \itemmax=\itemindent
   \advance\itemmax by -\itemmargin
@@ -2193,7 +2327,6 @@
   \parindent=0pt
   \parskip=\smallskipamount
   \ifdim\parskip=0pt \parskip=2pt \fi
-  \def#2{\endgraf\afterenvbreak\endgroup}%
   \def\itemcontents{#1}%
   % @itemize with no arg is equivalent to @itemize @bullet.
   \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
@@ -2209,10 +2342,8 @@
 % or number, to specify the first label in the enumerated list.  No
 % argument is the same as `1'.
 %
-\defparsearg\enumerate{\enumeratey #1  \endenumeratey}
+\envparseargdef\enumerate{\enumeratey #1  \endenumeratey}
 \def\enumeratey #1 #2\endenumeratey{%
-  \begingroup % ended by the @end enumerate
-  %
   % If we were given no argument, pretend we were given `1'.
   \def\thearg{#1}%
   \ifx\thearg\empty \def\thearg{1}\fi
@@ -2289,7 +2420,7 @@
 %
 \def\startenumeration#1{%
   \advance\itemno by -1
-  \itemizey{#1.}\Eenumerate\flushcr
+  \itemizey{#1.}\flushcr
 }
 
 % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
@@ -2427,30 +2558,28 @@
 }
 
 % multitable-only commands.
address@hidden outside of @multitable}}
address@hidden outside of @multitable}}
+%
+% @headitem starts a heading row, which we typeset in bold.
+% Assignments have to be global since we are inside the implicit group
+% of an alignment entry.  Note that \everycr resets \everytab.
+\def\headitem{\checkenv\multitable \crcr \global\everytab={\bf}\the\everytab}%
+%
+% A \tab used to include \hskip1sp.  But then the space in a template
+% line is not enough.  That is bad.  So let's go back to just `&' until
+% we encounter the problem it was intended to solve again.
+%                                      --karl, address@hidden, 20apr99.
+\def\tab{\checkenv\multitable &\the\everytab}%
 
 % @multitable ... @end multitable definitions:
 %
 \newtoks\everytab  % insert after every tab.
 %
-\defparsearg\multitable{\bgroup
+\envdef\multitable{%
   \vskip\parskip
   \startsavinginserts
   %
-  % @headitem starts a heading row, which we typeset in bold.
-  % Assignments have to be global since we are inside the implicit group
-  % of an alignment entry.
-  \def\headitem{\crcrwithinserts \global\everytab={\bf}\the\everytab}%
-  %
-  % @item within a multitable starts a normal row, get rid of any bold.
-  \def\item{\crcrwithinserts \global\everytab={}}%
-  %
-  % A \tab used to include \hskip1sp.  But then the space in a template
-  % line is not enough.  That is bad.  So let's go back to just & until
-  % we encounter the problem it was intended to solve again.  --karl,
-  % address@hidden, 20apr99.
-  \def\tab{&\the\everytab}%
+  % @item within a multitable starts a normal row.
+  \let\item\crcr
   %
   \tolerance=9500
   \hbadness=9500
@@ -2460,72 +2589,80 @@
   \overfullrule=0pt
   \global\colcount=0
   %
-  \def\Emultitable{%
-    \global\setpercentfalse
-    \crcrwithinserts
-    \egroup\egroup
+  \everycr = {%
+    \noalign{%
+      \global\everytab={}%
+      \global\colcount=0 % Reset the column counter.
+      % Check for saved footnotes, etc.
+      \checkinserts
+      % Keeps underfull box messages off when table breaks over pages.
+      %\filbreak
+       % Maybe so, but it also creates really weird page breaks when the
+       % table breaks over pages. Wouldn't \vfil be better?  Wait until the
+       % problem manifests itself, so it can be fixed for real --karl.
+    }%
   }%
   %
+  \parsearg\domultitable
+}
+\def\domultitable#1{%
   % To parse everything between @multitable and @item:
   \setuptable#1 \endsetuptable
   %
-  % \everycr will reset column counter, \colcount, at the end of
-  % each line. Every column entry will cause \colcount to advance by one.
-  % The table preamble
-  % looks at the current \colcount to find the correct column width.
-  \everycr{\noalign{%
-  %
-  % \filbreak%% keeps underfull box messages off when table breaks over pages.
-  % Maybe so, but it also creates really weird page breaks when the table
-  % breaks over pages. Wouldn't \vfil be better?  Wait until the problem
-  % manifests itself, so it can be fixed for real --karl.
-    \global\colcount=0\relax}}%
-  %
   % This preamble sets up a generic column definition, which will
   % be used as many times as user calls for columns.
   % \vtop will set a single line and will also let text wrap and
   % continue for many paragraphs if desired.
-  \halign\bgroup&\global\advance\colcount by 1\relax
-    \multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname
-  %
-  % In order to keep entries from bumping into each other
-  % we will add a \leftskip of \multitablecolspace to all columns after
-  % the first one.
-  %
-  % If a template has been used, we will add \multitablecolspace
-  % to the width of each template entry.
-  %
-  % If the user has set preamble in terms of percent of \hsize we will
-  % use that dimension as the width of the column, and the \leftskip
-  % will keep entries from bumping into each other.  Table will start at
-  % left margin and final column will justify at right margin.
-  %
-  % Make sure we don't inherit \rightskip from the outer environment.
-  \rightskip=0pt
-  \ifnum\colcount=1
-    % The first column will be indented with the surrounding text.
-    \advance\hsize by\leftskip
-  \else
-    \ifsetpercent \else
-      % If user has not set preamble in terms of percent of \hsize
-      % we will advance \hsize by \multitablecolspace.
-      \advance\hsize by \multitablecolspace
-    \fi
-   % In either case we will make \leftskip=\multitablecolspace:
-  \leftskip=\multitablecolspace
-  \fi
-  % Ignoring space at the beginning and end avoids an occasional spurious
-  % blank line, when TeX decides to break the line at the space before the
-  % box from the multistrut, so the strut ends up on a line by itself.
-  % For example:
-  % @multitable @columnfractions .11 .89
-  % @item @code{#}
-  % @tab Legal holiday which is valid in major parts of the whole country.
-  % Is automatically provided with highlighting sequences respectively marking
-  % characters.
-  \noindent\ignorespaces##\unskip\multistrut}\cr
+  \halign\bgroup &%
+    \global\advance\colcount by 1
+    \multistrut
+    \vtop{%
+      % Use the current \colcount to find the correct column width:
+      \hsize=\expandafter\csname col\the\colcount\endcsname
+      %
+      % In order to keep entries from bumping into each other
+      % we will add a \leftskip of \multitablecolspace to all columns after
+      % the first one.
+      %
+      % If a template has been used, we will add \multitablecolspace
+      % to the width of each template entry.
+      %
+      % If the user has set preamble in terms of percent of \hsize we will
+      % use that dimension as the width of the column, and the \leftskip
+      % will keep entries from bumping into each other.  Table will start at
+      % left margin and final column will justify at right margin.
+      %
+      % Make sure we don't inherit \rightskip from the outer environment.
+      \rightskip=0pt
+      \ifnum\colcount=1
+       % The first column will be indented with the surrounding text.
+       \advance\hsize by\leftskip
+      \else
+       \ifsetpercent \else
+         % If user has not set preamble in terms of percent of \hsize
+         % we will advance \hsize by \multitablecolspace.
+         \advance\hsize by \multitablecolspace
+       \fi
+       % In either case we will make \leftskip=\multitablecolspace:
+      \leftskip=\multitablecolspace
+      \fi
+      % Ignoring space at the beginning and end avoids an occasional spurious
+      % blank line, when TeX decides to break the line at the space before the
+      % box from the multistrut, so the strut ends up on a line by itself.
+      % For example:
+      % @multitable @columnfractions .11 .89
+      % @item @code{#}
+      % @tab Legal holiday which is valid in major parts of the whole country.
+      % Is automatically provided with highlighting sequences respectively
+      % marking characters.
+      \noindent\ignorespaces##\unskip\multistrut
+    }\cr
+}
+\def\Emultitable{%
+  \crcr
+  \egroup % end the \halign
+  \global\setpercentfalse
 }
-\def\crcrwithinserts{\crcr\noalign{\checkinserts}}
 
 \def\setmultitablespacing{% test to see if user has set \multitablelinespace.
 % If so, do nothing. If not, give it an appropriate dimension based on
@@ -2556,42 +2693,27 @@
 
 
 \message{conditionals,}
-% Prevent errors for section commands.
-% Used in @ignore and in failing conditionals.
-\def\ignoresections{%
-  \let\appendix=\relax
-  \let\appendixsec=\relax
-  \let\appendixsection=\relax
-  \let\appendixsubsec=\relax
-  \let\appendixsubsection=\relax
-  \let\appendixsubsubsec=\relax
-  \let\appendixsubsubsection=\relax
-  %\let\begin=\relax
-  %\let\bye=\relax
-  \let\centerchap=\relax
-  \let\chapter=\relax
-  \let\contents=\relax
-  \let\section=\relax
-  \let\smallbook=\relax
-  \let\subsec=\relax
-  \let\subsection=\relax
-  \let\subsubsec=\relax
-  \let\subsubsection=\relax
-  \let\titlepage=\relax
-  \let\top=\relax
-  \let\unnumbered=\relax
-  \let\unnumberedsec=\relax
-  \let\unnumberedsection=\relax
-  \let\unnumberedsubsec=\relax
-  \let\unnumberedsubsection=\relax
-  \let\unnumberedsubsubsec=\relax
-  \let\unnumberedsubsubsection=\relax
-}
+
+% @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext,
+% @ifnotxml always succeed.  They currently do nothing; we don't
+% attempt to check whether the conditionals are properly nested.  But we
+% have to remember that they are conditionals, so that @end doesn't
+% attempt to close an environment group.
+%
+\def\makecond#1{%
+  \expandafter\let\csname #1\endcsname = \relax
+  \expandafter\let\csname iscond.#1\endcsname = 1
+}
+\makecond{iftex}
+\makecond{ifnotdocbook}
+\makecond{ifnothtml}
+\makecond{ifnotinfo}
+\makecond{ifnotplaintext}
+\makecond{ifnotxml}
 
 % Ignore @ignore, @ifhtml, @ifinfo, and the like.
 %
 \def\direntry{\doignore{direntry}}
-\def\documentdescriptionword{documentdescription}
 \def\documentdescription{\doignore{documentdescription}}
 \def\docbook{\doignore{docbook}}
 \def\html{\doignore{html}}
@@ -2605,10 +2727,6 @@
 \def\menu{\doignore{menu}}
 \def\xml{\doignore{xml}}
 
-% @dircategory CATEGORY  -- specify a category of the dir file
-% which this file should belong to.  Ignore this in TeX.
-\let\dircategory = \comment
-
 % Ignore text until a line address@hidden #1', keeping track of nested 
conditionals.
 %
 % A count to remember the depth of nesting.
@@ -2621,7 +2739,7 @@
   \catcode`\} = \other
   %
   % Make sure that spaces turn into tokens that match what \doignoretext wants.
-  \catcode\spaceChar = 10
+  \spaceisspace
   %
   % Count number of #1's that we've seen.
   \doignorecount = 0
@@ -2687,23 +2805,30 @@
 % didn't need it.
 % We rely on the fact that \parsearg sets \catcode`\ =10.
 %
-\def\set{\parseargusing{\catcode`\-=\other \catcode`\_=\other}\setxxx}
-\def\setxxx#1{\setyyy#1 \endsetyyy}
+\parseargdef\set{\setyyy#1 \endsetyyy}
 \def\setyyy#1 #2\endsetyyy{%
-  \def\temp{#2}%
-  \edef\next{\gdef\makecsname{SET#1}}%
-  \ifx\temp\empty
-    \next{}%
-  \else
-    \setzzz#2\endsetzzz
-  \fi
+  {%
+    \makevalueexpandable
+    \def\temp{#2}%
+    \edef\next{\gdef\makecsname{SET#1}}%
+    \ifx\temp\empty
+      \next{}%
+    \else
+      \setzzz#2\endsetzzz
+    \fi
+  }%
 }
 % Remove the trailing space \setxxx inserted.
 \def\setzzz#1 \endsetzzz{\next{#1}}
 
 % @clear VAR clears (i.e., unsets) the variable VAR.
 %
-\defparsearg\clear{\global\expandafter\let\csname SET#1\endcsname=\relax}
+\parseargdef\clear{%
+  {%
+    \makevalueexpandable
+    \global\expandafter\let\csname SET#1\endcsname=\relax
+  }%
+}
 
 % @value{foo} gets the text saved in variable foo.
 \def\value{\begingroup\makevalueexpandable\valuexxx}
@@ -2742,53 +2867,36 @@
 % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
 % with @set.
 %
-\defparsearg\ifset{%
-  \expandafter\ifx\csname SET#1\endcsname\relax
-    \let\next=\ifsetfail
-  \else
-    \let\next=\ifsetsucceed
-  \fi
-  \next
+% To get special treatment of address@hidden ifset,' call \makeond and the 
redefine.
+%
+\makecond{ifset}
+\def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}}
+\def\doifset#1#2{%
+  {%
+    \makevalueexpandable
+    \let\next=\empty
+    \expandafter\ifx\csname SET#2\endcsname\relax
+      #1% If not set, redefine \next.
+    \fi
+    \expandafter
+  }\next
 }
-\def\ifsetsucceed{\conditionalsucceed{ifset}}
 \def\ifsetfail{\doignore{ifset}}
-\defineunmatchedend{ifset}
 
 % @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
 % defined with @set, or has been undefined with @clear.
 %
-\defparsearg\ifclear{%
-  \expandafter\ifx\csname SET#1\endcsname\relax
-    \let\next=\ifclearsucceed
-  \else
-    \let\next=\ifclearfail
-  \fi
-  \next
-}
-\def\ifclearsucceed{\conditionalsucceed{ifclear}}
+% The `\else' inside the `\doifset' parameter is a trick to reuse the
+% above code: if the variable is not set, do nothing, if it is set,
+% then redefine \next to \ifclearfail.
+%
+\makecond{ifclear}
+\def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}}
 \def\ifclearfail{\doignore{ifclear}}
-\defineunmatchedend{ifclear}
 
-% @iftex, @ifnothtml, @ifnotinfo, @ifnotplaintext always succeed; we
-% read the text following, through the first @end iftex (etc.).  Make
-% address@hidden iftex' (etc.) valid only after an @iftex.
-%
-\def\iftex{\conditionalsucceed{iftex}}
-\def\ifnothtml{\conditionalsucceed{ifnothtml}}
-\def\ifnotinfo{\conditionalsucceed{ifnotinfo}}
-\def\ifnotplaintext{\conditionalsucceed{ifnotplaintext}}
-\defineunmatchedend{iftex}
-\defineunmatchedend{ifnothtml}
-\defineunmatchedend{ifnotinfo}
-\defineunmatchedend{ifnotplaintext}
-
-% True conditional.  Since \set globally defines its variables, we can
-% just start and end a group (to keep the @end definition undefined at
-% the outer level).
-%
-\def\conditionalsucceed#1{\begingroup
-  \expandafter\def\csname E#1\endcsname{\endgroup}%
-}
+% @dircategory CATEGORY  -- specify a category of the dir file
+% which this file should belong to.  Ignore this in TeX.
+\let\dircategory=\comment
 
 % @defininfoenclose.
 \let\definfoenclose=\comment
@@ -2978,6 +3086,10 @@
   \definedummyword{oe}%
   \definedummyword{o}%
   \definedummyword{ss}%
+  \definedummyword{exclamdown}%
+  \definedummyword{questiondown}%
+  \definedummyword{ordm}%
+  \definedummyword{ordf}%
   %
   % Although these internal commands shouldn't show up, sometimes they do.
   \definedummyword{bf}%
@@ -2996,6 +3108,7 @@
   \definedummyword{sc}%
   \definedummyword{t}%
   %
+  \definedummyword{LaTeX}%
   \definedummyword{TeX}%
   \definedummyword{acronym}%
   \definedummyword{cite}%
@@ -3050,6 +3163,7 @@
 % control sequences and just writes whatever the best ASCII sort string
 % would be for a given command (usually its argument).
 %
+\def\indexdummylatex{LaTeX}
 \def\indexdummytex{TeX}
 \def\indexdummydots{...}
 %
@@ -3090,6 +3204,8 @@
   \def\ss{ss}%
   \def\exclamdown{!}%
   \def\questiondown{?}%
+  \def\ordf{a}%
+  \def\ordm{o}%
   %
   % Don't no-op \tt, since it isn't a user-level command
   % and is used in the definitions of the active chars like <, >, |, etc.
@@ -3103,6 +3219,7 @@
   \let\sc=\asis
   \let\t=\asis
   %
+  \let\LaTeX=\indexdummylatex
   \let\TeX=\indexdummytex
   \let\acronym=\asis
   \let\cite=\asis
@@ -3298,7 +3415,7 @@
 % @printindex causes a particular index (the ??s file) to get printed.
 % It does not print any chapter heading (usually an @unnumbered).
 %
-\defparsearg\printindex{\begingroup
+\parseargdef\printindex{\begingroup
   \dobreak \chapheadingskip{10000}%
   %
   \smallfonts \rm
@@ -3749,7 +3866,7 @@
 % (e.g., figures), q.v.  By default (before any chapter), that is empty.
 \let\chaplevelprefix = \empty
 % 
-\outer\defparsearg\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz
+\outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz
 \def\chapterzzz#1{%
   % section resetting is \global in case the chapter is in a group, such
   % as an @include file.
@@ -3771,7 +3888,7 @@
   \global\let\subsubsection = \numberedsubsubsec
 }
 
-\outer\defparsearg\appendix{\apphead0{#1}} % normally apphead0 calls 
appendixzzz
+\outer\parseargdef\appendix{\apphead0{#1}} % normally apphead0 calls 
appendixzzz
 \def\appendixzzz#1{%
   \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
     \global\advance\appendixno by 1
@@ -3789,14 +3906,14 @@
 }
 
 % @centerchap is like @unnumbered, but the heading is centered.
-\outer\defparsearg\centerchap{{\unnumberedyyy{#1}}}
+\outer\parseargdef\centerchap{{\unnumberedyyy{#1}}}
 
-\outer\defparsearg\unnumbered{\unnmhead0{#1}} % normally unnmhead0 calls 
unnumberedzzz
+\outer\parseargdef\unnumbered{\unnmhead0{#1}} % normally unnmhead0 calls 
unnumberedzzz
 \def\unnumberedzzz#1{%
   \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
     \global\advance\unnumberedno by 1
   %
-  % Since an unnumbered as no number, no prefix for figures.
+  % Since an unnumbered has no number, no prefix for figures.
   \global\let\chaplevelprefix = \empty
   \resetallfloatnos
   %
@@ -3825,40 +3942,40 @@
 \let\top\unnumbered
 
 % Sections.
-\outer\defparsearg\numberedsec{\numhead1{#1}} % normally calls seczzz
+\outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz
 \def\seczzz#1{%
   \global\subsecno=0 \global\subsubsecno=0  \global\advance\secno by 1
   \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}%
 }
 
-\outer\defparsearg\appendixsection{\apphead1{#1}} % normally calls 
appendixsectionzzz
+\outer\parseargdef\appendixsection{\apphead1{#1}} % normally calls 
appendixsectionzzz
 \def\appendixsectionzzz#1{%
   \global\subsecno=0 \global\subsubsecno=0  \global\advance\secno by 1
   \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}%
 }
 \let\appendixsec\appendixsection
 
-\outer\defparsearg\unnumberedsec{\unnmhead1{#1}} % normally calls 
unnumberedseczzz
+\outer\parseargdef\unnumberedsec{\unnmhead1{#1}} % normally calls 
unnumberedseczzz
 \def\unnumberedseczzz#1{%
   \global\subsecno=0 \global\subsubsecno=0  \global\advance\secno by 1
   \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}%
 }
 
 % Subsections.
-\outer\defparsearg\numberedsubsec{\numhead2{#1}} % normally calls 
numberedsubseczzz
+\outer\parseargdef\numberedsubsec{\numhead2{#1}} % normally calls 
numberedsubseczzz
 \def\numberedsubseczzz#1{%
   \global\subsubsecno=0  \global\advance\subsecno by 1
   \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}%
 }
 
-\outer\defparsearg\appendixsubsec{\apphead2{#1}} % normally calls 
appendixsubseczzz
+\outer\parseargdef\appendixsubsec{\apphead2{#1}} % normally calls 
appendixsubseczzz
 \def\appendixsubseczzz#1{%
   \global\subsubsecno=0  \global\advance\subsecno by 1
   \sectionheading{#1}{subsec}{Yappendix}%
                  {\appendixletter.\the\secno.\the\subsecno}%
 }
 
-\outer\defparsearg\unnumberedsubsec{\unnmhead2{#1}} %normally calls 
unnumberedsubseczzz
+\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} %normally calls 
unnumberedsubseczzz
 \def\unnumberedsubseczzz#1{%
   \global\subsubsecno=0  \global\advance\subsecno by 1
   \sectionheading{#1}{subsec}{Ynothing}%
@@ -3866,21 +3983,21 @@
 }
 
 % Subsubsections.
-\outer\defparsearg\numberedsubsubsec{\numhead3{#1}} % normally 
numberedsubsubseczzz
+\outer\parseargdef\numberedsubsubsec{\numhead3{#1}} % normally 
numberedsubsubseczzz
 \def\numberedsubsubseczzz#1{%
   \global\advance\subsubsecno by 1
   \sectionheading{#1}{subsubsec}{Ynumbered}%
                  {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}%
 }
 
-\outer\defparsearg\appendixsubsubsec{\apphead3{#1}} % normally 
appendixsubsubseczzz
+\outer\parseargdef\appendixsubsubsec{\apphead3{#1}} % normally 
appendixsubsubseczzz
 \def\appendixsubsubseczzz#1{%
   \global\advance\subsubsecno by 1
   \sectionheading{#1}{subsubsec}{Yappendix}%
                  {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}%
 }
 
-\outer\defparsearg\unnumberedsubsubsec{\unnmhead3{#1}} %normally 
unnumberedsubsubseczzz
+\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} %normally 
unnumberedsubsubseczzz
 \def\unnumberedsubsubseczzz#1{%
   \global\advance\subsubsecno by 1
   \sectionheading{#1}{subsubsec}{Ynothing}%
@@ -3938,11 +4055,11 @@
 }
 
 % @heading, @subheading, @subsubheading.
-\defparsearg\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{}
+\parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{}
   \suppressfirstparagraphindent}
-\defparsearg\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{}
+\parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{}
   \suppressfirstparagraphindent}
-\defparsearg\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{}
+\parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{}
   \suppressfirstparagraphindent}
 
 % These macros generate a chapter, section, etc. heading only
@@ -4237,81 +4354,83 @@
 % Prepare to read what we've written to \tocfile.
 %
 \def\startcontents#1{%
-   % If @setchapternewpage on, and @headings double, the contents should
-   % start on an odd page, unlike chapters.  Thus, we maintain
-   % \contentsalignmacro in parallel with \pagealignmacro.
-   % From: Torbjorn Granlund <address@hidden>
-   \contentsalignmacro
-   \immediate\closeout\tocfile
-   %
-   % Don't need to put `Contents' or `Short Contents' in the headline.
-   % It is abundantly clear what they are.
-   \def\thischapter{}%
-   \chapmacro{#1}{Yomitfromtoc}{}%
-   %
-   \savepageno = \pageno
-   \begingroup                  % Set up to handle contents files properly.
-      \catcode`\\=0  \catcode`\{=1  \catcode`\}=2  address@hidden
-      % We can't do this, because then an actual ^ in a section
-      % title fails, e.g., @chapter ^ -- exponentiation.  --karl, 9jul97.
-      %\catcode`\^=7 % to see ^^e4 as \"a etc. address@hidden
-      \raggedbottom             % Worry more about breakpoints than the bottom.
-      \advance\hsize by -\contentsrightmargin % Don't use the full line length.
-      %
-      % Roman numerals for page numbers.
-      \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
+  % If @setchapternewpage on, and @headings double, the contents should
+  % start on an odd page, unlike chapters.  Thus, we maintain
+  % \contentsalignmacro in parallel with \pagealignmacro.
+  % From: Torbjorn Granlund <address@hidden>
+  \contentsalignmacro
+  \immediate\closeout\tocfile
+  %
+  % Don't need to put `Contents' or `Short Contents' in the headline.
+  % It is abundantly clear what they are.
+  \def\thischapter{}%
+  \chapmacro{#1}{Yomitfromtoc}{}%
+  %
+  \savepageno = \pageno
+  \begingroup                  % Set up to handle contents files properly.
+    \catcode`\\=0  \catcode`\{=1  \catcode`\}=2  address@hidden
+    % We can't do this, because then an actual ^ in a section
+    % title fails, e.g., @chapter ^ -- exponentiation.  --karl, 9jul97.
+    %\catcode`\^=7 % to see ^^e4 as \"a etc. address@hidden
+    \raggedbottom             % Worry more about breakpoints than the bottom.
+    \advance\hsize by -\contentsrightmargin % Don't use the full line length.
+    %
+    % Roman numerals for page numbers.
+    \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
 }
 
 
 % Normal (long) toc.
 \def\contents{%
-   \startcontents{\putwordTOC}%
-     \openin 1 \jobname.toc
-     \ifeof 1 \else
-       \closein 1
-       \input \jobname.toc
-     \fi
-     \vfill \eject
-     \contentsalignmacro % in case @setchapternewpage odd is in effect
-     \pdfmakeoutlines
-   \endgroup
-   \lastnegativepageno = \pageno
-   \global\pageno = \savepageno
+  \startcontents{\putwordTOC}%
+    \openin 1 \jobname.toc
+    \ifeof 1 \else
+      \input \jobname.toc
+    \fi
+    \vfill \eject
+    \contentsalignmacro % in case @setchapternewpage odd is in effect
+    \ifeof 1 \else
+      \pdfmakeoutlines
+    \fi
+    \closein 1
+  \endgroup
+  \lastnegativepageno = \pageno
+  \global\pageno = \savepageno
 }
 
 % And just the chapters.
 \def\summarycontents{%
-   \startcontents{\putwordShortTOC}%
-      %
-      \let\numchapentry = \shortchapentry
-      \let\appentry = \shortchapentry
-      \let\unnchapentry = \shortunnchapentry
-      % We want a true roman here for the page numbers.
-      \secfonts
-      \let\rm=\shortcontrm \let\bf=\shortcontbf
-      \let\sl=\shortcontsl \let\tt=\shortconttt
-      \rm
-      \hyphenpenalty = 10000
-      \advance\baselineskip by 1pt % Open it up a little.
-      \def\numsecentry##1##2##3##4{}
-      \let\appsecentry = \numsecentry
-      \let\unnsecentry = \numsecentry
-      \let\numsubsecentry = \numsecentry
-      \let\appsubsecentry = \numsecentry
-      \let\unnsubsecentry = \numsecentry
-      \let\numsubsubsecentry = \numsecentry
-      \let\appsubsubsecentry = \numsecentry
-      \let\unnsubsubsecentry = \numsecentry
-      \openin 1 \jobname.toc
-      \ifeof 1 \else
-        \closein 1
-        \input \jobname.toc
-      \fi
-     \vfill \eject
-     \contentsalignmacro % in case @setchapternewpage odd is in effect
-   \endgroup
-   \lastnegativepageno = \pageno
-   \global\pageno = \savepageno
+  \startcontents{\putwordShortTOC}%
+    %
+    \let\numchapentry = \shortchapentry
+    \let\appentry = \shortchapentry
+    \let\unnchapentry = \shortunnchapentry
+    % We want a true roman here for the page numbers.
+    \secfonts
+    \let\rm=\shortcontrm \let\bf=\shortcontbf
+    \let\sl=\shortcontsl \let\tt=\shortconttt
+    \rm
+    \hyphenpenalty = 10000
+    \advance\baselineskip by 1pt % Open it up a little.
+    \def\numsecentry##1##2##3##4{}
+    \let\appsecentry = \numsecentry
+    \let\unnsecentry = \numsecentry
+    \let\numsubsecentry = \numsecentry
+    \let\appsubsecentry = \numsecentry
+    \let\unnsubsecentry = \numsecentry
+    \let\numsubsubsecentry = \numsecentry
+    \let\appsubsubsecentry = \numsecentry
+    \let\unnsubsubsecentry = \numsecentry
+    \openin 1 \jobname.toc
+    \ifeof 1 \else
+      \input \jobname.toc
+    \fi
+    \closein 1
+    \vfill \eject
+    \contentsalignmacro % in case @setchapternewpage odd is in effect
+  \endgroup
+  \lastnegativepageno = \pageno
+  \global\pageno = \savepageno
 }
 \let\shortcontents = \summarycontents
 
@@ -4464,7 +4583,7 @@
 % One exception: @ is still an escape character, so that @end tex works.
 % But \@ or @@ will get a plain tex @ character.
 
-\def\tex{\begingroup
+\envdef\tex{%
   \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
   \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
   \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
@@ -4497,10 +4616,11 @@
   \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
   \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
   address@hidden@}%
-\let\Etex=\endgroup}
+}
+% There is no need to define \Etex.
 
 % Define @lisp ... @end lisp.
-% @lisp does a \begingroup so it can rebind things,
+% @lisp environment forms a group so it can rebind things,
 % including the definition of @end lisp (which normally is erroneous).
 
 % Amount to narrow the margins by for @lisp.
@@ -4560,8 +4680,7 @@
 %
 \newskip\lskip\newskip\rskip
 
-\def\cartouche{%
-\begingroup\inENV
+\envdef\cartouche{%
   \ifhmode\par\fi  % can't be in the midst of a paragraph.
   \startsavinginserts
   \lskip=\leftskip \rskip=\rightskip
@@ -4600,7 +4719,6 @@
       \cartbot
   \egroup
   \checkinserts
-\endgroup
 }
 
 
@@ -4608,7 +4726,6 @@
 % inside a group.
 \def\nonfillstart{%
   \aboveenvbreak
-  \inENV % This group ends at the end of the body
   \hfuzz = 12pt % Don't be fussy
   \sepspaces % Make spaces be word-separators rather than space tokens.
   \let\par = \lisppar % don't ignore blank lines
@@ -4621,103 +4738,71 @@
   \ifx\nonarrowing\relax
     \advance \leftskip by \lispnarrowing
     \exdentamount=\lispnarrowing
-    \let\exdent=\nofillexdent
-    \let\nonarrowing=\relax
   \fi
+  \let\exdent=\nofillexdent
+}
+
+% We often define two environments, @foo and @smallfoo.
+% Let's do it by one command:
+\def\makedispenv #1#2{
+  \expandafter\envdef\csname#1\endcsname{#2}
+  \expandafter\envdef\csname small#1\endcsname
+    {\smallexamplefonts \rm #2}
+  \expandafter\let\csname E#1\endcsname \afterenvbreak
+  \expandafter\let\csname Esmall#1\endcsname \afterenvbreak
 }
 
-% Define the \E... control sequence only if we are inside the particular
-% environment, so the error checking in \end will work.
+% And there are often two synonyms:
+\def\maketwodispenvs #1#2#3{
+  \makedispenv{#1}{#3}
+  \makedispenv{#2}{#3}
+}
+
+% @lisp: indented, narrowed, typewriter font; @example: same as @lisp.
 %
-% To end an @example-like environment, we first end the paragraph (via
-% \afterenvbreak's vertical glue), and then the group.  That way we keep
-% the zero \parskip that the environments set -- \parskip glue will be
-% inserted at the beginning of the next paragraph in the document, after
-% the environment.
+% @smallexample and @smalllisp: use smaller fonts.
+% Originally contributed by address@hidden
 %
-\def\nonfillfinish{\afterenvbreak\endgroup}
-
-% @lisp: indented, narrowed, typewriter font.
-\def\lisp{\begingroup
+\maketwodispenvs {lisp}{example}{%
   \nonfillstart
-  \let\Elisp = \nonfillfinish
   \tt
   \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
   \gobble       % eat return
 }
 
-% @example: Same as @lisp.
-\def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp}
-
-% @smallexample and @smalllisp: use smaller fonts.
-% Originally contributed by address@hidden
-\def\smalllisp{\begingroup
-  \def\Esmalllisp{\nonfillfinish\endgroup}%
-  \def\Esmallexample{\nonfillfinish\endgroup}%
-  \smallexamplefonts
-  \lisp
-}
-\let\smallexample = \smalllisp
-
-
-% @display: same as @lisp except keep current font.
+% @display/@smalldisplay: same as @lisp except keep current font.
 %
-\def\display{\begingroup
+\makedispenv {display}{%
   \nonfillstart
-  \let\Edisplay = \nonfillfinish
   \gobble
 }
-%
-% @smalldisplay: @display plus smaller fonts.
-%
-\def\smalldisplay{\begingroup
-  \def\Esmalldisplay{\nonfillfinish\endgroup}%
-  \smallexamplefonts \rm
-  \display
-}
 
-% @format: same as @display except don't narrow margins.
+% @format/@smallformat: same as @display except don't narrow margins.
+% @flushleft (same as @format).  (Note: @smallflushleft not documeted.)
 %
-\def\format{\begingroup
+\maketwodispenvs {format}{flushleft}{%
   \let\nonarrowing = t%
   \nonfillstart
-  \let\Eformat = \nonfillfinish
   \gobble
 }
-%
-% @smallformat: @format plus smaller fonts.
-%
-\def\smallformat{\begingroup
-  \def\Esmallformat{\nonfillfinish\endgroup}%
-  \smallexamplefonts \rm
-  \format
-}
-
-% @flushleft (same as @format).
-%
-\def\flushleft{\begingroup \def\Eflushleft{\nonfillfinish\endgroup}\format}
 
 % @flushright.
 %
-\def\flushright{\begingroup
+\envdef\flushright{%
   \let\nonarrowing = t%
   \nonfillstart
-  \let\Eflushright = \nonfillfinish
   \advance\leftskip by 0pt plus 1fill
   \gobble
 }
+\let\Eflushright = \afterenvbreak
 
 
 % @quotation does normal linebreaking (hence we can't use \nonfillstart)
 % and narrows the margins.
 %
-\def\quotation{%
-  \begingroup\inENV %This group ends at the end of the @quotation body
+\envdef\quotation{%
   {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
   \parindent=0pt
-  % We have retained a nonzero parskip for the environment, since we're
-  % doing normal filling. So to avoid extra space below the environment...
-  \def\Equotation{\parskip = 0pt \nonfillfinish}%
   %
   % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
   \ifx\nonarrowing\relax
@@ -4729,6 +4814,10 @@
   \parsearg\quotationlabel
 }
 
+% We have retained a nonzero parskip for the environment, since we're
+% doing normal filling. So to avoid extra space below the environment...
+\def\Equotation{\parskip = 0pt \afterenvbreak}
+
 % If we're given an argument, typeset it in bold with a colon after.
 \def\quotationlabel#1{%
   \def\temp{#1}%
@@ -4856,22 +4945,23 @@
   % without the active space; thus we have to use \xdef and \gobble.
 \endgroup
 %
-\def\verbatim{%
-  \let\Everbatim\nonfillfinish
-  \begingroup
+\envdef\verbatim{%
     \setupverbatim\doverbatim
 }
+\let\Everbatim = \afterenvbreak
+
 
 % @verbatiminclude FILE - insert text of file in verbatim environment.
 %
 \def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude}
 %
 \def\doverbatiminclude#1{%
-  \begingroup
+  {%
     \makevalueexpandable
     \setupverbatim
     \input #1
-  \nonfillfinish % contains \endgroup
+    \afterenvbreak
+  }%
 }
 
 % @copying ... @end copying.
@@ -4950,11 +5040,8 @@
 \newskip\defargsindent \defargsindent=50pt
 \newskip\deflastargmargin \deflastargmargin=18pt
 
-% \startdefun \deffn
-% -- starts the processing of @deffn
-\def\startdefun#1{%
-  \begingroup\inENV
-  \def\thisenv{#1}%
+% Start the processing of @deffn:
+\def\startdefun{%
   \ifnum\lastpenalty<10000
     \medbreak
   \else
@@ -4977,99 +5064,25 @@
   \exdentamount=\defbodyindent
 }
 
-% \dodefunx \startdefun \deffn
-% -- converts \deffn expansion to \deffnx, omitting \startdefun.
-\def\dodefunx \startdefun #1{%
+\def\dodefunx#1{%
+  % First, check whether we are in the right environment:
+  \checkenv#1%
+  %
   % As above, allow line break if we have multiple x headers in a row.
   % It's not a great place, though.
   \ifnum\lastpenalty=10002 \penalty3000 \fi
   %
-  % Check whether we are inside the corresponding @defun.
-  \def\temp{#1}%
-  \ifx\thisenv\temp
-  \else
-    \errmessage{\expandafter\string\temp x inside
-      \expandafter\noexpand\thisenv environment}%
-  \fi
-}
-
-% Without continued lines we'd just have:
-%   \def\parsedefunline#1{\parseargusing\activeparens{\parsedefunlineX#1}}
-%   \def\parsedefunlineX#1#2{\printdefunline #1#2\DefunTerm}
-% but with continuations, things are much more complicated.
-%
-\def\parsedefunline#1{%
-  \def\defunlinemacro{#1}% store \deffnheader (initially)
-  \parsedefunlineX
-}
-\def\parsedefunlineX{%
-  \parseargusing\activeparens\parsedefunlineY
-}
-\def\parsedefunlineY#1{%
-  % We have to prepend a token to prevent brace stripping;
-  % \defunlinemacro just comes handy.
-  \defunchkspace\defunlinemacro#1\DefunMid\ \DefunMid\DefunTerm
-}
-\def\defunchkspace#1\ \DefunMid#2\DefunTerm{%
-  \def\temp{#2}%
-  \ifx\temp\empty
-    % The line doesn't end with `@ '; in this case, #1 ends with \DefunMid.
-    \let\next\defunchktab
-  \else
-    % `@ ' was found and stripped.
-    \let\next\defunloop
-  \fi
-  \next#1\^^I\DefunMid\DefunTerm
-}
-\def\defunchktab#1\^^I\DefunMid#2\DefunTerm{%
-  \def\temp{#2}%
-  \ifx\temp\empty
-    % The line doesn't end with address@hidden', either.
-    \let\next\defunchkfinish
-  \else
-    % address@hidden' was found and stripped.
-    \let\next\defunloop
-  \fi
-  \next#1\^^I\DefunMid\DefunTerm
-}
-\def\defunloop#1\^^I\DefunMid\DefunTerm{%
-  % Expand the \defunlinemacro token at the beginning of #1.
-  \expandafter\def\expandafter\defunlinemacro
-    \expandafter{#1 }%
-  \parsedefunlineX
-}
-\def\defunchkfinish#1\DefunMid\^^I%\DefunMid\DefunTerm -- stays here
-{%
-  % #1 starts with \defunlinemacro, which is expanded and its expansion
-  % starts with eg. \deffnheader.
-  \expandafter\replaceeols #1\^^M%\DefunMid\DefunTerm -- stays here
-}
-
-% Each occurence of `\^^M' or `<space>\^^M' is replaced by a single space.
-%
-% The parameters start with \deffnheader token, so trere is no risk braces
-% could be stripped at #1.  And we have a \DefunMid token just before
-% \DefunTerm, so we cannot loose braces at #2 either.  Uff!
-%
-\def\replaceeols#1\^^M#2\DefunTerm{%
-  \stripDefunMid #2%
-  \ifx\temp\empty
-    % This \^^M is the terminating one.
-    \printdefunline #1\DefunTerm
-  \else
-    \replaceeolsX#1\^^M \^^M#2\DefunTerm
-  \fi
+  % And now, it's time to reuse the body of the original defun:
+  \expandafter\gobbledefun#1%
 }
-\def\replaceeolsX#1 \^^M{\replaceeolsY#1\^^M}
-\def\replaceeolsY#1\^^M#2\^^M{\replaceeols#1 }
-\def\stripDefunMid#1\DefunMid{\def\temp{#1}}
+\def\gobbledefun#1\startdefun{}
 
-% \printdefunline \deffnheader text\DefunTerm
+% \printdefunline \deffnheader{text}
 %
-\def\printdefunline#1\DefunTerm{%
+\def\printdefunline#1#2{%
   \begingroup
     % call \deffnheader:
-    #1 \endheader
+    #1#2 \endheader
     % common ending:
     \interlinepenalty = 10000
     \advance\rightskip by 0pt plus 1fil
@@ -5082,7 +5095,7 @@
   \endgroup
 }
 
-\def\Edefun{\endgraf\endgroup\medbreak}
+\def\Edefun{\endgraf\medbreak}
 
 % \makedefun{deffn} creates \deffn, \deffnx and \Edeffn;
 % the only thing remainnig is to define \deffnheader.
@@ -5100,21 +5113,21 @@
 % \deffnheader has to be defined explicitly.
 %
 \def\domakedefun#1#2#3{%
-  \def#1{%
-    \startdefun#1%
-    \parsedefunline#3%
+  \envdef#1{%
+    \startdefun
+    \parseargusing\activeparens{\printdefunline#3}%
   }%
-  % A tricky way to recycle the code defined above:
-  \def#2{\expandafter\dodefunx#1}%
+  \def#2{\dodefunx#1}%
+  \def#3%
 }
 
-% Untyped functions (@deffn, @defop):
+%%% Untyped functions:
 
-\makedefun{deffn} % category name args
-\def\deffnheader{\deffngeneral{}}
+% @deffn category name args
+\makedefun{deffn}{\deffngeneral{}}
 
-\makedefun{defop} % category class name args
-\def\defopheader#1 {\defopon{#1\ \putwordon}}
+% @deffn category class name args
+\makedefun{defop}#1 {\defopon{#1\ \putwordon}}
 
 % \defopon {category on}class name args
 \def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
@@ -5124,16 +5137,16 @@
 \def\deffngeneral#1#2 #3 #4\endheader{%
   % Remember that \dosubin{fn}{xxx}{} is equivalent to \doind{fn}{xxx}.
   \dosubind{fn}{\code{#3}}{#1}%
-  \defname{#2}{}{#3}\ampdefunargs{#4\unskip}%
+  \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}%
 }
 
-% Typed functions (@deftypefn, @deftypeop):
+%%% Typed functions:
 
-\makedefun{deftypefn} % category type name args
-\def\deftypefnheader{\deftypefngeneral{}}
+% @deftypefn category type name args
+\makedefun{deftypefn}{\deftypefngeneral{}}
 
-\makedefun{deftypeop} % category class type name args
-\def\deftypeopheader#1 {\deftypeopon{#1\ \putwordon}}
+% @deftypeop category class type name args
+\makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}}
 
 % \deftypeopon {category on}class type name args
 \def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
@@ -5142,16 +5155,16 @@
 %
 \def\deftypefngeneral#1#2 #3 #4 #5\endheader{%
   \dosubind{fn}{\code{#4}}{#1}%
-  \defname{#2}{#3}{#4}\normaldefunargs{#5\unskip}%
+  \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
 }
 
-% Typed variables (@deftypevr, @deftypecv):
+%%% Typed variables:
 
-\makedefun{deftypevr}% category type var args
-\def\deftypevrheader{\deftypecvgeneral{}}
+% @deftypevr category type var args
+\makedefun{deftypevr}{\deftypecvgeneral{}}
 
-\makedefun{deftypecv}% category class type var args
-\def\deftypecvheader#1 {\deftypecvof{#1\ \putwordof}}
+% @deftypecv category class type var args
+\makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}}
 
 % \deftypecvof {category of}class type var args
 \def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} }
@@ -5160,38 +5173,39 @@
 %
 \def\deftypecvgeneral#1#2 #3 #4 #5\endheader{%
   \dosubind{vr}{\code{#4}}{#1}%
-  \defname{#2}{#3}{#4}\normaldefunargs{#5\unskip}%
+  \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
 }
 
-% Untyped variables (@defvr, @defcv):
-\makedefun{defvr}% category var args
-\def\defvrheader#1 {\deftypevrheader{#1} {} }
+%%% Untyped variables:
 
-\makedefun{defcv}% category class var args
-\def\defcvheader#1 {\defcvof{#1\ \putwordof}}
+% @defvr category var args
+\makedefun{defvr}#1 {\deftypevrheader{#1} {} }
+
+% @defcv category class var args
+\makedefun{defcv}#1 {\defcvof{#1\ \putwordof}}
 
 % \defcvof {category of}class var args
 \def\defcvof#1#2 {\deftypecvof{#1}#2 {} }
 
-% Type (@deftp):
-\makedefun{deftp}% category name args
-\def\deftpheader#1 #2 #3\endheader{%
+%%% Type:
+% @deftp category name args
+\makedefun{deftp}#1 #2 #3\endheader{%
   \doind{tp}{\code{#2}}%
-  \defname{#1}{}{#2}\normaldefunargs{#3\unskip}%
+  \defname{#1}{}{#2}\defunargs{#3\unskip}%
 }
 
 % Remaining @defun-like shortcuts:
-\makedefun{defun}     \def\defunheader{\deffnheader{\putwordDeffunc} }
-\makedefun{defmac}    \def\defmacheader{\deffnheader{\putwordDefmac} }
-\makedefun{defspec}   \def\defspecheader{\deffnheader{\putwordDefspec} }
-\makedefun{deftypefun}\def\deftypefunheader{\deftypefnheader{\putwordDeffunc} }
-\makedefun{defvar}    \def\defvarheader{\defvrheader{\putwordDefvar} }
-\makedefun{defopt}    \def\defoptheader{\defvrheader{\putwordDefopt} }
-\makedefun{deftypevar}\def\deftypevarheader{\deftypevrheader{\putwordDefvar} }
-\makedefun{defmethod} \def\defmethodheader{\defopon\putwordMethodon}
-\makedefun{deftypemethod}\def\deftypemethodheader{\deftypeopon\putwordMethodon}
-\makedefun{defivar}    \def\defivarheader{\defcvof\putwordInstanceVariableof}
-\makedefun{deftypeivar}\def\deftypeivarheader{\deftypecvof\putwordInstanceVariableof}
+\makedefun{defun}{\deffnheader{\putwordDeffunc} }
+\makedefun{defmac}{\deffnheader{\putwordDefmac} }
+\makedefun{defspec}{\deffnheader{\putwordDefspec} }
+\makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} }
+\makedefun{defvar}{\defvrheader{\putwordDefvar} }
+\makedefun{defopt}{\defvrheader{\putwordDefopt} }
+\makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} }
+\makedefun{defmethod}{\defopon\putwordMethodon}
+\makedefun{deftypemethod}{\deftypeopon\putwordMethodon}
+\makedefun{defivar}{\defcvof\putwordInstanceVariableof}
+\makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof}
 
 % \defname, which formats the name of the @def (not the args).
 % #1 is the category, such as "Function".
@@ -5251,16 +5265,9 @@
   % arguments will be output next, if any.
 }
 
-% This expands the args, with & being treated magically.
-%
-\def\ampdefunargs{%
-  \magicamp
-  \normaldefunargs
-}
-
 % Print arguments in slanted typewriter, prevent hyphenation at `-' chars.
 % 
-\def\normaldefunargs#1{%
+\def\defunargs#1{%
   % use sl by default (not ttsl), inconsistently with using tt for the
   % name.  This is because literal text is sometimes needed in the
   % argument list (groff manual), and ttsl and tt are not very
@@ -5365,28 +5372,33 @@
 % To do this right we need a feature of e-TeX, \scantokens,
 % which we arrange to emulate with a temporary file in ordinary TeX.
 \ifx\eTeXversion\undefined
- \newwrite\macscribble
- \def\scanmacro#1{%
-   \begingroup \newlinechar`\^^M
-   % Undo catcode changes of \startcontents and \doprintindex
-   address@hidden \catcode`\\=\other \escapechar=`\@
-   % Append \endinput to make sure that TeX does not see the ending newline.
-   \toks0={#1\endinput}%
-   \immediate\openout\macscribble=\jobname.tmp
-   \immediate\write\macscribble{\the\toks0}%
-   \immediate\closeout\macscribble
-   \let\xeatspaces\eatspaces
-   \input \jobname.tmp
-   \endgroup
-}
-\else
-\def\scanmacro#1{%
-\begingroup \newlinechar`\^^M
-% Undo catcode changes of \startcontents and \doprintindex
address@hidden \catcode`\\=\other \escapechar=`\@
-\let\xeatspaces\eatspaces\scantokens{#1\endinput}\endgroup}
+  \newwrite\macscribble
+  \def\scantokens#1{%
+    \toks0={#1\endinput}%
+    \immediate\openout\macscribble=\jobname.tmp
+    \immediate\write\macscribble{\the\toks0}%
+    \immediate\closeout\macscribble
+    \input \jobname.tmp
+  }
 \fi
 
+\def\scanmacro#1{%
+  \begingroup
+    \newlinechar`\^^M
+    \let\xeatspaces\eatspaces
+    % Undo catcode changes of \startcontents and \doprintindex
+    address@hidden \catcode`\\=\other \escapechar=`\@
+    % ... and \example
+    \spaceisspace
+    %
+    % Append \endinput to make sure that TeX does not see the ending newline.
+    %
+    % I've verified that it is necessary both for e-TeX and for ordinary TeX
+    %                                                  --kasal, 29nov03
+    \scantokens{#1\endinput}%
+  \endgroup
+}
+
 \newcount\paramno   % Count of parameters
 \newtoks\macname    % Macro name
 \newif\ifrecursive  % Is it recursive?
@@ -5394,7 +5406,7 @@
                     % \do\macro1\do\macro2...
 
 % Utility routines.
-% Thisdoes \let #1 = #2, except with \csnames.
+% This does \let #1 = #2, except with \csnames.
 \def\cslet#1#2{%
 \expandafter\expandafter
 \expandafter\let
@@ -5491,7 +5503,7 @@
   \else \expandafter\parsemacbody
   \fi}
 
-\defparsearg\unmacro{%
+\parseargdef\unmacro{%
   \if1\csname ismacro.#1\endcsname
     \global\cslet{#1}{macsave.#1}%
     \global\expandafter\let \csname ismacro.#1\endcsname=0%
@@ -5666,7 +5678,7 @@
 
 % @node's only job in TeX is to define \lastnode, which is used in
 % cross-references.
-\defparsearg\node{\ENVcheck\nodexxx #1,\finishnodeparse}
+\parseargdef\node{\checkenv{}\nodexxx #1,\finishnodeparse}
 \def\nodexxx#1,#2\finishnodeparse{\gdef\lastnode{#1}}
 \let\nwnode=\node
 \let\lastnode=\empty
@@ -5685,14 +5697,16 @@
 %
 \newcount\savesfregister
 %
-\gdef\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
-\gdef\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
-\gdef\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
+\def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
+\def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
+\def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
 
 % \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
-% anchor), namely NAME-title (the corresponding @chapter/etc. name),
-% NAME-pg (the page number), and NAME-snt (section number and type).
-% Called from \donoderef and \anchor.
+% anchor), which consists of three parts:
+% 1) NAME-title - the current sectioning name, taken from \thissection;
+% 2) NAME-snt   - section number and type, defined as the SNT arg;
+% 3) NAME-pg    - the page number.
+% This is called from \donoderef, \anchor, and \dofloat.
 % 
 % We take care not to fully expand the title, since it may contain
 % arbitrary macros.
@@ -5704,7 +5718,9 @@
   \pdfmkdest{#1}%
   \iflinks
     {%
+      \indexnofonts
       \turnoffactive
+      \otherbackslash
       \edef\writexrdef##1##2{%
        address@hidden #1 of \setref, expanded by the \edef
          ##1}{##2}}% these are parameters of \writexrdef
@@ -5728,38 +5744,33 @@
 \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
   \unsepspaces
   \def\printedmanual{\ignorespaces #5}%
-  \def\printednodename{\ignorespaces #3}%
-  \setbox1=\hbox{\printedmanual}%
-  \setbox0=\hbox{\printednodename}%
+  \def\printedrefname{\ignorespaces #3}%
+  \setbox1=\hbox{\printedmanual\unskip}%
+  \setbox0=\hbox{\printedrefname\unskip}%
   \ifdim \wd0 = 0pt
     % No printed node name was explicitly given.
     \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax
       % Use the node name inside the square brackets.
-      \def\printednodename{\ignorespaces #1}%
+      \def\printedrefname{\ignorespaces #1}%
     \else
       % Use the actual chapter/section title appear inside
       % the square brackets.  Use the real section title if we have it.
       \ifdim \wd1 > 0pt
         % It is in another manual, so we don't have it.
-        \def\printednodename{\ignorespaces #1}%
+        \def\printedrefname{\ignorespaces #1}%
       \else
         \ifhavexrefs
           % We know the real title if we have the xref values.
-          \def\printednodename{\refx{#1-title}{}}%
+          \def\printedrefname{\refx{#1-title}{}}%
         \else
           % Otherwise just copy the Info node name.
-          \def\printednodename{\ignorespaces #1}%
+          \def\printedrefname{\ignorespaces #1}%
         \fi%
       \fi
     \fi
   \fi
   %
-  % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not
-  % insert empty discretionaries after hyphens, which means that it will
-  % not find a line break at a hyphen in a node names.  Since some manuals
-  % are best written with fairly long node names, containing hyphens, this
-  % is a loss.  Therefore, we give the text of the node name again, so it
-  % is as if TeX is seeing it for the first time.
+  % Make link in pdf output.
   \ifpdf
     \leavevmode
     \getfilename{#4}%
@@ -5775,35 +5786,71 @@
     \linkcolor
   \fi
   %
-  \ifdim \wd1 > 0pt
-    \putwordsection{} ``\printednodename'' \putwordin{} \cite{\printedmanual}%
-  \else
-    % _ (for example) has to be the character _ for the purposes of the
-    % control sequence corresponding to the node, but it has to expand
-    % into the usual \leavevmode...\vrule stuff for purposes of
-    % printing. So we \turnoffactive for the \refx-snt, back on for the
-    % printing, back off for the \refx-pg.
-    {\turnoffactive \otherbackslash
-     % Only output a following space if the -snt ref is nonempty; for
-     % @unnumbered and @anchor, it won't be.
-     \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
-     \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
-    }%
-    % output the `[mynode]' via a macro.
-    \xrefprintnodename\printednodename
-    %
-    % But we always want a comma and a space:
-    ,\space
+  % Float references are printed completely differently: "Figure 1.2"
+  % instead of "[somenode], p.3".  We distinguish them by the
+  % LABEL-title being set to a magic string.
+  {%
+    % Have to otherify everything special to allow the \csname to
+    % include an _ in the xref name, etc.
+    \indexnofonts
+    \turnoffactive
+    \otherbackslash
+    \expandafter\global\expandafter\let\expandafter\Xthisreftitle
+      \csname X#1-title\endcsname
+  }%
+  \ifx \Xthisreftitle \floatmagic
+    % If the user specified the print name (third arg) to the ref,
+    % print it instead of our usual "Figure 1.2".
+    \ifdim\wd0 = 0pt
+      \refx{#1-snt}%
+    \else
+      \printedrefname
+    \fi
     %
-    % output the `page 3'.
-    \turnoffactive \otherbackslash \putwordpage\tie\refx{#1-pg}{}%
+    % if the user also gave the printed manual name (fifth arg), append
+    % "in MANUALNAME". 
+    \ifdim \wd1 > 0pt
+      \space \putwordin{} \cite{\printedmanual}%
+    \fi
+  \else
+    % node/anchor (non-float) references.
+    % 
+    % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not
+    % insert empty discretionaries after hyphens, which means that it will
+    % not find a line break at a hyphen in a node names.  Since some manuals
+    % are best written with fairly long node names, containing hyphens, this
+    % is a loss.  Therefore, we give the text of the node name again, so it
+    % is as if TeX is seeing it for the first time.
+    \ifdim \wd1 > 0pt
+      \putwordsection{} ``\printedrefname'' \putwordin{} \cite{\printedmanual}%
+    \else
+      % _ (for example) has to be the character _ for the purposes of the
+      % control sequence corresponding to the node, but it has to expand
+      % into the usual \leavevmode...\vrule stuff for purposes of
+      % printing. So we \turnoffactive for the \refx-snt, back on for the
+      % printing, back off for the \refx-pg.
+      {\turnoffactive \otherbackslash
+       % Only output a following space if the -snt ref is nonempty; for
+       % @unnumbered and @anchor, it won't be.
+       \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
+       \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
+      }%
+      % output the `[mynode]' via a macro so it can be overridden.
+      \xrefprintnodename\printedrefname
+      %
+      % But we always want a comma and a space:
+      ,\space
+      %
+      % output the `page 3'.
+      \turnoffactive \otherbackslash \putwordpage\tie\refx{#1-pg}{}%
+    \fi
   \fi
   \endlink
 \endgroup}
 
 % This macro is called from \xrefX for the `[nodename]' part of xref
 % output.  It's a separate macro only so it can be changed more easily,
-% since not square brackets don't work in some documents.  Particularly
+% since square brackets don't work well in some documents.  Particularly
 % one that Bob is working on :).
 %
 \def\xrefprintnodename#1{[#1]}
@@ -5836,15 +5883,6 @@
   \fi\fi\fi
 }
 
-% Use TeX 3.0's \inputlineno to get the line number, for better error
-% messages, but if we're using an old version of TeX, don't do anything.
-%
-\ifx\inputlineno\thisisundefined
-  \let\linenumber = \empty % Pre-3.0.
-\else
-  \def\linenumber{\the\inputlineno:\space}
-\fi
-
 % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
 % If its value is nonempty, SUFFIX is output afterward.
 %
@@ -5880,8 +5918,16 @@
 \def\xrdef#1{\expandafter\gdef\csname X#1\endcsname}
 
 % Read the last existing aux file, if any.  No error if none exists.
-% Open the new one.
 % 
+\def\tryauxfile{%
+  \openin 1 \jobname.aux
+  \ifeof 1 \else
+    \readauxfile
+    \global\havexrefstrue
+  \fi
+  \closein 1
+}
+
 \def\readauxfile{\begingroup
   address@hidden
   \catcode`\^^A=\other
@@ -5950,28 +5996,12 @@
     }%
   }%
   %
-  % Turn off \ as an escape so we do not lose on
-  % entries which were dumped with control sequences in their names.
-  % For example, @xrdef{$\leq $-fun}{page ...} made by @defun ^^
-  % Reference to such entries still does not work the way one would wish,
-  % but at least they do not bomb out when the aux file is read in.
-  \catcode`\\=\other
-  %
   % @ is our escape character in .aux files.
   \catcode`\{=1
   \catcode`\}=2
   address@hidden
   %
-  \openin 1 \jobname.aux
-  \ifeof 1 \else
-    \closein 1
-    \input \jobname.aux
-    \global\havexrefstrue
-  \fi
-  % Open the new aux file right away (otherwise the \immediate's in
-  % \setref cause spurious terminal output).  TeX will close it
-  % automatically at exit.
-  \immediate\openout\auxfile=\jobname.aux
+  \input \jobname.aux
 \endgroup}
 
 
@@ -6104,9 +6134,9 @@
   \next
 }
 \def\newsaveinsX #1{%
-  \csname newbox\endcsname #1% \newbox cannot be pronounced, as it is outer
+  \csname newbox\endcsname #1%
   \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts
-    \checksaveins#1}%
+    \checksaveins #1}%
 }
 
 % initialize:
@@ -6123,12 +6153,12 @@
 % undone and the next image would fail.
 \openin 1 = epsf.tex
 \ifeof 1 \else
-  \closein 1
   % Do not bother showing banner with epsf.tex v2.7k (available in
   % doc/epsf.tex and on ctan).
   \def\epsfannounce{\toks0 = }%
   \input epsf.tex
 \fi
+\closein 1
 %
 % We will only complain once about lack of epsf.tex.
 \newif\ifwarnednoepsf
@@ -6188,57 +6218,60 @@
 % We don't actually implement floating yet, we just plop the float "here".
 % But it seemed the best name for the future.
 % 
-\def\float{\parsearg\parsefloat}
-\def\parsefloat#1{\dofloat #1,,\finish}
+\envparseargdef\float{\dofloat #1,,,\finish}
 
-% #1 is the optional text label for this float, typically "Figure",
-% "Table", "Example", etc.  Can't contain commas.  If omitted, this
-% float will not be numbered and cannot be referred to.
+% #1 is the optional FLOATTYPE, the text label for this float, typically
+% "Figure", "Table", "Example", etc.  Can't contain commas.  If omitted,
+% this float will not be numbered and cannot be referred to.
 % 
-% #2 is optional and ignored; it will be for specifying the positions
-% allowed to float to (here, top, bottom).
+% #2 is the optional xref label.  Also must be present for the float to
+% be referable.
+% 
+% #3 is the optional positioning argument; for now, it is ignored.  It
+% will somehow specify the positions allowed to float to (here, top, bottom).
 % 
 % We keep a separate counter for each FLOATTYPE, which we reset at each
 % chapter-level command.
 \let\resetallfloatnos=\empty
 %
-\def\dofloat#1,#2,#3\finish{\vtop\bgroup
-  \def\floattype{#1}%
-  \def\floatloc{#2}% we do nothing with this yet.
-  % xx should we indent the whole thing? center it?
-  % 
-  % allow @[short]caption now.
-  \let\thiscaption=\empty
-  \def\caption##1{\def\thiscaption{##1}}%
-  %
-  \let\thisshortcaption=\empty
-  \def\shortcaption##1{\def\thisshortcaption{##1}}%
-  %
-  \ifx\floattype\empty \else
-    % For now, assume the FLOATTYPE is entirely letters, so we just use it
-    % in a control sequence name literally.  We want each FLOATTYPE to be
-    % numbered separately (Figure 1, Table 1, Figure 2, ...).
-    \expandafter\let\expandafter\floatno\csname\floattype floatno\endcsname
-    \ifx\floatno\relax
-      % Haven't seen this figure type before, so need to define
-      % the counter for it, and then redefine \floatno.
-      \expandafter\innernewcount\csname\floattype floatno\endcsname
-      \expandafter\let\expandafter\floatno\csname\floattype floatno\endcsname
-      %
-      % Remember to reset this floatno at the next chap.
-      \toks0 = \expandafter{\resetallfloatnos}%
-      \xdef\resetallfloatnos{\the\toks0 \makecsname{\floattype floatno}=0 }%
-    \fi
-    \global\advance\floatno by 1
-  \fi
+\def\dofloat#1,#2,#3,#4\finish{%
+  % don't lose footnotes inside @float.
+  \startsavinginserts
   %
-  \def\Efloat{%
-    % we have four possibilities:
-    % @float foo & @caption{cap}: foo 1.1: cap
-    % @float foo & no caption:    foo 1.1
-    % @float & @caption(cap):     cap
-    % @float & no caption:
+  \vtop\bgroup
+    \def\floattype{#1}%
+    \def\floatlabel{#2}%
+    \def\floatloc{#3}% we do nothing with this yet.
+    % xx should we indent the whole thing? center it?
     %
+    \ifx\floattype\empty \else
+      % For now, assume the FLOATTYPE is entirely letters, so we just use it
+      % in a control sequence name literally.  We want each FLOATTYPE to be
+      % numbered separately (Figure 1, Table 1, Figure 2, ...).
+      \expandafter\getfloatno\csname\floattype floatno\endcsname
+      \global\advance\floatno by 1
+      %
+      \ifx\floatlabel\empty \else
+       {%
+         % This magic value for \thissection is output by \setref as the
+         % XREFLABEL-title value.  \xrefX uses it to distinguish float
+         % labels (which have a completely different output format) from
+         % nodes and xref labels.
+         % 
+         \let\thissection=\floatmagic
+         \setref{\floatlabel}{Yfloat}%
+       }%
+      \fi
+    \fi
+}
+
+% we have four possibilities:
+% @float Foo & @caption{Cap}: Foo 1.1: Cap
+% @float Foo & no caption:    Foo 1.1
+% @float & @caption{Cap}:     Cap
+% @float & no caption:
+%
+\def\Efloat{%
     \let\printedsomething = \empty
     %
     \ifx\floattype\empty \else
@@ -6253,9 +6286,9 @@
     %
     \ifx\thiscaption\empty \else
       \ifx\printedsomething\empty
-        \vskip.5\parskip  % space above caption
+       \vskip.5\parskip  % space above caption
       \else
-        :\space  % had a number, so print a colon.
+       :\space  % had a number, so print a colon.
       \fi
       %
       % Print caption text.
@@ -6266,18 +6299,42 @@
     % Space below caption, if we printed anything.
     \ifx\printedsomething\empty \else \vskip\parskip \fi
     %
-    \egroup  % end of \vtop
-  }%
+  \egroup  % end of \vtop
+  \checkinserts
 }
 
-% @listoffloats FLOATTYPE - print a list of floats like a table of contents.
-\def\listoffloats{\parsearg\dolistoffloats}
-\def\dolistoffloats#1{%xx
+\def\caption#1{\checkenv\float \def\thiscaption{#1}}
+\def\shortcaption#1{\checkenv\float \def\thisshortcaption{#1}}
+\let\thiscaption=\empty
+\let\thisshortcaption=\empty
+
+% The parameter is the control sequence identifying the counter we are
+% going to use.  Create it if it doesn't exist and assign it to \floatno.
+\def\getfloatno#1{%
+  \ifx#1\relax
+      % Haven't seen this figure type before.
+      \csname newcount\endcsname #1%
+      %
+      % Remember to reset this floatno at the next chap.
+      \expandafter\gdef\expandafter\resetallfloatnos
+        \expandafter{\resetallfloatnos #1=0 }%
+  \fi
+  \let\floatno#1%
 }
 
-% Default definitions.
address@hidden while not in @float environment}}
address@hidden while not in @float environment}}
+% \setref calls this to get the XREFLABEL-snt value.  We want an @xref
+% to the FLOATLABEL to expand to "Figure 3.1".  We call \setref when we
+% first read the @float command.
+% 
+\def\Yfloat{\floattype @tie{}\chaplevelprefix\the\floatno}%
+
+% Magic string used for the XREFLABEL-title value, so \xrefX can
+% distinguish floats from other xref types.
+\def\floatmagic{!!float!!}
+
+% @listoffloats FLOATTYPE - print a list of floats like a table of contents.
+\parseargdef\listoffloats{%xx
+}
 
 
 \message{localization,}
@@ -6288,18 +6345,17 @@
 % properly.  Single argument is the language abbreviation.
 % It would be nice if we could set up a hyphenation file here.
 %
-\defparsearg\documentlanguage{%
+\parseargdef\documentlanguage{%
   \tex % read txi-??.tex file in plain TeX.
-  % Read the file if it exists.
-  \openin 1 txi-#1.tex
-  \ifeof1
-    \errhelp = \nolanghelp
-    \errmessage{Cannot read language file txi-#1.tex}%
-    \let\temp = \relax
-  \else
-    \def\temp{\input txi-#1.tex }%
-  \fi
-  \temp
+    % Read the file if it exists.
+    \openin 1 txi-#1.tex
+    \ifeof 1
+      \errhelp = \nolanghelp
+      \errmessage{Cannot read language file txi-#1.tex}%
+    \else
+      \input txi-#1.tex
+    \fi
+    \closein 1
   \endgroup
 }
 \newhelp\nolanghelp{The given language definition file cannot be found or
@@ -6482,7 +6538,7 @@
 % Perhaps we should allow setting the margins, \topskip, \parskip,
 % and/or leading, also. Or perhaps we should compute them somehow.
 %
-\defparsearg\pagesizes{\pagesizesyyy #1,,\finish}
+\parseargdef\pagesizes{\pagesizesyyy #1,,\finish}
 \def\pagesizesyyy#1,#2,#3\finish{{%
   \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
   \globaldefs = 1
@@ -6529,8 +6585,8 @@
 \def\normalplus{+}
 \def\normaldollar{$}%$ font-lock fix
 
-% This macro is used to make a character print one way in ttfont
-% where it can probably just be output, and another way in other fonts,
+% This macro is used to make a character print one way in \tt
+% (where it can probably be output as-is), and another way in other fonts,
 % where something hairier probably needs to be done.
 %
 % #1 is what to print if we are indeed using \tt; #2 is what to print
@@ -6658,10 +6714,6 @@
 @catcode`@& = @other
 @address@hidden = @other
 @address@hidden = @other
-
address@hidden Set initial fonts.
address@hidden
address@hidden
 
 
 @c Local variables:

-- 
Alexandre Duret-Lutz





reply via email to

[Prev in Thread] Current Thread [Next in Thread]