3

There are five figures. Basically, I'd like them to displayed as following:

     |figure 1|figure 2|

|figure 3|figure 4|figure 5|

The first two figures are in the first row and the last three are in the second row. And The first row should be in the middle of the second row.

Werner
  • 603,163
FihopZz
  • 355

3 Answers3

4

(Updated to include @Mico's suggestion of a \bigskip.)

Here's one possibility that makes use of \parboxes. This solution makes sense, I think, if you want all of the figures to have a figure number that increases.

You can change the length for the first two \parboxes and the length for the first two \includegraphics commands if you want the top two figures to be smaller and not span the entire width of the overall figure environment.

\documentclass{article}

\usepackage{graphicx}
\usepackage{mwe}

\begin{document}

\begin{figure}
\parbox{.48\textwidth}{\includegraphics[width=.48\textwidth]{example-image-a}\caption{}}
\hfill
\parbox{.48\textwidth}{\includegraphics[width=.48\textwidth]{example-image-a}\caption{}}

\bigskip

\parbox{.32\textwidth}{\includegraphics[width=.32\textwidth]{example-image-a}\caption{}}
\hfill
\parbox{.32\textwidth}{\includegraphics[width=.32\textwidth]{example-image-a}\caption{}}
\hfill
\parbox{.32\textwidth}{\includegraphics[width=.32\textwidth]{example-image-a}\caption{}}
\end{figure}

\end{document}

enter image description here

There are also the subfig and subcaption packages that allow you to have subfigures (e.g., the labels will be something like Figure 1(a), Figure 1(b), etc.; see, for starters, subcaption vs. subfig: Best package for referencing a subfigure and also Jesse's answer for a concrete example).

Adam Liter
  • 12,567
  • You may want to insert a bit of extra vertical spacing, say \medskip or \bigskip, between the two groups of figures. Otherwise, it's not immediately clear where the first two captions belong. – Mico Mar 14 '14 at 13:12
  • @Mico thanks for the suggestion! Answer has been updated. – Adam Liter Mar 14 '14 at 14:40
3

Another alternative is use of subfigure package with subfigure command.

Edit: Reminded by Adam, subfigure is depreciated, so a new update here subfig is used with subfloat command.

enter image description here

Code

\documentclass[]{article}
\usepackage[margin=1cm]{geometry}
\usepackage{subfig}
\usepackage[demo]{graphicx}

\begin{document}

\begin{figure*}[htbp]
\centering
\subfloat[~subcaption1]{\includegraphics[scale=.95]{figure}}\,
\subfloat[~subcaption2]{\includegraphics[scale=.95]{figure}}
\\
\subfloat[~subcaption1]{\includegraphics[scale=.95]{figure}}\,
\subfloat[~subcaption2]{\includegraphics[scale=.95]{figure}}\,
\subfloat[~subcaption2]{\includegraphics[scale=.95]{figure}}
\vspace{-0.6 cm}  % can be changed to suit one's need.
\caption{Caption}
\label{}
\end{figure*}

\end{document}
Jesse
  • 29,686
  • What's the need for \mbox? – karlkoeller Mar 14 '14 at 05:52
  • Indeed, it works without \mbox, but my gut feeling was that it is for horizontally aligned material said in wikibook here. http://en.wikibooks.org/wiki/LaTeX/Boxes#makebox_and_mbox. With that in mind I keep it there. @karlkoeller, what do you reckon? – Jesse Mar 14 '14 at 06:00
  • I would remove it. But feel free not to follow my opinion. :-) – karlkoeller Mar 14 '14 at 09:07
  • @Jesse Those \mbox commands only add unwanted spaces (because you're not protecting end-of-lines). Also the lonely [t] in the options to figure* should be [tp] – egreg Mar 14 '14 at 11:30
  • @egreg, karlkoeller -- Thanks to you all. I finally understand the differences which had puzzled me since I posted it, not sure whether to keep or to remove it. – Jesse Mar 14 '14 at 12:02
1

You could place the graphs in minipage environments -- each one associated with a \caption command -- all within one and the same figure environment.

enter image description here

\documentclass{article}
\usepackage[demo]{graphicx}  % omit 'demo' option in real document
\begin{document}

\begin{figure}
\centering

% first group of figures
\begin{minipage}{0.31\textwidth}
\includegraphics[width=\linewidth]{pic1.pdf}
\caption{First of five} \label{fig:1}
\end{minipage}
\hspace{3mm} % choose horizontal spacing to suit your needs
\begin{minipage}{0.31\textwidth}
\includegraphics[width=\linewidth]{pic2.pdf}
\caption{Second of five} \label{fig:2}
\end{minipage}

% second group of figures
\bigskip
\begin{minipage}{0.31\textwidth}
\includegraphics[width=\linewidth]{pic3.pdf}
\caption{Third of five} \label{fig:3}
\end{minipage}
\hspace*{\fill}
\begin{minipage}{0.31\textwidth}
\includegraphics[width=\linewidth]{pic4.pdf}
\caption{Fourth of five} \label{fig:4}
\end{minipage}
\hspace*{\fill}
\begin{minipage}{0.31\textwidth}
\includegraphics[width=\linewidth]{pic5.pdf}
\caption{Last of five} \label{fig:5}
\end{minipage}
\end{figure}

\hrule % just to illustrate width of text block
\end{document}
Mico
  • 506,678