[Dev-luatex] Very simple sample?

Javier Bezos lists at texytipografia.com
Sat May 12 17:06:12 CEST 2007


David:

> Actually, it is more efficient to use \unexpanded instead of
> \detokenize here.  \unexpanded takes the token list and just passes it
> to TeX's printer.  The printed rendition is then fed into Lua.

I'm not sure. The following minimal file works fine:
=========
\def\lua#1{\directlua0\expandafter{\detokenize{#1}}}

\def\sub#1{%
  \lua{
    tex.print("{\\bf #1}");
}}

\sub{Hello} Bye

\bye
=========

If I use \unexpanded it fails:

This is luaTeX, Version 3.141592-snapshot-2007042614 (Web2C 7.5.6)
(lua-tex.tex
! Argument of \\ has an extra }.
<inserted text>
                \par
<to be read again>
                   }
<inserted text>  tex.print("{\\bf Hello}
                                        ");
\lua ...\directlua 0\expandafter {\unexpanded {#1}
                                                  }
l.10 \sub{Hello}
                 Bye


Javier


More information about the dev-luatex mailing list