[luatex] Newbie question: how to stop TeX trying to interpret Lua?

Paul Isambert zappathustra at free.fr
Mon Apr 4 09:37:42 CEST 2011


Le 04/04/2011 09:26, luigi scarso a écrit :
> On Mon, Apr 4, 2011 at 9:03 AM, Dirk Laurie<dpl at sun.ac.za>  wrote:
>> I've managed quite well for several months by writing and debugging
>> my Lua code separately and using only "dofile" inside \directlua.
>> Now I'm trying to do it all inside LuaTeX.
>>
>> It comes as a shock that
>>
>> \directlua{ tex.print("\\TeX") }
>>
>> does not work.  TeX grabs the double-quote and tries to make some
>> accented character.  I've read to about page 25 of the LuaTeX manual
>> and it's already way over my head.  The answer, apart from working
>> with dofile, may be in there but I'm not going to find it soon.
>>
>> Help please!
>>
>> Dirk
>>
> what about
> \directlua{ tex.print([=[\TeX]=]) }
> ?


It won't work properly either. Let's not forget that \directlua expands 
its argument. In both cases there lacks a \noexpand.
Using \directlua is good for snippets only, otherwise it's not very 
convenient, and you have to change catcodes. Everything (I hope) is 
explained in the Wiki:
http://wiki.luatex.org/index.php/Writing_Lua_in_TeX

Best,
Paul



More information about the luatex mailing list