I want to create a tikz picture that makes usage of beamer commands such as \only<2>, thereby creating multiple pages and adding lines etc. only in the second page.
I then later on want to include these pages in a presentation.
Currently, I'm doing that by using \documentclass{beamer}, and putting the tikzpicture inside a frame. However, this forces me to finish the presentation in this document: I need to specify frame title, and also footer, and presentation styles.
I would much rather just create the plain pictures here, include them in the other presentation using \begin{frame}{Foo} \includegraphics{...}\end{frame}. However, when I do that inside beamer, there is unnecessary white space around the tikzpictures. When I don't do it inside beamer, I cannot use the \only. What should I do?
%\documentclass[tikz]{standalone}
\documentclass{beamer}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{frame}
\begin{tikzpicture}
\begin{axis}
\addplot[blue, thick] {x};
\only<2>{\addplot[blue, thick, dashed] {2*x};}
\end{axis}
\end{tikzpicture}
\end{frame}
\end{document}




beamerarticlepackage (part of the beamer class) that allows you to use beamer commands in other classes (such as article), which might be useful here. See page 209 of the manual. – Marijn Feb 20 '19 at 13:02\usepackage[noxcolor]{beamerarticle}allows me to compile everything astikz standalone, but will only show the "last page" of each slide, instead of having several pages. Unfortunately, I cannot find this use caseto be detailed in the manual. – FooBar Feb 20 '19 at 13:54\standaloneframes, as e.g. in https://tex.stackexchange.com/a/168705/121799 ? – Feb 20 '19 at 14:58\ifnum? See e.g. https://tex.stackexchange.com/a/459641/121799 for how to use it for drawing certain things only on certain "frames". Sometimes\ifcasecan be useful.) – Feb 20 '19 at 16:24stand-alone-file.pdf; this white space is then also included when including in the final presentation. – FooBar Feb 20 '19 at 16:32