W3cubDocs

/LaTeX

Spacing in math mode

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.

\negthickspace

Normally -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.

\negmedspace

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.

\,

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).

\quad

This 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.

\qquad

A length of 2 quads, that is, 36mu = 2em. It is available in both text and math mode.

© 2007–2018 Karl Berry
Public Domain Software
http://latexref.xyz/Spacing-in-math-mode.html