Graphics, Figures & Tableshelp with animate package and tikz

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
fenghedo
Posts: 19
Joined: Sat Oct 04, 2008 3:01 pm

help with animate package and tikz

Post by fenghedo »

Hi all,

I have the following code that TeXnicCenter has been complaining "Package animate error: contents of first frame must not have zero width." I have no idea what is wrong. Please help.

Code: Select all

\documentclass{beamer}
\usepackage{tikz}
\usepackage{animate}

\usetikzlibrary{mindmap,trees}

\begin{document}

\begin{frame}
	\frametitle{test animation}
	\begin{animateinline}[controls,
	begin={\begin{tikzpicture}},
	end={\end{tikzpicture}}]{10}
		\path[remember picture,overlay,mindmap,concept color=red!50]
		node[concept,shift={(2cm,1cm)}] at (current page.west) {My first line};
		\newframe
		\path[remember picture,overlay,mindmap,concept color=red!50]
		node[concept,shift={(2cm,1cm)}] at (current page.west) {My second line};
		\newframe
		\path[remember picture,overlay,mindmap,concept color=red!50]
		node[concept,shift={(2cm,1cm)}] at (current page.west) {My 3rd line};
	\end{animateinline}
\end{frame}

\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

fenghedo
Posts: 19
Joined: Sat Oct 04, 2008 3:01 pm

Re: help with animate package and tikz

Post by fenghedo »

Any ideas? :(
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

help with animate package and tikz

Post by gmedina »

Hi,

I did some tests and discovered that the use of the overlay option was problematic (creates an empty frame); if you suppress that option, your code compiles OK (although I don't know if it will still produce the desired result):

Code: Select all

\documentclass{beamer}
\usepackage{tikz}
\usepackage{animate}

\usetikzlibrary{mindmap,trees}

\begin{document}

\begin{frame}
   \frametitle{test animation}
   \begin{center}
   \begin{animateinline}[controls,
   begin={\begin{tikzpicture}},
   end={\end{tikzpicture}}]{1}
     \path[remember picture,mindmap,concept color=red!50]
      node[concept,shift={(2cm,1cm)}] at (current page.west) {My first line};
      \newframe
      \path[remember picture,mindmap,concept color=red!50]
      node[concept,shift={(2cm,1cm)}] at (current page.west) {My second line};
      \newframe
      \path[remember picture,mindmap,concept color=red!50]
      node[concept,shift={(2cm,1cm)}] at (current page.west) {My 3rd line};
     \end{animateinline}
   \end{center}
\end{frame}

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
fenghedo
Posts: 19
Joined: Sat Oct 04, 2008 3:01 pm

help with animate package and tikz

Post by fenghedo »

Thanks gmedina for your reply. I did try your suggestion with a somewhat more complicated plotting. However, after the compile, I get a blank page. So I am giving up on this idea of using animate package. I tried the beamer animate command and it worked, although that gives us a lot more pages and the coding is a little bit too tedious (you have to use \only <n-> for each page and my animation gives me like 90 pages.


gmedina wrote:Hi,

I did some tests and discovered that the use of the overlay option was problematic (creates an empty frame); if you suppress that option, your code compiles OK (although I don't know if it will still produce the desired result):

Code: Select all

\documentclass{beamer}
\usepackage{tikz}
\usepackage{animate}

\usetikzlibrary{mindmap,trees}

\begin{document}

\begin{frame}
   \frametitle{test animation}
   \begin{center}
   \begin{animateinline}[controls,
   begin={\begin{tikzpicture}},
   end={\end{tikzpicture}}]{1}
     \path[remember picture,mindmap,concept color=red!50]
      node[concept,shift={(2cm,1cm)}] at (current page.west) {My first line};
      \newframe
      \path[remember picture,mindmap,concept color=red!50]
      node[concept,shift={(2cm,1cm)}] at (current page.west) {My second line};
      \newframe
      \path[remember picture,mindmap,concept color=red!50]
      node[concept,shift={(2cm,1cm)}] at (current page.west) {My 3rd line};
     \end{animateinline}
   \end{center}
\end{frame}

\end{document}
Post Reply