I am a learner to Latex. I am using Texstudio to edit the word. When I try to insert a .eps format figure, this error happens. Error: Package pdftex.def Error

The code is:










Thanks a lot,


  • 1
    You have to compile with --shell-escape like pdflatex --shell-escape yourfile for epstopdf to work properly. Also use graphicx instead of graphics. Note the x at the end. Don't load graphics as you are loading graphicx. – user11232 Sep 3 '14 at 7:37
  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. PdfTeX can't work with eps files, thats why an extra run is required in the background that you have to allow using the --shell-escape switch. – Johannes_B Sep 3 '14 at 7:39

You should not put the extension .eps to the figure file. The package epstopdf inserts, by default, .eps at the end of the graphics file name. Otherwise, you will get the error

Package epstopdf Info: Source file: <example-image-b.eps>
(epstopdf)                    date: 2012-05-15 17:21:24
(epstopdf)                    size: 52171 bytes
(epstopdf)             Output file: <example-image-b-eps-converted-to.pdf>
(epstopdf)             Command: <epstopdf --outfile=example-image-b-eps-convert
ed-to.pdf example-image-b.eps>
(epstopdf)             \includegraphics on input line 10.
runsystem(epstopdf --outfile=example-image-b-eps-converted-to.pdf example-image

Package epstopdf Info: Result file: <example-image-b-eps-converted-to.pdf>.

E:\Latex workshop\framed\test\only-test\doi4.tex:10: Package pdftex.def Error: 
File `example-image-b-eps-converted-to.pdf' not found.

Second, you should use --shell-escape while compiling:

pdflatex --shell-escape yourfile

where yourfile is your main .tex file.

Third, don't use graphicx and graphics both. Use graphicx (more modern than graphics) and load it before epstopdf.

With all above, the MWE is




I met the same problem as you described and tried a lot of methods. If you were using Mac with TexStudio, I think this could be a problem of TexStudio itself. Everything works fine with the same files for me on Windows or on Mac with other software. You may try other software to transfer the eps files to pdf files, such as Sublime or TexShop.

An easy way for Mac users with Texstudio: I opened a .eps file by double-clicking which launched via Preview by default, ready for save as pdf. If the .eps files are few and you are patient enough to manually export one by one, I would recommend this simple step. It worked for me.

I also encountered this problem. pdfTex tells you to check the log, and there I found the follwoing:

2016-07-24 17:45:18,822+0200 INFO pdflatex - installing package graphics-def triggered by tex\latex\graphics-def\pdftex.def

2016-07-24 17:45:18,898+0200 INFO pdflatex - mpm: starting package maintenance...

2016-07-24 17:45:18,898+0200 INFO pdflatex - mpm: installation directory: "C:\Users\Philipp\AppData\Local\Programs\MiKTeX 2.9"

2016-07-24 17:45:18,898+0200 INFO pdflatex - mpm: package repository: http://ftp.fernuni-hagen.de/ftp-dir/pub/mirrors/www.ctan.org/systems/win32/miktex/tm/packages/

2016-07-24 17:45:19,013+0200 INFO pdflatex - mpm: lightweight database digest: 0d353e43fc36f1131535dede775291d5

2016-07-24 17:45:19,019+0200 FATAL pdflatex - Unknown archive file size.

2016-07-24 17:45:19,019+0200 FATAL pdflatex - Info: package="graphics-def"

2016-07-24 17:45:19,019+0200 FATAL pdflatex - Source: libraries\miktex\packagemanager\internal.h

2016-07-24 17:45:19,019+0200 FATAL pdflatex - Line: 477

The highlighted sentences gave me the feeling that there is an issue with the automated package management trying to install the missing package "graphics-def". Therefore I installed it manually via the MikTeX package manager.

Finally, LaTeX is now running fine again.

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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