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

luigi scarso luigi.scarso at gmail.com
Mon Apr 4 10:10:00 CEST 2011

On Mon, Apr 4, 2011 at 9:37 AM, Paul Isambert <zappathustra at free.fr> wrote:
> 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


\directlua{ tex.print([=[\TeX]=]) }
\directlua{ tex.print(string.char(92,84,101,88)) }
\directlua{ tex.print(string.char(92).."TeX") }

produce correctly the same \TeX logo with luatex fmt from minimals.

But I must admit that as context user I seldom give attention to this
low level questions.
I was surprised by the mail of Dirk, because I have not  accented
characters, but an error

! Argument of \\ has an extra }.

\directlua{ tex.print("\TeX") }
gives  the meaning of
the \TeX macro, i.e
Tkern -.1667emlower .5exhbox Ekern -.125emX


More information about the luatex mailing list