Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I need an image with five subfigures arranged this way.

enter image description here

I have tried to use subfig and floatrow, but I haven't been able to place the figures as I need them

share|improve this question
    
I found the package \usepackage{textpos} really good for this. Then you would simply place your images in brackets like \begin{textblock}{1}(5.5,2.5){1,1} Some figure \end{textblock}. Read more about the package here mirror.ctan.org/macros/latex/contrib/textpos/textpos.pdf. Another method is using minipages. –  N3buchadnezzar Nov 18 '11 at 2:14

3 Answers 3

up vote 9 down vote accepted

You could use a combination of minipages and subfigure environments (from the subcaption package); a little example:

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

\begin{document}

\begin{figure}
\begin{minipage}{.33\textwidth}
  \begin{subfigure}{\linewidth}
    \centering
    \includegraphics[width=.7\linewidth]{name1}
    \caption{First subfigure}
    \label{fig:sub1}
  \end{subfigure}\\[1ex]
  \begin{subfigure}{\linewidth}
    \centering
    \includegraphics[width=.7\linewidth]{name2}
    \caption{Second subfigure}
    \label{fig:sub2}
  \end{subfigure}
\end{minipage}%
\begin{minipage}{.33\textwidth}
  \begin{subfigure}{\linewidth}
    \centering
    \includegraphics[width=.7\linewidth]{name3}
    \caption{Third subfigure}
    \label{fig:sub3}
  \end{subfigure}
\end{minipage}%
\begin{minipage}{.33\textwidth}
  \begin{subfigure}{\linewidth}
    \centering
    \includegraphics[width=.7\linewidth]{name4}
    \caption{Fourth subfigure}
    \label{fig:sub4}
  \end{subfigure}\\[1ex]
  \begin{subfigure}{\linewidth}
    \centering
    \includegraphics[width=.7\linewidth]{name5}
    \caption{Fifth subfigure}
    \label{fig:sub5}
  \end{subfigure}
\end{minipage}
\caption{Five subfigures}
\label{fig:test}
\end{figure}

\end{document}

enter image description here

I used the demo option for the graphicx package to replace the actual figures with black rectangles and make my code compilable for everyone; do not use that option in your actual code.

share|improve this answer
    
Gonzalo, perhaps add [!htpb] after \begin{figure} ? Seems like quite a standard thing to do. This way we restrict the floating of the figure quite a bit. Using 4 images, the chances of the figure actually fitting is quite low. Also great solution =) –  N3buchadnezzar Nov 18 '11 at 2:29
1  
@N3buchadnezzar: thanks. As for the placement specifiers, for some time now, I've opted for not using them in my example codes unless the person asking the question explicitly mentions a problem with their use. –  Gonzalo Medina Nov 18 '11 at 3:18

You could use three minipages next to each other:

enter image description here

\documentclass{article}

\usepackage{caption,subcaption}
\begin{document}
\begin{figure}
\centering
\begin{minipage}{0.3\textwidth}
\subcaptionbox{A}{\rule{3cm}{3.5cm}}\\[1ex]
\subcaptionbox{B}{\rule{3cm}{3.5cm}}
\end{minipage}%
\begin{minipage}{0.3\textwidth}
\subcaptionbox{C}{\rule{3cm}{3.5cm}}
\end{minipage}%
\begin{minipage}{0.3\textwidth}
\subcaptionbox{D}{\rule{3cm}{3.5cm}}\\[1ex]
\subcaptionbox{E}{\rule{3cm}{3.5cm}}
\end{minipage}
\caption{Pictures!}
\end{figure}

\end{document}
share|improve this answer
    
You could add % after the first and second \end{minipage} commands to prevent undesired blank spaces. –  Gonzalo Medina Nov 18 '11 at 2:25
    
@GonzaloMedina: Good point, thanks! I've also adopted the \\[1ex] from your answer to get nicer vertical spacing. –  Jake Nov 18 '11 at 2:46

Using the subfig package you can use tabulars to arrange the images:

enter image description here

\documentclass{article}
\usepackage{subfig}% http://ctan.org/pkg/subfig
\begin{document}
\begin{figure}[ht]
  \begin{tabular}{c}
    \subfloat[subfigure 1]{\rule{100pt}{50pt}} \\
    \subfloat[subfigure 2]{\rule{100pt}{50pt}}
  \end{tabular} \hfill
  \begin{tabular}[m]{c}
    \subfloat[subfigure 3]{\rule{100pt}{50pt}}
  \end{tabular} \hfill
  \begin{tabular}{c}
    \subfloat[subfigure 4]{\rule{100pt}{50pt}} \\
    \subfloat[subfigure 5]{\rule{100pt}{50pt}}
  \end{tabular}
  \caption{bla bla bla bla bla bla}
\end{figure}
\end{document}

Vertical alignment across the subfigures is obtained using the optional tabular parameter [m] for middle. Using \hfill as suggested will push the columns of subfigures to the outer edges of the text block. If you want these columns evenly spaces, use \null\hfill on the left of the first column and \hfill\null on the right of the last column. Alternatively, a fixed spacing using \hspace{<len>} is also possible, where <len> is any recognized TeX length.

tabular column specification necessarily adds a little horizontal space of \tabcolsep between columns. If you want this removed (for whatever reason), you can use a {@{}c@{}} column specification instead of {c}.

share|improve this answer
    
Is this the preferred solution when using memoir? –  Neil G Feb 6 at 11:53
    
@NeilG: You could probably use any of the solutions in the answers in terms of positioning. Although memoir provides its own \subbottom and \subtop sub-figure tools. –  Werner Feb 6 at 15:13
    
yes, so I figured I could use \subbottom inside a tabular? Yours seems like the least verbose solution. –  Neil G Feb 7 at 0:21
    
@NeilG: Yes. I've mocked something up (see here) and it seems to work. –  Werner Feb 7 at 0:34
    
Awesome!! Thank you. This is exactly what I was looking for. –  Neil G Feb 7 at 1:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.