At least me have seen your post and tried some solutions, but nothing
useful....
On Thu, Nov 22, 2012 at 3:45 PM, Romain Diss
Hi all,
Le mardi 20 novembre 2012, Romain Diss a écrit :
Le lundi 19 novembre 2012, Romain Diss a écrit :
I got some problems to express powers of ten in the \unit command. See the strange behaviour with these two minimal examples.
\starttext \unit{10^2 meter}\\ \unit{10^{-12} second} \stoptext Is this a bug or are these expressions not supported?
I'm not an expert neither in TeX nor Lua, but I quickly glance at the source code (phys-dim.*) and here is what I understand: — the brackets { } are not recognized (a comment in the lua code mentioned it), so \unit{10^{-12} second} should be \unit{10^-12 second}; — the hat sign '^' is recognized as 'e' so it means "… times ten to the power…" instead of "to the power…" as one should expect.
So I come back to my problem. I want to write 10⁻¹² s (ten to the negative twelfth power second). Actually, I'm typing \math{10^{-12} \unit{second}} but I'd prefer to type \unit{10^-12 second} (for coherence). Is it possible to modify phys-dim.lua in that way or is this to much work (I have no idea if this is a matter of changing one line or a hundred lines in phys-dim.lua. Maybe also this is a too specific request, I don't know…
Nobody seems very enthusiastic concerning this thread so I tried to go further in the comprehension of the phys-dim.lua code. I now have found an approximate solution to my problem : \unit{$10^{-12}$ second} give the right result. It is not very satisfactory because I'm now used to use \m{} instead of $ $. In the phys-dim.lua code, the line 64 shows that \m{} can be used inside \unit{} but this doesn't work for: \unit{\m{10^{-12}} second} because the pattern doesn't handle nested curly braces.
Is there any Lua expert to find a pattern to handle exponents?
Thank you.
-- Romain Diss
___________________________________________________________________________________ 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
___________________________________________________________________________________
-- luigi