Positioning Subcaptions Properly With Subcaption

The subcaption package in LaTeX provides convenient methods for adding subcaptions to figures with multiple panels or parts. Proper positioning of these subcaptions in relation to the figure itself requires utilizing the appropriate package options.

Centering Subcaptions Vertically

When adding a subcaption underneath a figure, the default behavior places the subcaption box flush with the bottom of the graphic. However, the subcaption package has built-in functionality to better control this vertical position.

Use “position=b” Option for Bottom Alignment

To align the subcaption box to the true bottom edge of the figure, spanning any full-figure caption width, apply the "position=b" option to the \subcaption command:

\begin{figure}
  \centering
    \includegraphics[width=\linewidth]{example-image}
    \caption{Full width figure caption}
    \subcaption[Short caption text]{Longer explanatory subcaption text}[\position=b]  
\end{figure}

This positions the subcaption box baseline along the true bottom edge of the graphic. Any descenders will extend below this line.

Set Distance from Figure with “skip=” Length

Alternatively, use the "skip=" option to define a precise vertical space between the bottom of the figure and the subcaption baseline:

\subcaption[Subcaption text.]{Subcaption text}[\skip=10pt]

The example skips 10pt of space below the graphic before aligning the subcaption. Any positive \skip length works to separate the two boxes as needed.

Aligning Subcaptions Horizontally

In addition to vertical position, subcaptions may need right, left, or centered alignment relative to the main figure width. The subcaption package provides inline commands to adjust this.

“hfill” Command to Right Align

To create right-aligned subcaptions, use LaTeX's \hfill command to maximize horizontal space between the left-hand figure edge and subcaption text:

\begin{figure}
\centering
  \includegraphics[width=0.8\linewidth]{example-image}
    \caption{Figure caption text}
    \hfill
    \subcaption{Subcaption text}  
\end{figure}

This right-aligns the subcaption while keeping the figure left-aligned within the same horizontal space.

“raggedright” for Left Alignment

Conversely, using the standard \raggedright command before the \subcaption positions its left edge against the figure:

\begin{figure}  
 \centering
  \includegraphics[width=0.8\linewidth]{example-image}
    \caption{Figure caption text}
    \raggedright
    \subcaption{Subcaption text}
\end{figure}

\raggedright disables default text justification rules, allowing left-flush alignment.

“centering” for Center Alignment

For centered subcaptions under full-width figures, apply the \centering command:

\begin{figure}
\centering
  \includegraphics[width=\linewidth]{example-image}
    \caption{Figure caption text}
    \centering
    \subcaption{Subcaption text}
\end{figure}

This centers the subcaption box width relative to the figure width above it.

Multi-Panel Figures

Complex figures containing subfigures or panels require additional subcaption handling to sync label references and maintain positioning.

Subcaption Package Numbering

The subcaption package automatically numbers sub-parts in discrete or alphabetical schemes. Enable this when defining subcaptions:

\begin{figure}
\begin{subfigure}{0.45\linewidth}
  \includegraphics[width=\linewidth]{imageA}
  \subcaption{First subfigure}\label{fig:1a}  
\end{subfigure}
\hfill
\begin{subfigure}{0.45\linewidth}
  \includegraphics[width=\linewidth]{imageB}
  \subcaption{Second subfigure}\label{fig:1b}
\end{subfigure}
\caption{Full figure caption}
\end{figure}

References like Fig. \ref{fig:1a} and Fig. \ref{fig:1b} then pair automatically with the appropriate sub-part.

Syncing Captions with Panels

Utilize the same figure environment for coupled images and captions:

\begin{figure}
\begin{subfigure}{\linewidth}
  \centering
    \includegraphics[width=0.45\linewidth]{imageA}
    \subcaption{First subfigure}
\end{subfigure}
\hfill
\begin{subfigure}{\linewidth}
  \centering  
    \includegraphics[width=0.45\linewidth]{imageB}
    \subcaption{Second subfigure}
\end{subfigure}
    \caption{Full figure caption}
\end{figure}

This associates both subfigures to the overall caption and allows collective numbering.

Customization Options

Format multi-part figures via:

  • Label prefix - \renewcommand{\thesubfigure}{Prefix\arabic{subfigure}}
  • Label font style
  • Caption separator (colon, em dash, etc.)
  • Skip space between subparts with [t!] option

Troubleshooting Misalignments

With complex subcaption configurations, positioning conflicts can occur causing overlaying caption boxes or unlabeled subfigures.

Debugging Overlaying Captions

If full and sub- captions overlap visually:

  • Check skip space below figure
  • Reduce caption and subcaption font sizes
  • Increase space between blocks via \vspace

This separates caption elements along the Z-axis when competing for area.

Managing Caption Box Size

In constrained spaces like narrow table columns, explicitly define caption widths:

\begin{table}
\begin{minipage}[t]{0.5\linewidth}
  \centering
    \includegraphics[width=\linewidth]{table-image}
    \caption[Table caption]{Table caption text}  
    \subcaption*{Table subcaption text} 
\end{minipage}
\end{table}

This avoids overflowing standard caption boundaries.

Multi-Line Captions

Long subcaption text may wrap improperly without line breaks:

\subcaption[Short caption label]{Long explanatory subcaption sentence floodingcaption space.}

Manually insert line breaks (\\) to shape this text as needed:

\subcaption[Label]{Long explanatory subcaption sentence\\flooding caption space.}

Example Codes

Refer to these complete examples for commonly needed subcaption configurations and best practices.

Full Examples for Common Use Cases

  • Single subcaption under a figure
  • Figure with two subparts and collective numbering
  • Table with explanatory subcaption below
  • Subcaption spanning full figure width
  • Two-line subcaption with manual line break

Explained and Annotated

All examples contain:

  • Markup overview
  • Package requirements
  • Customization notes
  • Position tweaks

Use these templates to achieve properly formatted subcaptions for any use case.

Leave a Reply

Your email address will not be published. Required fields are marked *