Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
    
@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. –  Hendrik Vogt Mar 1 '11 at 10:33
    
@Hendrik: Thanks for correcting the typos! –  lockstep Mar 1 '11 at 11:48
    
I will also thank you both, as they were originally my typos. –  Dom Mar 1 '11 at 12:12

2 Answers 2

up vote 11 down vote accepted

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.

share|improve this answer
    
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? –  Dom Feb 23 '11 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. –  Will Robertson Feb 23 '11 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. –  Dom Feb 25 '11 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? –  Will Robertson Feb 26 '11 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. –  Dom Feb 28 '11 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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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