[NTG-pdftex] \expanded (was: Misleading cs names?)

Heiko Oberdiek oberdiek at uni-freiburg.de
Sun Dec 9 22:21:28 CET 2007


Hello,

On Sun, Dec 09, 2007 at 08:14:31PM +0100, Morten Høgholm wrote:

> Usually the x expansion meant "uses \edef" and so they were all  
> non-expandable. But now that we have pdfeTeX'ed the l3 kernel, we have  
> functions doing full expansion like \numexpr and friends and \pdfstrcmp  
> (does \edef on both arguments) used in \tlist_if_eq:xxTF. This reminds me:  
> the notes from the Oldenburg meeting mentions an \expanded primitive:
>   \expanded <general text>
>   Expandable command returning the full expansion
>   of the tokens in <general text>.
> So since this pretty much exists inside \pdfstrcmp as it is now, it could  
> go into pdfTeX 1.50 and we would be free of these problems. Except of  
> course, \expanded is already used a lot in ConTeXt with different  
> semantics.
> 
> Any opinions from the ConTeXt/pdfTeX people here?

I miss "\expanded", too.

A workaround for a \detokenize with expanded argument:
  \pdfunescapehex{\pdfunescapehex{...}}
For LuaTeX \pdf(|un)escapehex are defined in package `pdftexcmds':
  \pdf at unescapehex and \pdf at escapehex, both are expandable.
Disadvantages of the workaround:
* slower
* no <general text>, but macro argument
* detokenization happens.

But I assume, you want only expansion, not detokenization?
(then the latter can be achieved by
\detokenize\expandafter{\expanded{...}})

Biggest problem is probably a good name:
a) \expanded would be a nice name, but it clashes with ConTeXt.
   I remember trouble with \unexpanded :-(
b) It would belong to e-TeX, but there isn't a e-TeX prefix:
   \etexexpanded or \etexexpand
c) pdfTeX's convention with prefix "\pdf" (see \pdfstrcmp, \pdfescape*):
   \pdfexpanded or \pdfexpand
d) longer names
   
My preference is c) to avoid trouble with macro name clashes.
I can live with a), then my package etexcmds would get a
new macro \etex at expanded.

Yours sincerely
  Heiko <oberdiek at uni-freiburg.de>

PS: ntg-pdftex list added.


More information about the ntg-pdftex mailing list