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 know that includegraphics can be used in Latex to include images into the document, but how can I specify a path for that file?

\includegraphics[]{picture-name}

Instead of asdd.jpg I want to specify C:\Documents and Settings\Nina\asdd.jpg, because that's where the image is.

share|improve this question

migrated from stackoverflow.com Apr 9 '11 at 15:39

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

    
There is a LaTeX-specific page in the StackExchange network. Consider that one. –  0xC0000022L Apr 9 '11 at 15:36
    
And what's with that {imgs/RTS}? where it is located? i need the image asdd.jpg from C:\Documents and Settings\Nina folder. How can i specify this?? –  qwerty Apr 9 '11 at 15:43
    
@qwerty: Rather than "answering" your question, you should edit the original question to include the additional information. (You may have to register at tex.se in order to do so.) –  lockstep Apr 9 '11 at 15:46
    
But tell me, how can i specify that folder and the image wihtin that folder? –  qwerty Apr 9 '11 at 15:47
    
I just told you - you place the full path in the {image} field. Works for me. –  TomMD Apr 9 '11 at 15:49

4 Answers 4

You need to write the \ as / because (La)TeX follows the Unix style (which is also used for WWW addresses). Also the spaces in the filename are a problem. You can load the grffile package with the space option to make things easier as mentioned by Herbert in How to include graphics with spaces in their path?. If it wouldn't be for the \vs./ your question would be a duplicate of it. Alternatively try to enclose the file base in { } as explained in \includegraphics: Dots in filename.

% Preamble
\usepackage{graphicx}
\usepackage[space]{grffile}
%...
% Document
\includegraphics{C:/Documents and Settings/Nina/asdd.jpg}
share|improve this answer

You may use following command:

\graphicspath{{<your path>}}

Also see this and this.

share|improve this answer

I had no issues when I put the path directly where the picture name belongs, for example:

\begin{figure}[t]
  %\epsfig{figure=RTS.eps,height=5.5cm}
  \includegraphics[height=5.5cm]{imgs/RTS}
  \caption{The run-time system intercepts calls that cross protection domains, allocating
  new stacks, updating memory permissions and tracking old stack and credential values
  for use once the callee returns.}
  \label{fig:rts}
\end{figure}

In the above "imgs" is the immediate (local) directory and RTS is the file minus the extension. I have "RTS.pdf" and "RTS.eps" files in that directory containing my image.

pslatex or pdflatex will use the correct file for their respective needs.

EDIT: And yes, if I place the full path (/home/username/..., the Linux equal of C:\Documents and Settings\...)instead of just a relative path (the immediate sub-directory of imgs) then it also works fine.

If you're still having trouble then perhaps you need to escape the spaces in your path: C:\Documents\ and\ Settings\...

share|improve this answer

If the images are in the same folder, use \graphicspath{}

share|improve this answer

Your Answer

 
discard

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