I was trying to include an image in my file but this error came up:

! Missing number, treated as zero.
<to be read again> 
l.207               \includegraphics{rate\_of\_return}

I've looked everywhere and tried a lot of things, but the problem remains unresolved.

This is my code:

% ... some stuff

\item[c)] \hfill \\
    In the graph below, the full line is for 7\%, the long-short dashed
    line is for 6\%, and the regular dashed line is for 5\%.

% ... some stuff

closed as too localized by lockstep, Thorsten, Andrew Swann, Mensch, Stefan Kottwitz Feb 6 '13 at 12:39

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}.A tip: If you indent lines by 4 spaces, they'll be marked as a code sample. You can also highlight the code and click the "code" button (with "{}" on it). – mafp Feb 6 '13 at 11:21
  • Did you try with \includegraphics{rate_of_return}? – Ignasi Feb 6 '13 at 11:21
  • Ignasi - that worked. I didn't know that you didn't need to escape the underscores for \includegraphics. – ydh28 Feb 6 '13 at 11:22
  • mafp - Thank you for editing my post. Next time I'll definitely do that. – ydh28 Feb 6 '13 at 11:23
  • 1
    We'd like to keep answers separate from questions, so you should write a separate answer (or accept an existing answer) instead of editing your question. Self-answers are perfectly admissible, and a well-written answer may earn you additional reputation. – You Feb 6 '13 at 11:48

You don't have to escape underscores in file names. So you should use \includegraphics{rate_of_return}. Same happens with other file commands like \input, \include or \includeonly.

You need to escape underscores when you want to type _ in the middle of your text.

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