ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Ian Lawrence <physics.rooted@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Reflections the interplay between units and digits
Date: Fri, 26 Aug 2011 12:37:41 +0100	[thread overview]
Message-ID: <241A0196-80CB-48CE-9D37-E74B36B2C56A@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 184 bytes --]

Morning all…

I think that there are several issues in the interplay of the \units and \digits command that could be a bit better (Sorry Hans…all meant in the best possible way).


[-- Attachment #2: digits_trial.pdf --]
[-- Type: application/pdf, Size: 23756 bytes --]

[-- Attachment #3: Type: text/plain, Size: 2794 bytes --]


So here is a complete example and the pdf I get, after some experimentation. With kludges of my own. I'd guess there are several people using ConTEXt for the sciences, so this may help some, or some may set me on a better path…

___

\starttext
\setdigitmode 6

{\em digit exponent powers - don't work}

\digits{20e-12}

\digits{-123.222,00e-12} % this one gives nothing at all

But it seems it should \emdash\ ConTEXt magazine3 May 2003, from which the following non-working examples come

\digits 123.222,00^10 % this one gives nothing at all

\digits 123.222,00e10 % this one gives nothing at all

\digits /123.222,00e-12 % this one gives nothing at all

\digits -123.222,00e-12 % this one gives nothing at all

\digits +123.222,00e-12 % this one gives nothing at all

{\em spacing and decimal points}


\digits 12,345,000.90


Has the same effect as this hard-coded beasty.


12~345~000.78

Digits without exponents seem to work....

\digits 1230.92


\digits{12,460,800.89}


{\em Now a little challenge - write out the speed of light, with units. So to combine units with digits}


\unit{299792458 meter inverse second} % en-route, but I'd like every three digits separated by a non-breaking space

So try the digits command - two possibilities

%\digit {\unit{299792458 meter inverse second}} % digits nests units - well the interpreter rejected this one


%\unit{\digit{299792458} meter inverse second} % units nests digits - and this one.

Conclusion digits and units don't play nicely together...unless someone has a nice solution


Maybe a bit hard coding - fugly, but maybe...


\unit{299~792~458 meter inverse second} % fails to interpret units, so no good

299~792~\unit{458 meter inverse second} % looks OK, but inelegant

Now for trying to write in standard form..first the inelegant form, but giving a passable result

Speed = 3 \times\ \unit{10^8 meter inverse second}

But I'd guess this will not be inside a tex box, so the layout might be dodgy... numbers and units should not be split over two lines...

A much more elegant solution would be:

Speed = \unit{3e8 meter inverse second} % the documentation seems to support this, but not the practice...

This one would be cleanly coded, if only the exponentiation worked... 


{\em spread of a physical quantity}
One more, whilst I'm here. People will want to indicate a spread in a physical quantity, so:

\unit{400\endash 700 THz}   % inserts an unwanted space after the 400: ( 400 –700 THz). (cf 11\endash 14 , which 'behaves' as expected

You can again kludge, by

400\endash \unit{700 THz}

But elegant coding it ain't \ldots and again probably no bounding tex box, so may get split over two lines.

\stoptext

___

KR
Ian

[-- Attachment #4: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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:[~2011-08-26 11:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=241A0196-80CB-48CE-9D37-E74B36B2C56A@gmail.com \
    --to=physics.rooted@gmail.com \
    --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).