Tell me more ×
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.

I have an eps file: "model.eps" here:

http://petitlien.fr/my_test_file

The content preview is here:

http://apercu.petitlien.fr/my_test_file

I wish to make label replacements in the eps file using the psfrag commands as follows:

\psfrag{A}{$m$}
\psfrag{B}{$k$}
\psfrag{Y}{inner boundary}

This is relatively easy to do with the psfrag package loaded such as in:

\documentclass[]{article}
\usepackage[dvips]{graphicx,color}
\usepackage{psfrag}
\begin{document}
\thispagestyle{empty}
\begin{figure}
\psfrag{A}{$m$}
\psfrag{B}{$k$}
\psfrag{Y}{inner boundary}
\includegraphics{E:/test/model.eps}
\end{figure}
\end{document}

But the above code will create an A4 paper with the figure in the middle. I don't want this.

What I would like to have is:

  1. An new EPS file with the labels replaced by the psfrag commands. This new EPS file must have the same bounding box as the file "model.eps". This means if in GSView, I activate options > EPS Clip, then I must just see a tight bounding box around the new EPS file as in "model.eps". So this will result in a standalone EPS file with the labels properly replaced.

  2. A method to convert this EPS file say to a PDF file but with the resulting file having the same "bounding box" size as the EPS file.

Psfrag is a wonderful tool and it would be great to be able to produce a standalone EPS with a tight bounding box and with all appropriate labels included via Psfrag.

Thank you for any suggestions and answers


Update

I have been looking at psfragger

http://www.ctan.org/tex-archive/support/psfragger

but it doesn't work. It is not maintained anymore.


A solution

The standalone package seems to work fine. I can obtain a tight pdf file through latex > dvips > ps2pdf.

\documentclass{standalone}
\usepackage[dvips]{graphicx,color}
\usepackage{psfrag}
\begin{document}
\psfrag{A}{$m$}
\psfrag{B}{$k,c$}
\psfrag{Y}{inner stator bore}
\includegraphics{E:/test/jeffcott.eps}
\end{document}

However the ps generated in the process (with dvips) does not appear well. Any reason for that?

share|improve this question
For getting PDF output from psfrag, I recommend looking at this question: tex.stackexchange.com/q/11839/86, for getting as small a bounding box as possible, I recommend looking at this question: tex.stackexchange.com/questions/11866/… (the accepted answer there works for any reasonable output format, not just PNG). – Andrew Stacey Mar 28 '11 at 8:31
Thanks for the pointers. I will study them. – yCalleecharan Mar 28 '11 at 8:50
@Andrew Stacey: The standalone package seems to do the trick. I have post an answer neatly. – yCalleecharan Mar 28 '11 at 10:36
@Andrew Stacey : I have edited my post as you requested. No I haven't tried the pdflatex method as you suggested. This is because I use TexLive 2010 and I can run both dvips and pdflatex on the document. PdfLaTeX will create the pdf equivalent of the figures. They won't be right but I can use the standalone package in the solution I posted above to get the right pdf figures with the psfrag labels. Then I can replace the correct pdf figures generated by the PdfLaTeX by the correct ones (through the standalone package). – yCalleecharan Mar 29 '11 at 4:51
Check this question – Lev Bishop Mar 30 '11 at 2:49
show 1 more comment

closed as not a real question by lockstep, egreg, Joseph Wright Nov 5 '11 at 20:54

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, see the FAQ.

Browse other questions tagged or ask your own question.