This has already been answered in the comments but let's go right on ahead and provide a full answer down here.
For our purposes, LaTeX has three modes: math mode, paragraph mode and left-to-right mode (LR mode).
In math mode, LaTeX treats everything as maths. It doesn't know that or
is a word, it just treats it as maths. What this means is that Roman (as in the Roman or Latin alphabet we use in English) letters are set in italics by default. A string of Roman letters abc
is treated as a string of variables, a
, b
and c
, multiplied together. This is normally what you want with maths, right? If you have ab
you usually mean the variable a times the variable b.
Now, if I write or
, LaTeX doesn't know that's the English word "or", it just treats it as the variable o times the variable r.
Next thing: spacing in math mode is handled automatically - and very smartly - by TeX. White space in the input is ignored in the output:
a b cd e f
And
abcdef
Produce the same result. (The spacing around these letters will be suitable for a string of variables being multiplied as we discussed above.)
Spacing around operators and relations such as \sin
, \log
, +
, -
, =
, \in
and so on is all done for you.
x\sin x+d=4
And
x \sin x+ d = 4
Will produce the same result, with the appropriate spacing around the sin the + and the =.
So what do you do if you want to have some text in math mode, including proper spaces around the text?
The simplest way is to be sure to load the amsmath
package and use the \text{}
command. This, I believe, puts us in LR mode, but it doesn't really matter for our purposes, what it means is that LaTeX is back to treating things as text! or
is now taken to be a word, one or more spaces in the input produces a space in the output.
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
x = 4 \text{ or } x = 5
\]
\end{document}

Finally, there are two types of math mode. Display math mode is used for displaying equations, they will be centred, there will be a skip above and below to visually separate them, large operators like \sum
will appear large and limits will generally be set above and below the operator. In TeX, display math mode was accessed by $$ ... $$
, but in LaTeX, we prefer \[ ... \]
.
\text{ or }
, with the spaces inside the text string. also, better to use\[ ... \]
than$$ ... $$
-- see Why is\[ … \]
preferable to$$
?