On Fri, Jul 23, 2010 at 10:38 PM, luigi scarso <luigi.sca...@gmail.com> wrote: > On Fri, Jul 23, 2010 at 10:25 PM, Vnpenguin <vnpeng...@vnoss.org> wrote: >> Hi, >> Here is my test: >> =================================================== >> \setuppapersize[A4][A4] >> \usetypescript[postscript] >> \setupbodyfont[palatino,12pt] >> >> \starttext >> \startformula >> K = \frac{\sigma_1}{\sigma_2} = \frac{355}{14}= \ctxlua{tex.print(355/14)} >> \stopformula >> \stoptext >> =================================================== >> >> It works well and give me result = 25,357142857143. In order to obtain >> 2 decimal number I tried: >> >> \startformula >> K = \frac{\sigma_1}{\sigma_2} = \frac{355}{14}= >> \ctxlua{tex.printf("%0.2f",355/14)} >> \stopformula >> >> But it does not work. Here is the error: >> >> tex.printf("\doplaceformulanumber \stopdisplaymath \global \let \gdef \ETC. >> ! File ended while scanning text of \zerocount. >> <inserted text> >> } >> <*> ./test-lua.tex >> ? >> >> Another try: >> >> \startformula >> K = \frac{\sigma_1}{\sigma_2} = \frac{355}{14}= >> \ctxlua{tex.print(string.format("%0.2f",355/14))} >> \stopformula >> >> gives me the same error. >> >> So is there really a function printf() in LuaTeX engine ? >> >> Thanks >> ___________________________________________________________________________________ >> 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://tex.aanhet.net >> archive : http://foundry.supelec.fr/projects/contextrev/ >> wiki : http://contextgarden.net >> ___________________________________________________________________________________ >> > hm, what about > tex.sprint(tex.ctxcatcodes,string.format("\%.2f",355/14) sorry tex.sprint(tex.ctxcatcodes,string.format("\%.2f",355/14))
-- luigi ___________________________________________________________________________________ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________