On Mon, 15 Oct 2012 12:08:30 +0200 Sietse Brouwer <sbbrou...@gmail.com> wrote:
> > There is a bug with format() as redefined in m-graph.mkiv > > 1e10 and 1e-10 truncate the tailing 0. > > The function strip() is removing 0 throughout the exponent, and I > don't know what purpose that might serve. If we never want to remove > zeroes, this works: > > local function strip(s) > - return "\\times10^{"..(s:gsub("%+*0*","")).."}" > + return "\\times10^{"..(s:gsub("%+*","")).."}" > end > > Note that if the exponent is zero the "× 10^0" will be left out > completely, in both the old and the new strip() function. This seems > to be by design. Illustration of this behaviour: > > \usemodule[graph] > \starttext > \startMPpage > label(format("@g","1e+0"),(2cm,-1cm)) ; > \stopMPpage > \stoptext Thanks, this "fixes" it for now, but I believe that the strip is intended to remove leading zeros, as in label(format("@g","1e+08"),(2cm,-1cm)) ; I suppose that the correct syntax must be something like the regex s/[+-]*0*\([1-9]\)/\1/ (not sure how to state this in lua gsub()...) Alan ___________________________________________________________________________________ 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 ___________________________________________________________________________________