When typesetting mathematics, LaTeX puts in spacing according to the normal rules for mathematics texts. If you enter y=m x then LaTeX ignores the space and in the output the m is next to the x, as y=mx.
But LaTeX’s rules occasionally need tweaking. For example, in an integral the tradition is to put a small extra space between the f(x) and the dx, here done with the \, command:
\int_0^1 f(x)\,dx
LaTeX provides the commands that follow for use in math mode. Many of these spacing definitions are expressed in terms of the math unit mu. It is defined as 1/18em, where the em is taken from the current math symbols family (see Units of length). Thus, a \thickspace is something like 5/18 times the width of a ‘M’.
\;Synonym: \thickspace. Normally 5.0mu plus 5.0mu. With amsmath, or as of the 2020-10-01 LaTeX release, can be used in text mode as well as math mode; before that, in math mode only.
\negthickspaceNormally -5.0mu plus 2.0mu minus 4.0mu. With amsmath, or as of the 2020-10-01 LaTeX release, can be used in text mode as well as math mode; before that, in math mode only.
\:\>Synonym: \medspace. Normally 4.0mu plus 2.0mu minus 4.0mu. With amsmath, or as of the 2020-10-01 LaTeX release, can be used in text mode as well as math mode; before that, in math mode only.
\negmedspaceNormally -4.0mu plus 2.0mu minus 4.0mu. With amsmath, or as of the 2020-10-01 LaTeX release, can be used in text mode as well as math mode; before that, in math mode only.
\,Synonym: \thinspace. Normally 3mu, which is 1/6em. Can be used in both math mode and text mode (see \thinspace & \negthinspace).
This space is widely used, for instance between the function and the infinitesimal in an integral \int f(x)\,dx and, if an author does this, before punctuation in a displayed equation.
The antiderivative is
\begin{equation}
3x^{-1/2}+3^{1/2}\,.
\end{equation}
\!A negative thin space. Normally -3mu. With amsmath, or as of the 2020-10-01 LaTeX release, can be used in text mode as well as math mode; before that, The \! command is math mode only but the \negthinspace command has always worked in text mode (see \thinspace & \negthinspace).
\quadThis is 18mu, that is, 1em. This is often used for space surrounding equations or expressions, for instance for the space between two equations inside a displaymath environment. It is available in both text and math mode.
\qquadA length of 2 quads, that is, 36mu = 2em. It is available in both text and math mode.
| • \smash | Eliminate height or depth of a subformula. | |
| • \phantom & \vphantom & \hphantom | Make empty box same size as argument. |
© 2007–2018 Karl Berry
Public Domain Software
http://latexref.xyz/Spacing-in-math-mode.html