2

This question already has an answer here:

I am trying to create an image in LaTeX that shows a table auto-filling itself, such as the four tables shown below. I've seen some posts about animating pictures, but I haven't seen anything about compiling "slides" together into an image. The four slides are below.

\documentclass[12pt]{article}
\usepackage{amsmath,amssymb}

\begin{document}

\begin{tabular}{|c|c|}
\hline
1 & \\
\hline
 & 
\hline
\end{tabular}

\begin{tabular}{|c|c|}
\hline
1 & 2\\
\hline
 & \\
\hline
\end{tabular}

\begin{tabular}{|c|c|}
\hline
1 & 2\\
\hline
3 & \\
\hline
\end{tabular}

\begin{tabular}{|c|c|}
\hline
1 & 2\\
\hline
3 & 4\\
\hline
\end{tabular}

\end{document}

This produces the tables, but I don't know how to make them into one image. How do I combine them?

marked as duplicate by Werner tables Jul 16 '15 at 20:59

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • I'd hazard a guess that you could facilitate the animate-package (mirrors.ibiblio.org/CTAN/macros/latex/contrib/animate/… 5 - The user interface -- Quote regarding the animateline: Even ordinary textual material may be animated in this way.) – Richard Jul 16 '15 at 20:22
  • You want to make an animated GIF? – Werner Jul 16 '15 at 20:24
  • @Werner Yes I do. – Arcturus Jul 16 '15 at 20:32
  • @Eridan: You can use the following as a guide: Animations in LaTeX I typically use ImageMagick's convert to make an animated GIF out of a multi-page PDF. – Werner Jul 16 '15 at 20:37
  • Thanks, @Werner I'd seen that page, but it looked like it was tikzpicture-specific. Now I see it's not. – Arcturus Jul 16 '15 at 21:04
2

The following code produces a table that fills itself:

\documentclass[12pt]{standalone}
\usepackage{amsmath,amssymb}
\usepackage{animate}
\usepackage{xcolor}

\begin{document}

\begin{animateinline}[autoplay,loop]{1}
\begin{tabular}{|c|c|}\hline
1 &{\color{white}2} \\\hline
 & \\\hline
\end{tabular}
\newframe
\begin{tabular}{|c|c|}\hline
1 & 2\\\hline
 & \\\hline
\end{tabular}
\newframe
\begin{tabular}{|c|c|}\hline
1 & 2\\\hline
3 & \\\hline
\end{tabular}
\newframe
\begin{tabular}{|c|c|}\hline
1 & 2\\\hline
3 & 4\\\hline
\end{tabular}
\end{animateinline}
\end{document}

I took the liberty to also add the xcolor package and adding a white 2 to the first table. That way the table doesn't change it's form. The only way I was able to see the animation was the usage of the Adobe PDF reader.

Frames: First Second Third Fourth

Cheers

  • If you want the table to grow on click, put option step to the animateinline environment. – AlexG Jul 17 '15 at 6:46

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