Index: texinfo.tex =================================================================== --- texinfo.tex (revision 6493) +++ texinfo.tex (working copy) @@ -7460,7 +7460,9 @@ \def\macroargctxt{% used when scanning invocations \scanctxt - \catcode`\\=0 + \catcode`\ =\other + \catcode`\\=\active + %\catcode`\\=0 } % why catcode 0 for \ in the above? To recognize \\ \{ \} as "escapes" % for the single characters \ { }. Thus, we end up with the "commands" @@ -7907,16 +7909,52 @@ \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} +% Call #1 with a list of tokens #2, with any doubled backslashes in #2 +% compressed to one. +\def\passargtomacro#1#2{% +% Append an unexpandable token to #2, to allows a trailing +% active backslash in the argument not to eat the next token. +\let\macroargdummy=\relax +\def\arg{#2\macroargdummy}% +% +% Expand the arg list. There won't be unwanted expansion of control sequences +% in the argument because the arg was read with the catcode of @ as \other. +\let\resultingbackslash=\relax % prevent expansion +\usemacroargbackslash +\macroargctxt +\def\macroargdummy{}% +\edef\arg{\arg}% +\expandafter#1\expandafter{\arg}% +} + +% use active definition of backslash at time of expansion +\def\resultingbackslash{\activebackslash} + +% \macroargbackslash +% - expand \\ and single \ as \resultingbackslash +{ address@hidden @address@hidden@active address@hidden@macroargbackslash#1{% +% we need noexpand because \ is active address@hidden @noexpand address@hidden address@hidden address@hidden @resultingbackslash #1% address@hidden + address@hidden@address@hidden@macroargbackslash} +} + + % \braceorline MAC is used for a one-argument macro MAC. It checks % whether the next non-whitespace character is a {. It sets the context % for reading the argument (slightly different in the two cases). Then, -% to read the argument, in the whole-line case, it then calls the -% regular \parsearg MAC; in the lbrace case, it just calls MAC itself. +% to read the argument, in the whole-line case, it then calls the regular +% \parsearg MAC; in the lbrace case, it calls \passargtomacro MAC. % \def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx} \def\braceorlinexxx{% - \ifx\nchar\bgroup\macroargctxt - \else\macrolineargctxt\expandafter\parsearg + \ifx\nchar\bgroup + \macroargctxt\expandafter\passargtomacro + \else + \macrolineargctxt\expandafter\parsearg \fi \macnamexxx} @@ -10292,7 +10330,10 @@ % catcode other. We switch back and forth between these. @address@hidden@address@hidden @address@hidden@address@hidden address@hidden@address@hidden@normalbackslash} address@hidden@address@hidden @address@hidden + @address@hidden@address@hidden@address@hidden % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of