Generalpdflatex graphics problem

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
dmt
Posts: 82
Joined: Sat Mar 15, 2008 8:13 pm

pdflatex graphics problem

Post by dmt »

I'm having a weird problem which seems to have "suddenly" appeared.

I am using LEd on Windows to generate pdf files from latex. I am trying to include .eps images in my file. It works fine when I generate a dvi file, and I can see the result, but all attempts to generate a pdf with pdflatex (or from the dvi) fail because it says suddenly it can't find the graphics file.

Here is my code:

Code: Select all

\begin{figure}[h]
\includegraphics[trim=2.8cm 1.5cm 3cm 1.3cm, clip=true, scale=.8]{newclock}
\end{figure}
The error I get is that it can't find "newclock" not "newclock.eps". If I add the .eps extension explicitly it says that .eps is not a recognized graphics type. I don't get these problems at all when generating the DVI file.

And the weirdest part is I am pretty sure this was working a day or two ago, although I've been messing around with so many graphics types I could be remembering wrong.

Anyone have any suggestions?

Also, if I add this line:

Code: Select all

\DeclareGraphicsExtensions{.eps}
I also get the error ".eps not a recognized graphics extension".

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Re: pdflatex graphics problem

Post by Stefan Kottwitz »

Hi dmt,

pdflatex cannot embed eps files directly. You could go the way tex->dvi->ps->pdf or, alternatively, convert the eps files with eps2pdf or epstopf into pdf format for use with pdflatex.

Stefan
balf
Posts: 158
Joined: Sat Jan 12, 2008 1:11 am

Re: pdflatex graphics problem

Post by balf »

It's impossible that it worked : pdflatex can't use eps.files because the pdf format is only a subset of postscript ; in particular, it lacks a computing engine, required by postscript. What you can do is converting your .eps files to pdf (with the same name) That way, whn you compile via dvi+dvips, it will use the eps file, and when using pdflatex, it will use the pdf one. You can use epstopdf to do the conversion (it's a gui interface to ghostscript, dedicated to that job.
dmt
Posts: 82
Joined: Sat Mar 15, 2008 8:13 pm

Re: pdflatex graphics problem

Post by dmt »

Okay. Would I then be better off going with png files? I'm using a geometry program that can output eps or png files (possibly even something called pstricks, though I have no idea what that is).

If I go with png so I have do some weird bounding box stuff to make it work? I'm really new to the whole image thing.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Re: pdflatex graphics problem

Post by Stefan Kottwitz »

Hi dmt,

png maybe easier, but you should get better quality if you output eps and convert it to pdf using eps2pdf or epstopdf, sometimes already included in a latex distribution.
The reason is, that png is a bitmap graphic format, with fixed resolution, but eps and pdf can contain vector graphics and can be scaled without quality loss.
Just try both ways and compare for yourself - my choice would probably be eps and converting to pdf, depending on the content of the graphics of course - i would do that for geometry but not for photos.

Stefan
balf
Posts: 158
Joined: Sat Jan 12, 2008 1:11 am

Re: pdflatex graphics problem

Post by balf »

Well, one advantage of eps is that it is a vector format; you can zoom your image at will. If it also outputs pstricks, you can manually correct your file. Pstricks is a sort of interface between LaTeX and PostScript ; it is understood only by LaTeX, not pdfLaTeX (at least directly). So you have commands like \pscircle, \psparabola and a lot of other ones. You should take a look at their site, where you'll find many examples of the possibilities:
http://www.tug.org/applications/PSTricks/

B.A.
dmt
Posts: 82
Joined: Sat Mar 15, 2008 8:13 pm

Re: pdflatex graphics problem

Post by dmt »

Thanks for all the replies. I was able to convert latex to ps and then ps to pdf and don't seem to have any quality problems.

I might look into the epstopdf idea as well, though the ps step seems okay for now.

Thanks again for the help.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

pdflatex graphics problem

Post by localghost »

The process of converting EPS files to PDF described by Stefan_K with epstopdf can be done "on the fly" with the epstopdf package from the oberdiek bundle.


Best regards
Thorsten¹
Post Reply