How to typeset an array of figures?

  • Context: MHB 
  • Thread starter Thread starter Ackbach
  • Start date Start date
  • Tags Tags
    Array
Click For Summary
SUMMARY

This discussion focuses on typesetting a 3 x 2 array of figures in LaTeX using the graphicx, caption, and subcaption packages. The provided code demonstrates how to create a figure environment that includes multiple subfigures, each with its own caption. The \subcaptionbox command is also mentioned as an alternative for aligning subfigures automatically by their captions. This solution effectively addresses the challenge of arranging figures within a single figure environment.

PREREQUISITES
  • Familiarity with LaTeX typesetting
  • Understanding of the graphicx package for image inclusion
  • Knowledge of the caption and subcaption packages
  • Basic concepts of figure and subfigure environments in LaTeX
NEXT STEPS
  • Explore advanced features of the subcaption package
  • Learn about the \subcaptionbox command for subfigure alignment
  • Investigate additional spacing options between figures in LaTeX
  • Review best practices for organizing figures in academic papers
USEFUL FOR

Researchers, academic writers, and anyone using LaTeX for document preparation who needs to effectively typeset multiple figures in a structured format.

Ackbach
Gold Member
MHB
Messages
4,148
Reaction score
94
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?
 
Physics news on Phys.org
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}%
        ~ %add desired spacing between images, e. g. ~, \quad, \qquad etc.
          %(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}
        ~ %add desired spacing between images, e. g. ~, \quad, \qquad etc.
          %(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}
 
Ackbach said:
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}%
        ~ %add desired spacing between images, e. g. ~, \quad, \qquad etc.
          %(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}
        ~ %add desired spacing between images, e. g. ~, \quad, \qquad etc.
          %(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.
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 2 ·
Replies
2
Views
10K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
4
Views
7K
  • · Replies 4 ·
Replies
4
Views
6K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K