# Using negative coordinates in EPS file with XeLaTeX

I've run into inconsistent behavior with XeLaTeX and EPS files with negative coordinates. The wrapping block for the figure is calculated correctly; however, the content of the figure is misplaced (coordinate (0, 0) are where the squares adjoin).

For comparison, see expected result

What's the point, this behavior changed after update from TeX Live 2009 to TeX Live 2013 and I think it's a bug as with pdflatex, I obtain the expected result.

I've been digging into texlive files and found that the important change is in xetex.def file, seemingly v0.96 update. I'd like to know whether this is a regression bug or intended behavior. And if it's correct, why it's different from pdflatex. Thanks.

Bellow are MWEs for the document and the figure as well.

\documentclass{minimal}

\usepackage{graphicx}

\begin{document}
Lorem ipsum lorem ipsum lorem ipsum
lorem ipsum lorem ipsum lorem ipsum
lorem ipsum lorem ipsum lorem ipsum
lorem ipsum lorem ipsum lorem ipsum.
\includegraphics[width=0.25\textwidth]{fig.eps}
Lorem ipsum lorem ipsum lorem ipsum
lorem ipsum lorem ipsum lorem ipsum
lorem ipsum lorem ipsum lorem ipsum
lorem ipsum lorem ipsum lorem ipsum
lorem ipsum lorem ipsum lorem ipsum.
\end{document}


And the figure (Metapost source)

prologues:=3;
u:=1cm;

beginfig(1);

draw unitsquare.scaled(3u);
fill unitsquare.scaled(3u).shifted(-3u,-3u);

% this is a quickfix for the issue
%currentpicture := currentpicture shifted (-llcorner currentpicture);

endfig;

end

• In my experience, support of EPS is XeLaTeX is not really good. It's better to convert to PDF, which is what gmp (Metapost inclusion in LaTeX) does. – egreg Nov 21 '13 at 20:27

Can't you use LuaTeX? Then you are able to integrate the MP-code into the document:

\documentclass{article}
\usepackage{luamplib}

\begin{document}

Lorem ipsum lorem ipsum lorem ipsum
lorem ipsum lorem ipsum lorem ipsum
lorem ipsum lorem ipsum lorem ipsum
lorem ipsum lorem ipsum lorem ipsum.
%
\begin{mplibcode}
u:=1cm;
beginfig(1);
draw unitsquare.scaled(3u);
fill unitsquare.scaled(3u).shifted(-3u,-3u);
endfig;
\end{mplibcode}
%
Lorem ipsum lorem ipsum lorem ipsum
lorem ipsum lorem ipsum lorem ipsum
lorem ipsum lorem ipsum lorem ipsum
lorem ipsum lorem ipsum lorem ipsum
lorem ipsum lorem ipsum lorem ipsum.
\end{document}


• Interesting, though, I don't know anything about LuaTeX at all. The problem is, this is a part of a bigger project and switching to LuaTeX is not really an option. – Werkov Nov 21 '13 at 20:04
• I suppose that you have nothing to change in your project when using LuaLaTeX – user2478 Nov 21 '13 at 20:09

I've propagated this question also to the TeX Live mailing list and it was a bug that's been fixed now (thanks to willing developers), yet in development version only.

• Can you add a pointer to the bug report and the fix please? – Thruston Feb 2 '14 at 17:22
• – Werkov Feb 3 '14 at 0:49
• The quick work around mentioned in the thread above is to remove the comment line %%Creator: MetaPost from each .eps file that MP produces. I find that this bash one-liners does this nicely (but use with caution!) for i in *.eps; do grep -v MetaPost $i >temp.txt && mv temp.txt$i; done – Thruston Apr 16 '14 at 17:20