Is there any way of using psfrag with pdflatex? It seems fairly similar to the problem of using pstricks with pdflatex. Do they both depend on the same things, or does psfrag include pstricks?

Can I assume that if I use one of the workarounds to make pstricks work, the same workaround would do for psfrag? Is there an equivalent of \usepackage[pdf]{pstricks} that will work for psfrag?

I realise there are a few questions here rather than just one, but they all share the overall question of how to use psfrag with pdflatex. Thank you.

  • @lockstep: Sorry, I just see that I reverted your capitalization. (You were so keen on that capitalization that you missed the typo in the title :-)) As I see it, if we talk about the program pdflatex, we don't use capitalization. Commented Mar 1, 2011 at 10:33
  • I will also thank you both, as they were originally my typos.
    – Heather
    Commented Mar 1, 2011 at 12:12

3 Answers 3


I recommend (disclaimer, I wrote them both) either of the pstool or the auto-pst-pdf packages. The latter is more useful when you have other PSTricks material; pstool is better when you only have psfrag material only. (One day I'd like to extend pstool to handle both cases.)

They both use the -shell-escape feature to process the psfrag graphics separately before inserting them into the document.

  • Thanks for the suggestions, I put auto-pst-pdf in for using pstricks and used the --shell-escape feature. Does this mean that I can just include psfrag as well as pstricks after including the auto-pst-pdf package? p.s. did you not include links because you wrote them?
    – Heather
    Commented Feb 23, 2011 at 14:41
  • @Dom — it's late and I'm too lazy to include links :) If you're using a recent MiKTeX or TeX Live you should have the packages installed already. For psfrag usage in auto-pst-pdf, you must surround the graphics with \begin{postscript}...\end{postscript}. See the pst-pdf (no auto-) documentation for further information. Commented Feb 23, 2011 at 14:46
  • Thanks, this worked very well. Only thing I will say is it is very slow with large eps files (approx 2Mb) and Ghostscript maxed out my cpu for around 5 mins! I like it though, makes everything much easier.
    – Heather
    Commented Feb 25, 2011 at 20:12
  • @Dom that sounds about right. Do you need such big eps files though? Sounds like possibly you've got big bitmaps which would be better off in PNG from the start, or very highly sampled plots that could be decimated. What sorts of figures are they? Commented Feb 26, 2011 at 1:43
  • It's highly sampled plots, Plot3d generated by mathematica. I don't need it, and I'm thinking about removing the 3d plot in favour of a clearer contour version anyway.
    – Heather
    Commented Feb 28, 2011 at 11:53

After some further googling I found something potentially useful. It seems someone has written a bourne-shell script and package that work together, it's called pdfrack.

After a quick read of the instructions, it seems you create your document and run the shell script first to generate pdf pictures of the eps files with the psfrag replacements. Then you run pdflatex normally on your document, to build the pdf including the pdf pictures already generated by the pdfrack package.

Disclaimer: I haven't tried this yet, and to be honest, Will Robertson's answer seems to be the easier solution.


I just wrote an answer to the similar question psfrag substitute when using pdflatex.

I am doing Latex marking on .pdf with Inkscape. Basically when saving a picture into pdf, you can select an option "filter all text and write it in an ancillary file". Then Inkscape creates two outputs, the pdf image without any text and a tex file you include, which places text on the pdf image. There is nothing much more to do than open-and-save your pdf, then replace \includegraphics{mypix.pdf} by \include{mypix.pdf-tex}, the file created by inkscape.

  • I don't know how this solves the problem. Could you show some example?
    – user31729
    Commented Dec 12, 2014 at 16:01
  • Some more help and examples on the online documentation Note that here you first load your pdf file with "recognise text fields" before the steps described Commented Dec 15, 2014 at 9:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .