1

For larger beamer presentation I have a bunch of (TikZ) animations (see here for a little context). To speed up compilation, I would like to get some help from \usetikzlibrary{external} in my preamble.

The problem now is that I also have quite large movies (from rotating samples, the presentation is on Microtomography), which I load via \animategraphics[every=\everyframe]{25}{frame}{000}{500} (I have defined a variable \everyframe which helps speeding up the compilation of these movies for preview purposes). These movies are aligned on the center of the frame by encapsulating them in a centered node like so

\begin{frame}{Visualization}
    \begin{tikzpicture}[remember picture,overlay]%
    \node at (current page.center){%
        \animategraphics[autoplay,palindrome,width=\paperwidth,every=\everyframe]{25}{./movies/scan/visualization/lung}{000}{473}%
        };%
    \end{tikzpicture}%
\end{frame}

Now it seems to me that using \usetikzlibrary{external} and aligning the movies to the current page.center with TikZ are mutually exclusive. If I externalize the animations, then the movies are not aligned on the center of the page. If I don't externalize the anmimations, compiling the document takes too long to do often.

Is there a way of both having the cake and eating it, e.g. externalizing the animations and aligning the movies on the page center?

I've seen this question and answer here which deals with needed number of compilations, but I think I cannot have the animations in their separate PDF files, since they are PNG frames which get loaded with \animagegraphics. This also makes it hard to provide a good MWE

BTW1: I am aware that all this is just cosmetics, a final run before standing in front of the students will take care of all this. Nonetheless I'd really like to have a nice preview of my presenation with minimized compilation time.

BTW2: The current state of the presentation can be found here in its GitHub repository.

AlexG
  • 54,894
Habi
  • 7,694
  • While working on your document, you could also set option draft, when loading the animate package. – AlexG Nov 14 '19 at 11:16
  • @AlexG: I know, but then I don't see any images, which is kind of what I want to do here... – Habi Nov 14 '19 at 12:58

1 Answers1

1

While skimming through the TikZ manual section "Externalizing Graphics" I found this:

/tikz/external/export={boolean} (no default, initially true)

A boolean which can be used to disable the export mechanism for all pictures inside of the current TeX-scope.

Thus, to exempt certain tikzpicure environments from externalization, such as those for page-centering the animated bitmaps, you simply need:

\begin{frame}{Visualization}
    {%
    \tikzset{external/export=false}%
    \begin{tikzpicture}[remember picture,overlay]%
    \node at (current page.center){%
        \animategraphics[autoplay,palindrome,width=\paperwidth,every=\everyframe]{25}{./movies/scan/visualization/lung}{000}{473}%
        };%
    \end{tikzpicture}%
    }
\end{frame}

BTW, combining the frame option [c] and the centering environment has the similar effect of centering content both vertically and horizontally, with less effort:

\begin{frame}[c]{Visualization}
\begin{centering}
  \animategraphics[autoplay,palindrome,width=\paperwidth,every=\everyframe]{25}{./movies/scan/visualization/lung}{000}{473}%
  \par%
\end{centering}
\end{frame}
AlexG
  • 54,894
  • I'll use the first suggestion, thanks a lot! – Habi Nov 15 '19 at 10:32
  • And; I'm using the TikZ-page-centering method because I want the animations centered on the whole page/frame and not only on the text area (which might actually be an issue of our university template...). See here for the BTW suggestion: https://share.getcloudapp.com/p9uz9xD8 and here for the TikZ solution: https://share.getcloudapp.com/z8uwg70v – Habi Nov 15 '19 at 10:40