[Tex/LaTex] Math mode horizontal space difference between \ (backslash) and \; (backslash semicolon) and what to use for multiplication

best practicesmath-modespacing

In this code:

\documentclass{article}
\begin{document}
\begin{equation}
c = a b
\end{equation}
\end{document}

I would like to insert a space between 'a' and 'b' (as opposed to \cdot or \times). Usually, I just write a simple backslash:

c = a \ b

This seems to produce the same spacing as:

c = a \; b

Is there a difference? What kind of spacing do you recommend to use for multiplication: \ (backslash) or \, (backslash comma) or \: (backslash colon) or \; (backslash semicolon) or some other spacing?

Best Answer

Use no space between terms that are multiplied. So

$c=ab$

is the correct way of typing the formula. In case you have

$c=a\log b$

TeX takes care of the spacing and automatically inserts a thin space (equivalent to \,): you have to do nothing at all except using the right command (\log for the logarithm).

Note that spaces in math formulas are ignored, so

$c = a b$

produces the same result as $c=ab$.

About the differences among the various commands:

  1. \ (backslash space) inserts a normal interword space; use it for separating terms in an equation, but in general it shouldn't be used in math

  2. \, inserts a thin space, the same that's automatically inserted in $a\log b$ both after a and \log

  3. \: is the same spacing that's automatically inserted around the + sign in $a+b$ (or, in general, around binary operation symbols)

  4. \; is the same spacing that's automatically inserted around the = sign in $a=b$ (or, in general, around binary relation symbols)

In some cases it's good to add an explicit spacing, for instance in

$\sqrt{\,\log x}$

because of the high ell that goes in the corner of the radical. But such manual adjustments are rarely needed.