# Re-setting the numbering in minipages sub-figures

For my presentation I am using minipage format in a frame to display two figures side by side (in beamer) with short subcaptions for each figures. Each figure is numbered as (a) Carbon (b) Aluminium (Figure 1). When I use another frame with minipage format with another two figures, it will display the sub-caption numbers as (c) Iron (d) Copper (Figure 2). This is what is required for me. But when I have the next frame with two figures side by side, I don't want the numbering to be as (e) Carbon(f) Aluminium (Like it is happening in Figure 3). And the next as (g) XXXXX (h) XXXXXX and the next as (i) XXXXXX (j) XXXXX and at last aft (y) XXXXXX (z) XXXXX, error message(s) is/are displayed like this.."Counter too large....."

It should be once again (a) Carbon(b) Aluminium (In Figure 3).

The piece of the code of the above is given below:

\documentclass{beamer}
\usepackage{natbib}
\usetheme{Warsaw}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{xcolor}
\captionsetup{compatibility=false}
\usepackage{fancybox}
\usepackage{multirow}
\usepackage{graphicx}
\usepackage{beamerthemesplit}
\usepackage{amssymb,amsmath,amsthm,latexsym}
\usepackage{amsfonts}
\usepackage{color}
\newcounter{saveenumi}
\newcommand{\seti}{\setcounter{saveenumi}{\value{enumi}}}
\newcommand{\conti}{\setcounter{enumi}{\value{saveenumi}}}
\usepackage{graphics}
\setbeamercovered{highly dynamic}

\subsection*{Multiple Scattered Photons \& Saturation Thickness}
\begin{frame}
\begin{block}{\large Multiple scattered photons versus target thickness}
\begin{figure}
\begin{minipage}{150pt}
\begin{center}
\includegraphics[width=\textwidth]{Figure4_3a.jpg}
\subcaption{Carbon}
\end{center}
\end{minipage}
\hfill
\begin{minipage}{150pt}
\begin{center}
\includegraphics[width=\textwidth]{Figure4_3b.jpg}
\subcaption{Aluminium}
\end{center}
\end{minipage}
\hfill
\end{figure}
\end{block}
\end{frame}

\begin{frame}
\begin{block}{\large Multiple scattered photons versus target thickness (continued...)}
\begin{figure}
\begin{minipage}{150pt}
\begin{center}
\includegraphics[width=\textwidth]{Figure4_3c.jpg}
\subcaption{Iron}
\end{center}
\end{minipage}
\hfill
\begin{minipage}{150pt}
\begin{center}
\includegraphics[width=\textwidth]{Figure4_3d.jpg}
\subcaption{Copper}
\end{center}
\end{minipage}
\hfill
\end{figure}
\end{block}
\end{frame}

\subsection*{Experimental and MCNP comparison for 75 mm collimator}

\begin{frame}
\begin{block}{\large Multiple scattered photons versus target thickness for 75 mm collimator}
\begin{figure}
\begin{minipage}{150pt}
\begin{center}
\includegraphics[width=\textwidth]{Figure4_4a.jpg}
\subcaption{Carbon}
\end{center}
\end{minipage}
\hfill
\begin{minipage}{150pt}
\begin{center}
\includegraphics[width=\textwidth]{Figure4_4b.jpg}
\subcaption{Aluminium}
\end{center}
\end{minipage}
\hfill
\end{figure}
\end{block}
\end{frame}

\end{document}


To reset the counter, you can use \setcounter{subfigure}{0}. In case you have many figures with this problem there are already some questions and answers on this side, how to to this automatically.

\documentclass{beamer}
\usepackage{natbib}
\usetheme{Warsaw}
\usepackage{caption}
\usepackage{subcaption}
\captionsetup{compatibility=false}
\usepackage{fancybox}
\usepackage{multirow}
\usepackage{beamerthemesplit}
\usepackage{amssymb,amsmath,amsthm,latexsym}
\usepackage{amsfonts}
\newcounter{saveenumi}
\newcommand{\seti}{\setcounter{saveenumi}{\value{enumi}}}
\newcommand{\conti}{\setcounter{enumi}{\value{saveenumi}}}
\setbeamercovered{highly dynamic}

\begin{document}

\begin{frame}
\begin{block}{\large Multiple scattered photons versus target thickness (continued...)}
\begin{figure}
\begin{minipage}{150pt}
\begin{center}
\includegraphics[width=\textwidth]{pic}
\subcaption{Iron}
\end{center}
\end{minipage}
\hfill
\begin{minipage}{150pt}
\begin{center}
\includegraphics[width=\textwidth]{pic}
\subcaption{Copper}
\end{center}
\end{minipage}
\hfill
\end{figure}
\end{block}
\end{frame}

\begin{frame}
\begin{block}{\large Multiple scattered photons versus target thickness for 75 mm collimator}
\setcounter{subfigure}{0}
\begin{figure}
\begin{minipage}{150pt}
\begin{center}
\includegraphics[width=\textwidth]{pic}
\subcaption{Carbon}
\end{center}
\end{minipage}
\hfill
\begin{minipage}{150pt}
\begin{center}
\includegraphics[width=\textwidth]{pic}
\subcaption{Aluminium}
\end{center}
\end{minipage}
\hfill
\end{figure}
\end{block}
\end{frame}

\end{document}


Comment:

You do not need packages like xcolor, graphicx, color or graphics as beamer already provides these functionalities.

• Thank you very much for providing the solution. It is working exactly in a way I needed. Thank you once again – Kiran K U May 4 '16 at 16:51