From 322258bbc5eaaec5188cbe5e158b97fcd508ffb8 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Mon, 1 Apr 2019 23:24:13 +0000
Subject: tl-update-auto

git-svn-id: svn://tug.org/texlive/trunk@50702 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/tex/texinfo/texinfo.tex | 448 ++++++++++++++++++++----------
 1 file changed, 297 insertions(+), 151 deletions(-)

(limited to 'Master/texmf-dist/tex/texinfo/texinfo.tex')

diff --git a/Master/texmf-dist/tex/texinfo/texinfo.tex b/Master/texmf-dist/tex/texinfo/texinfo.tex
index 667292a96a1..192284cccc1 100644
--- a/Master/texmf-dist/tex/texinfo/texinfo.tex
+++ b/Master/texmf-dist/tex/texinfo/texinfo.tex
@@ -3,7 +3,8 @@
 % Load plain if necessary, i.e., if running under initex.
 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
 %
-\def\texinfoversion{2019-03-23.11}
+\def\texinfoversion{2019-03-03.15}
+
 %
 % Copyright 1985, 1986, 1988, 1990-2019 Free Software Foundation, Inc.
 %
@@ -386,8 +387,14 @@
     % take effect in \write's, yet the group defined by the \vbox ends
     % before the \shipout runs.
     %
-    \atdummies         % don't expand commands in the output.
-    \turnoffactive
+    \indexdummies         % don't expand commands in the output.
+    \normalturnoffactive  % \ in index entries must not stay \, e.g., if
+               % the page break happens to be in the middle of an example.
+               % We don't want .vr (or whatever) entries like this:
+               % \entry{{\indexbackslash }acronym}{32}{\code {\acronym}}
+               % "\acronym" won't work when it's read back in;
+               % it needs to be
+               % {\code {{\backslashcurfont }acronym}
     \shipout\vbox{%
       % Do this early so pdf references go to the beginning of the page.
       \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi
@@ -448,10 +455,11 @@
   }%
 }
 
-% First remove any @comment, then any @c comment.  Pass the result on to 
-% \argcheckspaces.
+% First remove any @comment, then any @c comment.  Also remove a @texinfoc
+% comment (see \scanmacro for details).  Pass the result on to \argcheckspaces.
 \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
-\def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
+\def\argremovec#1\c#2\ArgTerm{\argremovetexinfoc #1\texinfoc\ArgTerm}
+\def\argremovetexinfoc#1\texinfoc#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
 
 % Each occurrence of `\^^M' or `<space>\^^M' is replaced by a single space.
 %
@@ -1123,16 +1131,6 @@ where each line of input produces a line of output.}
   \fi
 \fi
 
-\newif\ifpdforxetex
-\pdforxetexfalse
-\ifpdf
-  \pdforxetextrue
-\fi
-\ifx\XeTeXrevision\thisisundefined\else
-  \pdforxetextrue
-\fi
-
-
 % PDF uses PostScript string constants for the names of xref targets,
 % for display in the outlines, and in other places.  Thus, we have to
 % double any backslashes.  Otherwise, a name like "\node" will be
@@ -2846,7 +2844,7 @@ end
 
 % @t, explicit typewriter.
 \def\t#1{%
-  {\tt \plainfrenchspacing #1}%
+  {\tt \rawbackslash \plainfrenchspacing #1}%
   \null
 }
 
@@ -2873,6 +2871,7 @@ end
     % Turn off hyphenation.
     \nohyphenation
     %
+    \rawbackslash
     \plainfrenchspacing
     #1%
   }%
@@ -3113,7 +3112,7 @@ end
 % So now @email is just like @uref, unless we are pdf.
 %
 %\def\email#1{\angleleft{\tt #1}\angleright}
-\ifpdforxetex
+\ifpdf
   \def\email#1{\doemail#1,,\finish}
   \def\doemail#1,#2,#3\finish{\begingroup
     \unsepspaces
@@ -3123,7 +3122,18 @@ end
     \endlink
   \endgroup}
 \else
-  \let\email=\uref
+  \ifx\XeTeXrevision\thisisundefined
+    \let\email=\uref
+  \else
+    \def\email#1{\doemail#1,,\finish}
+    \def\doemail#1,#2,#3\finish{\begingroup
+      \unsepspaces
+      \pdfurl{mailto:#1}%
+      \setbox0 = \hbox{\ignorespaces #2}%
+      \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
+      \endlink
+    \endgroup}
+  \fi
 \fi
 
 % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
@@ -4657,6 +4667,19 @@ end
   }
 }
 
+% We have this subroutine so that we can handle at least some @value's
+% properly in indexes (we call \makevalueexpandable in \indexdummies).
+% The command has to be fully expandable (if the variable is set), since
+% the result winds up in the index file.  This means that if the
+% variable's value contains other Texinfo commands, it's almost certain
+% it will fail (although perhaps we could fix that with sufficient work
+% to do a one-level expansion on the result, instead of complete).
+% 
+% Unfortunately, this has the consequence that when _ is in the *value*
+% of an @set, it does not print properly in the roman fonts (get the cmr
+% dot accent at position 126 instead).  No fix comes to mind, and it's
+% been this way since 2003 or earlier, so just ignore it.
+% 
 \def\expandablevalue#1{%
   \expandafter\ifx\csname SET#1\endcsname\relax
     {[No value for ``#1'']}%
@@ -4685,7 +4708,7 @@ end
 % if possible, otherwise sort late.
 \def\indexnofontsvalue#1{%
   \expandafter\ifx\csname SET#1\endcsname\relax
-    ZZZZZZZ%
+    ZZZZZZZ
   \else
     \csname SET#1\endcsname
   \fi
@@ -4835,8 +4858,23 @@ end
 \def\docodeindexxxx #1{\doind{\indexname}{\code{#1}}}
 
 
-% Used for the aux, toc and index files to prevent expansion of Texinfo 
-% commands.
+% Used when writing an index entry out to an index file to prevent
+% expansion of Texinfo commands that can appear in an index entry.
+%
+\def\indexdummies{%
+  \escapechar = `\\     % use backslash in output files.
+  \definedummyletter\@%
+  \definedummyletter\ %
+  %
+  % For texindex which always views { and } as separators.
+  \def\{{\lbracechar{}}%
+  \def\}{\rbracechar{}}%
+  %
+  % Do the redefinitions.
+  \definedummies
+}
+
+% Used for the aux and toc files, where @ is the escape character.
 %
 \def\atdummies{%
   \definedummyletter\@%
@@ -4866,7 +4904,8 @@ end
 \def\definedummyletter#1{\def#1{\string#1}}%
 \let\definedummyaccent\definedummyletter
 
-% Called from \atdummies to prevent the expansion of commands.
+% Called from \indexdummies and \atdummies, to effectively prevent
+% the expansion of commands.
 %
 \def\definedummies{%
   %
@@ -5031,9 +5070,11 @@ end
   \commondummyword\xref
 }
 
+% This does nothing, but for a time it was recommended to use
+% \usebracesinindexestrue to be able to use braces in index entries.
+
 \let\indexlbrace\relax
 \let\indexrbrace\relax
-\let\indexatchar\relax
 
 {\catcode`\@=0
 \catcode`\\=13
@@ -5067,8 +5108,10 @@ end
   }
 
   \gdef\indexnonalnumreappear{%
+    \useindexbackslash
     \let-\normaldash
     \let<\normalless
+    \def\@{@}%
   }
 }
 
@@ -5179,6 +5222,8 @@ end
 
 
 
+\let\SETmarginindex=\relax % put index entries in margin (undocumented)?
+
 % #1 is the index name, #2 is the entry text.
 \def\doind#1#2{%
   \iflinks
@@ -5210,6 +5255,13 @@ end
 \fi}
 \def\indexisfl{fl}
 
+% Output \ as {\indexbackslash}, because \ is an escape character in
+% the index files.
+\let\indexbackslash=\relax
+{\catcode`\@=0 \catcode`\\=\active
+  @gdef@useindexbackslash{@def\{{@indexbackslash}}}
+}
+
 % Definition for writing index entry sort key.
 {
 \catcode`\-=13
@@ -5221,25 +5273,14 @@ end
   \xdef\indexsortkey{#1}\endgroup}
 }
 
-\def\indexwriteseealso#1{
-  \gdef\pagenumbertext{@seealso{#1}}%
-}
-
-% The default definitions
-\def\sortas#1{}%
-\def\seealso#1{\i{\putwordSeeAlso}\ #1}% for sorted index file only
-\def\putwordSeeAlso{see also}
-
 % Given index entry text like "aaa @subentry bbb @sortas{ZZZ}":
 %   * Set \bracedtext to "{aaa}{bbb}"
 %   * Set \fullindexsortkey to "aaa @subentry ZZZ"
-%   * If @seealso occurs, set \pagenumbertext
 %
 \def\splitindexentry#1{%
   \gdef\fullindexsortkey{}%
   \xdef\bracedtext{}%
   \def\sep{}%
-  \def\seealso##1{}%
   \expandafter\doindexsegment#1\subentry\finish\subentry
 }
 
@@ -5251,6 +5292,7 @@ end
     %
     % Fully expand the segment, throwing away any @sortas directives, and 
     % trim spaces.
+    \def\sortas##1{}%
     \edef\trimmed{\segment}%
     \edef\trimmed{\expandafter\eatspaces\expandafter{\trimmed}}%
     %
@@ -5260,20 +5302,16 @@ end
     % font commands turned off.
     \bgroup
       \let\sortas\indexwritesortas
-      \let\seealso\indexwriteseealso
       \indexnofonts
       % The braces around the commands are recognized by texindex.
       \def\lbracechar{{\indexlbrace}}%
       \def\rbracechar{{\indexrbrace}}%
       \let\{=\lbracechar
       \let\}=\rbracechar
-      \def\@{{\indexatchar}}%
-      \def\atchar##1{\@}%
       %
       \let\indexsortkey\empty
-      \global\let\pagenumbertext\empty
       % Execute the segment and throw away the typeset output.  This executes
-      % any @sortas or @seealso commands in this segment.
+      % any @sortas commands in this segment.
       \setbox\dummybox = \hbox{\segment}%
       \ifx\indexsortkey\empty{%
         \indexnonalnumdisappear
@@ -5294,20 +5332,21 @@ end
   \fi
 }
 \def\isfinish{\finish}%
-\newbox\dummybox % used above
 
 \let\subentry\relax
 
 % Write the entry in \toks0 to the index file.
 %
 \def\doindwrite{%
-  \maybemarginindex
-  %
-  \atdummies
+  % Put the index entry in the margin if desired.
+  \ifx\SETmarginindex\relax\else
+    \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}%
+  \fi
   %
-  % For texindex which always views { and } as separators.
-  \def\{{\lbracechar{}}%
-  \def\}{\rbracechar{}}%
+  % Remember, we are within a group.
+  \indexdummies % Must do this here, since \bf, etc expand at this stage
+  \useindexbackslash % \indexbackslash isn't defined now so it will be output 
+                     % as is; and it will print as backslash.
   %
   % Split the entry into primary entry and any subentries, and get the index 
   % sort key.
@@ -5321,21 +5360,11 @@ end
   %
   \edef\temp{%
     \write\writeto{%
-      \string\entry{\fullindexsortkey}%
-        {\ifx\pagenumbertext\empty\noexpand\folio\else\pagenumbertext\fi}%
-        \bracedtext}%
+      \string\entry{\fullindexsortkey}{\noexpand\folio}\bracedtext}%
   }%
   \temp
 }
-
-% Put the index entry in the margin if desired (undocumented).
-\def\maybemarginindex{%
-  \ifx\SETmarginindex\relax\else
-    \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \relax\indextext}}%
-  \fi
-}
-\let\SETmarginindex=\relax
-
+\newbox\dummybox % used above
 
 % Take care of unwanted page breaks/skips around a whatsit:
 %
@@ -5423,14 +5452,9 @@ end
 %  \entry {topic}{pagelist}
 %     for a topic that is used without subtopics
 %  \primary {topic}
-%  \entry {topic}{}
 %     for the beginning of a topic that is used with subtopics
 %  \secondary {subtopic}{pagelist}
 %     for each subtopic.
-%  \secondary {subtopic}{}
-%     for a subtopic with sub-subtopics
-%  \tertiary {subtopic}{subsubtopic}{pagelist}
-%     for each sub-subtopic.
 
 % Define the user-accessible indexing commands
 % @findex, @vindex, @kindex, @cindex.
@@ -5455,10 +5479,14 @@ end
   \plainfrenchspacing
   \everypar = {}% don't want the \kern\-parindent from indentation suppression.
   %
+  % See if the index file exists and is nonempty.
+  % Change catcode of @ here so that if the index file contains
+  % \initial {@}
+  % as its first line, TeX doesn't complain about mismatched braces
+  % (because it thinks @} is a control sequence).
+  \catcode`\@ = 12
   % See comment in \requireopenindexfile.
   \def\indexname{#1}\ifx\indexname\indexisfl\def\indexname{f1}\fi
-  %
-  % See if the index file exists and is nonempty.
   \openin 1 \jobname.\indexname s
   \ifeof 1
     % \enddoublecolumns gets confused if there is no text in the index,
@@ -5468,6 +5496,8 @@ end
     \putwordIndexNonexistent
     \typeout{No file \jobname.\indexname s.}%
   \else
+    \catcode`\\ = 0
+    %
     % If the index file exists but is empty, then \openin leaves \ifeof
     % false.  We have to make TeX try to read something from the file, so
     % it can discover if there is anything in it.
@@ -5475,27 +5505,47 @@ end
     \ifeof 1
       \putwordIndexIsEmpty
     \else
-      \expandafter\printindexzz\thisline\relax\relax\finish%
+      % Index files are almost Texinfo source, but we use \ as the escape
+      % character.  It would be better to use @, but that's too big a change
+      % to make right now.
+      \def\indexbackslash{\ttbackslash}%
+      \let\indexlbrace\{   % Likewise, set these sequences for braces
+      \let\indexrbrace\}   % used in the sort key.
+      \begindoublecolumns
+      \let\dotheinsertentrybox\dotheinsertentryboxwithpenalty
+      %
+      % Read input from the index file line by line.
+      \loopdo
+        \ifeof1 \else
+          \read 1 to \nextline
+        \fi
+        %
+        \indexinputprocessing
+        \thisline
+        %
+        \ifeof1\else
+        \let\thisline\nextline
+      \repeat
+      %%
+      \enddoublecolumns
     \fi
   \fi
   \closein 1
 \endgroup}
+\def\loopdo#1\repeat{\def\body{#1}\loopdoxxx}
+\def\loopdoxxx{\let\next=\relax\body\let\next=\loopdoxxx\fi\next}
 
-% If the index file starts with a backslash, forgo reading the index
-% file altogether.  If somebody upgrades texinfo.tex they may still have
-% old index files using \ as the escape character.  Reading this would
-% at best lead to typesetting garbage, at worst a TeX syntax error.
-\def\printindexzz#1#2\finish{%
-  % NB this won't work if the index file starts with a group...
-  \uccode`\~=`\\ \uppercase{\if\noexpand~}\noexpand#1
-    \message{skipping sorted index file}%
-    (Skipped sorted index file in obsolete format)
+\def\indexinputprocessing{%
+  \ifeof1
+    \let\firsttoken\relax
   \else
-    \begindoublecolumns
-    \input \jobname.\indexname s
-    \enddoublecolumns
+    \edef\act{\gdef\noexpand\firsttoken{\getfirsttoken\nextline}}%
+    \act
   \fi
 }
+\def\getfirsttoken#1{\expandafter\getfirsttokenx#1\endfirsttoken}
+\long\def\getfirsttokenx#1#2\endfirsttoken{\noexpand#1}
+
 
 % These macros are used by the sorted index file itself.
 % Change them to control the appearance of the index.
@@ -5504,18 +5554,12 @@ end
 \catcode`\|=13 \catcode`\<=13 \catcode`\>=13 \catcode`\+=13 \catcode`\"=13
 \catcode`\$=3
 \gdef\initialglyphs{%
-  % special control sequences used in the index sort key
-  \let\indexlbrace\{%
-  \let\indexrbrace\}%
-  \let\indexatchar\@%
-  %
   % Some changes for non-alphabetic characters.  Using the glyphs from the
   % math fonts looks more consistent than the typewriter font used elsewhere
   % for these characters.
-  \uccode`\~=`\\ \uppercase{\def~{\math{\backslash}}}
+  \def\indexbackslash{\math{\backslash}}%
+  \let\\=\indexbackslash
   %
-  % In case @\ is used for backslash
-  \uppercase{\let\\=~}
   % Can't get bold backslash so don't use bold forward slash
   \catcode`\/=13
   \def/{{\secrmnotbold \normalslash}}%
@@ -5574,6 +5618,12 @@ end
 %
 \def\entry{%
   \begingroup
+    %
+    % For pdfTeX and XeTeX.
+    % The redefinition of \domark stops marks being added in \pdflink to 
+    % preserve coloured links across page boundaries.  Otherwise the marks
+    % would get in the way of \lastbox in \insertentrybox.
+    \let\domark\relax
     %
     % Start a new paragraph if necessary, so our assignments below can't
     % affect previous text.
@@ -5607,31 +5657,35 @@ end
 \gdef\finishentry#1{%
     \egroup % end box A
     \dimen@ = \wd\boxA % Length of text of entry
-    \global\setbox\boxA=\hbox\bgroup
-      \unhbox\boxA
-      % #1 is the page number.
+    \global\setbox\boxA=\hbox\bgroup\unhbox\boxA
+    % #1 is the page number.
+    %
+    % Get the width of the page numbers, and only use
+    % leaders if they are present.
+    \global\setbox\boxB = \hbox{#1}%
+    \ifdim\wd\boxB = 0pt
+      \null\nobreak\hfill\ %
+    \else
+      %
+      \null\nobreak\indexdotfill % Have leaders before the page number.
       %
-      % Get the width of the page numbers, and only use
-      % leaders if they are present.
-      \global\setbox\boxB = \hbox{#1}%
-      \ifdim\wd\boxB = 0pt
-        \null\nobreak\hfill\ %
+      \ifpdf
+        \pdfgettoks#1.%
+        \hskip\skip\thinshrinkable\the\toksA
       \else
-        %
-        \null\nobreak\indexdotfill % Have leaders before the page number.
-        %
-        \ifpdforxetex
+        \ifx\XeTeXrevision\thisisundefined
+          \hskip\skip\thinshrinkable #1%
+        \else
           \pdfgettoks#1.%
           \hskip\skip\thinshrinkable\the\toksA
-        \else
-          \hskip\skip\thinshrinkable #1%
         \fi
       \fi
+    \fi
     \egroup % end \boxA
     \ifdim\wd\boxB = 0pt
-      \noindent\unhbox\boxA\par
-      \nobreak
-    \else\bgroup
+      \global\setbox\entrybox=\vbox{\unhbox\boxA}%
+    \else
+    \global\setbox\entrybox=\vbox\bgroup
       % We want the text of the entries to be aligned to the left, and the
       % page numbers to be aligned to the right.
       %
@@ -5697,11 +5751,55 @@ end
     \egroup % The \vbox
     \fi
   \endgroup
+  \dotheinsertentrybox
 }}
 
 \newskip\thinshrinkable
 \skip\thinshrinkable=.15em minus .15em
 
+\newbox\entrybox
+\def\insertentrybox{%
+  \ourunvbox\entrybox
+}
+
+% default definition
+\let\dotheinsertentrybox\insertentrybox
+
+% Use \lastbox to take apart vbox box by box, and add each sub-box
+% to the current vertical list.
+\def\ourunvbox#1{%
+\bgroup % for local binding of \delayedbox
+  % Remove the last box from box #1
+  \global\setbox#1=\vbox{%
+    \unvbox#1%
+    \unskip % remove any glue
+    \unpenalty
+    \global\setbox\interbox=\lastbox
+  }%
+  \setbox\delayedbox=\box\interbox
+  \ifdim\ht#1=0pt\else
+    \ourunvbox#1 % Repeat on what's left of the box
+    \nobreak
+  \fi
+  \box\delayedbox
+\egroup
+}
+\newbox\delayedbox
+\newbox\interbox
+
+% Used from \printindex.  \firsttoken should be the first token
+% after the \entry.  If it's not another \entry, we are at the last
+% line of a group of index entries, so insert a penalty to discourage
+% widowed index entries.
+\def\dotheinsertentryboxwithpenalty{%
+  \ifx\firsttoken\isentry
+  \else
+    \penalty 9000
+  \fi
+  \insertentrybox
+}
+\def\isentry{\entry}%
+
 % Like plain.tex's \dotfill, except uses up at least 1 em.
 % The filll stretch here overpowers both the fil and fill stretch to push
 % the page number to the right.
@@ -5711,15 +5809,24 @@ end
 
 \def\primary #1{\line{#1\hfil}}
 
-\def\secondary{\indententry{0.5cm}}
-\def\tertiary{\indententry{1cm}}
-
-\def\indententry#1#2#3{%
-  \bgroup
-  \leftskip=#1
-  \entry{#2}{#3}%
-  \egroup
-}
+\newskip\secondaryindent \secondaryindent=0.5cm
+\def\secondary#1#2{{%
+  \parfillskip=0in
+  \parskip=0in
+  \hangindent=1in
+  \hangafter=1
+  \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill
+  \ifpdf
+    \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
+  \else
+    \ifx\XeTeXrevision\thisisundefined
+      #2
+    \else
+      \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
+    \fi
+  \fi
+  \par
+}}
 
 % Define two-column mode, which we use to typeset indexes.
 % Adapted from the TeXbook, page 416, which is to say,
@@ -5737,6 +5844,17 @@ end
   \output = {%
     \savetopmark
     %
+    % Here is a possibility not foreseen in manmac: if we accumulate a
+    % whole lot of material, we might end up calling this \output
+    % routine twice in a row (see the doublecol-lose test, which is
+    % essentially a couple of indexes with @setchapternewpage off).  In
+    % that case we just ship out what is in \partialpage with the normal
+    % output routine.  Generally, \partialpage will be empty when this
+    % runs and this will be a no-op.  See the indexspread.tex test case.
+    \ifvoid\partialpage \else
+      \onepageout{\pagecontents\partialpage}%
+    \fi
+    %
     \global\setbox\partialpage = \vbox{%
       % Unvbox the main output page.
       \unvbox\PAGE
@@ -6016,9 +6134,11 @@ end
 
 % @raisesections: treat @section as chapter, @subsection as section, etc.
 \def\raisesections{\global\advance\secbase by -1}
+\let\up=\raisesections % original BFox name
 
 % @lowersections: treat @chapter as section, @section as subsection, etc.
 \def\lowersections{\global\advance\secbase by 1}
+\let\down=\lowersections % original BFox name
 
 % we only have subsub.
 \chardef\maxseclevel = 3
@@ -6670,8 +6790,13 @@ end
   % 1 and 2 (the page numbers aren't printed), and so are the first
   % two pages of the document.  Thus, we'd have two destinations named
   % `1', and two named `2'.
-  \ifpdforxetex
+  \ifpdf
     \global\pdfmakepagedesttrue
+  \else
+    \ifx\XeTeXrevision\thisisundefined
+    \else
+      \global\pdfmakepagedesttrue
+    \fi
   \fi
 }
 
@@ -7034,7 +7159,11 @@ end
 
 % @cartouche ... @end cartouche: draw rectangle w/rounded corners around
 % environment contents.
-
+\font\circle=lcircle10
+\newdimen\circthick
+\newdimen\cartouter\newdimen\cartinner
+\newskip\normbskip\newskip\normpskip\newskip\normlskip
+\circthick=\fontdimen8\circle
 %
 \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
 \def\ctr{{\hskip 6pt\circle\char'010}}
@@ -7049,18 +7178,7 @@ end
 %
 \newskip\lskip\newskip\rskip
 
-% only require the font if @cartouche is actually used
-\def\cartouchefontdefs{%
-  \font\circle=lcircle10\relax
-  \circthick=\fontdimen8\circle
-}
-\newdimen\circthick
-\newdimen\cartouter\newdimen\cartinner
-\newskip\normbskip\newskip\normpskip\newskip\normlskip
-
-
 \envdef\cartouche{%
-  \cartouchefontdefs
   \ifhmode\par\fi  % can't be in the midst of a paragraph.
   \startsavinginserts
   \lskip=\leftskip \rskip=\rightskip
@@ -7932,18 +8050,36 @@ end
   }
 \fi
 
+% alias because \c means cedilla in @tex or @math
+\let\texinfoc=\c
+
+\newcount\savedcatcodeone
+\newcount\savedcatcodetwo
+
 % Used at the time of macro expansion.
 % Argument is macro body with arguments substituted
 \def\scanmacro#1{%
   \newlinechar`\^^M
   \def\xeatspaces{\eatspaces}%
   %
+  % Temporarily undo catcode changes of \printindex.  Set catcode of @ to
+  % 0 so that @-commands in macro expansions aren't printed literally when 
+  % formatting an index file, where \ is used as the escape character.
+  \savedcatcodeone=\catcode`\@
+  \savedcatcodetwo=\catcode`\\
+  \catcode`\@=0
+  \catcode`\\=\active
+  %
   % Process the macro body under the current catcode regime.
-  \scantokens{#1@comment}%
+  \scantokens{#1@texinfoc}%
   %
-  % The \comment is to remove the \newlinechar added by \scantokens, and
-  % can be noticed by \parsearg.  Note \c isn't used because this means cedilla 
-  % in math mode.
+  \catcode`\@=\savedcatcodeone
+  \catcode`\\=\savedcatcodetwo
+  %
+  % The \texinfoc is to remove the \newlinechar added by \scantokens, and
+  % can be noticed by \parsearg.
+  %   We avoid surrounding the call to \scantokens with \bgroup and \egroup
+  % to allow macros to open or close groups themselves.
 }
 
 % Used for copying and captions
@@ -8044,14 +8180,12 @@ end
 \def\macroargctxt{%
   \scanctxt
   \catcode`\ =\active
-  \catcode`\@=\other
   \catcode`\^^M=\other
   \catcode`\\=\active
 }
 
 \def\macrolineargctxt{% used for whole-line arguments without braces
   \scanctxt
-  \catcode`\@=\other
   \catcode`\{=\other
   \catcode`\}=\other
 }
@@ -8615,21 +8749,9 @@ end
 % also remove a trailing comma, in case of something like this:
 % @node Help-Cross,  ,  , Cross-refs
 \def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse}
-\def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}\omittopnode}
-
-% Used so that the @top node doesn't have to be wrapped in an @ifnottex
-% conditional.
-% \doignore goes to more effort to skip nested conditionals but we don't need 
-% that here.
-\def\omittopnode{%
-   \ifx\lastnode\wordTop
-   \expandafter\ignorenode\fi
-}
-\def\wordTop{Top}
-
-% Divert output to a box that is not output until the next @node command.
-\def\ignorenode{\setbox\dummybox\vbox\bgroup\def\node{\egroup\node}}
+\def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}}
 
+\let\nwnode=\node
 \let\lastnode=\empty
 
 % Write a cross-reference definition for the current node.  #1 is the
@@ -9104,6 +9226,19 @@ end
   \catcode`\^^]=\other
   \catcode`\^^^=\other
   \catcode`\^^_=\other
+  % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc.
+  % in xref tags, i.e., node names.  But since ^^e4 notation isn't
+  % supported in the main text, it doesn't seem desirable.  Furthermore,
+  % that is not enough: for node names that actually contain a ^
+  % character, we would end up writing a line like this: 'xrdef {'hat
+  % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
+  % argument, and \hat is not an expandable control sequence.  It could
+  % all be worked out, but why?  Either we support ^^ or we don't.
+  %
+  % The other change necessary for this was to define \auxhat:
+  % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
+  % and then to call \auxhat in \setq.
+  %
   \catcode`\^=\other
   %
   % Special characters.  Should be turned off anyway, but...
@@ -9121,7 +9256,14 @@ end
   \catcode`\%=\other
   \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
   %
-  \catcode`\\=\active
+  % This is to support \ in node names and titles, since the \
+  % characters end up in a \csname.  It's easier than
+  % leaving it active and making its active definition an actual \
+  % character.  What I don't understand is why it works in the *value*
+  % of the xrdef.  Seems like it should be a catcode12 \, and that
+  % should not typeset properly.  But it works, so I'm moving on for
+  % now.  --karl, 15jan04.
+  \catcode`\\=\other
   %
   % @ is our escape character in .aux files, and we need braces.
   \catcode`\{=1
@@ -11392,9 +11534,11 @@ directory should work if nowhere else does.}
 % \backslashcurfont outputs one backslash character in current font,
 % as in \char`\\.
 \global\chardef\backslashcurfont=`\\
+\global\let\rawbackslashxx=\backslashcurfont  % let existing .??s files work
 
-% \realbackslash is an actual character `\' with catcode other.
-{\catcode`\\=\other @gdef@realbackslash{\}}
+% \realbackslash is an actual character `\' with catcode other, and
+% \doublebackslash is two of them (for the pdf outlines).
+{\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}}
 
 % In Texinfo, backslash is an active character; it prints the backslash
 % in fixed width font.
@@ -11412,8 +11556,10 @@ directory should work if nowhere else does.}
 @def@ttbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}}
 @let@backslashchar = @ttbackslash % @backslashchar{} is for user documents.
 
+% \rawbackslash defines an active \ to do \backslashcurfont.
 % \otherbackslash defines an active \ to be a literal `\' character with
-% catcode other.
+% catcode other.  We switch back and forth between these.
+@gdef@rawbackslash{@let\=@backslashcurfont}
 @gdef@otherbackslash{@let\=@realbackslash}
 
 % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
@@ -11485,7 +11631,7 @@ directory should work if nowhere else does.}
   @ifx\@eatinput @let\ = @ttbackslash @fi
   @catcode13=5 % regular end of line
   @enableemergencynewline
-  @let@c=@comment
+  @let@c=@texinfoc
   @let@parsearg@originalparsearg
   % Also turn back on active characters that might appear in the input
   % file name, in case not using a pre-dumped format.
-- 
cgit v1.2.3

