add tag
topnush
I have some math in an itemize environment. I would to explain some equalities by pointing arrows to an explanation in a box. I would like those explanations to appear at the appropriate transition.  Here is my MWE:

```
\documentclass[xcolor={rgb}]{beamer}
\beamertemplatenavigationsymbolsempty
\setbeamersize{text margin left=10mm,text margin right=5mm} 
\setbeamertemplate{frametitle}[default][center]
\usepackage[many]{tcolorbox}
\newcommand{\ubar}[1]{\alt<+>{\underaccent{\bar}{#1}}{#1}}
\tcbuselibrary{skins}
\tcbset{
	arc=0pt,
	outer arc=0pt,
	colback=white,
}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
	shapes,
	tikzmark}
\usetikzlibrary{tikzmark,shapes.geometric, patterns,decorations.pathreplacing, calligraphy}

\begin{document}

\begin{frame}
	\tikzset{baseline,
	E/.style={ellipse, fill=blue!20, inner sep=2pt, anchor=base},
	N/.style={draw, very thick, rounded corners, fill=green!30,
		font=\scriptsize, rotate=90, anchor=east}
}
\end{frame}
\begin{frame}[t, fragile]{}
	\tikzset{baseline,
	E/.style={ellipse, fill=blue!20, inner sep=2pt, anchor=base},
	N/.style={draw, very thick, rounded corners, fill=green!30,
		font=\scriptsize, rotate=90, anchor=east}
}

\begin{itemize}[<+(1)->]
\setlength\itemsep{0.2cm}
\item[] line
\item[] line
\item[] line 
\item[] \tikz[baseline]\node[E] {\subnode{a}{$\mathbb{E}(Z_iC_i)=\mathbb{E}(\mathbb{E}(Z_iC_i\mid C_i))$}};
\item[]  \tikz[baseline]\node[E] {\subnode{c}{$\mathbb{E}(\mathbb{E}(Z_iC_i\mid C_i))=\mathbb{E}\left(C_i\mathbb{E}[Z_i\mid C_i]\right)$}};
\begin{tikzpicture}[remember picture, overlay]
\node[xshift=-12.2cm, yshift=4.5cm] (b) [N]
				at (current page.east)
				{Law one};
				\draw[-Stealth, shorten <=1mm, shorten >=1mm, dashed]
								(a) to [bend left] (b.south);
\end{tikzpicture}
\begin{tikzpicture}[remember picture, overlay]
					\node[xshift=-1cm] (b) [N]
					at (current page.east)
					{law two};
					\draw[-Stealth, shorten <=1mm, shorten >=1mm, dashed]
					(c) to [bend left] (b.north); 
					\end{tikzpicture}
\item[] Now  $\mathbb{E}(Z_iC_i)=\mathbb{E}(\mathbb{E}(Z_iC_i\mid C_i))=\mathbb{E}\left(C_i\mathbb{E}[Z_i\mid C_i]\right)$. 
\end{itemize}
\end{frame}
\end{document}
```

In this example I have added two lines starting \tikz to show the kind of thing I want although it's only the line that starts "Now" that I will want in the end. So on one transition I would like the first equality highlighted and an arrow connecting to an explanatory box and in the second the second equality highlighted and another line connecting the second equality to an explanatory box.  

How can you do this?
Top Answer
samcarter
There are many possible approaches. Here I use

- `hf-tikz` to conveniently highlight different parts of the equation

- use the fact that tikz commands like `\node<>{...}` or `\draw<>{...}` are overlay aware to uncover them on the desired slides

---

```
\documentclass[xcolor={rgb}]{beamer}
\beamertemplatenavigationsymbolsempty
\setbeamersize{text margin left=10mm,text margin right=5mm} 
\setbeamertemplate{frametitle}[default][center]
\usepackage[many]{tcolorbox}
\newcommand{\ubar}[1]{\alt<+>{\underaccent{\bar}{#1}}{#1}}
\tcbuselibrary{skins}
\tcbset{
	arc=0pt,
	outer arc=0pt,
	colback=white,
}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
	shapes,
	tikzmark}
\usetikzlibrary{tikzmark,shapes.geometric, patterns,decorations.pathreplacing, calligraphy}
%\usetikzlibrary{overlay-beamer-styles}

\usepackage[beamer,customcolors]{hf-tikz}
\hfsetfillcolor{structure.fg!20}
\hfsetbordercolor{structure.fg!20}

\begin{document}

\begin{frame}[t, fragile]{}
	\tikzset{baseline,
	E/.style={ellipse, fill=blue!20, inner sep=2pt, anchor=base},
	N/.style={draw, very thick, rounded corners, fill=green!30,
		font=\scriptsize, rotate=90, anchor=east}
}


\begin{itemize}[<+(1)->]
\setlength\itemsep{0.2cm}
\item[] line
\item[] line
\item[] line 
\item[] $
\tikzmarkin<7>{a}(0.2,-0.25)(-0.2,0.5)
  \tikzmark{bar}
  \mathbb{E}(Z_iC_i)=
\tikzmarkin<8>{b}(0.2,-0.25)(-0.2,0.5)
\mathbb{E}(\mathbb{E}(Z_iC_i\mid C_i))\tikzmarkend{a}
=\mathbb{E}\left(C_i\mathbb{E}[Z_i\mid C_i]\right)\tikzmarkend{b}
$
\begin{tikzpicture}[remember picture, overlay]
\node<7>[xshift=-12.2cm, yshift=4.5cm] (b) [N]
				at (current page.east)
				{Law one};
				\draw<7>[-Stealth, shorten <=1mm, shorten >=1mm, dashed]
								(pic cs:bar) to [bend left] (b.south);
\end{tikzpicture}
\begin{tikzpicture}[remember picture, overlay]
					\node<8>[xshift=-1cm] (b) [N]
					at (current page.east)
					{law two};
					\draw<8>[-Stealth, shorten <=-1mm, shorten >=1mm, dashed]
					(pic cs:foo) to [bend left] (b.north); 
					\end{tikzpicture}
\end{itemize}
\end{frame}
\end{document}
```

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

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.