bug-texinfo
[Top][All Lists]
Advanced

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

Re: backslashes in macro arguments


From: Karl Berry
Subject: Re: backslashes in macro arguments
Date: Thu, 17 Jun 2010 21:05:03 GMT

For bug-texinfo only ... what I did was this:

\def\macroargctxt{% used when scanning invocations
  \scanctxt
  \catcode`\\=0
}

By making the catcode 0 we end up getting the *commands* \\ \{ \}.
Texinfo already has @{ and @} so those are fine, and I simply defined @\
for this purpose:
\def\\{\normalbackslash}

This conflicts with the use of \\ and @\ inside @math, so that
combination won't work, but I doubt that's a serious problem in
practice.

What's worse is that \, can't be supported this way because Texinfo
already has a command @, (cedilla accent), and of course there'd be no
way to distinguish.

I couldn't find any way to do it by redefining the definition of \ as an
active char, because we have to simultaneously handle \foo\ in the macro
definitition, whereas the expansion of "foo" is what contains the stuff
like \\ and \, ... this is @mbodybackslash, and it can only do one
thing.  And since the calls can be recursive ... I gave up at that point.

Oleg or anyone, if you have any ideas (brilliant or otherwise :) about a
way to handle this, even in theory, that'd be cool.

The only real solution that comes to my mind is stop with the address@hidden \'s
already and use something like @macarg{foo} inside the definition
(instead of the horrible \foo\ notation).  Then there is no need for \'s
in the arguments, either.  @comma{} could be used for commas.

Sigh.

k



reply via email to

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