# Avoiding placing ,\, everywhere in mathmode

Whenever I write ", " (with a space after the comma) in mathmode, I really want a space there. usually, this is either something like

the points, $a, b$, and $c$....

or in an explicit vector:

Let the vector $x=(x_1, x_2, x_3)$ be...

Since TeX removes this space, my text is often riddled with explicit short spaces: $x_1,\,x_2,\,x_3)$.

Is there a way to tell TeX that this is not desirable or to hack TeX into submission?

-
I've asked a related question here: tex.stackexchange.com/q/8047/215 –  Seamus Dec 31 '10 at 18:58

This is kind of a non-answer, but here's what I'd do. For vectors, I'd always just use

Let the vector $x=(x_1,x_2,x_3)$ be ...


In math mode, TeX inserts a thin space after the , (\thinmuskip, as Lev points out in his answer), and I find that exactly right. In your other example, I'd write

the points $a$, $b$, and~$c$ ...


(with or without the , after $b$), and this is also what Knuth recommends in the TeXbook. (Note the tie after and!) This yields correct spacing; moreover, it allows a linebreak after $a$.

-
Right. There is some space after a comma in math mode, even if it's not how much you wanted. –  Ben Alpert Dec 31 '10 at 18:25
Indeed, the point here is that the comma has textual rather than mathematical meaning, and so should not be in math mode. –  Joseph Wright Dec 31 '10 at 18:45
@Joseph: Is your comment addressed to me or to Ben? (I'm no sure what you mean by here.) –  Hendrik Vogt Dec 31 '10 at 20:46
@Hendrik. To Ben: sorry if that was not clear. –  Joseph Wright Dec 31 '10 at 20:51
@morbusg: I don't like it since it adds space before the comma in $a$, $b$. –  Hendrik Vogt Jan 1 '11 at 9:26

In LuaTeX you can control the spacing between objects for each pair of classes individually:

Let the vector $x=(x_1, x_2, x_3)$ be\par
\Umathpunctordspacing\textstyle=20mu
Let the vector $x=(x_1, x_2, x_3)$ be
\bye

-

You can change the size of the skip after commas, semicolons and \colons (\mathpunct) by changing \thinmuskip, eg. \thinmuskip=5mu, but thin spaces are used in many other places so this is not a great solution.

You could make the comma an active character in mathmode (see, eg, this answer), but this could maybe cause compatibility problems with some packages.

Personally I would do as Hendrik said, enter your first example as

the points $a$, $b$, and~$c$ ...


and not mess with TeX's spacing for the second example (your version with the explicit thin spaces looks too big to me, although I accept that my judgement on these things has been calibrated by working with TeX so much).

-

It is not correct mathematical typesetting, but you can increase the spaces after commas with this code:

\documentclass{article}
\makeatletter
\def\Vec#1{\expandafter\Vec@i#1,,\@nil}
\def\Vec@i#1,#2,#3\@nil{%
$#1\ifx\relax#2\relax$\else,\mkern\thickmuskip\$%
\Vec@i#2,#3\@nil\fi}
\makeatother

\begin{document}

Let the vector \Vec{x=(x_1,x_2,x_3)} be...

and can simply be reverted
\let\Vec\ensuremath

Let the vector \Vec{x=(x_1,x_2,x_3)} be...

\end{document}

-
I tried to make your answer clearer. Please revert my edit if it isn't OK. –  Hendrik Vogt Jan 1 '11 at 9:01
@Hendrik: thanks and happy new year :-) –  Herbert Jan 1 '11 at 9:22