Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have a few JPEG images inside a folder. I use the following code to embed images

\begin{figurehere}

  \centering
    \includegraphics[width=0.5\textwidth]{folder\test.jpg}
    \caption{Example \cite{visbin}}

\end{figurehere}

But LaTeX doesn't allow me to compile it. It says Undefined control sequence <argument> folder\test

Can somebody please help me?

share|improve this question
    
It seems you're using the science package, which provides the figurehere environment. It's advisable to always provide such information in your questions so that other users can help you easily without having to figure out what packages you're using first. (It didn't matter for this problem, but is generally really helpful.) –  doncherry Nov 20 '11 at 19:37
add comment

migrated from stackoverflow.com Nov 20 '11 at 19:03

This question came from our site for professional and enthusiast programmers.

2 Answers

up vote 14 down vote accepted

Don't use backslashes recklessly. The standard directory separator should work fine on all platforms:

\includegraphics[width=0.5\textwidth]{folder/test.jpg}
%                                         ^^^^^

You can even omit the suffix .jpg to let the driver pick the best representation of the image (e.g. JPEG for PDF, and EPS for PS).

share|improve this answer
add comment

An alternative would be to set the \graphicspath (provided by graphicx) that LaTeX should use via

\graphicspath{{folder/}{otherfolder/}}

Also see the UK TeX FAQ entry on Importing graphics from "somewhere else".

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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