# 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.

-
If i can understand your question, you need independent .eps figure with latex text and font of article from matlab ? May be this comment and answer can help you –  texenthusiast Jan 12 at 20:40

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

\documentclass{article}

\pagestyle{empty}

\begin{document}

\psfrag{10}{9}
\psfrac{x}{$x$}
\includegraphics{my.eps}

\end{document}


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.

-
with \psfragfig{} from pstool package one can include psfrag commands in pdflatex -shell-escape mode to generate the figure in pdf –  texenthusiast Jan 13 at 0:13
@texenthusiast That under the assumption that the journal allows it. I'm a graphic editor of one journal, and using psfrag is frowned upon totally, it is one of the things that bring you only troubles. But I believe that a complete example would make a valid answer to the question, maybe not for the OP, but surely for the future reference. –  tohecz Jan 13 at 0:24
@tohecz: This is a nice straightforward solution, which I also tried at the beginning, however I am having trouble at the first step already, where for some mysterious reason my figures get chopped on the right side in the dvi file. Converting to ps and pdf does not change this fact (although I can see the whole figure in gsview, provided I rotate the media). It seems that I somehow need to control the placement of the figure on the page, but I don't know how easy that is. –  Andrew Milias Jan 13 at 1:35
I think I managed to solve all the issues with the dvi, and it now works fine. Thank you all very much for your help! –  Andrew Milias Jan 13 at 1:58