I'm picking up a document, thus far, created by someone else who is unavailable for questioning.

I have a vague idea what is trying to be accomplished with this:

\psfrag{T}{Thin film}
\psfrag{A}{Adhesive layer}
\psfrag{R}{Rigid surface}

(there are 2 more figures, b and c then)

"Fig. 1 Schematic description....." for a bottom of the page caption.

I can latex it without error, but when I try to pdfltex ... it I get an error message that states:

I could not locate the file with any of the extensions: .png, .pdf, .jpg, .mps, .jpg, .jbig2, .jb, .PNG, .PDF, .JPG, .JPEG, .JBIG2, .JB2 Try typing <return> to proceed.

After latex, xdvi file displays the desired figure, but there is text scrunched up on the left of the page, to the left of the figure partially revealing "F_c" (in the proper format) through X on successive lines, then "Thin film, Adhesive layer", then "Rigid surface". To the right of the figure is the figures' designator letter (a).

Just above to figure in the left margin above "F_c" is a cut-off word, ending ing 'g', I think "g replacements".

When I pdflatex in order to create a PDF file, then getting the aforementioned error message, I just , through it. The resulting PDF is a blank page, save for the figures' letter designators, (a), (b), and (c) in a column down the center of the page with the "Fig.1..." caption at the bottom of the page.

The figure1a is in the same directory as the document files as figure1a.fig in addition to a figure1a.eps.

I've been able to come up with scant little help in the Leslie Lamport book.

Can you tell me what the psfrag business is all about?

I've imported figures in my own documents, but not in this fashion. I hate to re-tool this one if I can create something better and learn a new technique in the process.

  • One issue here is that pdflatex can't handle eps files straightforwardly. It is looking for any of the listed file types. Convert the eps to a pdf first and try again.
    – Markus
    Commented Oct 30, 2014 at 14:05
  • 3
    See for example tex.stackexchange.com/questions/11839/…: you need to set up to run latex for the figures and then convert the appropriate parts to PDF format for pdflatex. That's best done using some automation.
    – Joseph Wright
    Commented Oct 30, 2014 at 14:06
  • So... adding \usepackage[pdf]{pstricks} to the preamble will fix it? (I'm kind of new to LaTeX) also, should I post commentary here or on the linked page?
    – TommyK
    Commented Oct 30, 2014 at 14:43
  • @TommyK as Joseph pointed out, psfrag is intended to be used along the latex route. Not sure if the [pdf] workaround has any effect on psfrag
    – Markus
    Commented Oct 30, 2014 at 14:48
  • So, I added the \usepackage[pdf]{pstricks} to no avail. I'm still confused.
    – TommyK
    Commented Oct 30, 2014 at 16:38

2 Answers 2


The psfrag package is used to remove labels and other text from .eps graphics and replace them with LaTeX labels. This can be used to ensure that fonts in figures are consistent with those in the main body of the document, regardless of whether your graphics software can access them. It is particularly useful for inserting formulae and symbols, since a label in the eps file can be replaced by (more or less) arbitrary LaTeX code. In this example, the word 'typography' is replaced by an italic version in the current font.


The file 'small.eps' is as follows:

%!PS-Adobe-2.0 EPSF-2.0
%%Title: test.eps
%%BoundingBox: 0 0 100 50
/Times-Roman findfont
15 scalefont
20 20 moveto
(typography) show


However, as you have discovered, psfrag only works if you compile via latex -> dvips -> ps2pdf; it won't work with pdflatex. There is a package called pstool which works around this problem. Provided that shell escape is enabled, this version of the example will work with pdflatex.

  • 2
    For pdflatex one can also load psfrag and auto-pst-pdf and use psfrag's original syntax. (This also requires shell-escape to be enabled.)
    – cgnieder
    Commented Oct 31, 2014 at 17:13
  • pstool indeed works great, but you should be careful not to write the file extension in the first mandatory argument of \psfragfig and to run pdflatex with the -shell-escape command line option.
    – yannis
    Commented Feb 12, 2020 at 22:53

To use psfrag with pdflatex, the first things is to make

pdflatex -synctex=1 -interaction=nonstopmode --shell-escape %.tex

In pdflatex compelation you should be add "--shell-escape %.tex" like the text befor.

And after you should be load auto-pst-pdf and psfrag

\documentclass[border={0pt 5pt 0pt 0pt}]{standalone}

You must log in to answer this question.

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