# can't \includegraphics eps files anymore with xelatex (used to work fine)

I've just noticed that (most likely caused by upgrading to opensuse 11.3 with TexLive 2009) whenever I try to \includegraphics{filename.eps} an eps file, I get the error:

Unable to load picture or PDF file


So documents that built fine now do not build anymore. I use XeLaTeX, and using eps used to work just fine without any special setup (that I can recall). I quickly tried including the epstopdf package and dropping the eps extensions, but I think this is for (pdf)latex only, not xelatex.

My xelatex version is:

This is XeTeX, Version 3.1415926-2.2-0.9995.2 (TeX Live 2009/openSUSE)


I'd like to be able to build my old documents again whilst having to do as little change as possible... I tried using epstopdf to convert my eps into pdf and then include the pdf. That works, but I'd prefer not having to convert all my eps and references to them if possible at all.

Thanks for any suggestions

Edit: not working on my Fedora13 system anymore either that uses version

2.2-0.996 (Web2C 7.5.6)


Example:

\documentclass[a4paper,10pt]{article}
\usepackage[utf8x]{inputenc}
\usepackage{graphicx}
\begin{document}
\includegraphics[width=225pt,height=81pt]{magic2.eps}
\end{document}


or bundled with an eps file here

-
Can you post a minimal (non-)working example? –  Konrad Rudolph Aug 7 '10 at 14:37
sure: bschwehn.de/temp/epstest.tar.gz (archive to include the eps, otherwise just any document with \includegraphics(fileyouhave.eps} and \usepackage{graphicx} should work) though there is the small chance, that my full document actually includes a package that made it work before. But the example shows the error I get: works with latex, not with xelatex –  Ben Schwehn Aug 7 '10 at 14:50
while the tar.gz is better than nothing, what is desired is a minimal example that's posted here rather than a temp dir on you machine. That way, respondents don't have to search through your entire file and once your file isn't served up anymore, the example remains here. –  vanden Aug 7 '10 at 17:59
@vanden: Thanks for the suggestion, I amended the question. I only uploaded the tar in the first place to have a complete example including an eps file –  Ben Schwehn Aug 7 '10 at 18:18

I think perhaps the information provided here and discussed here may be relevant to your problem. Basically TeXlive 2009 (at least certain versions) shipped with the wrong version of a file (xetex.def); updating it may help. Or not. Good luck either way.

-
Thank you so much! I googled for quite some time, but didn't find anyone else with the exact same problem. But your second link seems to be exactly what I'm experiencing. I'll try if I can update to a working TexLive version or patch. –  Ben Schwehn Aug 7 '10 at 22:54
Using this simple [patch][1] indeed fixed the problem. Thanks again :) [1]: bugs.debian.org/cgi-bin/bugreport.cgi?bug=485071 –  Ben Schwehn Aug 7 '10 at 23:24

Convert the picture to PDF or PNG and remove the file name extension from the \includegraphics command, maybe that will work.

-
Thanks of your answer. However, I know that it works if I convert the eps to pdf :) But as I said: "I'd prefer not having to convert all my eps and references to them if possible at all. " After all the documents used to build just fine with an older (or at least other, I can't recall what version I had before) version of xelatex when I wrote them (only a few months ago). Shouldn't I still be able to use eps? Or was I just lucky that it ever worked and normally xelatex doesn't work with eps? –  Ben Schwehn Aug 7 '10 at 18:38
Just for reference, converting to PNG will probably lose quality (vector->bitmap format), so prefer PDF. –  Roman Plášil Aug 7 '10 at 21:14

Another reason you might stop being able to include eps files is because the most recent version of texlive (at least the macports version) didn't include the rungs script. This might not be your problem but hopefully it will help some others.

You know you have this issue if you see a message telling you the following failed

rungs .. (really long arguments string)

A quick dirty fix is as follows. Copy and paste the following somewhere in your path and make sure it has executable permissions.

#!/usr/bin/env texlua
--*-Lua-*-
-- $Id: rungs.tlu 7698 2008-04-28 14:23:31Z reinhardk$

-- Copyright (C) 2008 Reinhard Kotucha.
-- You may freely use, modify and/or distribute this file.

-- Run Ghostscript (gs on Unix, gswin32c on Windows)

function fixwin(args_unix)
if os.type == 'windows' then
local args_win={}  -- new table
args_win[0]=args_unix[1]
for i=1, #args_unix do
args_win[i]='"'..args_unix[i]..'"'
end
return args_win
else
return args_unix
end
end

if os.type == 'windows' then
command={'gswin32c'}
else
command={'gs'}
end

for i=1, #arg do
command[#command+1]=arg[i]
end

command=fixwin(command)

--[[ prepend an additional hyphen to activate this code
for i=0, #command do
print (command[i])
end
os.exit(ret)
--]]

ret=os.spawn(command)
os.exit(ret)

-

Xelatex does not support the eps format, use the other format such as PDF, png, jpg ...

Try \usepackage[dvips]{graphicx}! It may let you to use the EPS format.

-
In additin, use \usepackage{epstopdf}. –  hassan_noori Feb 13 '11 at 12:56
With a current XeLaTeX you need nothing else than \includegraphics[...]{file.eps} –  Herbert Feb 13 '11 at 13:09
A current xelatex can insert eps-files. It (more precisely xdvipdfmx) does it by calling ghostscript in the background to convert the eps on-the-fly to a pdf. The on-the-fly conversion must be enabled in dvipdfmx.cfg. The conversion is done at every run so it can slow down compilation, so in general it is better to convert the eps to pdf permanantly. –  Ulrike Fischer Feb 13 '11 at 13:48
Who says XeTeX can not include eps images? –  IRAN Feb 13 '11 at 14:19
In fact, with some option, it can. I have no information about new version of XeLaTeX! –  hassan_noori Feb 13 '11 at 14:34