bug-texinfo
[Top][All Lists]
Advanced

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

Re: Bug in \cslet.


From: David Kastrup
Subject: Re: Bug in \cslet.
Date: 16 Aug 2004 13:26:00 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

Stepan Kasal <address@hidden> writes:

> I guess I'm the author of the previous version.  The TeXbook explains
> that you have to use three expandafter's to get something expanded twice:
> 
> \let\ea\expandafter \let\eA\expandafter
> % expand \twice twice
> \ea \eA \ea \twice
> % (\eA is used in the second round.)
> 
> So it was really natural to write:
> 
> \ea\eA\ea \let \ea\eA \csname#1\endcsname \csname#2\endcsname
> 
> The two \eA's are expanded in the second round.

Yes, I acknowledged that I was mistaken before.  The point is that the
first sequence of \ea reduces the stuff around #1 to a single token,
and so the second sequence _does_ work after all.

> Karl wrote:
> > > But I switched to your code anyway, since it's shorter and more
> > > easily understood.  At least I hope I'm understanding it!
> 
> I'd say it's more terse and more tricky.  But I'm glad your black
> magic has got in.  ;-)

One problem is that \expandafter cascades tend to accumulate
exponentially.  Making use of intermediate stages where forced
expansion is guaranteed (like between \csname and \endcsname) is a
deescalating measure.

Anyway, the change was just replacing one working version with
another, and I certainly would not have bothered if I had understood
this properly the first time round.  Storm in a waterglass, so to say.

Thanks for the thumbs-up, anyway.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum




reply via email to

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