I am currently updating my workflow from the old tex2ps2dvi workflow (needs a lot of time and matplotlib and other stuff etc. hasn't a EPS output (only PDF, SVG, PS, PNG, etc...).

I am trying to adopt the font in my picture to the rest of my document. Normally I use:

\psfrag{old text in old font}[l][l]{new text in new font}
\psfrag{old text in old font}[90][l][l]{90 deg rot new text in new font}

But I always have to save it as pdf and then open it with Illustrator and modify it and save it as EPS then include it...

Is there a native implementation of psfrag in LaTeX, which can handle the text-replacement with pdflatex?


No pdffrag as you learned. I suggest the following "solution":

  1. Create a minimal tex document which uses psfrag to insert the appropiate labels and fonts, and use it to include all your eps figures. Use also preview package which will produce a document with a single figure per page, and with a page size fitted to the figure size.
  2. Compile that document with your habitual chain latex->dvips
  3. Convert the resulting PostScript file to pdf. Let say that the result is the file myfigures.pdf
  4. In your main document, include each figure at the appropriate point with \includegraphics[page=n]{myfigures.pdf}, being n 1, 2, 3... for each figure.

Alternatively, and I'm not joking, you may consider using TikZ to redo all your figures, specially if they are few and simple.

| improve this answer | |
  • 5
    This is basically what the pst-pdf, auto-pst-pdf, and pstool packages all do internally :). You're right; there is no other alternative. – Will Robertson Jul 24 '12 at 7:43

It's an old question and I'm not sure if this is an alternative in all the aspects, but it may be interesting to add the following:

I was able to do the replacement using the package pstool and the command \psfragfig{}{}


This compiles with pdflatex --shell-escape filename.tex

See also: https://mathematica.stackexchange.com/questions/736/latex-and-mathematica

| improve this answer | |

Maybe fragmaster may help ? It is an automated Perl script doing the same. See the home page of the project for a detailed procedure of how to use the Perl script in order to automate the procedure explained in the starred answer of this post.

| improve this answer | |
  • Welcome to TeX.SX! A full example would be of more use here, in my point of view. Just elaborate a little bit on your answer, please – user31729 Oct 31 '14 at 9:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.