# ! Missing \$ inserted. <inserted text> \$

I am new to LaTeX and I am using it to write a report with several chapters (main page in which I include the other pages). I got this error:

C:\Users\hussam\Desktop\thèse\latex\thèse\thèse.brf

! Missing \$ inserted.

<inserted text>

\$

l.52

without any other information.

thèse.brf is a totally white page. I looked at line 52 of all my documents but couldn't find any problem.

-
Using accented characters in file names is very dangerous. – egreg Apr 21 '12 at 12:36
i assume this thèse.brf is being input? what encoding is the file in, and what packages do you have loaded? my guess is latex is confused by your file name into thinking that it contains something dedicated to maths (like ^, _ or the like. fwiw, i agree with @egreg: remember that tex dates from the days when ascii was an exciting new standard, and it's notorious for being confused by non-ascii characters; we could really do with a minimal example (a stripped-down version of your document that still fails) – wasteofspace Apr 22 '12 at 13:47

This error usually appears because you used a \$ somewhere previously that needs to be matched by an ending \$. You haven't given us very much to work with, but here are some troubleshooting steps.

• Look at the lines before line 52. Are there any \$ that you see that maybe need to be matched with something?

• If you hit ENTER in your console, will your file keep compiling? If so, keep hitting ENTER (or type Q) until it finishes, and then look at the output if possible. If you've been typing math, do you see a whole bunch of italicized stuff that has funny spacing? If so, that's a sign that LaTeX thinks you're still in math mode (so it's typesetting your text as math), so around there is where you should look for your missing \$.

-

In LaTeX, \$ is a special symbol. When two \$'s are placed around an equation, this tells LaTeX that this information is math, and not just regular text, e.g.:

\$4+3=7\$

When typing \$, or the dollar sign, in a document in LaTeX, such as “I have \$3.”, you must place a \ before, for e.g.:

I have \\$3.

You probably tried to type a dollar sign in the document, but LaTeX believed you wanted math mode, so it is looking for the closing \$.

-

I had the same problem and solved it by correctly escaping ^, _, and |. Looks like LaTeX sets both \$s itself if you seem to have forgotten them. Everything that may intend being a math formula causes this error.

-

I had this problem too, and it wasn't anywhere near the line number given in the logs.

Building on Leah's answer, if you press Q, then look in the logs, you'll see the message:

I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.

So on the next run, try pressing 2 at the error prompt, which tells latex to ignore the problem, and continue, instead of trying to fix it. In doing so, it'll print out the last bit of text it read (near the problem), and that should give you a clue where the problem is (you might need to do this a couple of times).

Turns out my problem was on line 366 of my .bib file, and no-where near line 20 as reported. It was caused by a ~ in a url that hadn't been converted by the zotero exporter. Deleting that line removed the error.

-