# subfloatrow of package floatrow does not work without subcaptions

I have two pictures that I want to place as subparts using the floatrow package. The following example works if I add subcaptions to the parts, but does not if I leave them out.

I do not want any subcaptions for these parts. Am I doing something wrong or is this a bug?

Here is a minimal working example:

\documentclass{article}

\usepackage[demo]{graphicx}
\usepackage{caption,subcaption}
\usepackage{floatrow}

\begin{document}

\begin{figure}
\ffigbox{%
\begin{subfloatrow}[2]%
\ffigbox{%
\includegraphics[width=3cm,height=3cm]{fig1}%
}{
%\subcaption{} %% does not work without
}%
\ffigbox{%
\includegraphics[width=3cm,height=3cm]{fig2}%
}{
%\subcaption{} %% does not work without
}%
\end{subfloatrow}%
}{
\caption{A caption}
}
\end{figure}

\end{document}

-

You can use the \phantomcaption command to actually skip the caption of the subfigures.

\documentclass{article}

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

\begin{document}

\begin{figure}

\begin{subfigure}{0.5\textwidth}\centering
\includegraphics[width=3cm,height=3cm]{fig1}%
\phantomcaption
\label{fig:subfiga}
\end{subfigure}

\begin{subfigure}{0.5\textwidth}\centering
\includegraphics[width=3cm,height=3cm]{fig1}%
\phantomcaption
\label{fig:subfigb}
\end{subfigure}

\caption{A caption}
\label{fig:thefig}
\end{figure}

\end{document}


-
Unfortunately, the \phantomcaption commant does not work in combination with the floatrow package. –  Björn Steffen Jul 30 '12 at 15:15
@BjörnSteffen Do you need to use it? I've not used it in my answer anyway. –  percusse Jul 30 '12 at 15:18
Yes I could disable floatrow for the current figure and just use your solution. Maybe its an odd behavior (or bug) of the floatrow package that it always requires a caption?! –  Björn Steffen Jul 30 '12 at 15:24
@BjörnSteffen Or slowly getting outdated though it's a very nice package. I don't know if it is still actively supported. –  percusse Jul 30 '12 at 15:30

You can use the starred version of \subcaption with an empty argument; you will also need to correct the vertical spacing removing the default caption skip (-10pt):

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{caption,subcaption}
\usepackage{floatrow}

\begin{document}

\begin{figure}
\floatsetup[subfigure]{captionskip=-10pt}%
\ffigbox{%
\begin{subfloatrow}[2]%
\ffigbox{\includegraphics[width=3cm,height=3cm]{fig1}}{\subcaption*{}}%
\ffigbox{\includegraphics[width=3cm,height=3cm]{fig2}}{\subcaption*{}}%
\end{subfloatrow}%
}{\caption{A test caption}}
\end{figure}

\end{document}


-
I hoped there is a cleaner way than using \vskip-1.5\baselineskip. But it seems that the floatrow package does not support float parts without captions inside (sub)floatrow. –  Björn Steffen Jul 30 '12 at 15:28
@BjörnSteffen apparently not; I've updated my answer with a cleaner approach (although some correction is still applied). –  Gonzalo Medina Jul 30 '12 at 23:21