On Wed, Nov 26, 2008 at 8:28 PM, Wolfgang Schuster wrote:
Am 26.11.2008 um 20:07 schrieb Mojca Miklavec:
Hello,
Here's a tiny question. The following command complains about undefined control sequence.
\starttext \startluacode print('a\tb')
print('a\t b')
But then I get some unwanted space.
\stopluacode hello \stoptext
There is a workaround: print(string.format('a\t%s', 'b')) but I find it weird. Even if the line above gets commented out with two dashes it still complains.
I understand approximately why this happens, but is that intended? Should I be using something else than \startluacode in the plethora of different lua triggering commands?
\start/stopluacode is defined as \startluacode#1\stopluacode (simplified) and you should take care of TeXs parsing rules.
If you want Lua comments and format command (\n, \t ...) use a external file for your Lua code.
OK, I will use external files next time. In this quick-and-dirty approach I just added string.format since it was easier than restructuring everything. I thought that \startluacode should be behaving the same way as verbatim environments where commands inside verbatim have no influence, but apparently I was wrong. Thanks, Mojca