[NTG-context] Learning LuaTeX : Invoice

Wolfgang Schuster schuster.wolfgang at googlemail.com
Sun Feb 20 14:29:42 CET 2011


Am 20.02.2011 um 13:58 schrieb Henning Hraban Ramm:

> \starttabulate[|lw(8cm)|rg(,)w(2cm)|rg(,)w(2cm)|rg(,)w(3cm)|]
> %\ctxlua{userdata.InvoiceLine("Play with \\LUATEX", 2.5)}
> \ctxlua{userdata.InvoiceLine("Do some \\CONTEXT", 0.5)}
> \ctxlua{userdata.InvoiceSumLine("Sum")}
> \stoptabulate

\startluacode
context.starttabulate({"|lw(8cm)|rg(,)w(2cm)|rg(,)w(2cm)|rg(,)w(3cm)|"})
userdata.InvoiceLine("Do some \\CONTEXT", 0.5)
userdata.InvoiceSumLine("Sum")
context.stoptabulate()
\stopluacode

> That seems to work so far, but invoice.hours and invoice.sum are always doubled!
> In my letter setup, it’s even quadrupled!
> I guess my functions gets called several times, but how can I avoid that?

The content of tabulate is processed twice to get the information for
“p” columns and you get therefore the wrong values in the last row.

Wolfgang



More information about the ntg-context mailing list