I try to write a multiplication dot and use \cdot
, 4 = 2\cdot{2}
. But I get the error message Missing $ inserted
. What have I forgotten?
1 Answer
TeX and its various derivatives (such as LaTeX) distinguish between normal prose (text mode) and mathematics (math mode). The simplest and original way to switch between the two is to use the math switch, which is $
.
Here is a sample document to show you how it is typically used.
\documentclass{article}
\begin{document}
This is some normal text, written in text-mode. In between dollar signs,
such as $ x = \frac{1}{2} = \frac{10}{20} = \frac{2}{5} \cdot \frac{5}{4} $,
one may write mathematics (using macros that only work in math-mode, such
as \verb:\frac:). For displayed equations, which are centered and put on
their own line, you can put math in between \verb:\[: and \verb:\]:, like this:
\[ E = mc^2 \]
If you want to number equations or to align them horizontally in a particular way,
you should consider using environments such as \texttt{equation}, \texttt{align},
or \texttt{gather} from the \texttt{amsmath} package.
\end{document}
$4 = 2\cdot2$
? Please provide a minimal working example (MWE) which will reproduce your error when compiled.\cdot
. We also use this same symbol for the dot product, although some books prefer the\circ
. And we generally use\times
for the cross product (vector product). Personally, I would never write 2(2)=4 or (2)(2)=4 in a text, even as a mathematician. I would find it very strange to see that.\cdot
is a macro that just inserts the centered dot. It does not take an argument. However, writing\cdot{2}
as you did in your example works, because the braces just put the single character 2 in a group of its own.