# \, does not work outside math mode in plain TeX

I read in several answers here that in LaTeX, \, works just like \thinspace outside math mode. However, that is not the case for plain TeX.

$printf '%s\n' 'a\,b\bye' > example.tex$ pdftex example.tex
This is pdfTeXk, Version 3.141592-1.40.3 (Web2C 7.5.6)
%&-line parsing enabled.
entering extended mode
(./example.tex
! Missing $inserted. <inserted text>$
\mskip
\,->\mskip
\thinmuskip
l.1 a\,
b\bye
? quit
OK, entering \batchmode

• What are the reasons to make such a design decision for the original TeX format?
• What is the difference between those two macros regarding their use? Is $\,$ the same as \thinspace?
• Which one should I use when separating a unit from a number? ($10\,{\rm kB}$, 10\thinspace kB, or 10$\,$kB?)
• By the way I know how these macros are defined, I can find it in my plain.tex. I’m looking for the information that is not obvious from the code. – Palec Mar 4 '15 at 9:13
• Formally, you are using a math spacing command outside math environment and it is not allowed but LaTeX relaxes that assumption and makes it less literal for the user tex.stackexchange.com/questions/74353/…. – percusse Mar 4 '15 at 9:18

In Plain TeX, \, is a math command and therefore can not be used in text mode. But you have already noticed that. So I will answer your three questions one by one:

• LaTeX was created later than (Plain) TeX. Therefore, the question should be, why was this changed for LaTeX? It seems that LaTeX redefined the \, command in order to choose the correct behaviour for both cases. One of many things LaTeX is trying to facilitate.

• No, it isn't. By default, \, inserts a \thinspace (equivalent to .16667em) in text mode and \thinmuskip (equivalent to 3mu, where 18mu=1em) in math mode (Werner, 2012). Thus, should either the \thinspace macro or the value of mu be modified, \, would not generate the same spacing in text and math mode.

• I would set such things (numerical values) always in math mode. Therefore, in plain TeX, $10\,{\rm kB}$ is preferable.

• Yes, it is the correct way to set something in roman. – yo' Mar 4 '15 at 9:20
• Probably I'd define a proper macro to show 'this is a unit' for plain TeX: something like \def\unit#1{{\rm#1}}\def\qty#1#2{#1\,\unit{#2}}. (This assumes that \unit\/qty are only in math mode, of course.) – Joseph Wright Mar 4 '15 at 9:26
• Probably I would switch to pdfLaTeX and use all the stuff, Joseph already defined for me... :-) – LaRiFaRi Mar 4 '15 at 9:33
• Actually, LaTeX contains lots of complicated stuff, @LaRiFaRi. It has a different philosophy from the original TeX. As it is impossible for a macro to detect every possible error and set up something similar to what is known as exceptions in programming, you sometimes get dumps of macros internals and you have to dig through code you did not write to find out, what you have done wrong. I prefer to keep the amount of such code as low as possible. – Palec Mar 4 '15 at 10:11