# Floatrow: multiline caption overlaps subsequent float

I am trying to create two subfigures with their own caption and a common caption using floatrow. However the caption for the figure containing the two subfigures is not adjusted in size if it covers mutliple lines, resulting in it overlapping subsequent content. I made the overlapped caption red so that it becomes even more apparent.

How do I get floatrow to account for the multiline caption(i.e. get rid of the overlap)?

\documentclass{muthesis}

\usepackage{floatrow}
\usepackage{caption}
\usepackage[demo]{graphicx}
\usepackage{xcolor}

\usepackage{lipsum}

\DeclareCaptionSubType[alph]{figure}
\captionsetup[subfigure]{labelformat=brace,textfont=md,labelfont=up,labelsep=space}

\begin{document}
\begin{figure}
\ffigbox[\linewidth]{%
\begin{subfloatrow}[2]%
\ffigbox[\linewidth]{%
\includegraphics[width=\linewidth,height=1em]{}%
\caption{Send}%
\label{fig:a}%
}{}%
\ffigbox[\linewidth]{%
\includegraphics[width=\linewidth,height=2em]{}%
\label{fig:b}%
}{}%
\end{subfloatrow}%
\caption{ Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus.  }%
\label{fig:subfig}%
}{}%
\end{figure}

\begin{table}
\ttabbox{%
\begin{tabular}{ll}
a&b\\
\end{tabular}%
\caption{\color{red}Overlapped}%
\label{tab:a}%
}{}
\end{table}

\lipsum
\end{document}

• Thank you for accepting the answer, you could upvote at once ;-) – Tarass Mar 16 '18 at 16:00
• @Tarass: I was reluctant, as I first had to figure out what your fix was (I saw it working). I currently can not accept the answer, as my actual problem has an additional challenge: the images have different height. The mwe above is adjusted to account for this. In the MWE the images will align to their top edge (after running tex twice), adding the style=plain fixes the overlap of the caption, but it also causes the valign=t, heightadjust=all keys to be overriden, which cause the images to align to their top edges in the first place. Can I prevent the overflwo and keep my alignment? – ted Mar 16 '18 at 16:14
• I have not such a problem, the images stay aligned on the bottom. Or I missunderstund your point ? See my edit. – Tarass Mar 16 '18 at 17:29

heightadjust=all needs to be changed to heightadjust=object inside the initial float setup.

\documentclass{muthesis}

\usepackage{caption}
\usepackage{floatrow}

\usepackage[demo]{graphicx}
\usepackage{xcolor}

\usepackage{lipsum}

\DeclareCaptionSubType[alph]{figure}
\captionsetup[subfigure]{labelformat=brace,textfont=md,labelfont=up,labelsep=space}

\begin{document}
\begin{figure}
\ffigbox[\linewidth]{%
\begin{subfloatrow}[2]%
\ffigbox[\linewidth]{%
\includegraphics[width=\linewidth]{monkey-selfie}%
\caption{Send}%
\label{fig:a}%
}{}%
\ffigbox[\linewidth]{%
\includegraphics[width=\linewidth]{sc-teacher}%
\label{fig:b}%
}{}%
\end{subfloatrow}%
\caption{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus.  }%
\label{fig:subfig}%
}{}%
\end{figure}

\begin{table}[h]
\ttabbox{%
\begin{tabular}{ll}
a&b\\
\end{tabular}%
\caption{\color{red}Overlapped}%
\label{tab:a}%
}{}
\end{table}

\lipsum
\end{document}

• While your solution works for my MWE, the actual case is slightly more complicated. style=plain overrides the previous keys, I will adjust my MWE. (+1 though) – ted Mar 16 '18 at 16:07
• Did you try style=Plaintop ? – Tarass Mar 16 '18 at 17:43
• Plaintop moves the caption above the images. I want the images to be aligned by their top edges (i.e. Figure 2 should move up, while the captions stay). And I am actually going for the subfloatrow as the two figures are closely related (think figure 2 Apes, a) male b) female). However you pointed me in the right direction. – ted Mar 16 '18 at 17:49
• I added my fix, your idea of adding style=plain pointed me in the right direction, one of my setup keys must have been wrong, see edited version to see what I went with in the end. P.S.: I think the capbesideposition key is not necessary either way. If you accept the edit, I will accept the answer – ted Mar 16 '18 at 17:54
• I tried with you new proposal, my two images stay aligned on bottom edges. Don't you want images aligned on top edges and caption beside ? – Tarass Mar 16 '18 at 18:02