I have a problem in getting pstool to work with \psfragfig.

I have a folder structure that looks as follows:


The MWE is shown below. All the packages are included for completeness as that reflects the custom, university provided class file I use. In that class file some other commands are included but those are mostly related to the customisation of the headers and titles and therefore omitted.


% Packages found in the class (.cls) file

% Packages added by me
\usepackage{pdfsync}                % enable tex source and pdf output syncronicity
\usepackage{natbib}                 % fancy citations
\usepackage{amsmath}                % enables no-number equations {equations*}
\usepackage{tikz}                   % needed to import .tikz graphics
\usepackage{pgfplots}               % needed to import .tikz graphics
\usetikzlibrary{plotmarks}          % needed for tikz scatter plot
\usepackage[section]{placeins}      % keeps figures from floating out of a 
\usepackage{pstool}                 % necessary for psfrag with pdflatex

\DeclareGraphicsExtensions{.pdf,.png,.jpg,.eps} %graphicsx package set-up





This MWE compiles fine the first time, but when I try it a second time the output looks like this: enter image description here
The log file has the following error line in it:

! LaTeX Error: Cannot determine size of graphic in testeps.pdf (no BoundingBox)

I have to manually delete all the files except for the .eps file in the images folder before it works again.

Obviously I don't want to delete all the files manually each time before every re-run, so how can I solve this problem?

I use TeXShop 3.24 on Mac OSX.

Update 1:

It seems that pstool trips over the presence of the .pdf file after it has run the first time. After a first run the image folder contains the following files:


If I delete the .pdf file and rerun, all goes well.

Update 2:

It seems that the line

\DeclareGraphicsExtensions{.pdf,.png,.jpg,.eps} %graphicsx package set-up

was giving problems. Removing that line solves my problem.

  • Hop this \usepackage[cleanup={.tex, .dvi, .ps, .pdf, .log}]{pstool} works, but make sure which files you need before adding the extensions. Commented Oct 17, 2013 at 0:51
  • The cleanup argument doesn't work. On the first run it now prints the text .dvi .ps .pdf .log after the image, and on the second run the same error appears. Commented Oct 17, 2013 at 7:43

1 Answer 1

  • With pstool it loads graphicx and psfrag. Make a simple MWE by removing unnecessary packages to demonstrate the error.

  • The \DeclareGraphicsExtensions{.pdf,.png,.jpg,.eps} need not be used since pdflatex knows which format to pick during a psfrag auxillary processing(latex->dvips->ps2pdf).

  • On TeXLive distro .eps files are also included via epstopdf automatically(under hood) but in MiKTeX it needs to included explicitly in preamble.

  • The following example uses EPS figure trial.eps at ctan and more examples at ctan

    % compiled by `pdflatex --shell-escape` enabled
    \listfiles % to show the list of packages loaded in .log file
    % Good options for pstool package
    \EndPreamble % Will help to pick the right preamble in pstool auxillary process 
    \caption{Tagged eps image}
    \caption{Replacing tags with real labels with psfrag}

enter image description here

enter image description here

You must log in to answer this question.

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