I am trying to adjust sub-captions for sub-figures in a figure which includes multiple \subfloatrow
s and an additional \ffigbox
outside the rows.
How can I modify the vertical spacing between sub-figure and sub-caption and between sub-caption and any sub-figure below it? I would like the sub-caption to be closer to its sub-figure and a little further from any sub-figure below it.
Code:
\documentclass{article}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage[valign=c,heightadjust=all]{floatrow}
\begin{document}
\begin{figure}
\centering
\captionsetup[subfloatrow]{font+={footnotesize}}%
\floatbox{figure}{%
\begin{subfloatrow}[2]
\ffigbox[\FBwidth]{%
\includegraphics[height=8em]{example-image-a}}{\caption*{Sub-Caption}}
\ffigbox[\FBwidth]{%
\includegraphics[height=8em]{example-image-a}}{\caption*{Sub-Caption}}
\end{subfloatrow}
\begin{subfloatrow}[3]
\ffigbox[\FBwidth]{%
\includegraphics[height=8em]{example-image-a}}{\caption*{Sub-Caption}}
\ffigbox[\FBwidth]{%
\includegraphics[height=8em]{example-image-a}}{\caption*{Sub-Caption}}
\ffigbox[\FBwidth]{%
\includegraphics[height=8em]{example-image-a}}{\caption*{Sub-Caption}}
\end{subfloatrow}
\begin{subfloatrow}[3]
\ffigbox[\FBwidth]{%
\includegraphics[height=8em]{example-image-a}}{\caption*{Sub-Caption}}
\ffigbox[\FBwidth]{%
\includegraphics[height=8em]{example-image-a}}{\caption*{Sub-Caption}}
\ffigbox[\FBwidth]{%
\includegraphics[height=8em]{example-image-a}}{\caption*{Sub-Caption}}
\end{subfloatrow}
\begin{subfloatrow}[2]
\ffigbox[\FBwidth]{%
\includegraphics[height=8em]{example-image-a}}{\caption*{Sub-Caption}}
\ffigbox[\FBwidth]{%
\includegraphics[height=8em]{example-image-a}}{\caption*{Sub-Caption}}
\end{subfloatrow}
\ffigbox{%
\includegraphics[height=8em]{example-image-a}}{\subcaption*{Sub-Caption}}
}{%
\caption{Caption}\label{fig:label}%
}
\end{figure}
\end{document}
Guntram's question is similar, but it has not be answered in over 2 years. The suggestion in comments is to abandon use of floatrow
. However, this is supposed, I think, to work with the caption
/subcaption
packages. At least, so the documentation says.
However, I don't find floatrow
's documentation at all easy and I cannot really figure out how caption
–subcaption
–floatrow
are intended to play nicely together.
Best Answer
Controlling vertical spacing between rows is well hidden in the documentation: you have to declare a key via
\DeclareFloatVCode
, and ask to apply it with\floatsetup{rowpostcode= …}
. Font size can be changed via\captionsetup[subfigure]
, ang the vertical skip between figure and caption is settled with\floatsetup{captionskip= …}
.Here is a (hideous) example: