pdfLaTeX 上的 animate 和 hyperref 之间的冲突

pdfLaTeX 上的 animate 和 hyperref 之间的冲突

当我编译下面的 MWE 时,在命令读取之前pdfLaTeX收到错误消息。我尝试切换和包的加载顺序,但仍然得到相同的错误。有谁能提供任何提示,说明问题出在哪里?`! pdfTeX error (ext4): destinations cannot be inside an XForm.\newframe*animatehyperref

\documentclass{memoir}

\usepackage{xifthen, ifpdf, ifxetex}
\usepackage[pdfcrop = { --hires }]{auto-pst-pdf} 
\ifpdf\else\usepackage{pstricks}\fi
\usepackage{animate}
\usepackage{hyperref}

\begin{document}
\begin{animateinline}{2}
  \begin{pspicture}(0,0)(1,1)
    \psline(0,0)(0.5,0.5)
  \end{pspicture}
\newframe*
  \begin{pspicture}(0,0)(1,1)
    \psline(0,0)(1,1)
  \end{pspicture}
\end{animateinline}
\end{document} 

答案1

hyperref由于某些不为人知的原因,auto-pst-pdf和的组合pstricks将 pdfTeX 内置\pdfdestpspicture环境中。

animate用于\pdfxform将动画帧提炼为 PDF XObjects。\pdfxform如果要提炼的内容包含 pdf 目标,则会失败。

下面的解决方法\pdfdest在本地中和。它看起来有点黑客化,但确实有效。

\documentclass{memoir}

\usepackage{xifthen, ifpdf, ifxetex}
\usepackage[pdfcrop = { --hires }]{auto-pst-pdf}
\ifpdf\else\usepackage{pstricks}\fi
\usepackage{animate}
\usepackage{hyperref}

\setlength\unitlength{1cm}
\begin{document}

\begingroup\def\pdfdest name#1#2{} %neutralise `\pdfdest'
\begin{animateinline}{2}
  \begin{picture}(1,1)
  \begin{pspicture}(0,0)(1,1)
    \psline(0,0)(0.5,0.5)
  \end{pspicture}
  \end{picture}
\newframe*
  \begin{picture}(1,1)  
  \begin{pspicture}(0,0)(1,1)
    \psline(0,0)(1,1)
  \end{pspicture}
  \end{picture}
\end{animateinline}
\endgroup

\end{document}

相关内容