On Sun, Feb 14 2010, Andreas Harder wrote:
1) Is it possible to have a comma as decimal separator?
2) If you look at the above definition, it works fine with +, –, /, but not with *. Is it possible to expand my macro that it will also work with a multiplication or even with the last two examples?
Hello Andreas, Just a quick hack: \usemodule[calcmath] \startluacode sqrt = math.sqrt pi = math.pi function my_equation(s, r) r = tostring(r) tex.print(s:gsub("*", "×") .. "=" .. r:gsub("%.", ",")) end \stopluacode \def\calculate#1{\calcmath{\ctxlua{my_equation("#1", #1)}}} \starttext \startlines \calculate{1+2} \calculate{3/2-1} \calculate{3*2} \calculate{sqrt(2)} \calculate{2*pi} \stoplines \stoptext Cheers, Peter -- Contact information: http://pmrb.free.fr/contact/