Skip to main content

Spaces in Mathematical Formulas

Adjusting the default mathematical mode spacing in (La)TeX is useful in certain cases; let's look at an example:

\documentclass{article}
\usepackage{amssymb}
\begin{document}
Assume we have the next sets
\[
S = \{ z \in \mathbb{C}\, |\, |z| < 1 \} \quad \textrm{and} \quad S_2=\partial{S}
\]
\end{document}

Spaces

The following example contains a complete list of spaces inserted using various commands and demonstrates their effect on typesetting mathematics:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
Spaces in mathematical mode.

\begin{align*}
f(x) &= x^2\! +3x\! +2 \\
f(x) &= x^2+3x+2 \\
f(x) &= x^2\, +3x\, +2 \\
f(x) &= x^2\: +3x\: +2 \\
f(x) &= x^2\; +3x\; +2 \\
f(x) &= x^2\ +3x\ +2 \\
f(x) &= x^2\quad +3x\quad +2 \\
f(x) &= x^2\qquad +3x\qquad +2
\end{align*}
\end{document}

The compilation result is as follows:

In mathematical mode, spacing around operators and relations is controlled by specific skip widths.

\thinmuskip (by default, it equals 3 mu). \medmuskip (by default, it equals 4 mu). \Thickmuskip (by default equals 5 mu).

User-Defined Binary and Relation Operators

You can force the spacing used in binary or relation operators, so you can define your own spacing.

\begin{align*}
34x^2a \mathbin{\#} 13bc \\
34x^2a \mathrel{\#} 13bc
\end{align*}

Quick Reference:

\quad
\,
\:
\;
\!
\
\qquad