# Two figures in a subfigure

I need to show a total of 8 figures in the same page, combining them in this way:

 img1-a img1-b
img2-a img2-b
(a)  (b)

img1-c img1-d
img2-c img2-d
(c)  (d)


I tried subfigure,

\begin{figure*}[tpb]
\centering
\subfigure[]
{\label{fig:conn}
\includegraphics[width=0.48\columnwidth,keepaspectratio]{img1-a}
\includegraphics[width=0.48\columnwidth,keepaspectratio]{img1-a}}\hfill

\subfigure[]
//and so on....


but I do not understand how to combine two figures to stay on the same column (i.e. figure img1-a and img2-a). Maybe forcing the subfigure width? Any help will be appreciated!

-

## migrated from stackoverflow.comJun 21 '12 at 17:03

This question came from our site for professional and enthusiast programmers.

did you have a look at the documentation of subfig package ctan.org/tex-archive/macros/latex/contrib/subfig and the subfigure package tug.ctan.org/tex-archive/obsolete/macros/latex/contrib/… - I think one of these should solve your problem – epsilonhalbe Jun 20 '12 at 17:09
Welcome to TeX.sx! Your question was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. – Werner Jun 21 '12 at 17:07

You can combine the images that have to be placed in the same column in the same subfigure with a minipage. I can't get this to work in subfigure, for some particular reason. But this code should give you the output you want with the subfig package.

\documentclass[11pt,a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage{graphicx}
\usepackage{subfig}
\begin{document}

\begin{figure}[tpb]
\centering
\subfloat[]{
\begin{minipage}{0.5\linewidth}
\includegraphics[width=0.98\linewidth, height = 0.2\textheight, keepaspectratio=true]{1a}

\includegraphics[width=0.98\linewidth, height = 0.2\textheight, keepaspectratio=true]{2a}
\end{minipage}}
\subfloat[]{
\begin{minipage}{0.5\linewidth}
\includegraphics[width=0.98\linewidth, height = 0.2\textheight, keepaspectratio=true]{1b}

\includegraphics[width=0.98\linewidth, height = 0.2\textheight, keepaspectratio=true]{2b}
\end{minipage}}

\subfloat[]{
\begin{minipage}{0.5\linewidth}
\includegraphics[width=0.98\linewidth, height = 0.2\textheight, keepaspectratio=true]{1c}

\includegraphics[width=0.98\linewidth, height = 0.2\textheight, keepaspectratio=true]{1d}
\end{minipage}}
\subfloat[]{
\begin{minipage}{0.5\linewidth}
\includegraphics[width=0.98\linewidth, height = 0.2\textheight, keepaspectratio=true]{2c}

\includegraphics[width=0.98\linewidth, height = 0.2\textheight, keepaspectratio=true]{2d}
\end{minipage}}
\end{figure}
\end{document}


Beware of removing whitelines here, as that influences the spacing of the floats.

-
tx for answering. I am trying your solution but error is occurring about subfloat. I have the \usepackage{graphicx} \usepackage{subfigure} \usepackage{subfloat}. – doxsi Jun 21 '12 at 8:18
I added my header to the example. It is possible that subfigure and subfloat don't play nice together. – Laura Jun 21 '12 at 9:49
@doxsi The only package to use in your case is subfig, in my opinion; subfigure is obsolete and you're using only its syntax. – egreg Jun 21 '12 at 17:28
Tx , it works. I just edited because "]" miss in the code – doxsi Jun 22 '12 at 12:48

A solution using subfig and floatrow with global caption

\documentclass{article}
\usepackage{floatrow}
\usepackage{graphicx}
\begin{document}

\begin{figure}
\ffigbox[\FBwidth]{%
\begin{subfloatrow}
\includegraphics{img1-b}
\end{subfloatrow}

\begin{subfloatrow}
\ffigbox[\FBwidth]{\caption{}\label{subfig:a}\includegraphics{img2-a}}{}
\ffigbox[\FBwidth]{\caption{}\label{subfig:b}\includegraphics{img2-b}}{}
\end{subfloatrow}
\vspace{10pt}
\begin{subfloatrow}
\includegraphics{img1-d}
\end{subfloatrow}

\begin{subfloatrow}
\ffigbox[\FBwidth]{\caption{}\label{subfig:c}\includegraphics{img2-c}}{}
\ffigbox[\FBwidth]{\caption{}\label{subfig:d}\includegraphics{img2-d}}{}
\end{subfloatrow}}
{\caption{now with caption}\label{fig:figures}}
\end{figure}

\end{document}

-
Tx, it works (erasing subfigure package). But I am esperimenting that no global caption appear using your solution. – doxsi Jun 22 '12 at 10:57
I noticed that too and wondered why, but since your sketch didn't had one either I stopped wondering why – Jonas Nyrup Jun 22 '12 at 14:31