[Tex/LaTex] Tikz overlay for subfigure environment- beamer

beameroverlayssubfloatstikz-pgf

I have been trying to create a list and a bunch of subfigures (both on each half of the slide). I have used \setbeamercovered{transparent}to progress along the list per keystroke. I want this keystroke to also be used to draw tikz overlays on the figure. I saw quite a few solutions, but all of them were using just a single figure. I cant seem to get it working for subfigures. Can someone please help me out..

Here is my minimal code..

\frame  
{  
  \setbeamercovered{transparent}  
\frametitle{Title}  
\begin{minipage}[t]{0.5\linewidth}  
\begin{itemize}[<+->]  
\item  
\item  
\item  
\item  
\end{itemize}  
\end{minipage}  
\hfill   
\vspace{-120pt}  
\begin{minipage}[t]{2\linewidth}  
\setcounter{subfigure}{0}  
\begin{figure}[!th]  
\centering  
\subfigure[1]{  
\includegraphics[scale=.25]{scen-q.pdf}  
\label{fig:scen1subfig1}  
}  
\hspace{-10pt}  
\subfigure[2]{  
\includegraphics[scale=.25]{scen-b.pdf}  
\label{fig:scen1subfig2}  
}
\newline
\subfigure[3]{
\includegraphics[scale=.25]{scen-s.pdf}
\label{fig:scen1subfig3}
}  
\subfigure[4]{  
\includegraphics[scale=.25]{scen-sw.pdf}  
\label{fig:scen1subfig4}  
}  
\hspace{130pt}  
\label{fig:scencomp}  
\end{figure}  
\end{minipage}  
}

I have seen this as a solution before

\begin{tikzpicture}    
\node[anchor=south west,inner sep=0] at (0,0) {\includegraphics[width=1\textheight]{5.pdf}};  
\draw<1>[red,ultra thick,rounded corners] (1.6,1) rectangle (\textheight-1cm,5);  
\draw<2>[red,ultra thick,rounded corners] (5.7,4.1) rectangle (7.5,4.9);  
\end{tikzpicture} 

But how do I do the same for subfigures?

Best Answer

I am not sure if this is the kind of overlay effect that you are trying to achieve; I used \onslide so that each image will become visible simultaneously with a corresponding item:

\PassOptionsToPackage{demo}{graphicx}
\documentclass{beamer}
\usepackage{subfigure}

\begin{document}

\begin{frame}  
\frametitle{Title}  

\begin{minipage}[t]{0.5\linewidth}  
\begin{itemize}[<+->]  
\item  First item.
\item  Second item.
\item  Third item.
\item  Fourth item.
\end{itemize}  
\end{minipage}%  
\begin{minipage}[t]{0.5\linewidth}  
\setcounter{subfigure}{0}  
\begin{figure} 
\onslide<1->{\subfigure[1]{%  
  \includegraphics[height=1cm,width=2cm]{scen-q.pdf}
}%
\label{fig:scen1subfig1}}\hfill
\onslide<2->{\subfigure[2]{% 
  \includegraphics[height=1cm,width=2cm]{scen-b.pdf}  
}%
\label{fig:scen1subfig2}}\\
\onslide<3->{\subfigure[3]{%
  \includegraphics[height=1cm,width=2cm]{scen-s.pdf}
}%  
\label{fig:scen1subfig3}}\hfill
\onslide<4>{\subfigure[4]{%  
  \includegraphics[height=1cm,width=2cm]{scen-sw.pdf}  
}%
\label{fig:scen1subfig4}}%
\caption{test figure}
\label{fig:scencomp}  
\end{figure}  
\end{minipage}  
\end{frame}

\end{document}

enter image description here

Please notice that I included some % characters that are essential to suppress spurious blank spaces. Also, subfigure is an obsolete package, so it would be a good idea to use subcaption instead.

Since I didn't have your actual figures, I used \PassOptionsToPackage{demo}{graphicx}; this simply replaces actual figures with black rectangles; delete that line in your actual document.