[Dev-luatex] # => ## in \directlua
Jonathan Sauer
Jonathan.Sauer at silverstroke.com
Tue Oct 7 15:16:28 CEST 2008
Hello,
> >> >> So `#' is transformed into `##' when passed from TeX to Lua.
> >> [...]
> >> This currently uses TeX's tokenlist print function, but I could
> >> make it behave differently, no problem (after all, this
> >> generated string is only 'seen' by the lua interpreter).
> >
> > In that case: Please make it so.
>
> It is consistent with TeX's printing mechanism.
Sure. But I don't think that this consistency is necessary. Also,
I would guess that "#" in a token register is not doubled when the
token register is accessed from Lua, so it would be consistent with
how "#" between TeX and Lua is handled there.
> You could deal with this problem by placing the resulting string
> inside of a macro body (where ## will get collapsed to # while the
> body is being collected) and then use it from there.
>
> Disadvantage: this is not an expandible method.
Or I could use gsub in the Lua code.
Disadvantage: It is expandable, but slower. Also, I need two
functions in Lua: One to be called from TeX, and one to be called
from other Lua functions.
Jonathan
More information about the dev-luatex
mailing list