[luatex] lua script on the run

Luis Rivera jlrn77 at gmail.com
Thu Jan 6 23:25:35 CET 2011


On 6 January 2011 16:05, Philipp Stephani <st_philipp at yahoo.de> wrote:
> Am 06.01.2011 um 15:00 schrieb Khaled Hosny:
>
>>> And before you arrive at a node list, TeX will already have complained about ^ outside math mode. Probably a token_filter callback would work better.
>>
>> I was not thinking about this particular case, one can use tex-friendly
>> transliteration scheme but still need to escape non-textual material
>> which makes node list processing appealing. I would have suggested
>> token_filter but tex tokens are beyond my understanding.
>
> Sadly, the documentation for the token library is quite incomplete and sometimes incorrect, but finally I got it to work:
>
> \input luatexbase.sty
> \input luaotfload.sty
> \directlua{%
>  [...]
> }
> \font\rm={name:DejaVu Sans:}\relax
> \rm
> ^c ^g ^h ^j ^s ^u $b^c$
> \bye
>

1. If I were to store the macro in a style sheet (texperanto.sty), I'd
probably remove the call to luaotfload, right? This call is only
necessary to make the sample run right. In that case the sample file
would simply be

\input texperanto.sty
\input luaotfload.sty
\font\rm={name:DejaVu Sans:}\relax
\rm
^c ^g ^h ^j ^s ^u $b^c$
\bye

And this code takes care of the case where the substitution is global;
i.e. when we do not call a macro \texperanto.

2. That still leaves aside the case where the call for the macro
\texperanto makes all changes local to the group.

By these examples I am even getting a grasp at the syntax for
intertwining TeX and Lua code. Thanks a lot.

-- 
Luis Rivera
O< http://www.asciiribbon.org/ campaign



More information about the luatex mailing list