5

Consider the code below. I'm attempting to add space between the subfigures and their respective captions by modifying subfigcapskip (I've also tried skip, aboveskip, and captionskip), but I'm not getting the desired effect. What is the correct property to specify?

\documentclass[11pt]{article}
\usepackage{tikz}
\usepackage{subcaption}
\usepackage{caption}

\begin{document}

\begin{figure}
\centering
\begin{subfigure}{0.45\textwidth}
\centering
    \begin{tikzpicture}
        \fill[blue] (0,0) rectangle (3,3);
    \end{tikzpicture}
    \subcaption[subfigcapskip =50pt]{A blue square.}
\end{subfig}%
\begin{subfigure}{0.45\textwidth}
\centering
    \begin{tikzpicture}
        \fill[red] (0,0) rectangle (3,3);
    \end{tikzpicture}
    \subcaption[subfigcapskip = 50pt]{A red square.}
\end{subfig}
\caption{Two squares.}
\end{figure}

\end{document}

MWE

3

The optional argument to \subcaption is not for specifying settings, but for the caption to be used in the list of figures/tables.

You have to use \captionsetup, either globally or locally. I show you both methods:

\documentclass[11pt]{article}
\usepackage{tikz}
\usepackage{subcaption}
\usepackage{caption}

\captionsetup[subfigure]{skip=15pt} % global setting for subfigure

\begin{document}

\begin{figure}
\centering
\begin{subfigure}{0.45\textwidth}
\centering
\begin{tikzpicture}
  \fill[blue] (0,0) rectangle (3,3);
\end{tikzpicture}
\subcaption{A blue square.}
\end{subfigure}%
\begin{subfigure}{0.45\textwidth}
\captionsetup{skip=50pt} % local setting for this subfigure
\centering
\begin{tikzpicture}
  \fill[red] (0,0) rectangle (3,3);
\end{tikzpicture}
\subcaption{A red square.}
\end{subfigure}
\caption{Two squares.}
\end{figure}

\end{document}

enter image description here

2

If you want a global modification, and want, say, 10pt (the default is 6), use:

\usepackage[skip=10pt]{subcaption}

If it is only for subfigure environments:

\captionsetup{subfigure]{skip=10pt}

It you want to modify only for some subfigures:

\begin{subfigure}{0.45\textwidth}
   \captionsetup{skip=10pt}
   ......

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.