# hf-tikz markin has to be on the 1st slide to be referable by overlay anotation

I am making a presentation in beamer. I would like to show some equations with description using overlays.

code:

\documentclass[12pt]{beamer}
\usepackage[beamer,markings]{hf-tikz}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}

\begin{frame}[t]
\frametitle{Total Electron Content}
\uncover<1->{
\begin{equation*}
n_{ion} = 1- \frac{40.3 N_e}{f^2}
\end{equation*}
}

\uncover<2->{
\begin{equation*}
\Delta \rho_{ion}=\frac{40.3}{f^2}\tikzmarkin<{1,3}>[mark at=0.93]{col}(0.2,-0.5)(-0,0.7)\int_S N_e\mathrm{d}S\tikzmarkend{col}
\end{equation*}
}
\uncover<3->{
\begin{tikzpicture}[remember picture,overlay]
\coordinate (col-aa) at ($(col)+(-2,-1.8)$);
\node[align=right,left] at (col-aa) {\small{TEC}};
\path[-stealth,red,draw] (col-aa) -| ($(col)+(1,-1.55)$);
\end{tikzpicture}
}
\end{frame}
\end{document}


This works OK since the first slide does not show the highlighted equation. The \tikzmarkin<{1,3}> can be there and would not affect anything.

However in case I would like to put the equation on the slide 1 and than highlight it on the 2nd, it does not work. It needs the \tikzmarkin{col} specified from the beginning, but, I do not want to show it there.

part of the code:

\begin{frame}[t]
\frametitle{Total Electron Content}
\begin{equation*}
\Delta \rho_{ion}=\frac{40.3}{f^2}\tikzmarkin<2>[mark at=0.93]{col}(0.2,-0.5)(-0,0.7)\int_S N_e\mathrm{d}S\tikzmarkend{col}
\end{equation*}

\uncover<2>{
\begin{tikzpicture}[remember picture,overlay]
\coordinate (col-aa) at ($(col)+(-2,-1.8)$);
\node[align=right,left] at (col-aa) {\small{TEC}};
\path[-stealth,red,draw] (col-aa) -| ($(col)+(1,-1.55)$);
\end{tikzpicture}
}
\end{frame}


error:

! Package pgf Error: No shape named col is known.

See the pgf package documentation for explanation.
Type  H <return>  for immediate help.
...

l.20 \end{frame}

?


Is it possible to make it work somehow?

-
The problem is that with \uncover the content is also processed on the slides where it is not shown, the \tikzmarkin<2> on the other hand only defines col on the specified slides, apparently. Either you use \only<2> on the tikzpicture (as it is overlayed, there wouldn’t be any difference anyway) or you change the hf-tikz styles (somehow) to invisible on slide 1. –  Qrrbrbirlbel Sep 18 '13 at 12:03
@Qrrbrbirlbel The substitution of \uncover<2> with \only<2> did all what I needed...the problem was the 'process all' behaviour of \uncover I was not considering. Please, make your comment as an answer so that I can accept it. –  MasterPJ Sep 18 '13 at 12:16

Qrrbrbirlbel in the comment already explained the issue: my answer tries also to show a simpler way to make annotations.

In the OP's code, the markings option is used only in theory: the mark is placed in position 0.93, but it is not recalled later on, making useless its definition. The snippet:

\begin{tikzpicture}[remember picture,overlay]
\coordinate (col-aa) at ($(col)+(-2,-1.8)$);
\node[align=right,left] at (col-aa) {\small{TEC}};
\path[-stealth,red,draw] (col-aa) -| ($(col)+(1,-1.55)$);
\end{tikzpicture}


is a remain from the initial versions of the package and it could be simplified a lot using markers.

Here is a solution:

\documentclass[12pt]{beamer}
\usepackage{lmodern}
\usepackage[beamer,markings]{hf-tikz}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}

\begin{frame}[t]
\frametitle{Total Electron Content}
\begin{equation*}
\Delta \rho_{ion}=\frac{40.3}{f^2}\tikzmarkin<2>[mark at=0.835]{col}(0.2,-0.5)(-0,0.7)\int_S N_e\mathrm{d}S\tikzmarkend{col}
\end{equation*}

\tikz[remember picture,overlay]{
\draw<2->[stealth-,red,draw,use marker id] (0,0)--++(0,-1)--++(-3,0)
node[left,black]{TEC};
}
\end{frame}
\end{document}


The key use marker id allows to start a new path in which the coordinates (0,0) identify the point marked previously.

To come back to the issue, here just having the overlay specifications coherent between the highlighted formula and the annotation is enough. With coherence I mean:

overlay specification of formula <= overlay specification of the annotation


For example:

\documentclass[12pt]{beamer}
\usepackage{lmodern}
\usepackage[beamer,markings]{hf-tikz}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}

\begin{frame}[t]
\frametitle{Total Electron Content}
\begin{equation*}
\Delta \rho_{ion}=\frac{40.3}{f^2}\tikzmarkin<2->[mark at=0.835]{col}(0.2,-0.5)(-0,0.7)\int_S N_e\mathrm{d}S\tikzmarkend{col}
\end{equation*}

\tikz[remember picture,overlay]{
\draw<3->[stealth-,red,draw,use marker id] (0,0)--++(0,-1)--++(-3,0)
node[left,black]{TEC};
}
\end{frame}
\end{document}


The result:

-