Format long numbers with a thousand separator?

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.


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.

A small MWE for numprint to answer your question:

\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:

numprint example

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

Tags:

Formatting