GeneralIncluding *.eps figure in Latex

LaTeX specific issues not fitting into one of the other forums of this category.
hzmonte
Posts: 17
Joined: Sun Nov 16, 2008 8:05 am

Re: Including *.eps figure in Latex

Post by hzmonte »

I have the same "LaTeX Error: Unknown graphics extension: .eps" problem when I
\includegraphics{graph.eps}
I am a novice and I am not sure whether I am using pdflatex. I am suspecting I am (am I?), because both the latex and the pdflatex commands point to the same file in my installation:
% ls -al /opt/tetex/3.0/bin/pdflatex
lrwxrwxrwx 1 sources sources 7 Nov 30 2007 /opt/tetex/3.0/bin/pdflatex -> pdfetex*
% ls -al /opt/tetex/3.0/bin/latex
lrwxrwxrwx 1 sources sources 7 Nov 30 2007 /opt/tetex/3.0/bin/latex -> pdfetex*

In my log file I have this:

This is pdfeTeX, Version 3.141592-1.21a-2.2 (Web2C 7.5.4) (format=latex 2006.3.7) 15 NOV 2008 21:32
entering extended mode

I read that pdflatex does not work with eps. And one have to convert eps to pdf. I do not know whether the pdflatex developers considered the portability issue when they rejected the eps format. Anyway, do I
\includegraphics{graph.pdf}
in order to make it work?

P.S.
1. Is it now the best/preferred practice to convert eps into pdf and use pdflatex?
2. I am now using an older version of tex/latex and it can handle eps. But my eps does not show up in my ps output. Instead, the file name shows up in the space where the picture is supposed to be. My code is:
\usepackage{graphicx}
...
\begin{figure*}[!ht]
\begin{minipage}{3.0in}
\begin{center}
\mbox{\includegraphics[scale=0.7]{code_trans4.eps}}\\
\end{center}
\end{minipage}
\caption{Fukuda's system.}
\label{fig:fukuda_sys}
\end{figure*}

My Makefile includes:

name := my_doc
all: $(name).dvi

$(name).dvi : $(name).tex $(INC) $(CODE) $(CLS)
latex $(name); latex $(name)

full:
latex $(name); bibtex $(name); latex $(name); latex $(name); bibtex $(name); latex $(name); dvips -Pwww -t letterSize $(name).dvi

Can someone lend me a hand?

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
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Including *.eps figure in Latex

Post by localghost »

Code: Select all

LaTeX Error: Unknown graphics extension: .eps
This line tells me that you seem not to run latex on your code. But this message …

Code: Select all

This is pdfeTeX, Version 3.141592-1.21a-2.2 (Web2C 7.5.4) (format=latex 2006.3.7)  15 NOV 2008 21:32
entering extended mode
… tells me something else. The preloaded format is given as latex. Obviously a contradiction. pdfeTeX is only the standard TeX engine to be called on every compiler run. It's not the source of error.

There must be something that causes the TeX engine to produce PDF output. This is mostly given by the driver option pdftex either in the option list of the document class or one or more packages, mostly color, graphicx, hyperref or xcolor. So, check your code for the mentioned driver option. If you can't locate the error, post at least your complete preamble (using the code environment) or your complete main file as attachment.


Best regards and welcome to the board
Thorsten¹
hzmonte
Posts: 17
Joined: Sun Nov 16, 2008 8:05 am

Including *.eps figure in Latex

Post by hzmonte »

OK, I've found out why only the file name of the eps file was shown - because I used the draft mode of the documentclass! If I use the final mode, the eps can show - assumed I use the "old version" of LaTeX. Well, one problem solved.

My .tex file, which I copied from someone else, includes

Code: Select all

%\documentclass[12pt,draft]{ucithesis}
\documentclass[12pt]{ucithesis}
\usepackage{verbatim}
%
\newif\ifpdf
\ifx\pdfoutput\undefined
    \pdffalse % we are not running PDFLaTeX
\else
\pdfoutput=1 % we are running PDFLaTeX
\pdftrue
\fi
%\usepackage{url}
\usepackage{amsmath}
\usepackage{array}
\usepackage{bm}
\usepackage{boxedminipage}
\usepackage{graphicx}
\usepackage{natbib}
\usepackage{path}
\usepackage{psfrag}
\usepackage{relsize}
\usepackage{subfigure}
%\usepackage[plainpages=false]{hyperref}
%\usepackage[plainpages=true]{hyperref}
\begin{comment}
\ifpdf
    \usepackage[pdftex]{graphicx}
    \pdfinfo{
       /Title      (Runtime Support for ...)
       /Author     (Me)
    }
\usepackage[pdftex,plainpages=false,breaklinks=true,colorlinks=true,
urlcolor=blue,citecolor=blue,%
linkcolor=blue,bookmarks=true,bookmarksopen=true,%
bookmarksopenlevel=3,pdfstartview=FitV]{hyperref}
%Options with pdfstartview are FitV, FitB and FitH
\pdfcompresslevel=1
\else
\usepackage{graphicx}
\fi
\end{comment}

%\usepackage{fixltx2e}
\usepackage{amssymb} 
\usepackage{amsmath}
With the Makefile in my previous post, when I use the "new version" of LaTeX in my installation, and run "make" I have the "! LaTeX Error: Unknown graphics extension: .eps" error (and also many [Non-PDF special ignored!] warnings). I hit Enter in response to the eps error and the LaTeX program (or whatever I am running) is able to finish and generate a PDF file in which the graphic does not show. Neither an empty box nor anything except a caption "Figure 4.1: Fukuda's system." The log file reads:

Code: Select all

This is pdfeTeX, Version 3.141592-1.21a-2.2 (Web2C 7.5.4) (format=latex 2006.5.17)  16 NOV 2008 11:11
The messages displayed while LaTeX is compiling include

Code: Select all

This is pdfeTeX, Version 3.141592-1.21a-2.2 (Web2C 7.5.4)
Document Class: ucithesis 2005/01/12 UCI Thesis class
(/opt/tetex/3.0/share/texmf/tex/latex/base/report.cls
Document Class: report 2004/02/16 v1.4f Standard LaTeX document class
(/opt/tetex/3.0/share/texmf/tex/latex/base/size12.clo))
(/opt/tetex/3.0/share/texmf/tex/latex/geometry/geometry.sty
(/opt/tetex/3.0/share/texmf/tex/latex/graphics/keyval.sty)
(/opt/tetex/3.0/share/texmf/tex/latex/geometry/geometry.cfg))
(/opt/tetex/3.0/share/texmf/tex/latex/setspace/setspace.sty
Package: `setspace' 6.7 <2000/12/01>
) (/opt/tetex/3.0/share/texmf/tex/latex/hyperref/hyperref.sty
(/opt/tetex/3.0/share/texmf/tex/latex/hyperref/pd1enc.def)
(/opt/tetex/3.0/share/texmf/tex/latex/hyperref/hyperref.cfg)
Implicit mode ON; LaTeX internals redefined
(/opt/tetex/3.0/share/texmf/tex/latex/url/url.sty))
*hyperref using default driver hdvips*
(/opt/tetex/3.0/share/texmf/tex/latex/hyperref/hdvips.def
(/opt/tetex/3.0/share/texmf/tex/latex/hyperref/pdfmark.def)))
(/opt/tetex/3.0/share/texmf/tex/latex/tools/verbatim.sty)
(/opt/tetex/3.0/share/texmf/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/opt/tetex/3.0/share/texmf/tex/latex/amsmath/amstext.sty
(/opt/tetex/3.0/share/texmf/tex/latex/amsmath/amsgen.sty))
(/opt/tetex/3.0/share/texmf/tex/latex/amsmath/amsbsy.sty)
(/opt/tetex/3.0/share/texmf/tex/latex/amsmath/amsopn.sty))
(/opt/tetex/3.0/share/texmf/tex/latex/tools/array.sty)
(/opt/tetex/3.0/share/texmf/tex/latex/tools/bm.sty)
(/opt/tetex/3.0/share/texmf/tex/latex/boxedminipage/boxedminipage.sty)
(/opt/tetex/3.0/share/texmf/tex/latex/graphics/graphicx.sty
(/opt/tetex/3.0/share/texmf/tex/latex/graphics/graphics.sty
(/opt/tetex/3.0/share/texmf/tex/latex/graphics/trig.sty)
(/opt/tetex/3.0/share/texmf/tex/latex/graphics/graphics.cfg)
(/opt/tetex/3.0/share/texmf/tex/latex/graphics/pdftex.def)))
(/opt/tetex/3.0/share/texmf/tex/latex/natbib/natbib.sty)
(/opt/tetex/3.0/share/texmf/tex/generic/path/path.sty
path.sty version 3.04 <25 Jul 1992>
) (/opt/tetex/3.0/share/texmf/tex/latex/psfrag/psfrag.sty)
(/opt/tetex/3.0/share/texmf/tex/latex/relsize/relsize.sty)
(/opt/tetex/3.0/share/texmf/tex/latex/subfigure/subfigure.sty
****************************************
* Local config file subfigure.cfg used *
****************************************
(/opt/tetex/3.0/share/texmf/tex/latex/subfigure/subfigure.cfg))
(/opt/tetex/3.0/share/texmf/tex/latex/amsfonts/amssymb.sty
(/opt/tetex/3.0/share/texmf/tex/latex/amsfonts/amsfonts.sty))
(./ming_dissert.aux

LaTeX Warning: Label `sect:binding' multiply defined.

)

Package hyperref Warning:  draft mode on.

(/opt/tetex/3.0/share/texmf/tex/latex/hyperref/nameref.sty)
(/opt/tetex/3.0/share/texmf/tex/context/base/supp-pdf.tex
(/opt/tetex/3.0/share/texmf/tex/context/base/supp-mis.tex
loading : Context Support Macros / Miscellaneous (2004.10.26)
)
loading : Context Support Macros / PDF (2004.03.26)
) [1
Non-PDF special ignored!
Non-PDF special ignored!
Non-PDF special ignored!
Non-PDF special ignored!{/opt/tetex/3.0/share/texmf-var/fonts/map/pdftex/updmap
/pdftex.map}] (/opt/tetex/3.0/share/texmf/tex/latex/base/omscmr.fd)
When I switch to an "old version" of LaTeX (or whatever it is), there is neither the "Unknown graphics extension: .eps" error nor any "[Non-PDF special ignored!]"warning. Simply running "make" does not generate any ps or pdf file. I need to do a "make full" and a ps file is generated. The messages displayed during compilation reads partly:

Code: Select all

This is TeX, Version 3.14159 (Web2C 7.3.1)
(ming_dissert.tex
LaTeX2e <1999/12/01> patch level 1
Babel <v3.6Z> and hyphenation patterns for american, french, german, ngerman, n
ohyphenation, loaded.
(ucithesis.cls
Document Class: ucithesis 2005/01/12 UCI Thesis class
(/opt/contrib/teTeX-1.0.7/texmf/tex/latex/base/report.cls
Document Class: report 1999/09/10 v1.4a Standard LaTeX document class
(/opt/contrib/teTeX-1.0.7/texmf/tex/latex/base/size12.clo))
(/opt/contrib/teTeX-1.0.7/texmf/tex/latex/misc/geometry.sty
(/opt/contrib/teTeX-1.0.7/texmf/tex/latex/graphics/keyval.sty)
(/opt/contrib/teTeX-1.0.7/texmf/tex/latex/config/geometry.cfg))
(/opt/contrib/teTeX-1.0.7/texmf/tex/latex/misc/setspace.sty
Package: `setspace' 6.4 <1998/11/26>
) (/opt/contrib/teTeX-1.0.7/texmf/tex/latex/hyperref/hyperref.sty
(/opt/contrib/teTeX-1.0.7/texmf/tex/latex/hyperref/pd1enc.def)
Implicit mode ON; LaTeX internals redefined
(/opt/contrib/teTeX-1.0.7/texmf/tex/latex/misc/url.sty))
*hyperref using default driver hypertex*
(/opt/contrib/teTeX-1.0.7/texmf/tex/latex/hyperref/hypertex.def))
The log file partly reads:

Code: Select all

This is TeX, Version 3.14159 (Web2C 7.3.1) (format=latex 2001.8.20)  16 NOV 2008 11:33
**ming_dissert
(ming_dissert.tex
LaTeX2e <1999/12/01> patch level 1
Babel <v3.6Z> and hyphenation patterns for american, french, german, ngerman, n
ohyphenation, loaded.
(ucithesis.cls
Document Class: ucithesis 2005/01/12 UCI Thesis class
(/opt/contrib/teTeX-1.0.7/texmf/tex/latex/base/report.cls
Document Class: report 1999/09/10 v1.4a Standard LaTeX document class
(/opt/contrib/teTeX-1.0.7/texmf/tex/latex/base/size12.clo
File: size12.clo 1999/09/10 v1.4a Standard LaTeX file (size option)
)
\c@part=\count79
\c@chapter=\count80
\c@section=\count81
\c@subsection=\count82
\c@subsubsection=\count83
\c@paragraph=\count84
\c@subparagraph=\count85
\c@figure=\count86
\c@table=\count87
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
(/opt/contrib/teTeX-1.0.7/texmf/tex/latex/misc/geometry.sty
Package: geometry 1999/10/07 v2.2 Page Geometry

(/opt/contrib/teTeX-1.0.7/texmf/tex/latex/graphics/keyval.sty
Package: keyval 1999/03/16 v1.13 key=value parser (DPC)
\KV@toks@=\toks14
)
\geom@cnth=\count88
\geom@cntv=\count89

(/opt/contrib/teTeX-1.0.7/texmf/tex/latex/config/geometry.cfg))
(/opt/contrib/teTeX-1.0.7/texmf/tex/latex/misc/setspace.sty
Package: setspace 1998/11/26 6.4 Contributed and Supported LaTeX2e package

Package: `setspace' 6.4 <1998/11/26>
) (/opt/contrib/teTeX-1.0.7/texmf/tex/latex/hyperref/hyperref.sty  
Package: hyperref 2000/01/22 v6.69c Hypertext links for LaTeX
\@linkdim=\dimen103
\Hy@linkcounter=\count90
\Hy@pagecounter=\count91

(/opt/contrib/teTeX-1.0.7/texmf/tex/latex/hyperref/pd1enc.def
File: pd1enc.def 1999/10/05 v0.6 PDFDocEncoding (Heiko Oberdiek)
)
Package hyperref Info: Option `draft' set `true' on input line 1408.
Package hyperref Info: Option `plainpages' set `false' on input line 1408.
Package hyperref Info: Bookmarks ON on input line 1459.
Package hyperref Info: Hyper figures OFF on input line 1478.
Package hyperref Info: Link nesting OFF on input line 1483.
Package hyperref Info: Hyper index ON on input line 1486.
Package hyperref Info: Plain pages OFF on input line 1493. 
Package hyperref Info: Backreferencing OFF on input line 1498.

Implicit mode ON; LaTeX internals redefined
The ps file generated shows the eps.

I am running all this on the same Solaris 10/UltraSparc machine.
User avatar
T3.
Posts: 208
Joined: Fri Mar 14, 2008 12:58 pm

Including *.eps figure in Latex

Post by T3. »

hzmonte wrote:My .tex file, which I copied from someone else, includes

Code: Select all

%[snip]
\newif\ifpdf
\ifx\pdfoutput\undefined
    \pdffalse % we are not running PDFLaTeX
\else
\pdfoutput=1 % we are running PDFLaTeX
\pdftrue
\fi
%[snip]
I expected to see this in your preamble. This is old, poorly designed code that doesn't work properly with newer TeX installations (defaulting to pdfTeX engine). Use ifpdf package instead.

Cheers,

Tomek
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Including *.eps figure in Latex

Post by localghost »

These old fashioned if/else branches are not needed any more. Modern versions of the packages are able to detect the compiler version which is processing the code. You should think carefully about what you want to do in your document and which packages are needed to get the desired result. Omit superfluous packages and restructure your preamble. Taking over just a template from another person can cause problems like these if you don't have the slightest idea of what the code is doing.
hzmonte
Posts: 17
Joined: Sun Nov 16, 2008 8:05 am

Re: Including *.eps figure in Latex

Post by hzmonte »

So, I should remove the whole \if block? Are you saying that the latest packages are not backward compatible with the old style LaTeX document so that an error is generated?

Given that I am not and do not inspire to become a professional typesetter or someone trying a make a living out of writing LaTex, I think it can be expected that I can only afford taking over a template from someone and not having the slightest idea of what many parts of the code is doing, while just trying to get a PS/PDF output. To be frank, learning LaTeX is just a necessary evil in order to publish things that I really inspire to be an expert in. I think this is exactly the reality faced by many, if not most, LaTeX users. If you were me, would you invest your time improving a LaTeX document, by omitting superfluous packages for example, or improving your 'real' work? I have already had a hard time keeping up with the stuff in my field. That would really be a luxury if I have to keep current with the latest development in LaTeX.

Hopefully if you can help me get this right, then the next guy who take over my template would save some time by not posting a post here.
Thank you in advance.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Including *.eps figure in Latex

Post by localghost »

hzmonte wrote:[...] So, I should remove the whole \if block? Are you saying that the latest packages are not backward compatible with the old style LaTeX document so that an error is generated? [...]
LaTeX packages are under continuous development. The most templates are not properly maintained to be up to date in combination with obsolete commands. Hence there can be problems when old templates use packages in modern version. This is what you experienced. You can see some suggestions in the code below.
hzmonte wrote:[...] Given that I am not and do not inspire to become a professional typesetter or someone trying a make a living out of writing LaTex, I think it can be expected that I can only afford taking over a template from someone and not having the slightest idea of what many parts of the code is doing, while just trying to get a PS/PDF output. To be frank, learning LaTeX is just a necessary evil in order to publish things that I really inspire to be an expert in. I think this is exactly the reality faced by many, if not most, LaTeX users. If you were me, would you invest your time improving a LaTeX document, by omitting superfluous packages for example, or improving your 'real' work? I have already had a hard time keeping up with the stuff in my field. That would really be a luxury if I have to keep current with the latest development in LaTeX. [...]
Nobody demanded that you become an expert. All I wanted to point out is that using a template from somebody else can cost the same or more time to sort out occurring problems than building your own preamble with a very basic structure and only add packages if additional features are needed. That's the way I build my documents. And I do so since I wrote my first document with the help of good literature some years ago. If you intend to do future projects with LaTeX, you should think about acquiring a book or read some other basic documentation. The first topic in the LaTeX»General forum may give some good examples.
hzmonte wrote:[...] Hopefully if you can help me get this right, then the next guy who take over my template would save some time by not posting a post here. [...]
Of cause I will. As I suggested in an earlier post, a restructuring of the preamble would be good. I did some cleaning and reduced the preamble to the (in my opinion) most important packages.

Code: Select all

\documentclass[12pt]{ucithesis}
\usepackage{fixltx2e}                          % Some enhancements to the LaTeX kernel
\usepackage[T1]{fontenc}                       % Cork Encoding
\usepackage[latin1]{inputenc}                  % Input encoding for direct input of special (national) characters
%\usepackage[english]{babel}                    % Enable your language
\usepackage{amsmath}                           % Enhanced typesetting of mathematics
\usepackage{amssymb}                           % Mathematical symbols by AMS-LaTeX
\usepackage{array,booktabs,dcolumn}            % Enhancement of tables
\usepackage[font=small,labelfont=bf]{caption}  % Customizing float captions
%\usepackage[font=footnotesize]{subcaption}     % Creating subfigures, supersedes package "subfigure"
\usepackage{graphicx}                          % Including external graphics files
\usepackage{natbib}                            % BibTeX bibliography style
\usepackage[
  plainpages=false,
  breaklinks=true,
  colorlinks=true,
  urlcolor=blue,
  citecolor=blue,
  linkcolor=blue,
  bookmarks=true,
  bookmarksopen=true,
  bookmarksopenlevel=3,
  pdfstartview=FitV
]{hyperref}                                    % Activate hyperlinks
As you can see, I have deleted some packages were I was not sure if they are really needed. The code should be compilable with latex and include your EPS graphics files. If you face any problems, post the complete log file here as attachment and we will see which packages have to be added again. Please refer to the documentations of the used packages to get a little bit familiar with their features. You can find them on CTAN.
hzmonte
Posts: 17
Joined: Sun Nov 16, 2008 8:05 am

Including *.eps figure in Latex

Post by hzmonte »

You commented out the subcaption and babel packages because they are not that important?
Latex complaints "! LaTeX Error: Option clash for package hyperref." if I use the hyperref options you indicated.
Back to one of the questions in my original post, is it now the preferred practice to use pdf instead of eps and let pdflatex handle it?
And what is the implication that both latex and pdflatex point to the same executable:

Code: Select all

% ls -al /opt/tetex/3.0/bin/pdflatex
lrwxrwxrwx 1 sources sources 7 Nov 30 2007 /opt/tetex/3.0/bin/pdflatex -> pdfetex*
% ls -al /opt/tetex/3.0/bin/latex
lrwxrwxrwx 1 sources sources 7 Nov 30 2007 /opt/tetex/3.0/bin/latex -> pdfetex
Last edited by hzmonte on Sat Nov 22, 2008 4:13 am, edited 1 time in total.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Including *.eps figure in Latex

Post by localghost »

hzmonte wrote:You commented out the subcaption and babel packages because they are not that important? [...]
I don't exactly know what the language of your document will be. So I set the line with babel as comment. And you are the only one to know if you are creating subfigures. So I set the line with subcaption also as comment.
hzmonte wrote:[...] Back to one of the questions in my original post, is it now the preferred practice to use pdf instead of eps and let pdflatex handle it? [...]
That depends a little bit on the format of the final output and the format of the graphics files input.
  • PDF as final output format.
    • If your graphics files are all in EPS format, it is better to compile with latex and so take the compiling route "LaTeX (=> DVI) => PS => PDF".
    • In the case that not all of the graphics have EPS format and a minor part has another one (JPG, PNG, ...), it can be better to convert those few files to EPS and take the same compiling route as above.
    • With the major part as pixel based graphics files (JPG, PNG) and only a few EPS files, the EPS files should be converted to PDF and the compilation process is done directly with pdflatex.
    Note that there is always the possibility to convert EPS files to PDF with epstopdf or "on the fly" with the epstopdf package.
  • Final output is not PDF but DVI or PS.
    • Compile with latex and provide all graphics files in EPS format.
hzmonte wrote:[...] And what is the implication that both latex and pdflatex point to the same executable [...]
As I stated earlier, pdfeTeX is only the engine to compile the document. The output is controlled by parameters it is called with. latex passes other parameters to this engine than pdflatex. So, you don't have to bother about these symbolic links to the same executable. But you can check in the shell where the executables are located.

Code: Select all

which latex
which pdflatex
Since you seem to use two different LaTeX systems (Web2C 7.5.4 and Web2C 7.3.1), these pointers and symbolic links may differ. Moreover the older system uses TeX as engine and the newer one uses PDFeTeX. You should be aware of that.
hzmonte
Posts: 17
Joined: Sun Nov 16, 2008 8:05 am

Option clash for package hyperref

Post by hzmonte »

Latex complaints "! LaTeX Error: Option clash for package hyperref." if I use the hyperref options you indicated.
Post Reply