ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Possible bug in \unit
@ 2011-12-07 21:27 Marco
  2011-12-07 22:59 ` Mojca Miklavec
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Marco @ 2011-12-07 21:27 UTC (permalink / raw)
  To: ntg-context

There seems to be a bug in the new unit system for \unit{kbit}:

% bit
\unit{kilo bit}  % kbit
\unit{kilobit}   % kbit
\unit{kbit}      % kB, shouldn't this be kbit?

Another thing:

\unit{3.4e-5} yields to 3.4⁻⁵ that's expected according to
the manual. But  how to get 3.4·10⁻⁵ (either  with \cot or
\times)?

Marco Patzer


___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Possible bug in \unit
  2011-12-07 21:27 Possible bug in \unit Marco
@ 2011-12-07 22:59 ` Mojca Miklavec
  2011-12-07 23:12   ` Marco
  2011-12-08 20:26 ` Ian Lawrence
  2011-12-09 19:22 ` Hans Hagen
  2 siblings, 1 reply; 11+ messages in thread
From: Mojca Miklavec @ 2011-12-07 22:59 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Wed, Dec 7, 2011 at 22:27, Marco <netuse@lavabit.com> wrote:
> There seems to be a bug in the new unit system for \unit{kbit}:
>
> % bit
> \unit{kilo bit}  % kbit
> \unit{kilobit}   % kbit
> \unit{kbit}      % kB, shouldn't this be kbit?

kB is kilobyte, not kilobit, but "kb" is probably also valid?

> Another thing:
>
> \unit{3.4e-5} yields to 3.4⁻⁵ that's expected according to
> the manual.

But the behaviour is wrong. (I just want to say that \cdot 10^{-5}
should not be just an option, but the default behaviour.)

Mojca
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Possible bug in \unit
  2011-12-07 22:59 ` Mojca Miklavec
@ 2011-12-07 23:12   ` Marco
  2011-12-07 23:20     ` Mojca Miklavec
  0 siblings, 1 reply; 11+ messages in thread
From: Marco @ 2011-12-07 23:12 UTC (permalink / raw)
  To: ntg-context

On 2011-12-07 Mojca Miklavec <mojca.miklavec.lists@gmail.com> wrote:

> On Wed, Dec 7, 2011 at 22:27, Marco <netuse@lavabit.com> wrote:
> > There seems to be a bug in the new unit system for \unit{kbit}:
> >
> > % bit
> > \unit{kilo bit}  % kbit
> > \unit{kilobit}   % kbit
> > \unit{kbit}      % kB, shouldn't this be kbit?
> 
> kB is kilobyte, not kilobit,

Exactly, \unit{kbit} should output kbit, instead of kB.

> but "kb" is probably also valid?

I don't know,  if kb is a valid shortcut  for kilo bit. kB
outputs kB (kilo  byte). I would vote for  that kb outputs
kbit  (kilo  bit).  But  that  \unit{kbit}  yields  kB  is
definitely wrong.

> > \unit{3.4e-5}   yields   to  3.4⁻⁵   that's   expected
> > according to the manual.
>
> But the behaviour is wrong.

I don't know if it's wrong. It's very non-intuitive, but I
think Hans had a reason not to include the \cdot 10.

> (I just  want to  say that \cdot  10^{-5} should  not be
> just an option, but the default behaviour.)

+1

Regards

Marco Patzer


___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Possible bug in \unit
  2011-12-07 23:12   ` Marco
@ 2011-12-07 23:20     ` Mojca Miklavec
  2011-12-08  5:51       ` Mikael P. Sundqvist
  0 siblings, 1 reply; 11+ messages in thread
From: Mojca Miklavec @ 2011-12-07 23:20 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Thu, Dec 8, 2011 at 00:12, Marco wrote:
> On 2011-12-07 Mojca Miklavec wrote:
>
>> > \unit{3.4e-5}   yields   to  3.4⁻⁵   that's   expected
>> > according to the manual.
>>
>> But the behaviour is wrong.
>
> I don't know if it's wrong.

But 5e3 would render 5^3 which is hopefully still 125.

> It's very non-intuitive, but I
> think Hans had a reason not to include the \cdot 10.

\cdot 10^{x} is pretty long and might be ugly. But writing out
exponent without the base is everything but the right approach. Even
writing out 5e3 is better than that.

Mojca
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Possible bug in \unit
  2011-12-07 23:20     ` Mojca Miklavec
@ 2011-12-08  5:51       ` Mikael P. Sundqvist
  0 siblings, 0 replies; 11+ messages in thread
From: Mikael P. Sundqvist @ 2011-12-08  5:51 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Thu, Dec 8, 2011 at 12:20 AM, Mojca Miklavec
<mojca.miklavec.lists@gmail.com> wrote:
> On Thu, Dec 8, 2011 at 00:12, Marco wrote:
>> On 2011-12-07 Mojca Miklavec wrote:
>>
>>> > \unit{3.4e-5}   yields   to  3.4⁻⁵   that's   expected
>>> > according to the manual.
>>>
>>> But the behaviour is wrong.
>>
>> I don't know if it's wrong.
>
> But 5e3 would render 5^3 which is hopefully still 125.
>
>> It's very non-intuitive, but I
>> think Hans had a reason not to include the \cdot 10.
>
> \cdot 10^{x} is pretty long and might be ugly. But writing out
> exponent without the base is everything but the right approach. Even
> writing out 5e3 is better than that.
>
> Mojca
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________

I've seen many people writing 5e3 to mean 5·10³, but I've never seen
5e3 to mean 5³.

The writing 5e3 = 5·10³ is sometimes called the E-notation [1]. Even
though I would never write it like that myself, I vote that 5e3 will
render as 5·10³ (or with \times instead of \cdot).

Best regards, Mikael

[1] http://en.wikipedia.org/wiki/Scientific_notation#E_notation

PS One could ask, however, if this really belongs to a unit package.
In my world it does not, but I can understand if it is convenient to
have there.
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Possible bug in \unit
  2011-12-07 21:27 Possible bug in \unit Marco
  2011-12-07 22:59 ` Mojca Miklavec
@ 2011-12-08 20:26 ` Ian Lawrence
  2011-12-09 19:22 ` Hans Hagen
  2 siblings, 0 replies; 11+ messages in thread
From: Ian Lawrence @ 2011-12-08 20:26 UTC (permalink / raw)
  To: mailing list for ConTeXt users

 I solved this = getting what I wanted by writing my own macro:

\define[3]\physicalquantitye{\hbox{#1 \times \unit{10^#2 #3}}}
%  \physicalquantitye{number}{exponent}{unit} -- gives short form of unit


That makes sense to me and is working fine.

There are a few more like this on the wiki (units page), in case anyone finds them useful.

On 7 Dec 2011, at 21:27, Marco wrote:
> 
> 
> Another thing:
> 
> \unit{3.4e-5} yields to 3.4⁻⁵ that's expected according to
> the manual. But  how to get 3.4·10⁻⁵ (either  with \cot or
> \times)?
> 



___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Possible bug in \unit
  2011-12-07 21:27 Possible bug in \unit Marco
  2011-12-07 22:59 ` Mojca Miklavec
  2011-12-08 20:26 ` Ian Lawrence
@ 2011-12-09 19:22 ` Hans Hagen
  2011-12-09 19:41   ` Marco
  2 siblings, 1 reply; 11+ messages in thread
From: Hans Hagen @ 2011-12-09 19:22 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Marco

On 7-12-2011 22:27, Marco wrote:
> There seems to be a bug in the new unit system for \unit{kbit}:
>
> % bit
> \unit{kilo bit}  % kbit
> \unit{kilobit}   % kbit
> \unit{kbit}      % kB, shouldn't this be kbit?
>
> Another thing:
>
> \unit{3.4e-5} yields to 3.4⁻⁵ that's expected according to
> the manual. But  how to get 3.4·10⁻⁵ (either  with \cot or
> \times)?

indeed .. here's the fix

\unexpanded\def\digitspower#1%
   {\times10\digits_raised{#1}}

\unexpanded\def\digitspowerplus#1%
   {\times10\digits_raised{\digitsplus#1}}

\unexpanded\def\digitspowerminus#1%
   {\times10\digits_raised{\digitsminus#1}}

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Possible bug in \unit
  2011-12-09 19:22 ` Hans Hagen
@ 2011-12-09 19:41   ` Marco
  2011-12-09 19:54     ` Hans Hagen
  0 siblings, 1 reply; 11+ messages in thread
From: Marco @ 2011-12-09 19:41 UTC (permalink / raw)
  To: ntg-context

On 2011-12-09 Hans Hagen <pragma@wxs.nl> wrote:

> > \unit{3.4e-5} yields to 3.4⁻⁵ that's expected according to
> > the manual. But  how to get 3.4·10⁻⁵ (either  with \cot or
> > \times)?
> 
> indeed .. here's the fix
> 
> \unexpanded\def\digitspower#1%
>    {\times10\digits_raised{#1}}
> 
> \unexpanded\def\digitspowerplus#1%
>    {\times10\digits_raised{\digitsplus#1}}
> 
> \unexpanded\def\digitspowerminus#1%
>    {\times10\digits_raised{\digitsminus#1}}

Thanks for the quick fix. I  assume it will be included in
the next beta.

One  feature request:  Could  it be  make configurable  to
either insert a \times or a \cdot?

Marco Patzer


___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Possible bug in \unit
  2011-12-09 19:41   ` Marco
@ 2011-12-09 19:54     ` Hans Hagen
  2011-12-09 21:01       ` Marco
  0 siblings, 1 reply; 11+ messages in thread
From: Hans Hagen @ 2011-12-09 19:54 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Marco

On 9-12-2011 20:41, Marco wrote:

> One  feature request:  Could  it be  make configurable  to
> either insert a \times or a \cdot?

is already possible


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Possible bug in \unit
  2011-12-09 19:54     ` Hans Hagen
@ 2011-12-09 21:01       ` Marco
  2011-12-09 21:15         ` Hans Hagen
  0 siblings, 1 reply; 11+ messages in thread
From: Marco @ 2011-12-09 21:01 UTC (permalink / raw)
  To: ntg-context

On 2011-12-09 Hans Hagen <pragma@wxs.nl> wrote:

> On 9-12-2011 20:41, Marco wrote:
> 
> > One  feature request:  Could  it be  make configurable  to
> > either insert a \times or a \cdot?
> 
> is already possible

How?


___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Possible bug in \unit
  2011-12-09 21:01       ` Marco
@ 2011-12-09 21:15         ` Hans Hagen
  0 siblings, 0 replies; 11+ messages in thread
From: Hans Hagen @ 2011-12-09 21:15 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Marco

On 9-12-2011 22:01, Marco wrote:
> On 2011-12-09 Hans Hagen<pragma@wxs.nl>  wrote:
>
>> On 9-12-2011 20:41, Marco wrote:
>>
>>> One  feature request:  Could  it be  make configurable  to
>>> either insert a \times or a \cdot?
>>
>> is already possible
>
> How?

http://www.pragma-ade.com/general/manuals/units-mkiv.pdf


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2011-12-09 21:15 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-07 21:27 Possible bug in \unit Marco
2011-12-07 22:59 ` Mojca Miklavec
2011-12-07 23:12   ` Marco
2011-12-07 23:20     ` Mojca Miklavec
2011-12-08  5:51       ` Mikael P. Sundqvist
2011-12-08 20:26 ` Ian Lawrence
2011-12-09 19:22 ` Hans Hagen
2011-12-09 19:41   ` Marco
2011-12-09 19:54     ` Hans Hagen
2011-12-09 21:01       ` Marco
2011-12-09 21:15         ` Hans Hagen

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).