[texhax] EPS figures

Steve Schwartz s.schwartz at imperial.ac.uk
Mon Jun 6 18:56:19 CEST 2011


Chetty,

On Mon, 2011-06-06 at 14:40 +0100, Veerappa Chetty wrote:
> I am using pdflatex (Sumatra). Can I create a pdf file with EPS
> figure? Can I create a latex file and then convert it PDF? Thanks
> Chetty

Don't confuse the figure format (eps or whatever) with the latex engine
(pdflatex) or latex previewer (Sumatra) although these are related. If
you use pdflatex you will generate a pdf file and need a pdf viewer,
which could be Sumatra, Acrobat Reader, ghostscript, or any of several
others.

pdflatex with graphicx can't natively use \includegraphics with eps
files, but it will handle jpegs, pdfs, png's and some others.

The epstopdf package will fix this for you:

\usepackage[pdftex]{graphicx}
\usepackage{epstopdf}

and enable pdflatex to import eps files. For larger projects it makes
more sense (IMHO) to perform a one-time conversion of the eps images to
pdf, rather than have epstopdf convert the eps ones each time you
(re)run pdflatex. There are several options to do this:

epstopdf is a Perl script that will do the job. It is included in lots
of latex distributions I think. It does an excellent job. I'm not a
Windows user so I can't tell you where it is or how to invoke it, but
that would be my recommendation. It drives ghostscript but works hard to
ensure that the resulting pdf has an origin in the right place, has a
good boundingbox, etc.

ghostscript will also do it directly

almost any application that will display an eps file will also print it,
so if you install a pdf-printer that should also work. If it prints onto
an A4 or letter-size page, see if you can change the print settings, or
use a pdf toolkit (google pdfcrop for example) to crop it down. (or crop
it with options passed to \includegraphics)

use pdflatex to do it, e.g. write a latex source myfig.tex containing:

\documentclass{article}
\usepackage[pdftex]{graphicx}
\usepackage{epstopdf}
\pagestyle{plain}  % no page numbers please
\begin{document}
\includegraphics{myfig.eps}
\end{document}

(untested, but I hope you get the idea) and then crop the resulting
myfig.pdf

One final comment: there are advantages in dropping the suffix to the
image file. For example, if you convert all your .eps files to .pdf ones
using one of the above methods, you can leave both versions in the same
folder and use

\includegraphics{myfig}

Pdflatex will look for a myfig.xxx that it can handle and will find
myfig.pdf. Ordinary latex will find myfig.eps and use that.

HTH
Steve


> On Mon, Jun 6, 2011 at 9:36 AM, Goebel, Juergen
> <juergen.goebel at cassidian.com> wrote:
>         Veerappa Chetty  wrote: 
>          
>         >  I am unable to insert a EPS figure. I am able to
>         insert .jpg files using  
>         > includegraphics command. I give below my codes.  
>         >  will appreciate your help. 
>          
>         Are you using pdflatex (jpg is ok) or latex (eps is ok)?
>          
>         Regards,
>          
>         Juergen
> 
> 
> 
> -- 
> Professor of Family Medicine
> Boston University
> Tel: 617-414-6221, Fax:617-414-3345
> emails: chettyvk at gmail.com,vchetty at bu.edu
> 
-- 
+-------------------------------------------------------------------+
Professor Steven J Schwartz        Phone: +44-(0)20-7594-7660
Head, Space & Atmospheric Physics  Fax:   +44-(0)20-7594-7772
The Blackett Laboratory            E-mail: s.schwartz at imperial.ac.uk
Imperial College London            Office: Huxley 6M67A 
London SW7 2AZ, U.K.               Web: www.sp.ph.ic.ac.uk/~sjs
+-------------------------------------------------------------------+



More information about the texhax mailing list