[luatex] Lua long strings
Philipp Stephani
st_philipp at yahoo.de
Fri May 6 12:06:32 CEST 2011
Am 06.05.2011 um 11:51 schrieb Dirk Laurie:
> I'd like to define a Latex environment "verbatimlua" that allows:
>
> \begin{verbatimlua}
> s = [[
> A long Lua string containing special characters like \ and %,
> with end-of-lines respected too.
> ]]
> print(s) -- all of s on the screen and in the log file
> tex.print(string.format("%.5f",math.pi))) -- 3.14159 in the TeX output
> \end{verbatimlua}
>
> I.e. it works like "verbatim" but the contents is passed to the Lua
> engine instead. Same as putting it in a file xxx.lua and saying
> \directlua{ dofile"xxx" }
>
> I can't possibly be the first person who has tried and failed to do this.
> Maybe someone has tried and succeeded?
See the luacode package:
http://ctan.org/pkg/luacode
More information about the luatex
mailing list