The problem of stuff jumping in beamer is a common one, (see e.g. Avoiding jumping frames in beamer) and we've seen it here from time to time (I imagine the "related" list at the side will be quite long on this one!). With a TikZ picture, one method of fixing this is to manually specify the bounding box. I'd like to get rid of the word "manually" in that sentence!
This oughtn't to be too hard to implement, my imagined scheme would involve writing out the final bounding box to the .aux
file so that it is available for use at the start of the tikzpicture environment.
First question: has anyone implemented this yet?
If (as I suspect) not, I'd like the second question to be "could someone do it for me?" but that's not in the spirit of the site. So here's my idea for how this would be done:
- On each slide of a frame, the tikzpicture saves its bounding box.
- At the end of the frame, the tikzpicture writes out the largest bounding box to the
.aux
file (note that the largest may not be the last). - On subsequent runs, the way that the bounding box was written out tells the tikzpicture what its bounding box ought to be and it draws a
\useasboundingbox
path accordingly (at the start of the picture).
So second question, which is a bit open-ended but hopefully I can get away with it: what are the pitfalls of the above.
And third question, (yup, I'm really stretching things here): if there is a part of the above that someone just happens to know, please put the code in an answer. I'm sufficiently confident of my TeX skills that I'll be able to take the pieces and put them together, and also to adapt pieces. So I'm not asking anyone to code this for me, just help me find the pieces needed.
(though if anyone does code it ...)
Here's a very simple example of what I mean (you have to compile it to see, though). As everyone knows, the earth goes around the sun. But not in this presentation. Cosmology according to this presentation is a ... little bit weird.
\documentclass{beamer}
\usepackage{tikz}
\begin{document}
\begin{frame}
\begin{tikzpicture}
\foreach \k in {1,...,8}
{
\fill<\k>[orange] (0,0) circle[radius=.5];
\fill<\k>[blue] (\k * 45:3) circle[radius=.2] coordinate (a);
}
\draw (0,0) -- (a);
\end{tikzpicture}
\end{frame}
\end{document}
Note: The above example is a very simple example, it is not a live example. I don't want an answer that fixes that particular example, I'm looking for a system of fixing every possible example.
(current page.center)
).