1

I'm inserting 2 rows of images with \subcaptionbox but the vertical space between them remains, which is originally occupied by index of first column images.

How could I reduce the space of this area?

enter image description here

My code:

\begin{figure}[h!]
    \captionsetup[subfigure]{position=b}
    \centering
    \caption{my-images}
    \label{fig:images}

    \subcaptionbox*{
        \label{img-0}}
    {\includegraphics[width=2.2cm]{img-0.jpg}}\hspace{0.5em}
    \subcaptionbox*{
        \label{img-1}}
    {\includegraphics[width=2.2cm]{img-1.jpg}}\hspace{0.5em}
    \subcaptionbox*{
        \label{img-2}}
    {\includegraphics[width=2.2cm]{img-2.jpg}}

    \subcaptionbox{
        \label{img-10}}
    {\includegraphics[width=2.2cm]{img-0.jpg}}\hspace{0.5em}
    \subcaptionbox{
        \label{img-11}}
    {\includegraphics[width=2.2cm]{img-1.jpg}}\hspace{0.5em}
    \subcaptionbox{
        \label{img-12}}
    {\includegraphics[width=2.2cm]{img-2.jpg}}

\end{figure}
3

I would place each of the sub-figures' stack of elements in a tabular. This allows you to easily control the gap using \\[<len>]:

enter image description here

\documentclass[draft]{article}

\usepackage{graphicx,subcaption}

\begin{document}

\begin{figure}[ht]
  \captionsetup[subfigure]{position=b}
  \centering
  \caption{my-images}\label{fig:images}

  \setlength{\tabcolsep}{0pt}% Remove column gap in tabular
  \subcaptionbox{\label{img-0}}{%
    \begin{tabular}{c}
      \includegraphics[width=2.2cm]{img-00.jpg} \\[.5\normalbaselineskip]
      \includegraphics[width=2.2cm]{img-10.jpg}
    \end{tabular}}%
  \hspace{0.5em}%
  \subcaptionbox{\label{img-1}}{%
    \begin{tabular}{c}
      \includegraphics[width=2.2cm]{img-01.jpg} \\[.5\normalbaselineskip]
      \includegraphics[width=2.2cm]{img-11.jpg}
    \end{tabular}}%
  \hspace{0.5em}%
  \subcaptionbox{\label{img-2}}{%
    \begin{tabular}{c}
      \includegraphics[width=2.2cm]{img-02.jpg} \\[.5\normalbaselineskip]
      \includegraphics[width=2.2cm]{img-12.jpg}
    \end{tabular}}%
\end{figure}

\end{document}

The above suggestion is based on the fact that a \subcaptionbox* with a \label seems redundant. However, if you do wish to retain such layout, you can insert a negative vertical space to reduce the gap between the two rows:

\begin{figure}[ht]
  \captionsetup[subfigure]{position=b}
  \centering
  \caption{my-images}\label{fig:images}

  \subcaptionbox*{.}{..}%
  \hspace{0.5em}%
  \subcaptionbox*{.}{..}%
  \hspace{0.5em}%
  \subcaptionbox*{.}{..}%

  \vspace{-0.5\baselineskip}

  \subcaptionbox{\label{.}}{..}%
  \hspace{0.5em}%
  \subcaptionbox{\label{.}}{..}%
  \hspace{0.5em}%
  \subcaptionbox{\label{.}}{..}%  
\end{figure}
| improve this answer | |

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.