[Tex/LaTex] Setup for sub-captions for two sub-figures one below the other

spacingsubcaptionsubfloats

I am using the caption and subcaption packages to create sub-figures in a document. I have two cases of sub-figures:

  1. Two sub-figures side-by-side. For this, the captioning is excellent.
  2. Two sub-figures one below the other. in this case, the first sub-caption appears immediately above the second sub-figure.

How can I configure the sub-captions to include a small space between themselves and the next element in the second case, without messing up the setup for the first case?

The rude way is to stick a vskip explicitly after the first sub-figure. I prefer to avoid this hack.

Best Answer

You can set the length \belowcaptionskip (default value 0pt) as you need it. Either do this locally inside the concerned figure environment as shown below or globally in the preamble.

\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage[font=small,labelfont=bf,tableposition=top]{caption}
\usepackage[font=footnotesize]{subcaption}

\begin{document}
  \begin{figure}[!ht]
    \setlength{\belowcaptionskip}{5pt}
    \centering
    \begin{subfigure}[b]{0.75\textwidth}
      \rule{\linewidth}{0.5\linewidth}
      \caption{First sub-figure}\label{fig:first}
    \end{subfigure}
    \begin{subfigure}[b]{0.75\textwidth}
      \rule{\linewidth}{0.5\linewidth}
      \caption{Second sub-figure}\label{fig:second}
    \end{subfigure}
    \caption{Two dummy sub-figures}\label{dummy}
  \end{figure}
\end{document}

The caption manual has the details.