# Four side by side figures each pair have one common caption

I am using the following LaTeX code to put four figures in two rows with two figures side by side so that both of them are on a line and have a one common caption. Unfortunately when I am using the caption the LaTeX file does not execute properly. How can I do the above procedure? There is other code that does not work. I am using MiKTeX 2.8 and TeXnicCenter stable 2.3.

Here is my code:

\begin{figure}[htp]

\begin{tabular}{cc}

% Requires \usepackage{graphicx}
\includegraphics[width=13cm]{fig1.eps}&

\hspace{-5cm} \includegraphics[width=13cm]{fig2}\caption{}\

\includegraphics[width=13cm]{fig3.eps}& \hspace{-5cm} \includegraphics[width=13cm]{fig4.eps}\caption{}\
\end{tabular} \end{figure}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SECOND CODE IS
\begin{figure}
\centering
\begin{tabular}{cc}
\includegraphics{fig1} &
\includegraphics{fig2}
\end{tabular}
\caption{.....}
\end{figure}
\begin{figure}
\centering
\begin{tabular}{cc}
\includegraphics{fig3} &
\includegraphics{fig4}
\end{tabular}
\caption{.....}
\end{figure}

• Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}.
– user31729
May 12, 2014 at 3:52
• Why does your SECOND CODE not work?
– Werner
May 12, 2014 at 5:16

One option:

\documentclass{article}
\usepackage[demo]{graphicx}

\begin{document}

\begin{figure}
\centering
\includegraphics[width=.4\linewidth]{fig3}\par
\caption{the caption for the first group}\par\bigskip
\label{fig:testa}

Your settings for the width (13cm) were perhaps too wide for a standard document; it's better to control the width using a fraction of \linewidth, as I did in my example code.
The demo option for graphicx simply replaces actual figures with black rectangles; do not use that option in your actual document.