Problem with matplotlib 1.0.1 and psfrag (LaTeX)

Can you provide a simple LaTeX document that illustrates the problem with psfrag? This is still compliant Postscript, AFAICT.

It is not a postscript compliance issue, but rather a requirement of the psfrag package which relys on searching for complete strings of the form "(...) show" for replacement.

Here is a simple example. Prior to this change, matplotlib would output the entire string "(0) show", "(1) show" and "(Np) show". The psfrag package replaces these with typeset versions of "zero", "one" and "$N_+$ in whatever font, size, etc. is active in the LaTeX file (providing an exact match with the surrounding text).

The new version of matplotlib has instead the individual characters followed by glyphshow: "/zero glyphshow" etc. and psfrag can no-longer locate the appropriate strings and replace them. Please provide a way for users to revert to the old behaviour of outputing the complete string rather than one glyph at a time as some of us use psfrag extensively for publication-quality figures.

% import matplotlib.pyplot as plt
% plt.plot([0,1],[0,1])
% plt.xticks([0,1], ['0', '1'])
% plt.xlabel(r'Np')
% savefig('bad.eps')
\documentclass{article}
\usepackage{graphicx}
\usepackage{psfrag}
\begin{document}
\psfrag{0}{zero}
\psfrag{1}{one}
\psfrag{Np}{$N_+$}
\includegraphics[width=\textwidth]{bad.eps}
\end{document}

ยทยทยท

On 13 Jan 2011, at 5:50 AM, Michael Droettboom wrote:

On 01/11/2011 10:43 AM, Benjamin Root wrote:

On Tue, Jan 11, 2011 at 8:45 AM, Lebostein <Lebostein@...380...> wrote:

I have compared the new and old output. For example the "0.0" in a diagram:

old eps (1.0.0):

35.223 19.934 m
0 0.141 rmoveto
(0.0) show
[1 2] 0 setdash
0.502 setgray

new eps (1.0.1):

35.222810 19.933563 translate
0.000000 rotate
0.000000 0.140625 m /zero glyphshow
6.362305 0.140625 m /period glyphshow
9.541016 0.140625 m /zero glyphshow
grestore
[1 2] 0 setdash
0.502 setgray