I have a problem with subfigure. I want to put some figures at different places in the section. I want to have them in pairs, so I use subfigure. But, instead of labels (a) and (b) in the Figure 1, and labels (a) and (b) in the Figure 2, I have (a) and (b) in Figure 1 and (c) and (d) in Figure 2. And it is like this in whole section. So in the end of the section, I have a pair of pictures, which I have to refer at as Figure 3(e) and 3(f). Instead of that, I would like to have each pair of pictures be named as (a) and (b). So I would have Fig. 1(a) and 1(b), Fig. 2(a) and 2(b), and so on. Do anyone know what to do with it? Thanks.
\documentclass[12pt,a4paper]{article}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{color}
\usepackage{float}
\begin{document}
\begin{figure}[H]
\begin{subfigure}{.9\textwidth}
\centering
\includegraphics[width=.5\linewidth]{1.pdf}
\caption{$H \rightarrow b\overline{b}$}
\end{subfigure}
\begin{subfigure}{.9\textwidth}
\centering
\includegraphics[width=.5\linewidth]{2.pdf}
\caption{$H \rightarrow \gamma \gamma$}
\end{subfigure}
\caption{mmmm}
\end{figure}
text text text
\begin{figure}[H]
\begin{subfigure}{.9\textwidth}
\centering
\includegraphics[width=.5\linewidth]{1.pdf}
\caption{$H \rightarrow b\overline{b}$}
\end{subfigure}
\begin{subfigure}{.9\textwidth}
\centering
\includegraphics[width=.5\linewidth]{2.pdf}
\caption{$H \rightarrow \gamma \gamma$}
\end{subfigure}
\caption{mmmm}
\end{figure}
\end{document}
Best Answer
By using the
subcaption
package:UPDATE
Using your own code, this is what I have:
Please keep in mind that
[demo]
was only used to replace your picture files. Just remove it on your preamble and use your files like\includegraphics[width=.5\linewidth]{yourownfilehere}
.The output of the code just mentioned is this: