
Tengo una secuencia de tikzpicture que son todas similares pero de tamaños ligeramente diferentes (tienen cosas que sobresalen. Pero me gustaría que todas estuvieran alineadas en el mismo punto de la tikzpicture.
Habría pensado que establecer una línea de base para todos ellos alinearía ese punto de coordenadas, pero todavía se "menean".
Aquí hay un MWE. Quiero que el nodo del círculo abierto en (0,0) esté en el mismo lugar de la página para cada superposición. Pero parece centrar el cuadro delimitador de cada tikzpicture; El tamaño del cuadro cambia debido al gran nodo verde. Pensé que la baseline
opción habría logrado esto, pero no es así.
\documentclass{beamer}
\usepackage{tikz}
\begin{document}
\newcommand\grf[1]{
\begin{tikzpicture}%[baseline={(0,0)}]
\node[circle,draw] (0) at (0,0) {} ; % <-- this circle node should not move
\node[circle,fill] (1) at (+1,+1) {} ;
\node[circle,fill] (2) at (+1,-1) {} ;
\node[circle,fill] (3) at (-1,-1) {} ;
\node[circle,fill] (4) at (-1,+1) {} ;
\node[circle,fill,green,inner sep=1em] at (#1) {} ;
\end{tikzpicture}
}
\begin{frame}
\only<1>{\grf{1}}%
\only<2>{\grf{2}}%
\only<3>{\grf{3}}%
\only<4>{\grf{4}}%
\end{frame}
\end{document}
Respuesta1
Establecer la línea de base no evita los saltos en general, ya que el cuadro delimitador aún puede cambiar. Una solución muy rápida es excluir el nodo adicional del cuadro delimitador agregando la overlay
clave.
\documentclass{beamer}
\usepackage{tikz}
\begin{document}
\newcommand\grf[1]{
\begin{tikzpicture}%[baseline={(0,0)}]
\node[circle,draw] (0) at (0,0) {} ; % <-- this circle node should not move
\node[circle,fill] (1) at (+1,+1) {} ;
\node[circle,fill] (2) at (+1,-1) {} ;
\node[circle,fill] (3) at (-1,-1) {} ;
\node[circle,fill] (4) at (-1,+1) {} ;
\node[circle,fill,green,inner sep=1em,overlay] at (#1) {} ;
\end{tikzpicture}
}
\begin{frame}
\only<1>{\grf{1}}%
\only<2>{\grf{2}}%
\only<3>{\grf{3}}%
\only<4>{\grf{4}}%
\end{frame}
\end{document}
En general, el TikLa biblioteca Z overlay-beamer-styles
tiene muchas opciones para evitar saltos. Aquí podrías usar
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{overlay-beamer-styles}
\begin{document}
\begin{frame}
\begin{tikzpicture}%[baseline={(0,0)}]
\node[circle,draw] (0) at (0,0) {} ; % <-- this circle node should not move
\node[circle,fill] (1) at (+1,+1) {} ;
\node[circle,fill] (2) at (+1,-1) {} ;
\node[circle,fill] (3) at (-1,-1) {} ;
\node[circle,fill] (4) at (-1,+1) {} ;
\path foreach \X in {1,...,4}
{node[circle,fill,green,inner sep=1em,visible on=<\X>] at (\X) {} };
\end{tikzpicture}
\end{frame}
\end{document}