[Tex/LaTex] Got Error “! Missing $ inserted.” when using \includegraphics

graphics

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} 

Best Answer

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/}}