12

The command \, can be used in both text and math mode, where it has the same behavior. Well, this is not strictly true, of which I can give a wonderful proof, but comments are too short to contain it. --- @egreg

The above remark was given by @egreg in an answer that I posted. Since it is too long for a comment, could someone elaborate on this?

12

Let's look at the definition of \, in the kernel:

% latex.ltx, line 1304:
\DeclareRobustCommand{\,}{%
   \relax\ifmmode\mskip\thinmuskip\else\thinspace\fi
}

Now we look at \thinspace:

% latex.ltx, line 1315:
\def\thinspace{\kern .16667em }

So in text mode a kern is used; a kern is almost like glue, but is never used as a line break point unless it's followed by glue (TeXbook, page 75, end of first dangerous bend), besides not being able to stretch or shrink. So A\,B will never be broken across lines, but A\, B can be.

Note that .16667em is 1/6 of an em (in the current font). Usually \thinmuskip is set to 3mu, so it is 1/6 of an em in the symbol font, which may be the same as the em in the current text font, but not necessarily. Of course, if the value of \thinmuskip is changed, the command will give really different results in text and in math mode.

The construction \mskip\thinmuskip is primitive. A \thinmuskip is used between an operator and an ordinary symbol and in some other cases.

  • perhaps it is worthwile to point out that the math mode definition also does not allow a break point, a math skip does not behave like a text skip in that regard. Thus the math mode action of \, parallels the text mode also in that regard (and as spaces are ignored in math mode, one would need $a\allowbreak\,b$ rather.) – user4686 Mar 4 '14 at 17:39
  • @jfbu Line breaks in math mode are allowed only at penalties (explicit or implicit). – egreg Mar 4 '14 at 17:41
  • as you said "A\,B will never be broken across lines" I felt that "and (for other reasons) $A\,B$ will also never be broken across lines" could complement it, the whole question being about comparing the text and math mode actions. – user4686 Mar 4 '14 at 17:46
  • @jfbu The fact is that it's obvious that \, isn't a break point in math mode. Basically, only relation and operation symbols are. – egreg Mar 4 '14 at 17:48
  • 3
    It may be obvious for you, I don't know if it was for the OP. – user4686 Mar 4 '14 at 17:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.