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?

5
  • 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
    Commented Jul 16, 2015 at 20:22
  • You want to make an animated GIF?
    – Werner
    Commented Jul 16, 2015 at 20:24
  • @Werner Yes I do.
    – Arcturus
    Commented Jul 16, 2015 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
    Commented Jul 16, 2015 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
    Commented Jul 16, 2015 at 21:04

1 Answer 1

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

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

Not the answer you're looking for? Browse other questions tagged .