# How to typeset an array of figures?

#### Ackbach

##### Indicium Physicus
Staff member
I want to typeset a 3 x 2 array of figures (that is, three rows of two columns), for answers to a multiple-choice question. How can I do that? The standard \begin{figure} environment seems to want to be outside of any environment. Ideas?

#### Ackbach

##### Indicium Physicus
Staff member
I found a workable solution at this website. Here's the code, more or less:

Code:
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}

\begin{figure}
\centering
\begin{subfigure}[b]{0.3\textwidth}
\includegraphics[width=\textwidth]{gull}
\caption{A gull}
\label{fig:gull}
\end{subfigure}%
%(or a blank line to force the subfigure onto a new line)
\begin{subfigure}[b]{0.3\textwidth}
\includegraphics[width=\textwidth]{tiger}
\caption{A tiger}
\label{fig:tiger}
\end{subfigure}
%(or a blank line to force the subfigure onto a new line)
\begin{subfigure}[b]{0.3\textwidth}
\includegraphics[width=\textwidth]{mouse}
\caption{A mouse}
\label{fig:mouse}
\end{subfigure}
\caption{Pictures of animals}\label{fig:animals}
\end{figure}

#### dwsmith

##### Well-known member
I found a workable solution at this website. Here's the code, more or less:

Code:
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}

\begin{figure}
\centering
\begin{subfigure}[b]{0.3\textwidth}
\includegraphics[width=\textwidth]{gull}
\caption{A gull}
\label{fig:gull}
\end{subfigure}%
%(or a blank line to force the subfigure onto a new line)
\begin{subfigure}[b]{0.3\textwidth}
\includegraphics[width=\textwidth]{tiger}
\caption{A tiger}
\label{fig:tiger}
\end{subfigure}
%(or a blank line to force the subfigure onto a new line)
\begin{subfigure}[b]{0.3\textwidth}
\includegraphics[width=\textwidth]{mouse}
\caption{A mouse}
\label{fig:mouse}
\end{subfigure}
\caption{Pictures of animals}\label{fig:animals}
\end{figure}
I general use \subcaptionbox which is also part of the subcaption package as well.

http://ctan.unixbrain.com/macros/latex/contrib/caption/subcaption.pdf

Chapter 4 of the documentation says:
A different way of setting sub-figures is offered by the \subcaptionbox
command, \subcaptionbox which automatically aligns the sub-figures resp. sub-tables by their very first caption line.