3

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} 
  • 3
    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
  • 1
    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
  • 1
    @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
5

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

  • 2
    If \Update really is a macro containing a path, does it contain underscores _? – Johannes_B Nov 22 '13 at 7:42
  • 1
    @Johannes_B: Underscores in file paths are OK. The path should not be typeset internally here, so I don't get how this error message is thrown. Maybe this isn't a correct MWE. – Martin Scharrer Nov 22 '13 at 15:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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