[Tex/LaTex] Need pairs of side-by-side subfigures with ONE caption each

graphics

Here is what I am trying to do:

(a) Picture, Picture

(Caption for BOTH images (a) goes here)

(b) Picture, Picture

(Caption for BOTH images (b) goes here)

Etc. For the life of me I cannot figure out how to get ONE caption per pair of subfigure without LaTeX stacking the subfigures on top of each other. Each section of code typically looks like this:

\begin{subfigure}[h]{5cm}
    \includegraphics[scale=0.3]{graphicA1}
    \includegraphics[scale=0.3]{graphicA2}
    \caption{captionA}
\end{subfigure}\\

With a simple \begin{figure} and \end{figure} around the whole thing. When I try this, graphicA1 and graphicA2 get stacked on top of each other. I do NOT want this. I want A1 and A2 in one single row, with a combined caption designed specifically for that subfigure set. How?

Best Answer

Here is an example using subfigure. You can set width dependent on \textwidth to prevent linebreak caused by to big images.

\documentclass[a4paper]{article}
\usepackage{graphicx}
\usepackage{subfigure}

\begin{document}
    \begin{figure}
        \centering
        \subfigure[caption A B]{
            \includegraphics[width=0.49\textwidth]{example-image-a}
            \includegraphics[width=0.49\textwidth]{example-image-b}
        }
        \subfigure[caption C A]{
            \includegraphics[width=0.49\textwidth]{example-image-c}
            \includegraphics[width=0.49\textwidth]{example-image-a}
        }
        \caption{caption}
    \end{figure}
\end{document}

enter image description here