TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have problem with this

$ \text{bredden = x \Leftrightarrow längden = 3 \cdot bredden = 3x} $

I get a

Missing $ inserted

error, although I have $.

share|improve this question
Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers. – Jubobs Jan 13 '14 at 0:53

When using \text{} you escape math mode. Your line asks LaTeX to compile several math symbols (such as \Leftrightarrow and \cdot) inside a text environment, which explains the error message.

The proper way of writing your line would, in any math environment, be

\text{bredden} = x \Leftrightarrow \text{längden} = 3 \cdot \text{bredden} = 3x

(with $ ... $ for your inline math case).

share|improve this answer

The "computer science answer" is that when parsers encounter an error, a possible error recovery strategy in some situations is to guess that a token is missing in the input stream, and simply put it in and try parsing again.

The error recovery strategy is just a guess, and, as such, it might be wrong. So wording the diagnostic as "missing $ inserted" is misleading. Inserting $ is just what the software did based on the hypothesis that a $ is missing at that point.

So you have to take the diagnostic with a grain of salt. It really means "Syntax error! trying to continue parsing by adding a dollar sign."

In the olden days of computing, it was important for parsers to have clever error recovery schemes. The reason was that the turnaround time to have a program processed through a job submission window was very high, and so programmers benefited from having as many errors in the code diagnosed as possible in a single pass. It would not have been acceptable to stop after a single error, and not diagnose the program further, because then N round trips through the job submission queue would have been required to fix N compilation errors.

The steadfast efforts of a compiler to keep going in the face of errors may result in it becoming confused, and generating reams and reams of inappropriate diagnostics. Creative Computing magazine used to have a contest for users to submit programs which generate the longest reams of diagnostics from some compiler that they use.

share|improve this answer
This is a correct insight into the history of this kind of error, though in this case, there really is a $ missing in the sense that \Leftrightarrow is a math mode-specific command. – Ryan Reich May 12 '13 at 17:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.