Lesson 1 showed that maths mode ignores your spaces and turns words into italic letters. This lesson is about the two fixes: \text for words, and the spacing commands for the few places LaTeX's own spacing needs help.
Words inside maths
\text{...} writes upright words, and inside it your spaces count again:
Notice the spaces inside the braces, \text{ for all }: without them the words run into the maths on either side.
\textbf{...} and \textit{...} give bold and italic words in the same way.
The spacing commands
From smallest to largest:
| Command | Space |
|---|---|
\! | a little less (negative) |
\, | thin |
\: | medium |
\; | thick |
\quad | the width of an M |
\qquad | twice that |
Try the difference:
Where they help
LaTeX spaces almost everything correctly by itself. The usual exceptions:
- Before the dx of an integral:
\int f(x) \, dx. - Between a root or a number and what follows:
\sqrt{2} \, x. - Between separate parts of one line:
x = 1, \quad y = 2. - Before a condition:
x^2 \geq 0 \quad \text{for all } x.
Dots
Three dots come in two heights:
\ldotssits low, between commas: .\cdotssits in the middle, between operators: .
\vdots and \ddots are the vertical and diagonal dots from lesson 9.
Practise
Here the spaces count, so type them where the formula shows them.
The spaces inside
\text{ for all }count.f(x) = 0 \text{ for all } x\quadbefore the words, and a space after "for" inside\text.x^2 \geq 0 \quad \text{for } x \in \mathbb{R}A thin space,
\,, before the dx.\int_0^1 x \, dx\quadafter the comma.x = 1, \quad y = 2Low dots between commas:
\ldots.1, 2, \ldots, nCentred dots between plus signs:
\cdots.a_1 + a_2 + \cdots + a_nA thin space after the root.
\sqrt{2} \, x
In short
\text{...}writes words, and spaces inside it count.\,\:\;\quad\qquadadd space, and\!takes a little away.\ldotsbetween commas,\cdotsbetween operators.
Next, in lesson 12: a full worked solution, from first line to last.