21

I'm trying to include an EPS figure in a document that will be compiled using pdflatex. Of course, the picture can be converted to pdf using epstopdf (which comes with the MikTeX distribution). Is there any way to do this on the fly, that is, make pdflatex do the conversion?

I'm looking for such a solution because I want to set up an easy-to-learn environment for students. Ideally, the converted picture is placed in the directory that also contains the original .eps, and the .pdf is used if available.

Martijn
  • 5,471
  • 4
  • 37
  • 50
  • 1
    Since you only need to convert your EPS figure once, I do not understand why you want to ask pdflatex to make the conversion... (I suppose that you will compile your TEX file more than once...) – ThibThib Jun 30 '09 at 12:34

3 Answers3

17

The relevant answer in the TeX FAQ points to epstopdf.sty, included with Heiko Oberdiek's packages.

Jouni K. Seppänen
  • 43,139
  • 5
  • 71
  • 100
  • 7
    And if you load it like this \usepackage[update,prepend]{epstopdf} the EPS file will be automatically re-converted to PDF if it's changed. – Will Robertson Jul 08 '09 at 05:58
  • 2
    And make sure that you already have `epstopdf` utility that will actually be used to convert .EPS to .PDF. You need to have `texlive-font-utils` package installed for that: `sudo apt-get install texlive-font-utils`. – akhmed May 20 '15 at 01:23
  • @jouni can you update this [link only answer](http://meta.stackexchange.com/questions/8231/are-answers-that-just-contain-links-elsewhere-really-good-answers) – Joel Jul 08 '15 at 04:33
2

I would recommend using latex-mk which is a nice way to have a very simple Makefile for latex construction. Of course you can have eps file converted to pdf, or fig to eps, etc, during the build process.

Currently my Makefile look like that :

NAME=report
TEXSRCS=report.tex
BIBTEXSRCS=biblio.bib
USE_PDFLATEX=true
VIEWPDF=open # cause i'm on osx, gv for most unix
XFIGDIRS=img

## For osx users :
include /opt/local/share/latex-mk/latex.gmk

## For unix users :
#include /usr/share/latex-mk/latex.gmk

When I invoke make, the first thing it does is converting some .fig into .pdf files. I'm pretty sure it would do the same with eps files.

claf
  • 9,043
  • 17
  • 62
  • 79
0

If you want to include one EPS figure in latex then you need to at first make the figure in EPS format if it is not in EPS format.Like if your figure is in .jpeg extension, then you need to make it .eps Then you need to include it in the LaTex with using some code which is common in LaTex and then to make it in pdf format you need to use one small instruction that is \usepackage{epstopdf} I was also facing this problem and found this post very helpful "How to Convert .eps to PDF in Latex ?"

Now i am able to include EPS figure in LaTex and also can convert it in PDF. I think you will also get help and all the details from the above link.Let me know if you face any further problem.