[Tex/LaTex] Export eps figures modified by psfrag


I am not an expert on figure exports and, although I have been searching around quite a lot, I can't find the answer to my problem. During the writing of a journal article, I had the idea of using psfrag to replace text on my .eps figures generated with Matlab. That works fine, as long as the main text .tex file is compiled as a whole. The problems start when one tries to generate the figures separately (since almost all journals require the figures to be uploaded as separate files). I have been trying to find a way to compile each figure into an .eps file with the psfrag labels added, so that I can submit these files separately.

Maybe my problem is ill-posed to begin with (for example, even if one manages to compile a single eps file with the psfrag substitutions, how can one control the relative sizes of figure and text?). If this is the case, I would appreciate if someone could provide a correct workflow for ending up with .eps figures whose text has the same font with the article.

Note: the only solution that I have managed to find and seems to be what I want, is the fragmaster.pl script, which however I do not how to operate in windows.

Best Answer

Save the following as fig.tex (of course, put your \psfrag instructions there):






Now, run the following commands:

latex fig.tex
dvips fig.dvi
ps2pdf fig.ps
pdfcrop fig.pdf
mv fig-crop.pdf fig.pdf
rm fig.dvi fig.ps

And you can happily do \includegraphics{fig.pdf} and use pdflatex.

Related Question