# Format long numbers with a thousand separator?

In most language, long numbers are split into groups of three digits, to increase readability.

In Dutch (my native language), 1000000 is usually written as 1 000 000. In English, this would be 1,000,000.

Now, I would like to know how to use this kind of formatting in LaTeX. I searched google, but I only found some articles that explain how to split very long numbers over multiple lines, which is not what I need.

Is there a package that does this automatically? Or a certain tag I can use for this?

Normally you would use \, for a thin space $1\,000\,000$ If you are entering that by hand. As noted in the comments siunitx or other packages have the ability to parse the bare number 1000000 and then format it according to formatting parameters with commas or thin spaces, so it depends what you want to do (and where the numbers are generated). Whether it is a few numbers in a hand authored text or if you are typesetting thousands of numbers in table data where hand editing to add grouping separator is not really an option.

• Is there any method to automatically apply siunitx to all the numbers of my document without needing to write \num in front of each one? I would like to have all my numbers shown with groups of 3 digits and a small space in between.
– skan
Oct 27, 2020 at 19:52
• @skan not really (but you could ask a new question see if anyone has any suggestions) Oct 27, 2020 at 20:02

There is a good package for all of these formatting issues with numbers, either in text or in tabular: \usepackage{numprint}. Please study the manual, it provides a lot of detailed information. You get the manual usually with something like texdoc numprinton the command line.

\documentclass[english]{article}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{numprint}
\npthousandsep{\,}

\begin{document}

This would be a line with a price tag: \numprint{1000000} EUR.

And as a tabular:
\begin{tabular}{N{7}{0}}
1000000 {~EUR}\\
\end{tabular}
\end{document}


We get this:

As you can see, just tell numprint how the thousand separator should look like. You can do much more, rounding numbers e.g.

• Note that numprint have an option to specify the unit this way \numprint[EUR]{1000000} or \numprint[nm^2]{5} Jul 13, 2020 at 17:30
• @Opsse I'm astonished, never noticed that option. Thank you! Jul 14, 2020 at 9:00

Use the package "Ziffer" which helps if you want to write 100000 as "100.000,00" it will show "10 000,00" (no space after the comma and a space instead of the dot)

• Please improve your answer with small. complete document, which will show syntax of using mentioned package. Jul 24, 2016 at 18:23
• Your comment would technically apply to the accepted answer as well. Sep 18, 2017 at 18:43