1

I am trying to arrange the subimages (a) and (b) of the following MWE such as that they are aligned on top. I tried it such as explained in the solution of How to achieve top-alignment of images in subfigure? but that solution works only with one subfloatrow.

How can it be achieved with multiple subfloatrow?

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

\begin{document}

\thisfloatsetup{style=plain}
\begin{figure}
  \ffigbox[\textwidth]
  {
    \thisfloatsetup{heightadjust=all
                    }
    \begin{subfloatrow}[2]\useFCwidth
      \ffigbox[\FBwidth][\FBheight][t]
      {\caption{} \label{}}
      {\includegraphics[width=0.5\textwidth,height=4.5cm]{example-image-a}}
      \hspace{10pt}
      \ffigbox[\FBwidth][\FBheight][t]
      {\caption{} \label{}}
      {\includegraphics[width=0.4\textwidth,height=5.5cm]{example-image-b}}
      \vspace{20pt}
    \end{subfloatrow}

    \thisfloatsetup{capbesideposition={left,top},
                    capbesidesep=none,
                    }
    \begin{subfloatrow}[1]
      \fcapside[\FBwidth]
      {\caption{} \label{}}
      {\includegraphics[width=0.9\textwidth,height=4.5cm]{example-image-c}}
      \vspace{10pt}
    \end{subfloatrow}

    \thisfloatsetup{capbesideposition={left,top},
                    capbesidesep=none,
                    }
    \begin{subfloatrow}[1]
      \fcapside[\FBwidth]
      {\caption{} \label{}}
      {\includegraphics[width=0.9\textwidth,height=4.0cm]{example-image-a}}
    \end{subfloatrow}
  }
  {\caption{Caption of all figures} \label{fig:}
  }
\end{figure}

\end{document}

enter image description here

TomTom
  • 141

3 Answers3

2

Making the image the same height to keep captions on one line:

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

\begin{document}

\thisfloatsetup{style=plain}
\begin{figure}
  \ffigbox[\textwidth]
  {
    \thisfloatsetup{heightadjust=all
                    }
    \begin{subfloatrow}[2]\useFCwidth
      \ffigbox[\FBwidth][\FBheight][t]
      {\caption{} \label{}}
      {\begin{minipage}[T][5.5cm][t]{.5\textwidth}
      \includegraphics[width=\textwidth,height=4.5cm]{example-image-a}
      \end{minipage}}
      \hspace{10pt}
      \ffigbox[\FBwidth][\FBheight][t]
      {\caption{} \label{}}
      {\begin{minipage}[T][5.5cm][t]{.4\textwidth}
          \includegraphics[width=\textwidth,height=5.5cm]{example-image-b}
            \end{minipage}}
      \vspace{20pt}
    \end{subfloatrow}

    \thisfloatsetup{capbesideposition={left,top},
                    capbesidesep=none,
                    }
    \begin{subfloatrow}[1]
      \fcapside[\FBwidth]
      {\caption{} \label{}}
      {\includegraphics[width=0.9\textwidth,height=4.5cm]{example-image-c}}
      \vspace{10pt}
    \end{subfloatrow}

    \thisfloatsetup{capbesideposition={left,top},
                    capbesidesep=none,
                    }
    \begin{subfloatrow}[1]
      \fcapside[\FBwidth]
      {\caption{} \label{}}
      {\includegraphics[width=0.9\textwidth,height=4.0cm]{example-image-a}}
    \end{subfloatrow}
  }
  {\caption{Caption of all figures} \label{fig:}
  }
\end{figure}

\end{document}

enter image description here

kaba
  • 195
1

Why floatrow if you load subcaption? With subcaption, easy thing:

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


\begin{document}

\thisfloatsetup{style=plain}
\begin{figure}
\begin{subfigure}[T]{.5\textwidth} 
\includegraphics[width=\textwidth,height=4.5cm]{example-image-a}
\caption{}
\end{subfigure}
\hfill
\begin{subfigure}[T]{.4\textwidth} 
\includegraphics[width=\textwidth,height=5.5cm]{example-image-b}
\caption{}
\end{subfigure}

\vspace{10pt}

\thisfloatsetup{capbesideposition={left,top},
                    capbesidesep=none,
                    }
    \begin{subfloatrow}[1]
      \fcapside[\FBwidth]
      {\caption{} \label{}}
      {\includegraphics[width=0.9\textwidth,height=4.5cm]{example-image-c}}
      \vspace{10pt}
    \end{subfloatrow}

    \thisfloatsetup{capbesideposition={left,top},
                    capbesidesep=none,
                    }
    \begin{subfloatrow}[1]
      \fcapside[\FBwidth]
      {\caption{} \label{}}
      {\includegraphics[width=0.9\textwidth,height=4.0cm]{example-image-a}}
    \end{subfloatrow}

\caption{Caption of all figures} 
\label{fig:}

\end{figure}

\end{document}

enter image description here

kaba
  • 195
  • Ohh nice solution. I didn't know that it is possible to mix the instructions of the two packages in that way. Is it possible to align the captions of image (a) and (b) on the same line while keeping the images aligned at top? – TomTom Jan 01 '20 at 17:42
  • As I just noticed, this solution does not print the caption at the end of the image. – TomTom Jan 02 '20 at 07:47
1

This works (slightly simplified from your code, added an adjustment of the main caption vertical spacing), but you have to compile twice:

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

\begin{document}

\begin{figure}
    \floatsetup{valign=t, heightadjust=all,}%captionskip =0ex
  \ffigbox[\textwidth]%
  {\begin{subfloatrow}[2]\useFCwidth
      \ffigbox[\FBwidth][\FBheight][t]
      {\caption{} \label{}}
      {\includegraphics[width=0.5\textwidth,height=4.5cm]{example-image-a}}
      \hspace{10pt}
      \ffigbox[\FBwidth][\FBheight][t]
      {\caption{} \label{}}
      {\includegraphics[width=0.4\textwidth,height=5.5cm]{example-image-b}}
    \vspace{20pt}
    \end{subfloatrow}
 \floatsetup{capbesideposition={left,top},
 capbesidesep=none,
 }
 \begin{subfloatrow}[1]
 \fcapside[\FBwidth]
 {\caption{} \label{}}
 {\includegraphics[width=0.9\textwidth,height=4.5cm]{example-image-c}}
 \vspace{20pt}
 \end{subfloatrow}

 \begin{subfloatrow}[1]
 \fcapside[\FBwidth]
 {\caption{} \label{}}
 {\includegraphics[width=0.9\textwidth,height=4.0cm]{example-image-a}}
 \end{subfloatrow}
 \vskip -6em
 }%
 {\caption{Caption of all figures} \label{fig:}}
\end{figure}

\end{document} 

enter image description here

Bernard
  • 271,350
  • Can you explain what causes the large vertical gap? What influences the value and how is the negative value determined/calculated? – TomTom Jan 01 '20 at 22:33
  • 1
    I didn't understand where it comes from. When I add an \hrule at the end of the \figbox, to visualise where the lasr subfloat row really ends, this hrule is normally placed, yet the caption is far below. The negative value was found by trial and error until it pleases me. – Bernard Jan 01 '20 at 22:45