# Mathematica eps graphics and psfrag in LaTeX

I used to to use MathPSFrag in Mathematica to export graphics to EPS for inclusion in LaTeX files.

However, with recent versions of Mathematica this does not seem to work very well anymore, see for example mathematica 8.0 and psfrag or LATEX and Mathematica.

In the latter thread it was suggested to use Mathematica's native Export function and then replace text, labels etc. using the pstool package.

How ever, when I create and export a simple plot via

plot = Plot[x, {x, 0, 1}, AxesLabel -> {"x", "y"}]
Export[NotebookDirectory[] <> "plot.eps", plot]


and then run pdflatex --shell-escape on the file

\documentclass{article}
\usepackage{pstool}
\begin{document}
\psfragfig{plot}
{
\psfrag{x}{$\xi$}
\psfrag{y}{$\phi$}
}
\end{document}


I obtain a two-page PDF document with the lower part of the plot on the top of the second page and the top part missing; the first page is completely empty.

I'd be grateful if somebody could point out what's going on. Also, the restriction to one-letter labels can be quite problematic. Have there been any developments since the two quoted threads about the best way to export graphics from mathematica into LaTeX?

Edit: What I described above applies to Mma 9.0 on a 64-bit Linux Mint 15.

When I export the plot on a Windows 7 computer, the PDF is created correctly. From this I infer that the problem does not lie with my latex installation, but with the way Mathematica exports the plot to eps. Is this known to be platform-dependent?

-

Have you tried converting the eps to pdf first? The epstopdf package is nice for this.

\documentclass{article}

\usepackage{graphicx}
\usepackage{epstopdf}

\begin{document}

\includegraphics{plot.eps}

\end{document}
`

I've run into the same sort of problem. I can't currently confirm for your set up because I'm not running a Linux box at the moment. I believe what's going on is not an issue with Mathematica at all. I think it might still be an issue with your LaTeX distribution. MikTeX (the Windows LaTeX distribution) includes an eps converter that will automatically convert the eps to pdf and then include it in the PDFLaTeX document. As hinted at in the articles you yourself referenced it's really only an issue with EPS and PDFLaTeX.

If that's not the case then it might be that your EPS bounding boxes are too big. For a solution to that problem see the second answer in this article.

Another useful article is here.

-