81

The images in my paper are in EPS format. If I execute pdflatex to get a PDF version of my paper, the figures won't appear. I have to typeset using the latex command, and then convert the DVI file to PDF using dvipdf.

Why doesn't pdflatex support EPS figures?

lockstep
  • 250,273
Julian Lamas-Rodriguez
  • 1,615
  • 2
  • 16
  • 14
  • 7
    I don't know the answer to your question, but apparently there is a package called epstopdf that will convert EPS to PDF on the fly: http://www.ctan.org/tex-archive/support/epstopdf/ Some instructions for using this package are in the OzTeX FAQ: http://www.trevorrow.com/oztex/ozfaq.html#pdfeps These instructions don't seem OzTeX-specific, but I haven't tried them. – PersonX Jul 27 '10 at 14:54
  • 3
    xelatex (a descendent of pdflatex) will automatically convert your eps files to PDF format during compilation so, in effect, you are free to mix pdf, png, jpg, and eps images in your document. – Dean Serenevy Apr 20 '13 at 20:26

7 Answers7

68

Yes it can and it will be default in TeXLive2010.

You need:

  1. \usepackage{epstopdf} in the preemble
  2. Include graphics without extension e.g \includegraphics{picture}
  3. pdflatex -shell-escape or enabling write18 on windows
Dima
  • 12,427
  • 8
  • 40
  • 53
  • 1
    on windows it is miktex-pdftex --enable-write18

    Or you can follow the guide here to enable write18 globally.

    – Dima Jul 27 '10 at 15:02
  • 22
    The approach here doesn't actually allow EPS files in PDF output directly. Instead, it makes sure that epstopdf is being used 'behind the scenes' to make PDF versions of the EPS files. It's these PDF files that are then included in the output. – Joseph Wright Jul 27 '10 at 15:12
  • 4
    @Joseph yes, you are quite right =) I was aiming more for "get it to work" instead of explaining "why you should do it like this, to get it to work". – Dima Jul 27 '10 at 15:59
  • It does not seem to be necessary to specify the file name without the eps extension. It works anyway (on TexLive 2009). Also the -shell-escape switch does not seem to be needed either - the output is fine without it on Debian/Ubuntu. – donatello Dec 03 '10 at 19:13
68

EPS is more than an image format: it's an entire programming language. The way that DVI mode includes EPS images is to simply leave a space for them in the output. If you look at a DVI, you'll find that the EPS images are not actually added to it: they have to be present for appropriate interpretation when looking at the DVI. When you convert the DVI to EPS format (or directly to PDF), it is the conversion tool that deals with the EPS, not TeX at all. (The usual DVI route uses GhostScript: it does contain all of the code to interpret EPS files.)

When producing a PDF directly, the images do have to be properly included by pdfTeX. It doesn't include an EPS interpreter (which would be much too complex to do), and instead expects that some other tool (probably GhostScript) is used first to make PDF files for inclusion. PDF files use some of the same concepts as EPS, but in a way that pdfTeX can use successfully.

Joseph Wright
  • 259,911
  • 34
  • 706
  • 1,036
19

I am using TeXStudio 2.5.1 on Windows 7, and found I need to have the \usepackage{epstopdf} line after the line \usepackage{graphicx} in my preamble ... Not sure why it would matter, but it works.

Speravir
  • 19,491
  • Your TeX editor does not matter here. But I guess, you use MiKTeX, because only for this distribution the approach you decribe is important. In TeX Live the need for conversion is done automatically. – Speravir Apr 20 '13 at 18:35
  • 1
    This comment needs to be voted up! Nothing worked for me except this! Thank you so much for putting this here! – Jean-Paul Jan 28 '15 at 14:17
8

Just to add my findings on Mac OS X, for me it was only necessary to add the -shell-escape option to pdflatex in order to avoid the epstopdf !!! Error: Output filename ... not allowed in restricted mode. message. All .eps files were then automatically converted to .pdf without requiring the epstopdf package to be explicitly used. This may be due to the installed options on my machine.

zelanix
  • 525
5

It does not seem to be necessary to specify the file name without the eps extension. It works anyway (on TexLive 2009). Also the -shell-escape switch does not seem to be needed either - the output is fine without it on Debian/Ubuntu. – donatello Dec 3 at 19:13

I only need \usepackage{epstopdf} as well. I have Windows7 with MikTeX.

Stefan Kottwitz
  • 231,401
  • In Debian Wheezy, I can verify that said -shell-escape switch IS needed if the pertinent "...-eps-converted-to.pdf" file is NOT already present (so said file can be created). Otherwise, said switch is not needed... – Digger Apr 29 '17 at 04:02
3

I experienced the same issue, and could figure it out by installing texlive-font-utils:

$ sudo apt-get install texlive-font-utils

I didn't have to use epstopdf.

Akihiko
  • 131
  • 5
    So you're saying that by installing texlive-font-utils you don't have to use epstopdf? I guess you still have to, it's just that it forms part of that package, right? – Werner Oct 30 '18 at 05:06
  • 1
    No, I did't have to use epstopdf.

    I made a further investigation. I did not explicitly include the package of epstopdf, but some related packages seem to be included maybe from other packages:

    ... (/usr/share/texlive/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty ... (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvdefinekeys.sty)) ...

    – Akihiko Oct 30 '18 at 09:27
0

Have you tried editing you graphics? I noticed that in Inkscape my *svg files that failed to print in LaTeX have the content being misaligned with the document space / page size. Ctrl + shift + D and then rearanging page size with content solved this issue for me... Apparently the *eps file saved with Inkscape does not cope when the content is not actually aligned with the page itself.

Now I am not sure if you used Inkscape at all... but for those who do, this may do the trick.

hubie
  • 1