# Adjusting vertical spacing in subfloatrow captions (subcaption+floatrow)

I am trying to adjust sub-captions for sub-figures in a figure which includes multiple \subfloatrows 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}
\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.

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:

\documentclass{article}
\usepackage[showframe, margin=25mm]{geometry}
\usepackage{graphicx}
\usepackage{subcaption}

\DeclareFloatVCode{largevskip}%
{\vskip 20pt}
\floatsetup{captionskip=0pt,rowpostcode =largevskip, valign=c }%
\captionsetup[subfigure]{font =Large}

\begin{document}
\begin{figure}
\centering-%
\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}


• Thanks! This solves half of the problem. I can add more space underneath the sub-captions and that's great ;). But I can't reduce the distance between the sub-figure and the sub-caption. (The skip=-10pt you have looked promising but doesn't seem to make any difference. [I hope you don't object to my edit - I got very confused when it kept claiming the macro you'd named was undefined!] – cfr Feb 23 '16 at 23:45
• Why did you need xcolor? I'm loading it in my real document, but I omitted it from the MWE. – cfr Feb 23 '16 at 23:45
• I have to admit I noticed \DeclareFloatVCode in the documentation. But I could not figure out what to do with it. It is not the most intuitive interface. More a scenic route. – cfr Feb 23 '16 at 23:47
• Sorry. I guess I messed up with an old code of mine. Probably I was doing two things (writing two codes?) at the same time. Probably I fing those example images very dull. I removed it. – Bernard Feb 23 '16 at 23:52
• No problem. Was just curious. If I add \captionsetup[subfigure]{font+={footnotesize},skip=2.5pt}% then this does affect the non-floatrow \subcaption* by reducing the distance between it and its sub-figure. But I can't figure out how to do the same for those in the subfloatrow. Is subfloatrow the correct type of caption? – cfr Feb 23 '16 at 23:55