On avoiding the intended (but unwanted) effect of \outer

David Carlisle d.p.carlisle at gmail.com
Fri Oct 18 18:26:50 CEST 2019

On Fri, 18 Oct 2019 at 17:15, Taylor, P <P.Taylor at rhul.ac.uk> wrote:
> David Carlisle wrote:
> > You could save yourself some bytes, and some expansion steps.
> >
> > \edef \imagebox #1{\expandafter\noexpand\csname newbox\endcsname #1\setbox #1}
> >
> > David
> Confused (as always), David.  Your definition is 77 characters, mine is
> 56.   I assume that the "bytes saved" must therefore be in TeX's
> internal memory, but we have for quite some time not been restricted to
> 640kB,

You got a new machine?

> so are there any real-world situations in which saving those few
> bytes (and some expansion steps) is more important that writing clear,
> simple, didactic code ?

I wouldn't say anything with `\csname` in it counts as clear simple or didactic,

The edef definition was intended to be didactic notably highlighting
that \outer does not stop definitions having that token, just stops
the token appearing in certain scanning contexts so you can give
\imagebox the definition that you intended, you just need to write it

By far the clearest and simplest version would be to repeat the
one-line definition of \newbox without \outer, then just use \newbox
directly or use a format that has done that for you already:-)

> ** Phil.


More information about the texhax mailing list