# XeLaTeX/xdvipdfmx or the driver bug with eps images

It seems that xelatex has problems including eps images; please see the below example; eps image can be download from LaTeX Graphics companion examples on CTAN.

\documentclass{article}
\usepackage{graphicx}
\begin{document}
\fbox{\includegraphics{w.eps}}
\end{document}


latex+dvips+pstopdf: image is included inside the \fbox

xelatex recent versions: image is outside of \fbox

xelatex old versions: (the one coded by Jonathan Kew): ok, image is included inside \fbox.

w.eps is taken from LaTeX graphics companion examples; therefore I do not think there is anything wrong with the image itself.

What is wrong?

• I think your MWE does not compile with xetex since you provided a \documentclass command, but I can confirm the phenomenon you described with xelatex – user31729 May 28 '14 at 6:13
• I never meant plain in the first place. – user22486 May 28 '14 at 6:15
• Perhaps you should nevertheless clearify ;-) – user31729 May 28 '14 at 6:16
• @ChristianHupfer From the earliest days of the site, we've been clear that LaTeX is assumed unless otherwise noted: realism! – Joseph Wright May 28 '14 at 7:12
• I think between egreg and I we've tracked down the issue: a change in the (x)dvipdfmx drivers: tug.org/svn/texlive?view=revision&revision=30175. Once I understand the issue properly I'll try to work out a fix! – Joseph Wright May 28 '14 at 12:02

The image w.eps is not an eps file, it is a ps file. This is the reason why it has not the correct bounding box values. Instead of

%!PS-Adobe-2.0
%%BoundingBox:100 100 150 150
100 100     translate % put origin at 100 100
...


it should be

%!PS-Adobe-2.0
%%BoundingBox:0 0 50 50
%100 100     translate % put origin at 100 100
...


Then it will be correct.

\documentclass{article}
\usepackage{graphicx}
\begin{document}
X\fbox{\includegraphics{w1.eps}}X
\end{document}


However, the xdvipdfmx driver should behave like the dvips driver, which ignores the translate command.

• Thanks for the suggested answer. However the edited eps image per your suggestion is broken with latex+dvips+ps2pdf (it is outside of \fbox) – user22486 May 29 '14 at 4:00
• The only difference I get is the fact that pdflatex and lualatex have paper format letter, whereas xelatex and latex->dvips->ps2pdf have a4. However, all engines produce the above output. – user2478 May 29 '14 at 7:18