15

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?

Yossi Farjoun
  • 13,274
  • 10
  • 74
  • 96

4 Answers4

23

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$.

Hendrik Vogt
  • 37,935
7

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).

Lev Bishop
  • 45,462
5

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
Philipp
  • 17,641
3

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}