56

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?

8
  • 19
    Math mode? $4 = 2\cdot2$? Please provide a minimal working example (MWE) which will reproduce your error when compiled.
    – Holene
    Commented May 11, 2013 at 8:46
  • 8
    @bjartmar: This might be language specific. In German, for example, scalar multiplication is written with a \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. Commented Feb 18, 2017 at 9:18
  • 1
    @user30523: Remember 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. Commented Feb 18, 2017 at 9:20
  • 1
    @bjartmar I think we were more META than off topic, but definitely getting off topic now... You would have been more lucky looking through any german textbook - one will hardly find a book where the cdot notation is not used for scalar multiplication. Anyway, mathematical notation is very much about conventions and often specific to the field of research. One might argue that (12)(3) could also be understood as the permutation transforming ABC -> BAC, depending on the context, of course. In that sense, I don't quite like that teacher's way of dealing with the situation. Commented Feb 18, 2017 at 19:29
  • 1
    Oh and by the way: Have a look at "A Computational Introduction to Number Theory and Algebra" by Victor Shoup. First page of first chapter (Basic properties of the integers), proof of the first theorem: [...] a | a because we can write a · 1 = a; 1 | a because we can write 1 · a = a; a | 0 because we can write a · 0 = 0. Source: shoup.net/ntb/ntb-v2.pdf Commented Feb 18, 2017 at 19:31

1 Answer 1

53

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}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .