texblog

Placing figures/tables side-by-side (\subfigure)

Remark:
The subfigure package has been replace by subfig and is therefore obsolete. Please see my post on that topic.

There are two different ways to place two figures/tables side-by-side. The subfigure package provides functionality to arrange figures and tables next to each other, within the usual figure-floating-environment. You can find a post on the minipage-environment here, behaving differently compared a subfigure, but is also used within a floating environment.

Subfigure is a package, therefore the first thing you need to do is add the package to your Latex-document.

\usepackage{subfigure}

Once the package is included, you can start using the environment.

Here is a complete example:

\documentclass{article}
\usepackage{subfigure}
\begin{document}
\begin{figure}[ht]
\centering
\subfigure[Caption of subfigure 1]{
	\rule{4cm}{3cm}
	\label{fig:subfig1}
}
\subfigure[Caption of subfigure 2]{
	\rule{4cm}{3cm}
	\label{fig:subfig2}
}
\subfigure[Caption of subfigure 3]{
	\rule{4cm}{3cm}
	\label{fig:subfig3}
}
\caption[Optional caption for list of figures]{Caption of subfigures \subref{fig:subfig1}, \subref{fig:subfig2} and \subref{fig:subfig3}}
\label{fig:subfigureExample}
\end{figure}
Reference to figure \ref{fig:subfigureExample}.
\end{document}

If the horizontal margins are exceeded, Latex will automatically place the sub-figure onto the next line.

Subfigure differs from minipage in that you cannot choose the space between two figures, but it is determined automatically, depending on the figure size. There is also a lower limit, whereas using minipage, you can theoretically place your figures directly side-by-side. By default, subfigure will alphabetically number your subfigures and you have access to the comlete reference as usual through \ref{fig:subfig1} or to the letter only through \subref{fig:subfig1}. The optional caption of a subfigure will be placed next to the letter. As usual, a caption can be added to the complete figure.

Subtables can be used in the very same way, just replace the \subfigure by \subtable for each table you want to place horizontally. See here for an introduction on tables. The tabular environment is sufficient, as basically the table environment is replace by subtable.

Remark: Even though not very nice, you can even place sub-figures next to sub-tables.

Exit mobile version