[Tex/LaTex] Common caption below vertically centered figure and table

captionsvertical alignment

I want to extend the answer from Table and Figure side-by-side with Table caption above, Figure caption below by making a common caption beneath the vertically centered image and table instead of having two separate captions. How do I do that without messing up the alignment of the two floats?

I'd like the common caption to say 'Figure XX'. Ideally, the center of the image and the table should not be affected by the size of the caption. Simply, the center of the table should be at the center of the image.

\documentclass{article}
\usepackage{floatrow}
\usepackage[demo]{graphicx}

\begin{document}

\begin{figure}
\CenterFloatBoxes
\begin{floatrow}
\ffigbox
  {\includegraphics{image}}
  {\caption{A caption for a figure in a figure and a table side by side}\label{fig:test}}
\killfloatstyle
\ttabbox
  {\begin{tabular}{ll}
    \hline
    column1a & column2a \\
    column1b & column2b \\
    column1c & column2c \\
    \hline
  \end{tabular}
  }
  {\caption{A caption for a table in a figure and a table side by side}\label{tab:test}}
\end{floatrow}
\end{figure}

\end{document}

enter image description here

Best Answer

I can't imagine less markup than this:

\documentclass{article}
\usepackage[demo]{graphicx}

\begin{document}

\begin{figure}
\centering

\begin{tabular}{@{}c@{}}
  \includegraphics{image}
\end{tabular}\qquad
\begin{tabular}{ll}
  \hline
  column1a & column2a \\
  column1b & column2b \\
  column1c & column2c \\
  \hline
\end{tabular}

\caption{A caption for a figure in a figure and a table side by side}\label{fig:test}
\end{figure}

\end{document}

enter image description here