# avoid space after thousands separator in math mode

In math mode, LaTeX inserts a small space after a comma. This looks nice in $a,b,c$, for example. But I don't like the way it looks when using a comma as a thousands separator, e.g., $x = 100,000$. (There is no space after the comma when writing 100,000 outside of math mode.) Is there an easy way to avoid this? Some symbol I should be using instead of comma?

• siunitx lets you configure all of this $x = \num{e5}$ or $x = \num{100000}$, and you can easily configure all the output. – Manuel Apr 8 '16 at 1:01
• $100{,}000$ will accomplish it. – Steven B. Segletes Apr 8 '16 at 1:29
• Yes, that does it, @StevenB.Segletes. Submit it up as an answer and I'll accept it. – LarrySnyder610 Apr 8 '16 at 1:33

There are different classes of mathematical symbols in LaTeX, as discussed in this question: What is the difference between \mathbin vs. \mathrel?

Depending on the class of a math symbol, surrounding space will be modified in predictable, relevant ways. The comma is of the type \mathpunct (mathematic punctuation) which, when surrounded by math atoms, inserts a small amount of space after itself, in what would be a typical use of punctuation grammar.

The way to override the natural behavior of a symbol class is to isolate it from surrounding math, typically done by embracing the symbol in its own group, as in {,}. In this way, the comma is made unaware of the existence of surrounding math and therefore does not insert the customary space associated with its use.

Thus, to the specific question of the OP, the use of $x =100{,}000$ will insert the comma without the customary space associated with mathematical punctuation.

Just for completeness, one should note that one can do the opposite, as well; that is, inserting customary space even in the absence of surrounding math. One does that by inserting empty math groups adjacent to the symbol. In the case of a comma, ,{} is sufficient to trigger the insertion of the space, even if there are no surrounding (non-empty) math atoms.

You can use the icomma package. But you must then ensure that you input a space after a comma if you want a space:

\documentclass[]{article}
\usepackage{icomma}
\begin{document}

$(a, b, c) = f(x, y)$

$(a,b,c) = f(x,y)$ %wrong

$100,000$

\end{document}