[Dev-luatex] # or ##, that is the question

Jonathan Sauer Jonathan.Sauer at silverstroke.com
Wed Oct 17 14:56:13 CEST 2007


> [...]
> > % Now this is weird: First doubled, then not
> > \edef\foo{\the\expandafter\toks@\the\toks@}
> \the\toks@ passes # unmolested into \edef.  In every other case (apart
> from the equivalent use of \unexpanded), a doubled ## is required for
> producing a single # in the result, because then # is a parameter
> delimiting token for the \edef.  The \expandafter takes the ## out of
> the token register and into the regular input stream, so the
> #-preserving character of \the inside of \edef is no longer in action.

You are of course right. And I am a little bit wiser.

> [...]
> > And it might be useful too, to build up the body of a complicated
> > macro inside a \toks register before finally creating the macro
> > using \edef:
> >
> > What do you think?
> You are about 20 years late.  Please check LaTeX's definition (and
> usage) of \g at addto@macro:
> [...]

Well, my example was to show how to use above behaviour to create the
body of a macro *with parameters* in a \toks register. \g at addto@macro
does not do this.

> David Kastrup


More information about the dev-luatex mailing list