GNU bug report logs -
#44578
incompability between preview and hyperref in latex 2020-10-01
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Hello,
I was trying to make a package with pstricks compile using pdflatex when I
stumbled on the incompatibility between preview and hyperref. I thought I'd
try to see whether I could do something about this issue, so I found a MWE
somewhere that uses pdflatex -shell-escape with auto-pst-pdf, which reliably
triggers this incompatibility:
\documentclass[12pt,letterpaper]{article}
\usepackage{hyperref}
\usepackage{pstricks}
\usepackage{auto-pst-pdf}
\begin{document}
Blah blah blah
\begin{pspicture}(4,4)
\psline(0,0)(4,0)
\end{pspicture}
\end{document}
I understand that the incompatibility with preview has started after the new
latex hook management arrived and some packages began adding code to the new
hooks shipout/firstpage and shipout/before. So I wrote a patch for preview.dtx
that removes this code, relevant snippet is here:
\let\pr <at> graphicstype=\z@
\DeclareOption{dvips}{%
\let\pr <at> graphicstype\@ne
- \preview <at> delay{\AtBeginDvi{%
+ \RemoveFromHook {shipout/before}[beamerbasenavigation]
+ \RemoveFromHook {shipout/before}[hyperref]
+ \RemoveFromHook {shipout/firstpage}[hyperref]
+ \preview <at> delay{\AddToHook {shipout/firstpage}{%
\special{!/preview <at> version(\pr <at> version)def}
\special{!userdict begin/preview-bop-level 0 def%
/bop-hook{/preview-bop-level dup load dup 0 le{/isls false def%
I uploaded a complete patch over here:
https://github.com/PJBrs/auctex/commit/
dcbe352eda9a31eaabe6816c7222357ec7cb93c7
I was wondering whether something like this could be a way forward for fixing
this bug. On the positive side, this fixes compiling documents with pstricks,
hyperref, (auto-)pst-pdf and pdflatex. On the negative, whenever the next
package begins adding code to these shipout hooks might cause the same problem
to begin again. A reverse strategy would be to remove all hooks except those
that belong to packages needed by preview (pstricks for one, and maybe some
others that I don't know about).
As a disclaimer, I should admit that I don't know very well what I'm doing
here, nor do I know much about latex, let alone latex hooks, but it is nice to
see that this patch works (at least, for my usecase with pst-pdf; I didn't
test preview-latex functionality in emacs, nor would I know how to do that).
Also, I just thought that this was a nice challenge :-)
Best,
PJ
[signature.asc (application/pgp-signature, inline)]
This bug report was last modified 93 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.