For quite some time now, the
graphicx
package would automatically sort out which file types to use whenever it encounters \includegraphics{some_file}
, where the extension of some_file
is not specified.That is to say, if you are generating to a
.dvi
, the system would look for some_file.eps
. If you are generating to a .pdf
, it looks for some_file.{pdf|jpg|png}
.But what if you want a
.pdf
and you work with .pdf, .jpg and .png graphic files, but suddenly you received a .eps graphics from your collaborator? (This actually happened to a lecturer at my university.)Well, you could always convert it manually to a .pdf yourself with GhostScript or GIMP, of course. But now the process can be automated if you're using MikTeX 2.8 or TeXLive 2009, as highlighted by Rob Hyndman.
In MikTeX 2.8, use the
epstopdf
package together with graphicx
, like so:\documentclass{article}\usepackage{graphicx,epstopdf}\begin{document}\includegraphics[width=\textwidth]{some_file}\end{document}
If all you have is
some_file.eps
, it will be automatically converted to a some_file-eps-converted-to.pdf
during the first time the LaTeX document is compiled and included in the final document output.If you're using TeXLive 2009, you don't even have to load
epstopdf
explicitly, but I say include it anyway, for portability's sake.
Great!
ReplyDeleteJust a bit wonder, why EPS is popularly used in LaTeX?
My guesses:
ReplyDelete1. Historical reasons: In the beginning there were TeX and DVI and EPS. PDF came much, much later.
2. Dislike of proprietary formats (PDF).
3. PNGs and JPEGs are raster graphic formats and doesn't measure up to professional publishing requirements. EPS and PDF support vector graphics and therefore are preferred.
4. Generating and previewing DVIs are often faster than pdflatex and previewing PDFs (especially if you're using Acrobat's products).