add tag
topnush
Take the following MWE:


```
\documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\setbeamersize{text margin left=10mm,text margin right=5mm} 
\setbeamertemplate{frametitle}[default][center]
\usepackage{calc}
\usepackage[many]{tcolorbox}
\usepackage{listings}
\lstdefinestyle{duckstyle}{%
    moredelim=[is][\color{red}]{|}{|},
    mathescape=true,
    escapechar=@,
    basicstyle=\ttfamily,
    columns=fullflexible
}
\lstset{style=duckstyle}

\newcommand{\Var}[1]{\ensuremath{\textcolor{varcolor}{#1}}}
\definecolor{varcolor}{RGB}{15,122,183}



\begin{document}
\begin{frame}[t, fragile]{}

\begin{columns}
\begin{column}{5.2cm} %
    \begin{tcolorbox}[top=0pt, left=5pt,right=5pt, colback=blue!5!white, text height=3cm]
\begin{lstlisting}[mathescape, name=code, basewidth = {.3em}]

set $\Var{A}$ = $\emptyset$
For each $\Var{i}$
  if $\Var{a_i} \in \Var{A}$
    $\Var{\tilde{f}_{a_i}} = \Var{\tilde{f}_{a_i}} + 1$
\end{lstlisting}
\end{tcolorbox}
\end{column}
   
\begin{column}{\textwidth-5cm} %

\end{column}
\end{columns}
\end{frame}

\end{document}
```

I would like to highlight one instance of `\Var{\tilde{f}_{a_i}}` and draw an arrow from some boxed text placed at an arbitrary position on the right hand side of the slide to it. I only want this to appear for one transition.
Top Answer
samcarter
One can use `hf-tikz` for the highlighting:

```
\documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\setbeamersize{text margin left=10mm,text margin right=5mm} 
\setbeamertemplate{frametitle}[default][center]
\usepackage{calc}
\usepackage[many]{tcolorbox}
\usepackage{listings}
\lstdefinestyle{duckstyle}{%
    moredelim=[is][\color{red}]{|}{|},
    mathescape=true,
    escapechar=@,
    basicstyle=\ttfamily,
    columns=fullflexible
}
\lstset{style=duckstyle}

\newcommand{\Var}[1]{\ensuremath{\textcolor{varcolor}{#1}}}
\definecolor{varcolor}{RGB}{15,122,183}

\tcbset{
	colback=white,
}
\usepackage{tikz}
\usetikzlibrary{tikzmark,calc}
\usepackage[beamer,customcolors]{hf-tikz}

\begin{document}
\begin{frame}[t, fragile]{}
	\tikzset{baseline,
	N/.style={draw, very thick, rounded corners, fill=green!30,
		font=\scriptsize}
}
\begin{columns}
\begin{column}{5.2cm} %
    \begin{tcolorbox}[top=0pt, left=5pt,right=5pt, colback=blue!5!white, text width=5.2cm, text height=7cm]
\begin{lstlisting}[mathescape, name=code, basewidth = {.3em}]

set $\Var{A}$ = $\emptyset$
For each $\Var{i}$
  if $\Var{a_i} \in \Var{A}$
    @$
      \tikzmarkin<2>{a}
        \Var{\tilde{f}_{a_i}}
      \tikzmarkend{a}
      = \Var{\tilde{f}_{a_i}} + 1$@
\end{lstlisting}
\end{tcolorbox}
\end{column}
   
\begin{column}{\textwidth-5cm} %

 \begin{tikzpicture}[remember picture, overlay]
     \draw<2>[->, overlay, dashed] (2,0) to [bend right]([yshift=0.4cm]pic cs:a);
     \node<2>[draw,N] at (2,0) {text};
   \end{tikzpicture}
\end{column}
\end{columns}
\end{frame}

\end{document}
```

![Screen Shot 2020-10-01 at 13.12.17.png](/image?hash=d41712f23575997313648732136e151232968b373fb14e1a9315cf76c9c93e17)

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.