amsmath.sty
defines \mspace
as follows:
\newcommand{\mspace}[1]{\mskip#1\relax}
What is the purpose of this definition?
amsmath.pdf
says that \mspace
is the "equivalent of \hspace
for math mode use".
I know that LaTeX has a philosophy of using braces around every argument. Is that the point? Or is it the idea that \mskip
is a TeX-command and thus shouldn't be used in LaTeX? I assume that the purpose of the \relax
is to safeguard against a following plus
or minus
(for stretchable/shrinkable lengths). Is this explicit safety the purpose of the command?
Related:
Best Answer
The LaTeX approach is that all commands should share, as far as possible, a similar input syntax. In the case of the
\hskip
and similar primitives, the syntax is not 'LaTeX-like': they pick up a following number without braces in a way that is not predictable from the 'usual LaTeX rules'. At the same time, and as you observe, the primitive syntax allows an optional trailing stretch component (there is also an optional trailing space and shrink component). The inclusion of a\relax
prevents this being accidentally parsed by TeX from 'some other content'.The addition of
\mspace
by the AMS is entirely consistent with LaTeX syntax and addresses exactly the same point as\hspace
does in relation to\hskip
. Probably at the time LaTeX2e was released the use of an extra macro for this slightly more unusual use case couldn't be justified by the kernel team (there were very few 'spare' macros). Today, we'd probably imagine that such a command would be added 'out of the box'.