2

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

2
  • Is the floatrow package a requirement?
    – cmhughes
    Nov 16, 2015 at 21:41
  • Not at all. I would prefer to use a package to minimize the amount of custom script in my file. Similarly, some sort of "hack" around this would not be optimal.
    – pir
    Nov 16, 2015 at 21:42

1 Answer 1

2

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

2
  • That is awesome! So simple. Did not think of that possibility at all.
    – pir
    Nov 16, 2015 at 21:48
  • @felbo The tabular around the image is the simplest way for getting vertical centering with respect to the other tabular.
    – egreg
    Nov 16, 2015 at 21:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .