2

I am trying to achieve something like this (with individual subcaption for each image):

enter image description here

I would like to know how to be able to add an arbitrary number of images A on the left (or right) of the two images-colum. I did not understood how latex works in placing images:

    \newsavebox{\measurebox}
   \usepackage{graphicx}
   \usepackage{subfig}
  \begin{figure}[h!]
    \centering
    \sbox{\measurebox}{%
        \begin{minipage}[b]{.33\textwidth}
            \subfloat
            []
            {\label{fig:figA}\includegraphics[width=\textwidth,height=5cm]{images/bosquet_1.png}}
    \end{minipage}}
    \usebox{\measurebox}\qquad
    \begin{minipage}[b][\ht\measurebox][s]{.33\textwidth}
        \centering
        \subfloat
        []
        {\label{fig:figB}\includegraphics[width=\textwidth,height=2cm]{example-image-a}}
        
        \vfill
        
        \subfloat
        []
        {\label{fig:figC}\includegraphics[width=\textwidth,height=2cm]{example-image-a}}
    \end{minipage}
    \caption{my caption. (a) is .... (b) is .... (c) is ....}
    \label{fig:Test}
\end{figure}
0

Whatever you put into the first minipage will end up in the "left column", separate two images that you want to appear on top of each other by an empty line. If you place multiple images in the first minipage, all of them will be taken into account by the savebox. All images you place in the second minipage will appear in the "right column". If you want them to be evenly spread, separate them by empty lines and \vfill.

Two further examples with different amounts of images per column could look like the following:

enter image description here

enter image description here

\documentclass{article}
    \newsavebox{\measurebox}
   \usepackage{graphicx}
   \usepackage{subcaption}
\begin{document}

\begin{figure}[h!]
    \centering
    \sbox{\measurebox}{%
        \begin{minipage}[b]{.33\textwidth}
            \subfloat
            []
            {\label{fig:figA}\includegraphics[width=\textwidth,height=5cm]{example-image-a}}
            
            \subfloat
            []
            {\label{fig:figB}\includegraphics[width=\textwidth,height=6cm]{example-image-a}}
    \end{minipage}}
    \usebox{\measurebox}\qquad
    \begin{minipage}[b][\ht\measurebox][s]{.33\textwidth}
        \centering
        \subfloat
        []
        {\label{fig:figC}\includegraphics[width=\textwidth,height=2cm]{example-image}}
        
        \vfill
        
        \subfloat
        []
        {\label{fig:figD}\includegraphics[width=\textwidth,height=2cm]{example-image}}
        
        \vfill
        
        \subfloat
        []
        {\label{fig:figE}\includegraphics[width=\textwidth,height=2cm]{example-image}}
        
        \vfill
        
        \subfloat
        []
        {\label{fig:figF}\includegraphics[width=\textwidth,height=2cm]{example-image}}
    \end{minipage}
    \caption{my caption. (\subref{fig:figA}) is .... (\subref{fig:figB}) is .... (\subref{fig:figC}) is .... }
    \label{fig:Test}
\end{figure}


\begin{figure}[h!]
    \centering
    \sbox{\measurebox}{%
        \begin{minipage}[b]{.33\textwidth}
            \subfloat
            []
            {\label{fig:figA}\includegraphics[width=\textwidth,height=3cm]{example-image-a}}
            
            \subfloat
            []
            {\label{fig:figB}\includegraphics[width=\textwidth,height=3cm]{example-image-a}}
            
            \subfloat
            []
            {\label{fig:figC}\includegraphics[width=\textwidth,height=3cm]{example-image-a}}
    \end{minipage}}
    \usebox{\measurebox}\qquad
    \begin{minipage}[b][\ht\measurebox][s]{.33\textwidth}
        \centering
        \subfloat
        []
        {\label{fig:figD}\includegraphics[width=\textwidth,height=4cm]{example-image}}
        
        \vfill
        
        \subfloat
        []
        {\label{fig:figE}\includegraphics[width=\textwidth,height=4cm]{example-image}}
    \end{minipage}
    \caption{my caption. (\subref{fig:figA}) is .... (\subref{fig:figB}) is .... (\subref{fig:figC}) is .... }
    \label{fig:Test}
\end{figure}

\end{document}

Side notes:

For your actual images, make sure, you only use width=.. or height=...(or at least add keepaspectratio), otherwise the images will get distorted, as you can see from my two examples.

Make sure the contents in the first minipage are taller than the contents in teh second minipage. Otherwise you will see overlaps.

In order to add more information about each subfigure inside of the main caption of the figure, you can use \subref as I did in my example code. I also suggest using more descriptive keys for the labels. Identifying images will then be a lot easier, especially if you later on decide to remove/add an image. (If you do so, fig:figB would not necessarily correspond to the sufigure with the caption (b))


Update regarding the request in the comments:

enter image description here

\documentclass{article}
    \newsavebox{\measurebox}
   \usepackage{graphicx}
   \usepackage{subcaption}
\begin{document}

  \begin{figure}[h!]
    \centering
    \sbox{\measurebox}{%
        \begin{minipage}[b]{.3\textwidth}
            \subfloat
            []
            {\label{fig:figA}\includegraphics[width=\textwidth,height=5cm]{example-image-a}}
    \end{minipage}}
    \usebox{\measurebox}\hfill
    \begin{minipage}[b]{.3\textwidth}
            \subfloat
            []
            {\label{fig:figA2}\includegraphics[width=\textwidth,height=5cm]{example-image-a}}
    \end{minipage}\hfill
    \begin{minipage}[b][\ht\measurebox][s]{.3\textwidth}
        \centering
        \subfloat
        []
        {\label{fig:figB}\includegraphics[width=\textwidth,height=2cm]{example-image-a}}
        
        \vfill
        
        \subfloat
        []
        {\label{fig:figC}\includegraphics[width=\textwidth,height=2cm]{example-image-a}}
    \end{minipage}
    \caption{my caption. (a) is .... (b) is .... (c) is ....}
    \label{fig:Test}
\end{figure}

\end{document}
6
  • Thank you very much for youe explanation. Actually I would like to add another image of the size of A next to the images already there.
    – J.Doe
    Jan 17 '21 at 17:02
  • A sketch of the desired output would be really helpful here. Would you add one to your question?
    – leandriis
    Jan 17 '21 at 17:27
  • Sure! I did it, thanks :D
    – J.Doe
    Jan 17 '21 at 17:40
  • Thanks for adding the image. What about the subcaptions? Should both "example-image-a" get an individual subcaption or a shared one? Here are two examples of individual or shared subcaptions: i.stack.imgur.com/QVZEE.png
    – leandriis
    Jan 17 '21 at 17:49
  • they should get and individual one each!
    – J.Doe
    Jan 17 '21 at 18:14

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.