topnush
In the following set of slides, the graph shifts to the right on transition 11 which is not what I want.


\documentclass{beamer}
\usepackage{tikz}

\begin{document}
\begin{frame}{}
\tikzstyle{vertex}=[very thick,draw=black, circle,minimum size=18pt,inner sep=0pt]
\tikzstyle{edge} = [draw,very thick,-]

\begin{figure}
\begin{tikzpicture}[scale=1.8, auto,swap]
% First we draw the vertices
\foreach \pos/\name in {{(0,2)/s}, {(2,1)/b}, {(4,1)/c},
{(0,0)/d}, {(3,0)/e}, {(2,-1)/f}, {(4,-1)/t}}
\node[vertex] (\name) at \pos {$\name$};
% Connect vertices with edges and draw weights
\foreach \source/ \dest / \myoverlay  in {
b/s/2-6,
c/b/3-,
f/e/4-8,
e/t/5-,
f/d/6-,
s/c/8-,
d/b/10-,
e/c/11-,
e/f/12
}{
\path<\myoverlay>[edge] (\source) -- node {} (\dest);
}

\node<2-10>[] at (0.6,3) {\Large Two words};
\node<11->[] at (0.6,3) {\Large More words words words words};

\end{tikzpicture}
\end{figure}
\end{frame}

\end{document}


This seems to be because "More words words words words" is longer than "Two words".

I find it confusing because "More words words words words" is still less wide than the picture so I am not sure what rule is telling it to be shifted to the left.
samcarter
overlay-beamer-styles to the rescue! The trick is to make the "More words words words words" string just invisible on the first few slides, but still reserve the space.


\documentclass{beamer}
\usepackage{tikz}

\usetikzlibrary{overlay-beamer-styles}

\begin{document}
\begin{frame}
\tikzset{
vertex/.style={
very thick,
draw=black,
circle,
minimum size=18pt,
inner sep=0pt
},
edge/.style={
draw,
thick
}
}

\begin{figure}
\begin{tikzpicture}[scale=1.8, auto,swap]

% First we draw the vertices
\foreach \pos/\name in {{(0,2)/s}, {(2,1)/b}, {(4,1)/c},
{(0,0)/d}, {(3,0)/e}, {(2,-1)/f}, {(4,-1)/t}}
\node[vertex] (\name) at \pos {$\name$};
% Connect vertices with edges and draw weights
\foreach \source/ \dest / \myoverlay  in {
b/s/2-6,
c/b/3-,
f/e/4-8,
e/t/5-,
f/d/6-,
s/c/8-,
d/b/10-,
e/c/11-,
e/f/12
}{
\path<\myoverlay>[edge] (\source) -- node {} (\dest);
}

\node<2-10> at (0.6,3) {\Large Two words};
\node[visible on=<11->] at (0.6,3) {\Large More words words words words};

\end{tikzpicture}
\end{figure}
\end{frame}

\end{document}


(please note that as @marmot mentioned in comments, \tikzstyle is deprecated, you should use \tikzset instead)

![document.gif](/image?hash=d88448a18d67235c8697e43d9b7a04e206aed3231335977ce9af35a4972704ec)

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.