I wanted to create a figure with clickable references do different chapters of my document. Therefore, I wanted to use pstool to replace placehoders in the figure with appropriate references.

If I not use hyperref, the placeholders are replaced correctly.

However as soon as I use hyperref, the processing of figures fails. I get "An error occured processing graphic: ‘./trial.eps’ Check the log file for compilation errors: ‘./trial-pstool.log’" message.

The log contains no errors, but warnings about undefined references.

To recreate the problem you should download the trial.eps from pstool example. As soon as you add the hyperref package in the example.tex:

\usepackage{hyperref} % <= uncommenting this line breaks processing
  \psfrag{[Mp]}{See section ~\ref{sec:test}}

Some random text before the section.
\section{Test section}
Here is some random text.

the document stops to compile correctly with:

pdflatex --shell-escape example.tex

The pdf is produced, but you'll see the error box instead of the figure.

You can still compile it with:

latex --shell-escape example.tex
latex --shell-escape example.tex
dvipdf example.dvi

and you'll get clickable reference in the figure.

Unfortunately, for certain reasons I'm forced to use pdflatex instead of latex/dvipdf.

  • At the moment your document does not compilable at all, since nobody has macros.tex at hand. Please post a compilable version of your document, not just fragments – user31729 Jan 17 at 20:31
  • It is only a part of the document. It shows how to modify the document that is available at github.com/wspr/pstool/tree/master/example (link provided in the question). – wzab Jan 17 at 20:38
  • 1
    @wzab please do not use external links, the question and answers are archived here forever and will not make sense if the code in that github link changes. please make a small but complete example. note links in included pdf do not work when pdf are included by pdftex – David Carlisle Jan 17 at 21:22
  • 1
    I have tried to reproduce your problem but for me it works correctly, I have downloaded some files from your github link, added hyperref, and compiled with pdflatex. I don't get errors and the pstool replacements in the figures are processed. It could be a version problem, I use pdflatex 3.14159265-2.6-1.40.18 (TeX Live 2017), pstool v1.5e (2018/01/20) and hyperref v6.86b (2018/02/06). Which versions do you use? – Marijn Jan 18 at 10:06
  • 1
    Also, as others have commented, it would be much easier to answer (and to isolate the problem) if you can minimize the example and post it here. The error is with trial.eps, so keep only those five lines in the document (around line 40) and remove everything else. Try to limit as much as you can the use of secondary files (like macros.tex and trial.tex), you may get some warnings but that should not affect the issue. In general, make it as easy as you can to reproduce the problem, without downloads and lots of files (except downloading trial.eps of course, since that is essential). – Marijn Jan 18 at 10:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.