[luatex] lua script on the run

Patrick Gundlach patrick at gundla.ch
Wed Jan 5 22:19:35 CET 2011



> but I was thinking about defining a command like, say,
> \texperanto, which performs a conversion of its argument on the fly,
> so that I may write
> 
> \texperanto{Alportu ^caron de sopiro!}
> 
> And LuaTeX actually typesets "Alportu ĉaron de sopiro!"

------------------------------------------------
\def\texperanto#1{\directlua{
  local str = string.gsub("#1","\%^c","ĉ")
  tex.print(str)
}}

\catcode`\^=11

\texperanto{Alportu ^caron de sopiro!}

\bye
------------------------------------------------

Patrick




More information about the luatex mailing list