LaTeX Wiki
Advertisement

Spaces, or white space, are rendered using some shorthand symbols, or more generally using the \mspace command.

Simple symbols (class 0) are rendered without any space between them. Operators (class 1) are rendered with spaces. Spacing symbols change the amount of spacing, either by adding more space or taking spaces away. Space is measured in math units, or mu. 18mu equals 1em.

LaTeX markup... ...results in: ...is used for:
a b c d Simple symbols (class 0) have no spaces around them
\sin b \cos d Operators (class 1) have thin spaces around them
a \, b \mspace{3mu} c \thinspace d Failed to parse (unknown function "\mspace"): {\displaystyle a \, b \mspace{3mu} c \thinspace d} thin 3mu space
a \: b \mspace{4mu} c \medspace d Failed to parse (syntax error): {\displaystyle a \: b \mspace{4mu} c \medspace d} medium 4mu space
a \; b \mspace{5mu} c \thickspace d Failed to parse (unknown function "\mspace"): {\displaystyle a \; b \mspace{5mu} c\thickspace d} thick 5mu space
a \ b \mspace{6mu} c \ d Failed to parse (unknown function "\mspace"): {\displaystyle a \ b \mspace{6mu} c \ d} thicker 6mu space provided by backslash followed by blank
a \quad b \mspace{18mu} c \quad d Failed to parse (unknown function "\mspace"): {\displaystyle a \quad b \mspace{18mu} c \quad d} 18mu or 1em space
a \qquad b \mspace{36mu} c \qquad d Failed to parse (unknown function "\mspace"): {\displaystyle a \qquad b \mspace{36mu} c \qquad d} 36mu or 2em space
a \! b \mspace{-3mu} c \negthinspace d Failed to parse (unknown function "\negthinspace"): {\displaystyle a \negthinspace b \mspace{-3mu} c \negthinspace d} negative thin -3mu space. See \int for a suggested use.
a \negmedspace b \mspace{-4mu} c \negmedspace d Failed to parse (unknown function "\negmedspace"): {\displaystyle a \negmedspace b \mspace{-4mu} c \negmedspace d} negative medium -4mu space
a \negthickspace b \mspace{-5mu} c \negthickspace d Failed to parse (unknown function "\negthickspace"): {\displaystyle a \negthickspace b \mspace{-5mu} c \negthickspace d} negative thick -5mu space

Spaces of exactly the size of some rendered text can be obtained using the \phantom, command, and its cousins, \hphantom and \vphantom, as follows:

LaTeX markup... ...results in: ...is used for:
& a \ b \\
& \cdot \phantom{\int XXX} \cdot \\
& c \ d
Failed to parse (unknown function "\begin{split}"): {\displaystyle \begin{split} & a \ b \\ & \centerdot \phantom{\int XXX} \centerdot \\ & c \ d \end{split}} space as wide
and high as
integral and three X’s
& a \ b \\
& \cdot \hphantom{\int XXX} \cdot \\
& c \ d
Failed to parse (unknown function "\begin{split}"): {\displaystyle \begin{split} & a \ b \\ & \centerdot \hphantom{\int XXX} \centerdot \\ & c \ d \end{split}} space as wide as
integral and three X’s;
height 0
& a \ b \\
& \cdot \vphantom{\int XXX} \cdot \\
& c \ d
Failed to parse (unknown function "\begin{split}"): {\displaystyle \begin{split} & a \ b \\ & \centerdot \vphantom{\int XXX} \centerdot \\ & c \ d \end{split}} space of width 0,
as high as
integral and three X’s

Using spaces in formulas

The Integral article gives suggestions on using negative space immediately following the integral sign(\!), and then some positive space (\,) before the "dx" to distinguish it as a special operator.

Using spaces to force LaTeX

In some implementations of the mediawiki software, the <math> ... </math> tags try to use HTML in some cases, rather than LaTeX. The standard way to defeat this is to include \, after each mathematical formula.

Advertisement