\documentclass[11pt,a4paper,fleqn,final]{article}
%\usepackage{tikz}
\usepackage[tikz]{ocgx2}
\usepackage[dvipdfmx,loop,palindrome,autoplay]{animate}
\usepackage{chemfig}
\begin{document}
\begin{center}
\begin{animateinline}{1}
\setatomsep{3em}\chemfig{O=C=O}
\newframe
\setatomsep{2.5em}\chemfig{O=C=O}
\newframe
\setatomsep{2em}\chemfig{O=C=O}
\newframe
\setatomsep{1.5em}\chemfig{O=C=O}
\newframe
\setatomsep{1em}\chemfig{O=C=O}
\end{animateinline}
\end{center}
\end{document}
When I compile this I get the following warning + nothing on the page.
! Undefined control sequence.
<argument> \LaTeX3 error:
Erroneous variable \origin:pbs@obj16 used!
l.20 \end{animateinline}
The same goes with "\newframe". My suspicion is that its the pdfbase.sty that is throwing the error.
EDIT:
\documentclass[dvipdfmx,11pt,a4paper,fleqn,final]{article}
\usepackage[loop,palindrome,autoplay]{animate}
\begin{document}
\begin{center}
\begin{animateinline}{1}
a
\newframe
b
\newframe
c
\newframe
d
\newframe
e
\end{animateinline}
\end{center}
\end{document}
Best Answer
The driver
dvipdfmx
cannot be auto-detected and must be passed as an option to all packages which containdvipdfmx
-specific code. In the code example, these areanimate
andocgx2
(not used, currently). (Another popular package ishyperref
.)Therefore, driver options are usually set globally with the documentclass as in:
Note that the animation widget size is defined by the first frame's dimensions and that the frames to follow are stretched or squeezed to fit into this widget. Consider putting all frames into a box with the same pre-defined width together with a
\strut
to also extend the box vertically, e. g.