5

Knuths definition of \, is \mskip\thinmuskip.

LaTeX changes this definition to

\DeclareRobustCommand{\,}{%
   \relax\ifmmode\mskip\thinmuskip\else\thinspace\fi
}
\def\thinspace{\kern .16667em }

amsmath.sty says it's

\DeclareRobustCommand{\tmspace}[3]{%
  \ifmmode\mskip#1#2\else\kern#1#3\fi\relax}
\renewcommand{\,}{\tmspace+\thinmuskip{.1667em}}

I might understand LaTeX's point to make a command usable also in text mode. But what's the point of the redefinition by amsmath?

6

You should look at the full picture:

 152   │ \ifx\leavevmode@ifvmode\@undefined
 153   │ \DeclareRobustCommand{\tmspace}[3]{%
 154   │   \ifmmode\mskip#1#2\else\kern#1#3\fi\relax}
 155   │ \else
 156   │ \DeclareRobustCommand{\tmspace}[3]{%
 157   │   \ifmmode\mskip#1#2\else\leavevmode@ifvmode\kern#1#3\fi\relax}
 158   │ \fi
 159   │ \renewcommand{\,}{\tmspace+\thinmuskip{.1667em}}
 160   │ \let\thinspace\,
 161   │ \renewcommand{\!}{\tmspace-\thinmuskip{.1667em}}
 162   │ \let\negthinspace\!
 163   │ \renewcommand{\:}{\tmspace+\medmuskip{.2222em}}
 164   │ \let\medspace\:
 165   │ \newcommand{\negmedspace}{\tmspace-\medmuskip{.2222em}}
 166   │ \renewcommand{\;}{\tmspace+\thickmuskip{.2777em}}
 167   │ \let\thickspace\;
 168   │ \newcommand{\negthickspace}{\tmspace-\thickmuskip{.2777em}}

The two definitions of \tmspace are due to recent decisions to make such commands start paragraph mode anyway. With a recent LaTeX kernel the second one will be used.

Contrast this with the code in the LaTeX kernel:

1619   │ \DeclareRobustCommand{\,}{%
1620   │    \relax\ifmmode\mskip\thinmuskip\else\thinspace\fi
1621   │ }

1630   │ \def\thinspace{\leavevmode@ifvmode\kern .16667em }
1631   │ \def\negthinspace{\leavevmode@ifvmode\kern-.16667em }

4543   │ \def\>{\mskip\medmuskip}
4544   │ \def\;{\mskip\thickmuskip}
4545   │ \def\!{\mskip-\thinmuskip}

4547   │ \let\:=\>

The approach of amsmath is much more rational and cleaner. They also provide text mode equivalent of all macros, whereas \! cannot be used in text mode if amsmath is not loaded, and similarly for the others. The final result will be essentially the same. However, a \, command will be translated into \tmspace+\thinmuskip{.1667em} when written in an auxiliary file, instead of \,. Not really a big deal.

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.