tikz beamer add tag
topnush
Here is a MWE:

```
\documentclass{beamer}
\usetheme{default}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, calc, matrix, overlay-beamer-styles}
\begin{document}
\begin{frame}
	\centering
	\begin{tikzpicture} [nodes in empty cells,
	nodes={minimum width=0.5cm, minimum height=0.5cm},
	row sep=-\pgflinewidth, column sep=-\pgflinewidth]
	%    border/.style={draw}
	
	\matrix(vector)[matrix of nodes, ampersand replacement=\&, % <- added ampersand replacement
	row 1/.style={nodes={draw=none, minimum width=0.3cm}},
	nodes={draw}]
	{ % use \& instead of & as column separator
		\tiny{0} \& \tiny{1} \& \tiny{2} \& \tiny{3} \& \tiny{4} \& \tiny{5}\& \tiny{6} \& \tiny{7}\& \tiny{8} \& \tiny{9}\\
			$3$ \& $8$ \& $9$ \& $15$ \& $14$\& $13$ \& $7$\& $2$ \& $2$ \& $1$\\
	};
	\end{tikzpicture}
\end{frame}
\end{document}
```

![Screenshot from 2024-02-21 14-56-45.png](/image?hash=b29e042063a9518bdb69f6b88262ca71a021fb7f545db7b304755fb5f4f77906)



I want to highlight different cells at different transitions.  Specifically, I would like to highlight the cell labelled 5 (with 13 in it) at transition 2, then split the array into 0-4 and 5-9 with a small gap in between, then highlight cell 2 in yellow.

How can this be done?

Top Answer
samcarter
As you are anyway loading the `overlay-beamer-styles` library, you can use `fill on=<...>` to highlight cells on specific overlays: 

```
\documentclass{beamer}
\usetheme{default}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, calc, matrix, overlay-beamer-styles}

\newlength{\myspace}
\setlength{\myspace}{0cm}

\begin{document}
\begin{frame}

  \only<3->{\setlength{\myspace}{1cm}}

	\centering
	\begin{tikzpicture} [nodes in empty cells,
	nodes={minimum width=0.5cm, minimum height=0.5cm},
	row sep=-\pgflinewidth, column sep=-\pgflinewidth]
	%    border/.style={draw}
	
	\matrix(vector)[matrix of nodes, ampersand replacement=\&, % <- added ampersand replacement
	row 1/.style={nodes={draw=none,font=\tiny}},
	nodes={draw,minimum width=0.6cm}]
	{ % use \& instead of & as column separator
   		0 \& 1 \& 2 \& 3 \& 4 \&[\myspace] 5\& 6 \& 7\& 8 \& 9\\
			$3$ \& |[fill=yellow,fill on=<4->]| $8$ \& $9$ \& $15$ \& $14$\& |[fill=yellow,fill on=<2>]| $13$ \& $7$\& $2$ \& $2$ \& $1$\\
	};
	\end{tikzpicture}
\end{frame}
\end{document}
```

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

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.