pgf-tikz / pgf

A Portable Graphic Format for TeX
https://pgf-tikz.github.io/
1.08k stars 104 forks source link

libxpdf: Syntax Error: AcroForm field object is wrong type when mixing tikzexternal with animate #1331

Open JasonGross opened 1 month ago

JasonGross commented 1 month ago

Brief outline of the bug

Mixing animateinline with \tikzexternalize seems to result in a slew of libxpdf: Syntax Error: AcroForm field object is wrong type. I can't tell if this is actually breaking anything, though. Sorry my example is not quite as minimal as it could be.

Minimal working example (MWE)

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}
\DeclareUnicodeCharacter{2212}{−}
\usepgfplotslibrary{groupplots,dateplot}
\usetikzlibrary{patterns,shapes.arrows}
\pgfplotsset{compat=newest}
\pgfplotsset{title/.append style={align=center}}
\usepackage{animate}
\usetikzlibrary{external}
\tikzexternalize
\def\basefigurename{test}
\usepackage{currfile}
\tikzsetfigurename{\basefigurename-\currfilebase-figure}
\begin{document}
\begin{filecontents*}[overwrite]{pics.tex}
\begin{animateinline}[autoplay,autoresume,controls,loop]{20.0}
\definecolor{darkgray176}{RGB}{176,176,176}
\definecolor{lightgray}{RGB}{211,211,211}
\definecolor{steelblue31119180}{RGB}{31,119,180}

% Frame 1
\begin{tikzpicture}
\begin{groupplot}[group style={group size=2 by 8}]
\nextgroupplot[tick align=outside,tick pos=left,x grid style={darkgray176},xmin=-1.5, xmax=1.5,xtick style={color=black},
y grid style={darkgray176},ymin=-1.5, ymax=1.5,ytick style={color=black}]
\addplot [semithick, black]
table {%
0 0
0.0752933174371719 0.0355731099843979
};
\addplot [semithick, black, mark=*, mark size=4, mark options={solid}]
table {%
0.0752933174371719 0.0355731099843979
};
\addplot [semithick, black]
table {%
0 0
-0.02556380815804 -0.0197121165692806
};
\end{groupplot}
\end{tikzpicture}

\newframe
\definecolor{darkgray176}{RGB}{176,176,176}
\definecolor{lightgray}{RGB}{211,211,211}
\definecolor{steelblue31119180}{RGB}{31,119,180}
% Frame 2
\begin{tikzpicture}
\begin{groupplot}[group style={group size=2 by 8}]
\nextgroupplot[tick align=outside,tick pos=left,x grid style={darkgray176},xmin=-1.5, xmax=1.5,xtick style={color=black},
y grid style={darkgray176},ymin=-1.5, ymax=1.5,ytick style={color=black}]
\addplot [semithick, black]
table {%
0 0
0.196652069687843 0.0978278592228889
};
\addplot [semithick, black, mark=*, mark size=4, mark options={solid}]
table {%
0.196652069687843 0.0978278592228889
};
\end{groupplot}
\end{tikzpicture}
\end{animateinline}
\end{filecontents*}
\input{pics.tex}
\end{document}
hmenke commented 1 month ago

The external library is currently unmaintained and it is unlikely that any bugs are going to be fixed in the future, due to the inherent defective design of the library. However, there are other third-party libraries for externalization which have learned from these past mistakes and which seem to be quite usable:

Both are included in TeX Live 2024.

JasonGross commented 1 month ago

Thank you @hmenke ! Neither of those packages work out of the box for me (I've just reported https://github.com/leo-colisson/robust-externalize/issues/43 and https://github.com/sasozivanovic/memoize/issues/19), but I'm trying to regenerate my code from tikzplotlib with tables pre-externalized and I'll see if I can get them working.