On 11/9/19 10:38 PM, Fabrice Couvreur wrote:
Hi, In the table below, how to have numbers with only three decimals ? Thank you. Fabrice
\starttext \startluacode local letters_1 = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J" } local letters_2 = { "1", "Année", "1998", "1999", "2000", "2001", "2002", "2003", "2004", "2005","2006" } context.startxtable({"align={middle,lohi}, width=1.2cm,offset=0.8ex,bodyfont=9pt"})
context.startxrow({"background=color,backgroundcolor=green"}) context.startxcell({"background=color,backgroundcolor=white,frame=off"}) context("") context.stopxcell() for _, letter in ipairs(letters_1) do context.startxcell() context(letter) context.stopxcell() end context.stopxrow()
context.startxrow() for _, letter in ipairs(letters_2) do context.startxcell() context(letter) context.stopxcell() end context.stopxrow()
context.startxrow() context.startxcell() context("2") context.stopxcell() context.startxcell({"width=2cm"}) context("Prix (kg)") context.stopxcell() for i=0,8 do context.startxcell() context("%0.5g",1.031^i) context.stopxcell()
Have you tried context.startxcell() context("%0.3g",1.031^i) context.stopxcell() ? Cheers, Henri
end context.stopxrow()
context.stopxtable() \stopluacode \stoptext
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________