[luatex] lua script on the run
Arno Trautmann
Arno.Trautmann at gmx.de
Thu Jan 6 11:41:44 CET 2011
Philipp Stephani wrote:
>
> […]
>> \texperanto{Alportu ^caron de sopiro!}
>>
>> And LuaTeX actually typesets "Alportu ĉaron de sopiro!"
>
> If you only need simple textual replacements, you can get quite far with Lua's built-in functions:
>
> \documentclass{minimal}
> \usepackage{fontspec}
> \usepackage{luacode}
> \begin{luacode*}
> function texperanto(text)
> tex.sprint((text:gsub("%^c", "ĉ")))
> end
> \end{luacode*}
> \newcommand*{\texperanto}[1]{\luadirect{texperanto([[#1]])}}
> \setmainfont{DejaVu Sans}
> \begin{document}
> \texperanto{Alportu ^caron de sopiro!}
> \end{document}
These solutions (Patrick's, Paul's and yours) are nice, but how would
one apply it to a whole document? I have a very similar need and it
would be nice not to put the whole document inside the \texperanto
macro. Would it be a good ideo to use this with \everypar to get the
paragraph gsub'd?
cheers
Arno
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://tug.org/pipermail/luatex/attachments/20110106/c2fe8d89/attachment.bin>
More information about the luatex
mailing list