1

I want to display two images with multiple subfigures in a grid so that the subfigures go vertical as well as keeping the two images sort of separated. My current approach looks like this:

\begin{figure}
    \begin{subfigure}{0.475\textwidth}
        \includegraphics[draft=false, width=\textwidth]{example-image-a} 
        \caption{Image A}
        \label{fig:1a}
    \end{subfigure}

    \begin{subfigure}{0.475\textwidth}
        \includegraphics[draft=false, width=\textwidth]{example-image-b} 
        \caption{Image B}
        \label{fig:1b}
    \end{subfigure}
    
    \caption{Image Collection 1}
    \label{fig:Pasnatsch}
\end{figure}

\begin{figure}
    \begin{subfigure}{0.475\textwidth}
        \includegraphics[draft=false, width=\textwidth]{example-image-c} 
        \caption{Image C}
        \label{fig:2a}
    \end{subfigure}

    \begin{subfigure}{0.475\textwidth}
        \includegraphics[draft=false, width=\textwidth]{example-image-duck} 
        \caption{Image D}
        \label{fig:2b}
    \end{subfigure}
    
    \caption{Image Collection 2}
    \label{fig:1}
\end{figure}

which does place the second group of images on a new page. Also the main captions are not properly aligned (showing me how to align them left / right / center would be great to know). An example project with the code above can be found at https://www.overleaf.com/read/rmkjzhqbbbpg

I also created an image to clarify what I want to achieve (bad quality, but I hope it makes it more understandable)

what I want

1
  • Welcome to TeX.SE. – Mico Feb 13 at 22:02
3

You could place each subgroup of subfigures (pun intended), along with the overall figure caption, in a separate minipage environment.

enter image description here

\documentclass[demo]{article} % remove 'demo' option in real document
\usepackage{graphicx,subcaption}
\captionsetup[subfigure]{skip=0.25\baselineskip}
\begin{document}
\begin{figure}
\begin{minipage}[t]{0.475\textwidth} % or '[b]', if desired
    \begin{subfigure}{\textwidth}
        \includegraphics[draft=false, width=\textwidth]{example-image-a} 
        \caption{Image A}
        \label{fig:1a}
    \end{subfigure}
    
    \medskip % create some vertical separation
    \begin{subfigure}{\textwidth}
        \includegraphics[draft=false, width=\textwidth]{example-image-b} 
        \caption{Image B}
        \label{fig:1b}
    \end{subfigure}
    \caption{Image Collection 1}
    \label{fig:Pasnatsch}
\end{minipage}
\hfill
\begin{minipage}[t]{0.475\textwidth} % or '[b]', if desired
    \begin{subfigure}{\textwidth}
        \includegraphics[draft=false, width=\textwidth]{example-image-c} 
        \caption{Image C}
        \label{fig:2a}
    \end{subfigure}

    \medskip
    \begin{subfigure}{\textwidth}
        \includegraphics[draft=false, width=\textwidth]{example-image-duck} 
        \caption{Image D}
        \label{fig:2b}
    \end{subfigure}
    \caption{Image Collection 2}
    \label{fig:2}
\end{minipage}
\end{figure}
\end{document}
1
  • 1
    Thanks, works like a charm :) – Lukas Feb 14 at 18:39

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.