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've been trying to insert an image into LaTeX using the [graphicx] package using TeXworks with very little success. The .PNG image I want to insert is currently just saved in my Windows Pictures library, so I was wondering if I have to have the image saved in a specific location before inserting it?

share|improve this question
    
Be careful with spaces in the path. –  Please don't touch Oct 29 '12 at 12:33
add comment

2 Answers

up vote 9 down vote accepted

You have to put the images into a directory that is searched by LaTeX during the compilation. Usually, the easiest is to put it in the same directory as where the .tex file is.

You can as well use the \graphicspath command in your preamble to specify the directories searched for graphics. Remember to put each directory in a second pair of braces, like:

\graphicspath{{figures/}{/home/me/mygraphics}}

(This example is for linux, for Windows, you shall use the correct directory specification. Remember that this will make your document non-portable.)

share|improve this answer
    
...and relative paths to subdirectories, too? –  krlmlr Oct 29 '12 at 12:24
    
@Jake the problem is that it's system-specific and the grfguide.pdf is void of Windows information :-/ –  tohecz Oct 29 '12 at 12:28
    
Thanks @tohecz. I've just tried this and works fine, just had to save the image in documents. –  Danger Fourpence Oct 29 '12 at 12:52
    
Relative paths are usually to be preferred, and work the same on Windows as on Linux/Mac. Don't use spaces in any case: TeX really does not like them. –  Joseph Wright Oct 29 '12 at 12:59
    
@JosephWright the guide says something different about Mac. I really don't know and I cannot test it, since I have only linux... –  tohecz Oct 29 '12 at 13:08
show 1 more comment

You can simply put the image in the same directory as your .tex file or in case it is in some other directory you can give the full path of the image file in the includegraphics command. Example if you put your image files in a directory named images within the directory where you have the .tex file then you can use includegraphics[options]{./images/xyz.png}

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.