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]
\begin{itemize}[<+-| alert@+>]
\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*}
\begin{itemize}[<+-| alert@+>]
\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?
Best Answer
I think the desired result was:
To obtain this the code needed is:
From your MWE, arrows were placed wrong because your
na
style just defined the positionbaseline=.5ex
but was not remembered in the next picture. You should useremember picture
also for the other two anchorst1
andt2
.In case you are looking for two frames, you have just to change:
into:
Remember that you should compile twice to get the right result.