3

I'm just beginning with LaTeX, and I'm trying to understand how to include images in my documents. I'm working under TeXnicCenter. In the book I've bought they say that I should use the command \includegraphics. I've used the packages calc and graphicx, but the message pdftex.def error appears when I try to open an image and apparently LaTeX can't find my file.

LaTeX writes:

! package pdftex.def Error: File 'The name of the file' not found.

I don't have files under the eps format, but .jpg or .png. I've tried to use the package epstopdf, as recommended on this website, but I can't understand where I'm supposed to enter the option -shell-escape. And as this package is supposed to convert eps files to pdf, I don't see how it could help me anyway, as I'm trying to use JPEG and PNG files. So as you can see, little problem here ...

My code is basically this (I hope the problem doesn't come from other packages I would have used and were not compatible, but I don't think so):

\documentclass{report}   
\usepackage{calc, graphicx}  
\usepackage{epstopdf}  


\begin{document} 

\includegraphics{C:/Users/Pictures/Lord of the Rings/Dimholt.jpg}

\end{document}
4
  • 1
    Are you using miktex? Aug 5, 2016 at 13:43
  • 2
    could you please put a minimal working example (MWE) to identify where the problem comes from? if you don't know how to make MWE, please check this link meta.tex.stackexchange.com/q/228/2288
    – Diaa
    Aug 5, 2016 at 13:50
  • 1
    To answer your question Ulrike Fisher, yes, I'm using miktex.
    – ABC
    Aug 5, 2016 at 16:36
  • 1
    I'll include the code in my question, just a minute.
    – ABC
    Aug 5, 2016 at 16:38

2 Answers 2

3

Well, if I compile your given code with MiKTeX 2.9 (and using TeXnicCenter with compiling option LaTeX->PDF) I get the same error you showed us.

enter image description here

This error simply tells you that the file thefile.jpg is not found and can therefore not be included to your document.

If I compile with added option demo to package graphicx the code compiles without error---of course, because LaTeX has not to search and clude a non existing file.

BTW, if I compile with pdflatex (that means the TeXnicCenter option LaTeX->PDF I do not need the other packages you added to your code.

Please see the following MWE, compiling without error:

\documentclass{report}

%\usepackage{calc}
%\usepackage{graphicx}
 \usepackage[demo]{graphicx} % <============ no error, no file to include!
%\usepackage{epstopdf} % <====== only needed, if you have ti onclude *.eps files!
%\usepackage{grffile}


\begin{document} 

\includegraphics{thefile.jpg}

\end{document}

If I now add a file thefile.jpg into the same directory the tex code is and delete option [demo], the image is included with no error.

If you want to include an *.eps file compiling with pdflatex, you need to uncomment package epstopdf. Then an file thefile.eps (you see the different extention .eps?) is converted to thefile.pdf and can be included. But then you need to call it in your TeX code with \includegraphics{thefile.eps}.

Please see this image and check the red marked parts:

enter image description here

For me it seems you do missmatch some things, I'm right?

5
  • Okay!!! Now it's working. In a new document than the one I had already created it is working. I'll try to discover why it's not working in the other one... Long night ahead... I must have written Something wrong.Thank you very much for your help.
    – ABC
    Aug 5, 2016 at 19:51
  • Actually, I think I understood why it wasn't working. If I add " "around the name of the file, and the command \string before the : of C:/User... in the name of the file, it does work. Maybe that's why it wasn't working at the beginning. Maybe it couldn't find the file because it couldn't distinguish the different elements in the name... Anyway, thank you again.
    – ABC
    Aug 5, 2016 at 19:55
  • okay, I'll change the code of my question to show where the problem was. It was definitely the problem with the name.
    – ABC
    Aug 5, 2016 at 20:09
  • Mensch solution doesn't work for me. Any help ? how was this resolved?
    – mindless
    Aug 10, 2019 at 12:08
  • @mindless Well, what did you do exactly, which code do you use, which tex editor? Perhaps you can ask a new follow up question better explaining your issue ... Have you tried using ""?
    – Mensch
    Aug 10, 2019 at 18:37
0

It is a simple update problem. I had a similar issue and when I updated the MiKTeX, the issue was resolved.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .