3

I have a quite simple problem that I am unable to resolve.

I use pdfLaTeX from latest MikTeX together with WinEdt. I need to use psfrag for my EPS figures and therefore, I apply the pstool package. This worked fine until summer.

Now I opened a document working at that time, but the same document and toolchain fails: The extended LaTeX run initiated by pstool fails and an empty PDF is created from the EPS.

A minimum example:

\documentclass[12pt,a4paper]{article}
\usepackage[margin=2cm,a4paper]{geometry}
\usepackage{hyperref}

\title{psfrag in pdflatex }

\usepackage{graphicx}
\usepackage{pstool}
\usepackage{bookmark}


\begin{document}
Test
\begin{figure}[h!]
\centering
 \psfragfig[mode=errorstop,width=0.9\textwidth]{Pulley_movable}
\caption{The EPS image with psfragfig}
\end{figure}

\end{document}

Interestingly, removing hyperref and bookmarks resolves the issue and creates the correct PDF!!! Thus, I assume my LaTeX configuration is basically doing the right job. Maybe a package is broken? Would someone please test my minimum example and report?

This is the result of the run. Note, there is a warning that no Pulley_movable.tex was found including psfrag commands, but I left them out to avoid any issue there. Providing the file does not help:

Startup Folder: C:\Users\xxxx\Documents\Papers\pstool-problem

This is pdfTeX, Version 3.14159265-2.6-1.40.21 (MiKTeX 20.11 Portable)
entering extended mode
(test.tex
LaTeX2e <2020-10-01> patch level 2
L3 programming layer <2020-10-27> xparse <2020-03-03>
(C:\ProgramData\Npackd\MiKTeX\texmfs\install\tex/latex/base\article.cls
Document Class: article 2020/04/10 v1.4m Standard LaTeX document class
(C:\ProgramData\Npackd\MiKTeX\texmfs\install\tex/latex/base\size12.clo))
(C:\ProgramData\Npackd\MiKTeX\texmfs\install\tex/latex/geometry\geometry.sty
...
...
(C:\ProgramData\Npackd\MiKTeX\texmfs\install\tex/generic/xkeyval\xkvutils.tex))
) (C:\ProgramData\Npackd\MiKTeX\texmfs\install\tex/latex/l3kernel\expl3.sty
(C:\ProgramData\Npackd\MiKTeX\texmfs\install\tex/latex/l3backend\l3backend-pdft
ex.def)))
(C:\ProgramData\Npackd\MiKTeX\texmfs\install\tex/latex/bookmark\bookmark.sty
(C:\ProgramData\Npackd\MiKTeX\texmfs\install\tex/latex/bookmark\bkm-pdftex.def)
)
No file test.aux.
*geometry* driver: auto-detecting
*geometry* detected driver: pdftex
(C:\ProgramData\Npackd\MiKTeX\texmfs\install\tex/latex/hyperref\nameref.sty
(C:\ProgramData\Npackd\MiKTeX\texmfs\install\tex/latex/refcount\refcount.sty)
(C:\ProgramData\Npackd\MiKTeX\texmfs\install\tex/generic/gettitlestring\gettitl
estring.sty))
(C:\ProgramData\Npackd\MiKTeX\texmfs\install\tex/context/base/mkii\supp-pdf.mki
i
[Loading MPS to PDF converter (version 2006.09.02).]
)
(C:\ProgramData\Npackd\MiKTeX\texmfs\install\tex/latex/epstopdf-pkg\epstopdf-ba
se.sty)"
"
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (MiKTeX 20.11 Portable)
entering extended mode
(Pulley_movable-pstool.tex
LaTeX2e <2020-10-01> patch level 2
L3 programming layer <2020-10-27> xparse <2020-03-03>
(C:\ProgramData\Npackd\MiKTeX\texmfs\install\tex/latex/base\article.cls
Document Class: article 2020/04/10 v1.4m Standard LaTeX document class
(C:\ProgramData\Npackd\MiKTeX\texmfs\install\tex/latex/base\size12.clo))
(C:\ProgramData\Npackd\MiKTeX\texmfs\install\tex/latex/geometry\geometry.sty
...
...
(C:\ProgramData\Npackd\MiKTeX\texmfs\install\tex/generic/luatex85\luatex85.sty)
 (C:\ProgramData\Npackd\MiKTeX\texmfs\install\tex/latex/preview\prtightpage.def
))
No file test.oldaux.
No file Pulley_movable-pstool.aux.
*geometry* driver: auto-detecting
*geometry* detected driver: dvips
(C:\ProgramData\Npackd\MiKTeX\texmfs\install\tex/latex/hyperref\nameref.sty
(C:\ProgramData\Npackd\MiKTeX\texmfs\install\tex/latex/refcount\refcount.sty)
(C:\ProgramData\Npackd\MiKTeX\texmfs\install\tex/generic/gettitlestring\gettitl
estring.sty))

Package hyperref Warning: Rerun to get /PageLabels entry.

Preview: Fontsize 12pt
<Pulley_movable.eps>
Preview: Tightpage -32891 -32891 32891 32891
[1] [2] (Pulley_movable-pstool.aux)

LaTeX Warning: Temporary extra page added at the end. Rerun to get it removed.

 )
Output written on C:\Users\xxxx\Documents\Papers\pstool-problem\Pulley_movab
le-pstool.dvi (2 pages, 4272 bytes).
Transcript written on C:\Users\xxxx\Documents\Papers\pstool-problem\Pulley_m
ovable-pstool.log.


Package pstool Warning: No file "Pulley_movable.tex" or "Pulley_movable-psfrag.
tex" can be found that may contain macros for "Pulley_movable.eps" on input lin
e 17.

(pstool-statusfile.txt)"
This is dvips(k) 2020.1 Copyright 2020 Radical Eye Software (www.radicaleye.com)
' TeX output 2020.11.11:1110' -> Pulley_movable-pstool.ps
<C:/ProgramData/Npackd/MiKTeX/texmfs/install/dvips/base/tex.pro>
<C:/ProgramData/Npackd/MiKTeX/texmfs/install/dvips/config/alt-rule.pro>
<C:/ProgramData/Npackd/MiKTeX/texmfs/install/dvips/psfrag/psfrag.pro>
<C:/ProgramData/Npackd/MiKTeX/texmfs/install/dvips/l3backend/l3backend-dvips.pro>
<C:/ProgramData/Npackd/MiKTeX/texmfs/install/dvips/base/texps.pro>
<C:/ProgramData/Npackd/MiKTeX/texmfs/install/dvips/base/special.pro>
<C:/ProgramData/Npackd/MiKTeX/texmfs/install/dvips/base/color.pro>. 
<C:/ProgramData/Npackd/MiKTeX/texmfs/install/fonts/type1/public/amsfonts/cm/cmr8.pfb>
<C:/ProgramData/Npackd/MiKTeX/texmfs/install/fonts/type1/public/amsfonts/cm/cmr12.pfb>
<C:/ProgramData/Npackd/MiKTeX/texmfs/install/fonts/type1/public/amsfonts/cm/cmbx12.pfb>
[1<./Pulley_movable.eps>] [2<./Pulley_movable-pstool.out.ps>] 
 (pstool-statusfile.txt)"
Error: /typecheck in --div--
Operand stack:
   1   0   0.0   -0.907531   a   65781.8
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   2015   1   3   %oparray_pop   2014   1   3   %oparray_pop   1998   1   3   %oparray_pop   1884   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   --nostringval--   4   --nostringval--   %repeat_continue   --nostringval--
Dictionary stack:
   --dict:974/1684(ro)(G)--   --dict:0/20(G)--   --dict:113/200(L)--   --dict:178/300(L)--
Current allocation mode is local
Current file position is 89152
MiKTeX GPL Ghostscript 9.25: Unrecoverable error, exit code 1
 (pstool-statusfile.txt)"

Overfull \hbox (113.53291pt too wide) in paragraph at lines 17--17
 [][] 

LaTeX Warning: Float too large for page by 140.75291pt on input line 18.


LaTeX Warning: `!h' float specifier changed to `!ht'.

[1
Non-PDF special ignored!
<special> header=psfrag.pro
{C:/ProgramData/Npackd/MiKTeX/texmfs/data/pdftex/config/pdftex.map}] [2 <./Pull
ey_movable.pdf>] (test.aux
! Undefined control sequence.
l.20 \HyPL@Entry
                {0<</S/D>>}
?

I reinstalled MikTeX but without any effect. Any help is greatly appreciated - thanks!

7
  • Welcome to TeX.SX! This really seems to be a MiKTeX issue. With TeXlive 2020 on Linux it works.
    – gernot
    Nov 11 '20 at 11:20
  • Thanks. Is there any MikTeX user who can confirm it crashes on any recent MikTeX installation? Note, I use windows.
    – Tobias
    Nov 11 '20 at 11:39
  • I will check a bit later Nov 11 '20 at 11:52
  • It fails for me too, and I can't confirm that it works without hyperref/bookmark: then there is no error, but I don't get a picture either, at least not with a simple eps. Nov 11 '20 at 13:44
  • Hopefully, problem lies in your .eps file, if I use the standard image ` \psfragfig[mode=errorstop,width=0.9\textwidth]{example-image-a}`, then it works fine for me....
    – MadyYuvi
    Nov 11 '20 at 15:42
3

The main problem is an incompability between preview and hyperref due to changes in the shipout code of LaTeX that I already reported here: https://lists.gnu.org/archive/html/bug-auctex/2020-11/msg00000.html

Because of this incompability the ghostscript call fails and then you get error both in miktex and texlive (but slightly different ones).

In your example you can get around this incompability either by not using preview but pdfcrop instead:

  \usepackage[crop=pdfcrop]{pstool}

or

\usepackage[crop=pdfcrop]{pstool}
\usepackage{bookmark}
\makeatletter
\AddToHook{env/document/begin}{%
\@ifpackageloaded{preview}{
\ifPreview
 \let\Hy@FirstPageHook\relax
 \let\Hy@EveryPageAnchor\relax
\fi}{}}
\makeatother

Beside there is the error

! Undefined control sequence.
  l.20 \HyPL@Entry

The problem here is that the command is only defined in the dvips driver of hyperref. hyperref normally adds a \providecommand to the aux, but this is missing and when pstool uses the aux also with pdftex it errors.

A work-around is to simply provide the command (after loading hyperref or bookmark)

\usepackage{bookmark}
\makeatletter
\providecommand\HyPL@Entry[1]{}
\makeatother
10
  • bug auctex? Are you sure?
    – Keks Dose
    Nov 14 '20 at 16:22
  • @KeksDose yes, I looked into the preview documentation (and into preview.sty). Nov 14 '20 at 16:23
  • @UlrikeFischer: This is strange: I am not an expert, but I simply installed TexLive portable and tried with the example. While MikTeX fails, TeXLive worked fine. Notably, I had no issues until summer. Is this maybe a bug that just appears for newer versions of some code. and TeXlive ist simply using the older code?
    – Tobias
    Nov 16 '20 at 10:56
  • Sorry but comments are a very bad place to discuss this. pstool is a very tricky package and without complete test document including all files like graphics and log-files is it very hard to say something. You are not even mentioning which error message you actually get. On the whole I think that is it mostly a pstool issue. Nov 16 '20 at 11:20
  • @UlrikeFischer: Thanks, I tested both workarounds, but the do not properly work. The second one, however, generated the correctly psfrag'ed PDF, but the final test. pdf contains an error message again: ´´´An error occured processing graphic: ‘./take_any_EPS.eps’ ´´´ So conversion works, but embedding fails...?!?
    – Tobias
    Nov 16 '20 at 11:22

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.