5

1

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.

However, 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?

In version 10 psfrag is completely dead, since even one letter symbols do not help, which is also acknowledged by WRI. However, in version 10 pdf export itself has improved significantly and treats latex quality fonts relatively smoothly, with a possible exception of linux users. – Alexey Bobrick – 2015-02-18T22:14:08.470

This is not a direct solution to your problem, but you might be interested in exporting the data in a

`csv`

,`dat`

or`txt`

file and have it read by $\LaTeX$ using`tikz`

,`pgfplots`

and/or even`Asymptote`

. This has many advantages and the workflow is usually smoother and simpler. – anderstood – 2015-02-18T22:29:35.583