GeneralCannot include eps figure

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
SantoBB
Posts: 1
Joined: Tue Jun 26, 2007 2:28 pm

Cannot include eps figure

Post by SantoBB »

Hello,

I wish to include a couple of eps fiigures I made with Matlab. However, no how I compile, I always get the error: unknown file extension.eps

I use WinEdt.

My preamble looks like this

Code: Select all

%% About/help document

\documentclass[11pt]{article}
\usepackage[pdftex]{graphicx}
\usepackage{epsfig}
\usepackage{color}
\usepackage{longtable}
\usepackage[UKenglish]{babel}
\usepackage[all]{xy}

% last in preamble
\usepackage[pdftex]{hyperref}
\hypersetup{colorlinks,%
citecolor=black,%
filecolor=black,%
linkcolor=blue,%
urlcolor=blue,%
pdftex}
And I try to include the figue in the following manner:

Code: Select all

\begin{figure}[hb!] \centering
\includegraphics[width=\textwidth]{3dmodel.eps}
\end{figure}
It works fine with .jpg, .png and even .pdf, but .eps systematically refuses service. I also tried converting from eps to pdf but I'm not having too much luck with that.

The funny thing is that I used to work with eps figures, and I never had trouble with it.

Can someone help me out here?

Thanks,

Mac

Recommended reading 2024:

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

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

User avatar
countbela666
Posts: 64
Joined: Thu Apr 26, 2007 2:44 pm

Cannot include eps figure

Post by countbela666 »

Hi Mac,

as only real latex can deal with EPS graphics, you cannot use EPS files without some additional work if you want to compile via pdflatex.

There are three possibilities:
  1. externally convert your graphics files via the tool epstopdf
  2. use the epstopdf package which does (1) on the fly (this package is part of the oberdiek bundle)
  3. use the pst-pdf package (requires compiling via the shell script/batch file ps4pdf, but is much more powerful)
Some more hints concerning your code:
  • Forget about the epsfig package, this is an ancient LaTeX2.09 package which nowadays only wraps the graphicx package. So replacing it by \usepackage{graphicx} should work as well and is state of the art.
  • In 99% of cases it is not neccessary to specify an output driver. You can omit all these "pdftex" parameters in your code. If something goes wrong passing one single "pdftex" to the document class should work as well.
  • It is unneccessary and bad programming style to specify a file extension for the included graphics. (pdf)LaTeX is able to detect the correct format if the name is ambigous.
Regards
Marcel
Listen to me children of the night, beyond the doors of darkness you will find
a thousand worlds for you to see here, take my hand and follow me...
Ted
Posts: 94
Joined: Sat Jun 23, 2007 4:11 pm

Cannot include eps figure

Post by Ted »

countbela666 wrote:
  • It is unneccessary and bad programming style to specify a file extension for the included graphics. (pdf)LaTeX is able to detect the correct format if the name is ambigous.

This is a little harsh. If you're using the epstopdf package from the oberdiek bundle, specifying the extension FORCES epstopdf to generate a new PDF on each run of pdflatex.

So in that case, I think it's good to add the .eps extension (that way if you regenerate an EPS from MATLAB, for example, your PDF will be sure to be regenerated).

--Ted
-- Ted [home/blog]
User avatar
countbela666
Posts: 64
Joined: Thu Apr 26, 2007 2:44 pm

Cannot include eps figure

Post by countbela666 »

You're totally right Ted, I forgot about this case. But nevertheless I think this to be a not very common exception from the usual way of compilation. Usually you don't need to specify an extension, which moreover makes your code more portable (cf. section 7.4 of epslatex.pdf).

Regards
Marcel
Listen to me children of the night, beyond the doors of darkness you will find
a thousand worlds for you to see here, take my hand and follow me...
ADelm
Posts: 2
Joined: Thu Jan 18, 2007 3:16 pm

Cannot include eps figure

Post by ADelm »

SantoBB wrote: Hello,

I wish to include a couple of eps fiigures I made with Matlab. However, no how I compile, I always get the error: unknown file extension.eps

I use WinEdt.

It works fine with .jpg, .png and even .pdf, but .eps systematically refuses service. I also tried converting from eps to pdf but I'm not having too much luck with that.

The funny thing is that I used to work with eps figures, and I never had trouble with it.


Another solution is to compile LaTeX -> PS -> PDF, in that case the eps figures are taken into account.

Alain Delmotte
Post Reply