Graphics, Figures & TablesEPS in XeLaTeX

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
pash
Posts: 3
Joined: Sun Mar 21, 2010 12:27 pm

EPS in XeLaTeX

Post by pash »

Hi experts,

I ran into a problem with including EPS figures into docs compiled with xelatex. The problem seems very common, but I am a bit confused.

I know, it was not possible to include EPS into PDF with pdflatex or dvipdf.

But about a year ago I've started to use xelatex (TeX Live 2008, installed as Full for Linux (Slackware) i386 from original DVD from CTAN). I have no problem with including EPS exported from OpenOfiice Draw into my docs compiled on this machine. Here is a complete set of usepackages in my preambles.

Code: Select all

\documentclass[12pt,a4paper,titlepage]{paper}
\usepackage[cm-default]{fontspec} 
\usepackage{xunicode}
\usepackage{xltxtra}
\usepackage{polyglossia}
…
\usepackage{afterpage}
\usepackage{color}
…
\usepackage[xetex]{hyperref}
…
\usepackage{verbatim}
\usepackage{calc}
\usepackage{lipsum}
\usepackage[table]{xcolor}
\usepackage{multirow}
\usepackage{rotating}
\usepackage{booktabs}
\usepackage{fancyhdr}
\usepackage[TABBOTCAP,loose,SF,scriptsize]{subfigure} % Yep, I know, it's obsolette :)
\usepackage{xtab}
Inserting this snippet I realized that I even have niether graphicx nor graphics package included. Well, I wrote about 20 documents, compiled with xelatex on that machine, with EPS included in them, each time thinking ‘Thank you, xelatex developers, this cauchemar with pre-converting EPS to something supported is now over!’

But yesterday I have installed TeXlive 2009 on my home machine (Linux Ubuntu i386. I first deleted all TeX packages installed by system and then set up full TeXLive 2009 from a DVD image). I took the same document, an exact copy of its directory with images and all inside. And xelatex tells me ‘! Unable to load picture or PDF file './images/logo-color.eps'’

I spent a good deal of time to google this out, but most answers I found say it is not possible to include EPS into PDF, compiled either with xelatex or pdflatex. But it can not be a correct answer since I can do so on my work machine!

I've also double-checked the file properties, owner, group, permissions—looks correct.
Last edited by pash on Sun Mar 21, 2010 3:07 pm, edited 1 time in total.

Recommended reading 2024:

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

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

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

EPS in XeLaTeX

Post by localghost »

pash wrote:[…] I spent a good deal of time to google this out, but most answers I found say it is not possible to include EPS into PDF, compiled either with xelatex or pdflatex. But it can not be a correct answer since I can do so on my work machine! […]
I find it hard to believe that. You can convert your EPS file to PDF with the command line tool epstopdf or »on the fly« with the epstopdf package. Note the instructions in the manual. The forum search will yield more useful results.


Best regards and welcome to the board
Thorsten
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

EPS in XeLaTeX

Post by frabjous »

pash wrote: I spent a good deal of time to google this out, but most answers I found say it is not possible to include EPS into PDF, compiled either with xelatex or pdflatex. But it can not be a correct answer since I can do so on my work machine!
Your work machine seems to be located in a parallel universe. Cool job.

Are you sure that you don't just happen to have multiple versions of the same images saved in the same directories on your work machine, only with different extensions, so that when you compile with XeLaTeX, it's choosing a different extension? (This could have happened, e.g., if you had ever run with epstopdf.)

In any case, Thorsten's advice should cover your needs.
pash
Posts: 3
Joined: Sun Mar 21, 2010 12:27 pm

EPS in XeLaTeX

Post by pash »

First thank you for the advice about epstopdf. Though I tried to just include \usepackage{epstopdf} on my home machine and got ‘Package epstopdf Warning: Other drivers than `pdftex.def' are not supported.’

I definitely should've first read the docs :)

But
frabjous wrote: Your work machine seems to be located in a parallel universe. Cool job.

Are you sure that you don't just happen to have multiple versions of the same images saved in the same directories on your work machine, only with different extensions, so that when you compile with XeLaTeX, it's choosing a different extension? (This could have happened, e.g., if you had ever run with epstopdf.)
Thank you for such a nice compliment to my job, but what I described is really true :) I've just checked if I was not drunk and there were no files in another format on my work machine (I can access it from home). Even if there were, copying the whole directory of a document would have given me the same result at home.

Is there a way to prove this? Even not to prove, but to research a bit what happens.

Here is a piece of xelatex output from the work machine. Maybe someone will be so kind to spend a bit of time and try to understand what happens. I tried myself but have not succeeded a lot by now.

Code: Select all

 xelatex ./main.tex
This is XeTeXk, Version 3.1415926-2.2-0.999.6 (Web2C 7.5.7)
 %&-line parsing enabled.
entering extended mode
(./main.tex
LaTeX2e <2005/12/01>
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, german-x-2008-06-18, ngerman-x-2008-06-18, ancientgreek, ibycus, ar
abic, basque, bulgarian, catalan, pinyin, coptic, croatian, czech, danish, dutc
h, esperanto, estonian, farsi, finnish, french, galician, german, ngerman, mono
greek, greek, hungarian, icelandic, indonesian, interlingua, irish, italian, la
tin, mongolian, mongolian2a, bokmal, nynorsk, polish, portuguese, romanian, rus
sian, sanskrit, serbian, slovak, slovenian, spanish, swedish, turkish, ukenglis
h, ukrainian, uppersorbian, welsh, loaded.
(/usr/local/texlive/2008/texmf-dist/tex/latex/paper/paper.cls
Document Class: paper 2008/05/30 1.0l LaTeX document class (wm).
(/usr/local/texlive/2008/texmf-dist/tex/latex/base/size12.clo))
(/usr/local/texlive/2008/texmf-dist/tex/xelatex/fontspec/fontspec.sty
(/usr/local/texlive/2008/texmf-dist/tex/generic/ifxetex/ifxetex.sty)
(/usr/local/texlive/2008/texmf-dist/tex/latex/tools/calc.sty)
(/usr/local/texlive/2008/texmf-dist/tex/latex/xkeyval/xkeyval.sty
(/usr/local/texlive/2008/texmf-dist/tex/generic/xkeyval/xkeyval.tex
(/usr/local/texlive/2008/texmf-dist/tex/generic/xkeyval/keyval.tex)))
fontspec.cfg loaded.
(/usr/local/texlive/2008/texmf-dist/tex/xelatex/fontspec/fontspec.cfg))
(/usr/local/texlive/2008/texmf-dist/tex/xelatex/xunicode/xunicode.sty)
(/usr/local/texlive/2008/texmf-dist/tex/xelatex/xltxtra/xltxtra.sty
(/usr/local/texlive/2008/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/local/texlive/2008/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/local/texlive/2008/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/local/texlive/2008/texmf/tex/latex/config/graphics.cfg)
(/usr/local/texlive/2008/texmf-dist/tex/xelatex/xetex-def/xetex.def)))
(/usr/local/texlive/2008/texmf-dist/tex/latex/etex-pkg/etex.sty)
(/usr/local/texlive/2008/texmf-dist/tex/latex/base/fixltx2e.sty))
(/usr/local/texlive/2008/texmf-dist/tex/xelatex/polyglossia/polyglossia.sty
(/usr/local/texlive/2008/texmf-dist/tex/latex/etoolbox/etoolbox.sty))
(/usr/local/texlive/2008/texmf-dist/tex/xelatex/polyglossia/gloss-english.ldf)
(/usr/local/texlive/2008/texmf-dist/tex/xelatex/polyglossia/gloss-russian.ldf)
\@input{definitions.aux}
(./definitions.tex)
(/usr/local/texlive/2008/texmf-dist/tex/latex/tools/afterpage.sty)
(/usr/local/texlive/2008/texmf-dist/tex/latex/graphics/color.sty
(/usr/local/texlive/2008/texmf/tex/latex/config/color.cfg))
(/usr/local/texlive/2008/texmf-dist/tex/latex/hyperref/hyperref.sty
(/usr/local/texlive/2008/texmf-dist/tex/generic/oberdiek/ifpdf.sty)
(/usr/local/texlive/2008/texmf-dist/tex/generic/oberdiek/ifvtex.sty)
(/usr/local/texlive/2008/texmf-dist/tex/latex/oberdiek/hycolor.sty
(/usr/local/texlive/2008/texmf-dist/tex/latex/oberdiek/xcolor-patch.sty))
(/usr/local/texlive/2008/texmf-dist/tex/latex/hyperref/pd1enc.def)
(/usr/local/texlive/2008/texmf-dist/tex/generic/oberdiek/etexcmds.sty
(/usr/local/texlive/2008/texmf-dist/tex/generic/oberdiek/infwarerr.sty))
(/usr/local/texlive/2008/texmf-dist/tex/xelatex/xetexconfig/hyperref.cfg)
(/usr/local/texlive/2008/texmf-dist/tex/latex/oberdiek/kvoptions.sty)
Implicit mode ON; LaTeX internals redefined
(/usr/local/texlive/2008/texmf-dist/tex/latex/ltxmisc/url.sty)
(/usr/local/texlive/2008/texmf-dist/tex/generic/oberdiek/bitset.sty
(/usr/local/texlive/2008/texmf-dist/tex/generic/oberdiek/intcalc.sty)
(/usr/local/texlive/2008/texmf-dist/tex/generic/oberdiek/bigintcalc.sty
(/usr/local/texlive/2008/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty)))
(/usr/local/texlive/2008/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty)
(/usr/local/texlive/2008/texmf-dist/tex/generic/oberdiek/atbegshi.sty))
*hyperref using driver hdvipdfm*
(/usr/local/texlive/2008/texmf-dist/tex/latex/hyperref/hdvipdfm.def)

Package hyperref Warning: Option `bookmarks' has already been used,
(hyperref)                setting the option has no effect on input line 59.

(/usr/local/texlive/2008/texmf-dist/tex/latex/tools/verbatim.sty)
(/usr/local/texlive/2008/texmf-dist/tex/latex/lipsum/lipsum.sty)
(/usr/local/texlive/2008/texmf-dist/tex/latex/xcolor/xcolor.sty
(/usr/local/texlive/2008/texmf/tex/latex/config/color.cfg)
(/usr/local/texlive/2008/texmf-dist/tex/latex/colortbl/colortbl.sty
(/usr/local/texlive/2008/texmf-dist/tex/latex/tools/array.sty)))
(/usr/local/texlive/2008/texmf-dist/tex/latex/multirow/multirow.sty)
(/usr/local/texlive/2008/texmf-dist/tex/latex/rotating/rotating.sty
(/usr/local/texlive/2008/texmf-dist/tex/latex/base/ifthen.sty))
(/usr/local/texlive/2008/texmf-dist/tex/latex/booktabs/booktabs.sty)
(/usr/local/texlive/2008/texmf-dist/tex/latex/fancyhdr/fancyhdr.sty)
(/usr/local/texlive/2008/texmf-dist/tex/latex/subfigure/subfigure.sty
****************************************
* Local config file subfigure.cfg used *
****************************************
(/usr/local/texlive/2008/texmf-dist/tex/latex/subfigure/subfigure.cfg))
(/usr/local/texlive/2008/texmf-dist/tex/latex/xtab/xtab.sty) (./main.aux

LaTeX Warning: Label `fig:solution-one-fw-two-bgp' multiply defined.


LaTeX Warning: Label `tab:solution1-equip' multiply defined.

) (/usr/local/texlive/2008/texmf-dist/tex/latex/hyperref/nameref.sty
(/usr/local/texlive/2008/texmf-dist/tex/latex/oberdiek/refcount.sty))
(./main.out) (./main.out) (./title.tex <./images/logo-color.eps>) [1]
(./main.toc) [2] (./problem-descr.tex) [3] (./tech-solutions.tex
(./solution1-one-fw.tex <./images/schemes/one-fw-two-routers.eps> [4] [5]
[6]
Underfull \hbox (badness 10000) in paragraph at lines 68--69
[]|\U/CMUSansSerif(0)/m/n/10.95 SRX650 devices, which are
And here is what happens on my home machine

Code: Select all

xelatex ./main.tex
This is XeTeX, Version 3.1415926-2.2-0.9995.2 (TeX Live 2009)
entering extended mode
(./main.tex
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, german-x-2009-06-19, ngerman-x-2009-06-19, ancientgreek, ibycus, ar
abic, basque, bulgarian, catalan, pinyin, coptic, croatian, czech, danish, dutc
h, esperanto, estonian, farsi, finnish, french, galician, german, ngerman, mono
greek, greek, hungarian, icelandic, indonesian, interlingua, irish, italian, ku
rmanji, latin, latvian, lithuanian, mongolian, mongolian2a, bokmal, nynorsk, po
lish, portuguese, romanian, russian, sanskrit, serbian, slovak, slovenian, span
ish, swedish, turkish, ukenglish, ukrainian, uppersorbian, welsh, loaded.
(/usr/local/texlive/2009/texmf-dist/tex/latex/paper/paper.cls
Document Class: paper 2008/05/30 1.0l LaTeX document class (wm).
(/usr/local/texlive/2009/texmf-dist/tex/latex/base/size12.clo))
(/usr/local/texlive/2009/texmf-dist/tex/xelatex/fontspec/fontspec.sty
(/usr/local/texlive/2009/texmf-dist/tex/generic/ifxetex/ifxetex.sty)
(/usr/local/texlive/2009/texmf-dist/tex/latex/tools/calc.sty)
(/usr/local/texlive/2009/texmf-dist/tex/latex/xkeyval/xkeyval.sty
(/usr/local/texlive/2009/texmf-dist/tex/generic/xkeyval/xkeyval.tex
(/usr/local/texlive/2009/texmf-dist/tex/generic/xkeyval/keyval.tex)))
fontspec.cfg loaded.
(/usr/local/texlive/2009/texmf-dist/tex/xelatex/fontspec/fontspec.cfg))
(/usr/local/texlive/2009/texmf-dist/tex/xelatex/xunicode/xunicode.sty)
(/usr/local/texlive/2009/texmf-dist/tex/xelatex/xltxtra/xltxtra.sty
(/usr/local/texlive/2009/texmf-dist/tex/latex/metalogo/metalogo.sty
(/usr/local/texlive/2009/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/local/texlive/2009/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/local/texlive/2009/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/local/texlive/2009/texmf-dist/tex/latex/latexconfig/graphics.cfg)
(/usr/local/texlive/2009/texmf-dist/tex/xelatex/xetex-def/xetex.def))))
(/usr/local/texlive/2009/texmf-dist/tex/latex/etex-pkg/etex.sty)
(/usr/local/texlive/2009/texmf-dist/tex/latex/base/fixltx2e.sty))
(/usr/local/texlive/2009/texmf-dist/tex/xelatex/polyglossia/polyglossia.sty
(/usr/local/texlive/2009/texmf-dist/tex/latex/etoolbox/etoolbox.sty))
(/usr/local/texlive/2009/texmf-dist/tex/xelatex/polyglossia/gloss-english.ldf)
(/usr/local/texlive/2009/texmf-dist/tex/xelatex/polyglossia/gloss-russian.ldf)
\@input{definitions.aux}
(./definitions.tex)
(/usr/local/texlive/2009/texmf-dist/tex/latex/oberdiek/epstopdf.sty
(/usr/local/texlive/2009/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty
(/usr/local/texlive/2009/texmf-dist/tex/generic/oberdiek/infwarerr.sty)
(/usr/local/texlive/2009/texmf-dist/tex/latex/oberdiek/grfext.sty)
(/usr/local/texlive/2009/texmf-dist/tex/latex/oberdiek/kvoptions.sty
(/usr/local/texlive/2009/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty
(/usr/local/texlive/2009/texmf-dist/tex/generic/oberdiek/etexcmds.sty)))
(/usr/local/texlive/2009/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty
(/usr/local/texlive/2009/texmf-dist/tex/generic/oberdiek/ifluatex.sty)
(/usr/local/texlive/2009/texmf-dist/tex/generic/oberdiek/ltxcmds.sty))

Package epstopdf Warning: Other drivers than `pdftex.def' are not supported.

)) (/usr/local/texlive/2009/texmf-dist/tex/latex/tools/afterpage.sty)
(/usr/local/texlive/2009/texmf-dist/tex/latex/graphics/color.sty
(/usr/local/texlive/2009/texmf-dist/tex/latex/latexconfig/color.cfg))
(/usr/local/texlive/2009/texmf-dist/tex/latex/hyperref/hyperref.sty
(/usr/local/texlive/2009/texmf-dist/tex/generic/oberdiek/ifpdf.sty)
(/usr/local/texlive/2009/texmf-dist/tex/generic/oberdiek/ifvtex.sty)
(/usr/local/texlive/2009/texmf-dist/tex/latex/oberdiek/hycolor.sty
(/usr/local/texlive/2009/texmf-dist/tex/latex/oberdiek/xcolor-patch.sty))
(/usr/local/texlive/2009/texmf-dist/tex/latex/hyperref/pd1enc.def)
(/usr/local/texlive/2009/texmf-dist/tex/xelatex/xetexconfig/hyperref.cfg)
Implicit mode ON; LaTeX internals redefined
(/usr/local/texlive/2009/texmf-dist/tex/latex/ltxmisc/url.sty)
(/usr/local/texlive/2009/texmf-dist/tex/generic/oberdiek/bitset.sty
(/usr/local/texlive/2009/texmf-dist/tex/generic/oberdiek/intcalc.sty)
(/usr/local/texlive/2009/texmf-dist/tex/generic/oberdiek/bigintcalc.sty))
(/usr/local/texlive/2009/texmf-dist/tex/generic/oberdiek/atbegshi.sty))
*hyperref using driver hdvipdfm*
(/usr/local/texlive/2009/texmf-dist/tex/latex/hyperref/hdvipdfm.def)

Package hyperref Warning: Option `bookmarks' has already been used,
(hyperref)                setting the option has no effect on input line 62.

(/usr/local/texlive/2009/texmf-dist/tex/latex/tools/verbatim.sty)
(/usr/local/texlive/2009/texmf-dist/tex/latex/lipsum/lipsum.sty)
(/usr/local/texlive/2009/texmf-dist/tex/latex/xcolor/xcolor.sty
(/usr/local/texlive/2009/texmf-dist/tex/latex/latexconfig/color.cfg)
(/usr/local/texlive/2009/texmf-dist/tex/latex/colortbl/colortbl.sty
(/usr/local/texlive/2009/texmf-dist/tex/latex/tools/array.sty)))
(/usr/local/texlive/2009/texmf-dist/tex/latex/multirow/multirow.sty)
(/usr/local/texlive/2009/texmf-dist/tex/latex/rotating/rotating.sty
(/usr/local/texlive/2009/texmf-dist/tex/latex/base/ifthen.sty))
(/usr/local/texlive/2009/texmf-dist/tex/latex/booktabs/booktabs.sty)
(/usr/local/texlive/2009/texmf-dist/tex/latex/fancyhdr/fancyhdr.sty)
(/usr/local/texlive/2009/texmf-dist/tex/latex/subfigure/subfigure.sty
****************************************
* Local config file subfigure.cfg used *
****************************************
(/usr/local/texlive/2009/texmf-dist/tex/latex/subfigure/subfigure.cfg))
(/usr/local/texlive/2009/texmf-dist/tex/latex/xtab/xtab.sty) (./main.aux

LaTeX Warning: Label `fig:solution-one-fw-two-bgp' multiply defined.


LaTeX Warning: Label `tab:solution1-equip' multiply defined.

) (/usr/local/texlive/2009/texmf-dist/tex/latex/hyperref/nameref.sty
(/usr/local/texlive/2009/texmf-dist/tex/latex/oberdiek/refcount.sty))
(./main.out) (./main.out) (./title.tex
! Unable to load picture or PDF file './images/logo-color.eps'.
<to be read again> 
                   }
l.3 ...raphics[scale=0.8]{./images/logo-color.eps}
                                                  \\
? 
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Re: EPS in XeLaTeX

Post by frabjous »

Ok, I was doing some googling of my own. Thorsten and I were completely wrong. I guess EPS support has been added via an update the xetex.def file for xdvipdfxm.

But there was a problem where due to inconsistent changes, there were two versions of this file numbered 0.93, and TeXlive 2009 shipped the wrong one. They've now been merged with 0.94.

See this, and the follow-up messages:
http://osdir.com/ml/debian-bugs-dist/20 ... 00752.html

(Funny thing is that you can tell from the logs that your work computer is using an older version of XeTeX itself!)

Try opening a terminal in Ubuntu and type in:

sudo tlmgr update --self --all

And that should update your entire TL system to its current state, which I think might fix your problem.

If that doesn't work, I have a few other ideas... though in the meantime you should be able to run epstopdf from the command line on your eps files if need be.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

EPS in XeLaTeX

Post by localghost »

frabjous wrote:[…] Thorsten and I were completely wrong. […]
That's really true. I created a small document with an included EPS file and ran XeLaTeX from MiKTeX 2.8 on it. It worked flawlessly. I will test it later on my TeX Live system on Linux.
pash
Posts: 3
Joined: Sun Mar 21, 2010 12:27 pm

EPS in XeLaTeX

Post by pash »

Guys, thank you a lot for your help.

I have uprated the TeX Live with tlmgr and it works just fine now!

--
Kind regards,
Pavel
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

EPS in XeLaTeX

Post by frabjous »

localghost wrote:
frabjous wrote:[…] Thorsten and I were completely wrong. […]
That's really true. I created a small document with an included EPS file and ran XeLaTeX from MiKTeX 2.8 on it. It worked flawlessly. I will test it later on my TeX Live system on Linux.
Indeed, I've never been so glad to be wrong. This is really a great new feature of Xe(La)TeX, and one more thing pushing me more and more in favor of using it nearly exclusively over pdf(La)TeX.
pash wrote:Guys, thank you a lot for your help.

I have uprated the TeX Live with tlmgr and it works just fine now!
Great! Glad to help.
Post Reply