# Got Error “! Missing \$ inserted.” when using \includegraphics

I use the following code to include a rotated figure but failed because of this error. I found the problem is with \includegraphics but I cannot see what went wrong.

\documentclass{article}

\usepackage{graphicx}
\usepackage{rotating}

\begin{document}

\graphicspath{ {D:\Update} }
\begin{sidewaysfigure}
\centering
\includegraphics{figure1.png}
\end{sidewaysfigure}

\end{document}

• Welcome to TeX.SX! Please make your code compilable. \Update is not defined here, and is probably the source of the problem. – jub0bs Nov 22 '13 at 7:28
• Welcome to TeX.sx! Usually, we don't put a greeting or a “thank you” in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Accepting and upvoting answers is the preferred way here to say “thank you” to users who helped you. – masu Nov 22 '13 at 7:30
• @Jubobs: I don't think the OP intended \Update to be a macro here, but meant directory 'Update' on drive 'D:. – Martin Scharrer Nov 22 '13 at 15:43
• @user41485: I do not get the same error when compiling the given code but the error ! Undefined control sequence. \reserved@b ->D:\Update, because the \Update is taken as a macro which isn't defined. Please ensure that this example document really produces that exact error. – Martin Scharrer Nov 22 '13 at 15:55
• @MartinScharrer Sorry, I had overlooked your comment. You must be right. – jub0bs Nov 23 '13 at 17:01

This is because \Update is interpreted as a macro here.
In LaTeX documents you need to use / instead of \ in file paths. Also a trailing / is required because later the file name is simply placed directly after the path.
Therefore you should use \graphicspath like this: \graphicspath{{D:/Update/}}
• If \Update really is a macro containing a path, does it contain underscores _`? – Johannes_B Nov 22 '13 at 7:42