[texhax] Force double expansion ?

Philip Taylor P.Taylor at Rhul.Ac.Uk
Wed Jul 16 21:40:29 CEST 2014


When peeking ahead using \futurelet, the expansion of the token to be 
peeked at can be forced using a simple chain of \expandafters, as in :

\expandafter \futurelet
     \expandafter \nexttok
         \expandafter\analysenexttok

such that if (for example) the following token were \whatever,
and if its expansion were \csname, then \analysenexttok would identify 
\nexttok as \csname and not as \whatever.  But suppose that that were 
not sufficient :  suppose that one wanted \nexttok to be \futurelet not 
to \csname, but rather to the /expansion/ of \csname ...\endcsname 
(assuming that the following code were well-formed).  Then how might 
that be forced ?  It is important to note that that only the first-level 
expansion of \csname ...\endcsname is required, so \edef (for example) 
is not an option.

Philip Taylor



More information about the texhax mailing list