Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Convert latex/dvipdf (.eps graphics) projects to pdflatex (.pdf graphics)

327 views
Skip to first unread message

Michael Friendly

unread,
Jan 3, 2012, 12:16:18 PM1/3/12
to
[Environment: debian linux, texlive 2009-7]

I have several legacy projects (books, papers, beamers) with many
graphics files in .eps format (or converted to .eps via command line
tools) that were compiled using the latex/dvipdf(m) route.

This is now limiting in that .ps/.eps doesn't support transparent
colors and it is now easier for me to generate new graphics in .pdf
in many applications.

So, I'd like to find an easy workflow to convert an old project from
using .eps graphics to .pdf so it can compile using pdflatex.
Other considerations are to preserve graphic resolution in the
conversion and not generate excessively huge graphics file sizes.

Two ways I can think of are

- use command line tools or scripts, e.g., using ImageMagik/convert
- use \DeclareGraphicsRule in my .tex, but I can't figure out how to
supply arguments {read-file} to get the bounding box info and {command}
to do the conversion.

thanks,
-Michael

William F Hammond

unread,
Jan 3, 2012, 7:12:42 PM1/3/12
to
Michael Friendly <frie...@yorku.ca> writes:

> I have several legacy projects (books, papers, beamers) with many
> graphics files in .eps format (or converted to .eps via command line
> tools) that were compiled using the latex/dvipdf(m) route.

If .eps is the original graphic, from the command line
use: epstopdf figX.eps

Otherwise, pdflatex handles .pdf, .png, and .jpg images.

In LaTeX source:

\usepackage{graphicx}
...
\includegraphics{figX} % no subscript

For more see

http://www.tex.ac.uk/cgi-bin/texfaq2html?label=pdftexgraphics

-- Bill

Herbert Schulz

unread,
Jan 3, 2012, 7:53:05 PM1/3/12
to
In article <i7vcosz...@hilbert.math.albany.edu>,
Howdy,

In recent TeX Live distributions (and maybe MikTeX?) the default
configuration is to allow restricted shell escape. This allows a
restricted version of epstopdf to be called (even without shell escape
enabled) that automatically does a file.eps->file-eps-converted-to.pdf
conversion (I believe it needs gs in the end) and then includes the
latter automatically. Just use the graphicx package. Makes eps inclusion
using pdflatex sort of transparent.

Good Luck,
Herb Schulz

Henning Haida

unread,
Jan 4, 2012, 10:16:36 AM1/4/12
to
Am 03.01.2012 18:16, schrieb Michael Friendly:
> So, I'd like to find an easy workflow to convert an old project from
> using .eps graphics to .pdf so it can compile using pdflatex.

epstopdf (command line) does this and, if you like, the package with the
same name, epstopdf, does it automatically.
http://mirror.ctan.org/macros/latex/contrib/oberdiek/epstopdf.pdf

Michael Friendly

unread,
Jan 4, 2012, 12:19:09 PM1/4/12
to Henning Haida
Thanks for pointing this out. epstopdf.sty seems to work like a charm,
and generates .pdf files that are smaller in size than the original .eps
and don't seem to suffer in terms of resolution. Plus it skips
converting files where I also had a .jpg version.

The only wrinkle was that for a beamer presentation, using

\documentclass[10pt,xcolor,dvipssnames,table]{beamer}
\usepackage[pdftex]{graphicx}
\usepackage{epstopdf}

I got

! LaTeX Error: Option clash for package graphicx.

since graphicx was already loaded by beamer. Commenting out that
\usepackage line fixed it.

best,
-Michael

Dan

unread,
Jan 4, 2012, 1:52:32 PM1/4/12
to
On Jan 3, 11:16 am, Michael Friendly <frien...@yorku.ca> wrote:
> [Environment: debian linux, texlive 2009-7]
>
> I have several legacy projects (books, papers, beamers) with many
> graphics files in .eps format (or converted to .eps via command line
> tools) that were compiled using the latex/dvipdf(m) route.

dvipdfm (though not necessarily dvipdf) works best with pdf
figures. In fact, it converts eps figures to pdf on the fly using
whatever method is laid out in its config file.

>
> This is now limiting in that .ps/.eps doesn't support transparent
> colors and it is now easier for me to generate new graphics in .pdf
> in many applications.

Thus even using your present latex+dvipdfm, converting the
eps to pdf would be (have been) helpful.

>
> So, I'd like to find an easy workflow to convert an old project from
> using .eps graphics to .pdf so it can compile using pdflatex.
> Other considerations are to preserve graphic resolution in the
> conversion and not generate excessively huge graphics file sizes.
>
> Two ways I can think of are
>
> - use command line tools or scripts, e.g., using ImageMagik/convert

I would convert all legacy eps figures to pdf with command
line tools. Generally one can convert all figures in a directory
in one go. Perhaps it is safest to keep the original eps around for
reference.

> - use \DeclareGraphicsRule in my .tex, but I can't figure out how to
> supply arguments {read-file} to get the bounding box info and {command}
> to do the conversion.

As mentioned, it is possible with the epstopdf package to do
on-the-fly conversion. If configured to keep the resultant pdf
and to not convert when the pdf already exists, you will have
eventually converted all the figures, and be using only the pdf
versions.

\DeclareGraphicsRule can pass instructions to dvips to
uncompress .eps.gz. (Even this seems unnecessary as
ghostscript seems able to read gzip compressed files on its
own.) I have had little success acomplishing any other
conversions by this means. I don't think pdflatex can apply
external tools it without the help of epstopdf.sty or its
equivalent.


Dan

Henning Haida

unread,
Jan 4, 2012, 5:32:49 PM1/4/12
to
Am 04.01.2012 18:19, schrieb Michael Friendly:
> \documentclass[10pt,xcolor,dvipssnames,table]{beamer}
> \usepackage[pdftex]{graphicx}
> \usepackage{epstopdf}
>
> I got
>
> ! LaTeX Error: Option clash for package graphicx.

\usepackage{graphicx}

should work in all cases. AFAIK it is recommended to omit any driver option.

Heiko Oberdiek

unread,
Jan 4, 2012, 7:57:31 PM1/4/12
to
No, it depends on the driver. Some can be detected at TeX macro level
(pdfTeX, XeTeX, LuaTeX, VTeX). Other drivers are run *after* the
TeX run and can't be detected at TeX macro level (dvips, dvipdfm,
dvipdfmx, dvipsone, ...).
--
Heiko Oberdiek
0 new messages