2

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?

Arcturus
  • 558

1 Answers1

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

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