GeneralThousands separator

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
mateovasco
Posts: 10
Joined: Wed Mar 19, 2008 11:04 pm

Thousands separator

Post by mateovasco »

Hi!

I want to use thousands separator in the numbers. For example, write 10123456.789012, and show 10,123,456.789012

I tried to use numprint package, but it show thousand separator after decimal point. eg. 10,123,456.789,012

Do you know any package???

Thanks!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

Thousands separator

Post by Juanjo »

You can do it with numprint. Load this package. With the settings

Code: Select all

\npthousandsep{,}\npthousandthpartsep{}\npdecimalsign{.}
the command \numprint{1234567890.123456789}, for example, yields 1,234,567,890.123456789 as desired.

I've seen in other thread that you load the spanish language with babel. In this case, the above way of writing decimal numbers is not in accordance with Spanish typography. See the document ortomatem.pdf, by Javier Bezos, about ortotypography in mathematics. I quote two paragraphs from page 17 of this document:
h) El separador decimal es la coma: 3,142.
i) Antes y después de la coma, se pueden separar los dígitos en grupos de tres
con espacios finos: 2,718 281 8. Si se emplean estos espacios finos, se admite su
supresión si la parte entera o la decimal sólo tienen cuatro cifras: 1200, 3,1415.
So, when writing in spanish, I would suggest the following settings for numprint:

Code: Select all

\npthousandsep{\,}\npdecimalsign{,}
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.
mateovasco
Posts: 10
Joined: Wed Mar 19, 2008 11:04 pm

Re: Thousands separator

Post by mateovasco »

Thank you so much... it worked perfectly
Post Reply