ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Romain Diss <romain.diss@yahoo.fr>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: \unit problem with powers of ten.
Date: Thu, 22 Nov 2012 15:45:52 +0100	[thread overview]
Message-ID: <201211221545.52542.romain.diss@yahoo.fr> (raw)
In-Reply-To: <201211201443.22353.romain.diss@yahoo.fr>

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
<romain.diss@yahoo.fr>
___________________________________________________________________________________
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
___________________________________________________________________________________

  reply	other threads:[~2012-11-22 14:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-19 22:44 Romain Diss
2012-11-20 13:43 ` Romain Diss
2012-11-22 14:45   ` Romain Diss [this message]
2012-11-22 14:51     ` luigi scarso
2012-11-22 18:09 ` Hans Hagen
2012-11-23 13:44   ` Sietse Brouwer
2012-11-23 19:25   ` Romain Diss
2012-11-23 22:51     ` Hans Hagen
2012-11-24  0:48       ` Sietse Brouwer
2012-11-24  7:39         ` Romain Diss
2012-11-24  9:59         ` Hans Hagen
2012-11-24 10:15           ` Romain Diss

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201211221545.52542.romain.diss@yahoo.fr \
    --to=romain.diss@yahoo.fr \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).