Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

When I compile the MWE below on pdfLaTeX I get the error message `! pdfTeX error (ext4): destinations cannot be inside an XForm. right before the \newframe* command is read. I have tried by switching the loading order of the animate and the hyperref packages, only to get the same error. Is there anyone out there who can provide any hints on what the problem is?

\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} 
share|improve this question

1 Answer 1

up vote 2 down vote accepted

For some obscure reason, the combination of hyperref, auto-pst-pdf and pstricks places the pdfTeX built-in \pdfdest into pspicture environments.

animate uses \pdfxform to distill animation frames into PDF XObjects. \pdfxform fails if the content to be distilled contains pdf destinations.

The workaround below neutralises \pdfdest locally. It looks a bit hackish, but works.

\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}
share|improve this answer
    
@{AlexG, Herbert}: Weeell... This answer would have been great one day ago (just kidding, it is great anyway). I have been working with the standalone package and followed Herbert's suggestion to use the \animategraphics command instead. Actually, I was going to ask him to turn his comment into a full-fledged answer, but now I think yours is what best fits my question and, besides, it is revelatory. Thanks indeed! –  Marcos Jan 17 at 10:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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