[luatex] Problem with luacode in sty file

Matthieu Berret m.berret at gmail.com
Thu Jul 3 13:42:59 CEST 2014

Hello, I'm trying to include a gcd function using lua in a sty file.
Here is the code of euclide.sty :

             function euclide(a,b)
                 if a < b then a,b = b,a end
                 r = a-math.floor(a/b)*b
                 if r == 0 then tex.print(b)    else euclide(b,r) end

Here is the texfile code :



The lualatex compilation give me errors :

    Runaway argument?
    ! File ended while scanning use of \luacode at grab@lines.
    <inserted text>

    I suspect you have forgotten a `}', causing me
    to read past where you wanted me to stop.
    I'll try to recover; but if the error is serious,
    you'd better type `E' or `X' now and fix your file.

    ! LaTeX Error: Missing \begin{document}.

Can somebody tell me what's wrong in my code ?
Thanks, MB.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/luatex/attachments/20140703/1d33fb4c/attachment.html>

More information about the luatex mailing list