# Side by side figures containing subfloats

Is it possible to get two figure environments side by side across the top of a page, where both (or at least 1) contains subfloats? IE:

And if so, how? I am currently using the subfig package with a combination of figure/subfloat in my document.

-
Welcome to TeX.sx! Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Upvoting is the preferred way here to say "thank you" to users who helped you. – doncherry Sep 17 '12 at 5:51

You can do it by using the packages floatrow and subfig together.

\documentclass{article}
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{floatrow}

\begin{document}
\begin{figure}[htbp]
\centering
\begin{floatrow}
\ffigbox[\FBwidth]
{
\subfloat[Caption]{\includegraphics[height=4cm,width=3cm]{image1a}}
\subfloat[Caption]{\includegraphics[height=4cm,width=3cm]{image1b}}
}{\caption{Caption here}}
\ffigbox{
\subfloat[Caption]{\includegraphics[height=4cm,width=3cm]{image2}}
}{\caption{Caption here}}
\end{floatrow}
\end{figure}
\end{document}


-
Verified this works as well. – DavidE Sep 19 '12 at 2:08

The vertical and horizontal alignments will be a problem if the subfigures don't have the same dimensions. Here's a way under that assumption.

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{subfig,lipsum}

\begin{document}

\lipsum[2]

\begin{figure}[htp]
\centering
\begin{minipage}{.6667\textwidth}
\centering
\hspace*{\stretch{1}}%
\subfloat[Caption]{\includegraphics[width=3cm,height=2cm]{x}}%
\hspace{\stretch{2}}%
\subfloat[Caption]{\includegraphics[width=3cm,height=2cm]{x}}%
\hspace{\stretch{1}}
\caption{Caption here}
\end{minipage}%
\begin{minipage}{.3333\textwidth}
\centering
\hspace*{\stretch{1}}%
\subfloat[Caption]{\includegraphics[width=3cm,height=2cm]{x}}%
\hspace{\stretch{1}}
\caption{Caption here}
\end{minipage}
\end{figure}

\lipsum[3]

\end{document}


As usual the lipsum package and the demo option to graphicx are just to prepare the example. I've arranged things so that the space between the subfigures will be the same. The \centering commands have the purpose of avoiding the paragraph indentation. Notice also the % used to mask off the end-of-lines that would produce spaces and the \hspace* commands for getting the space at the beginning of the lines.

-
Worked great, but as mentioned has problems with aligning captions of differing height floats. – DavidE Sep 19 '12 at 2:54