当我编译下面的 MWE 时,在命令读取之前pdfLaTeX
收到错误消息。我尝试切换和包的加载顺序,但仍然得到相同的错误。有谁能提供任何提示,说明问题出在哪里?`! pdfTeX error (ext4): destinations cannot be inside an XForm.
\newframe*
animate
hyperref
\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 内置\pdfdest
于pspicture
环境中。
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}