I want numbers like 5.5 million to be displayed using a comma as a thousands separator as "5,500,000". Is there a way to do this automatically, without having to manually put commas?
|
I think the
Should give you 1,234,567,890 Also you can use this as a package option like so: Be warned, this doesn't seem to work with older versions of |
|||||||||||||||
|
|
Seamus' answer involving
The first time I wrote this, I used a token register rather than Edit: |
|||||||||||
|
|
Using the http://www.ctan.org/pkg/numprint package with Btw: Grouping numbers into pairs of two can be done with the http://www.ctan.org/pkg/telprint package. |
||||
|
|
|
The siunitx documentation, v2.3d, 2011/08/18, section 2 Installation, says:
Whenever siunitx/LaTeX3/e-TeX are not available (because one is stuck with something other than a modern TeX system), TH.'s \ppnumber is a great help, if
is replaced by something like (there is no
. TH. said that he deliberately choose
, but for an alternative to siunitx (in regard of pretty printing numbers) I would suggest going for the most compatible code (even if longer). Additionally, I would suggest replacing
with
because replacing
with
because one never knows whether the command will be used in a way, so that it can break.
Further I needed to place a
As a last thought:
would make it clear that there is flexibility in choosing the separator. (There are languages where the comma is used instead of the period as decimal separator, for example.) In summary, I got
About http://www.texdev.net/2009/11/17/tex-counts-and-latex-counters/. |
|||||||
|
|
5,500,000 and 5.50 × 106 are equal. |
||||
|
|
