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.

Here's the preamble:

\documentclass{report}
\usepackage{fullpage}
\usepackage{amssymb}
\usepackage[fleqn]{amsmath}
\usepackage{graphicx}
\usepackage{color}

... And here's the call to \includegraphics:

\includegraphics[scale=0.5]{n6d.png}

The error on the log:

! Package pdftex.def Error: File `n6d.png' not found.

See the pdftex.def package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.39 ...aph & \includegraphics[scale=0.5]{n6d.png}
                                               & \includegraphics[scale=...

Typing "H" just puts it into draft mode.

The file 'n6d.png' is located in the same folder as the .tex file. I've tried putting just 'n6d' as the filename, but still have the same problem. Here's the command I'm calling to compile the PDF:

"C:\texlive\2012\bin\win32\pdflatex.exe" -output-directory "D:\Documents\School\Math3\Worksheets\3" "D:\Documents\School\Math3\Worksheets\3\wksht3_sols.tex"

There are other files in the .tex file that are having the same issue. Any ideas?

share|improve this question

migrated from stackoverflow.com Jan 27 '13 at 22:25

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

1  
There are many Questions about input paths. For instance this one might be interesting for further reading tex.stackexchange.com/questions/89247/input-file-folder/… –  bloodworks Jan 27 '13 at 23:15
add comment

4 Answers 4

Its not important that the image file is in the same directory of the tex file. It should be in the working directory where you launch the pdflatex command.

For example, if you run:

cd ~/bar
pdflatex foo/baz

the PDF file should be in the ~/bar directory rather than the ~/bar/foo directory.

Use the command \graphicspath to set a different path.

share|improve this answer
3  
What do you mean by "working directory where you launch the 'pdflatex' command?" –  AlanH Apr 6 '13 at 21:51
add comment

Thanks for the great answers! :-)

I also had this problem...the source of the error was (for me), that the file for the image I wanted to include was registering as having no file-extension (even though it really IS a .png file, and opens like one)! But it listed in the terminal as having no file-extension (for some strange reason).

I just renamed it to "file.png" instead of "file", and of course everything worked fine from there!

So maybe check if your image file actually does "exist" before you stress about which directory LaTeX is checking and so on.

share|improve this answer
1  
Please don't add "thanks" as answers. Invest some time in the site and you will gain sufficient privileges to upvote answers you like, which is the Stack Exchange way of saying thank you. –  Claudio Fiandrino May 26 at 12:45
add comment

You can set the path of your figures by adding

\graphicspath{{./Figures/}} %Where the figures folder is located

To your preamble. Of course, {./Figures/} is actually the path where the figures' folder is located.

Also, you may want to try not using wksht3_sols.tex as your file name (due to the _). Change it to something like wksht3sols.tex

Try doing these two things to see how it works.

share|improve this answer
add comment

I was having this problem too but have figured it out -- I know this is an old thread, but since the question might come up in searches for people with current problems (it came up in mine), I'll say how I fixed it.

If using MiKTeX, even if your figure file is in the same directory as the TeX file you're working with, you have to refresh the file name database every time you add files into this folder. So do this:

  1. open MiKTeX Settings / Options;
  2. Roots tab: check that the folder with the files in it is one of the Root paths;
  3. General tab: Maintenance: Refresh

This solves it for me.

share|improve this answer
2  
Threads are never old on stackexchange if you have good information to share. This is not the typical stupid forum managed by typical stupid people ;-) –  HAL9000 Feb 20 at 9:45
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.