15 Oct
2012
15 Oct
'12
12:21 p.m.
On Mon, 15 Oct 2012 13:03:40 +0200
Sietse Brouwer
Alan wrote:
Figured it out (and we don't want to strip a leading minus sign):
local function strip(s) return "\\times10^{"..(s:gsub("%+*0*([1-9])","%1")).."}" end
Better to anchor the pattern to the start of the string with `^` (and then the nonzerodigitmatching is no longer needed): gsub("^%+*0*", "") Otherwise, you'll get 805 --> 85.
Thank you for the suggestion. Tried it, but this doesn't work, so I must be missing something... Of course, with MetaPost 2.0 we will certainly come across such a case with numbers like 1e805. :) Alan