# Beamer TikZ generating two slides

I'm trying to label an equation I have on a Beamer slide with TikZ. Here's my code:

\begin{frame}
\frametitle{Power Utility Portfolio Choice}

\tikzstyle{na} = [baseline=-.5ex]

\item Portfolio Return
\tikz[na]\node [coordinate] (n1) {};
\end{itemize}

\begin{equation*}
\begin{aligned}
& \underset{\boldsymbol w_t}{\text{maximise}}
& & \tikz[baseline]{
\node[fill=blue!20,anchor=base] (t1)
{$\boldsymbol w_t \cdot \bar{\boldsymbol r}_t$};
} + \frac{1 - \gamma}{2}
\tikz[baseline]{
\node[fill=red!20,anchor=base] (t2)
{$\boldsymbol w_t \cdot (\Sigma_t\boldsymbol w_t)$};
} \\
& \text{subject to}
& & \boldsymbol w_t \cdot \boldsymbol \iota = 1\\
&&& \boldsymbol w_t \ge 0
\end{aligned}
\end{equation*}

\item Portfolio Variance
\tikz[na]\node [coordinate] (n2) {};
\end{itemize}

\begin{tikzpicture}[overlay]
\path[->]<1-> (n1) edge [bend left] (t1);
\path[->]<2-> (n2) edge [out=0, in=-90] (t2);
\end{tikzpicture}

\end{frame}


The problem is it generates two slides, one with both references and another with just the first.

Another issue is the last reference "Portfolio variance" is in red (the actual text), can I change it to black?

-
Additionally to what Claudio has written, you probably also want to remove the overlay specifications from the \path commands. – Daniel Jun 22 '12 at 12:17
Welcome to TeX.SX. How many frames do you want? In your code it is normal that two frames are produced because you are using automatic alert for itemize environments and <1->,<2-> for paths. To have just one frame remove [<+-| alert@+>] and <1->,<2->. – Claudio Fiandrino Jun 22 '12 at 12:17
Another thing: May I kindly ask you to choose a different username to avoid confusion? – Daniel Jun 22 '12 at 12:19

I think the desired result was:

To obtain this the code needed is:

\documentclass{beamer}
\usepackage{tikz}

\begin{document}
\begin{frame}
\frametitle{Power Utility Portfolio Choice}

\begin{itemize}
\item Portfolio Return
\tikz[remember picture, overlay, baseline=-.5ex]\node (n1) {};
\end{itemize}

\begin{equation*}
\begin{aligned}
& \underset{\boldsymbol w_t}{\text{maximise}}
& & \tikz[baseline,remember picture]{
\node[fill=blue!20,anchor=base] (t1)
{$\boldsymbol w_t \cdot \bar{\boldsymbol r}_t$};
} + \frac{1 - \gamma}{2}
\tikz[baseline,remember picture]{
\node[fill=red!20,anchor=base] (t2)
{$\boldsymbol w_t \cdot (\Sigma_t\boldsymbol w_t)$};
} \\
& \text{subject to}
& & \boldsymbol w_t \cdot \boldsymbol \iota = 1\\
&&& \boldsymbol w_t \ge 0
\end{aligned}
\end{equation*}

\begin{itemize}
\item Portfolio Variance
\tikz[remember picture,overlay, baseline=-.5ex]\node (n2) {};
\end{itemize}

\begin{tikzpicture}[remember picture,overlay]
\path[-stealth] (n1) edge [bend left] (t1);
\path[-stealth] (n2) edge [out=0, in=-90] (t2);
\end{tikzpicture}

\end{frame}

\end{document}


From your MWE, arrows were placed wrong because your na style just defined the position baseline=.5ex but was not remembered in the next picture. You should use remember picture also for the other two anchors t1 and t2.

In case you are looking for two frames, you have just to change:

\begin{tikzpicture}[remember picture,overlay]
\path[-stealth] (n1) edge [bend left] (t1);
\path[-stealth] (n2) edge [out=0, in=-90] (t2);
\end{tikzpicture}


into:

\begin{tikzpicture}[remember picture,overlay]
\path[-stealth]<1-> (n1) edge [bend left] (t1);
\path[-stealth]<2-> (n2) edge [out=0, in=-90] (t2);
\end{tikzpicture}


Remember that you should compile twice to get the right result.

-
Thank you, thats perfect! – Dan Jun 22 '12 at 14:12