I am trying to have a listing inside an animate environment. However I can't manage to do it if the hyperref package is loaded.
This is a MWE, obviously in the real application I need hyperref for other parts of the document. Is there a workaround? Some option in hyperref for example?
\documentclass{article}
\usepackage{animate}
\usepackage{listings}
\usepackage{hyperref} % comment this line to make the example work
\begin{document}
\begin{animateinline}[autoplay, loop]{5}
\begin{lstlisting}
listing inside animate
\end{lstlisting}
\newframe
text in frame
\newframe
\end{animateinline}
\begin{lstlisting}
listing outside animate
\end{lstlisting}
\end{document}
The error is
! LuaTeX error (ext4): destinations cannot be inside an XForm.
<argument> ... resources {\the \pdfpageresources }\@anim@box
\xdef \@anim@lastxform {\t...
The error is really an interaction between the three packages. listing works outside the animate or without hyperref. animate works without listings or without hyperref.
Possibly related: Hyperref adds vertical space to listings which gives me the idea that listings uses some hyperref feature if the package is previously (?) loaded. Something like this is described in the Section 5.3 in the listings package manual.
