2

I would like to place a threeparttable next to a figure and am unable to do so (I couldn't find an example that uses threeparttable). Here is what I was trying (though this doesn't work):

\begin{figure}\centering
    \begin{table}[h!] \small
    \begin{threeparttable}
    \caption{\textbf{X on Y} }
    \label{XYZ}
        \begin{tabular}{ p{4.1cm}  o{1.2cm} p{1.2cm}  }
        \hline
            &  (1) & (2)    \\ 
            &  (3) & (4)    \\ 
     \hline
    \end{tabular}
       \begin{tablenotes}
          \footnotesize
         \item \textbf{Note:} XXX \\
        \end{tablenotes}
    \end{threeparttable}
    \end{table}
  \qquad
  \rule{2cm}{3cm}% = graphic
  \caption{Double figure/table combo!}
\end{figure}

Thanks for any and all thoughts there.

Torbjørn T.
  • 206,688

1 Answers1

2

Use the standard method with \captionof:

\documentclass{article}
\usepackage{graphicx,threeparttable,caption}

\begin{document}

\begin{table}
\centering

\begin{minipage}{0.3\textwidth}
\centering
\includegraphics[width=.8\textwidth]{example-image-9x16}
\captionof{figure}{The figure}
\end{minipage}%
\begin{minipage}{0.7\textwidth}
\small
\begin{threeparttable}
\caption{\textbf{X on Y}}
\label{XYZ}

\begin{tabular}{ p{4.1cm}  p{1.2cm} p{1.2cm}  }
\hline
A    &  (1) & (2)    \\ 
B    &  (3) & (4)    \\ 
\hline
\end{tabular}

\begin{tablenotes}
\footnotesize
\item \textbf{Note:} XXX
\end{tablenotes}
\end{threeparttable}
\end{minipage}

\end{table}

\end{document}

enter image description here

In the reverse order:

\documentclass{article}
\usepackage{graphicx,threeparttable,caption}

\begin{document}

\begin{table}
\centering

\begin{minipage}{0.7\textwidth}
\small
\begin{threeparttable}
\caption{\textbf{X on Y}}
\label{XYZ}

\begin{tabular}{ p{4.1cm}  p{1.2cm} p{1.2cm}  }
\hline
A    &  (1) & (2)    \\ 
B    &  (3) & (4)    \\ 
\hline
\end{tabular}

\begin{tablenotes}
\footnotesize
\item \textbf{Note:} XXX
\end{tablenotes}
\end{threeparttable}
\end{minipage}%
\begin{minipage}{0.3\textwidth}
\centering
\includegraphics[width=.8\textwidth]{example-image-9x16}
\captionof{figure}{The figure}
\end{minipage}

\end{table}

\end{document}

Note the % that kills the space which would be added by the end-of-line.

enter image description here

egreg
  • 1,121,712
  • Great, thanks. When I try to put the figure to the right of the table (taking out from begin minipage to the end of that command), it goes underneath. Any particular trick to switching these? – coding_heart Oct 01 '15 at 15:20
  • @coding_heart You probably forgot the % after the first \end{minipage} – egreg Oct 01 '15 at 15:22
  • Actually, that doesn't work. I'm removing: \begin{minipage}{0.3\textwidth} \centering \includegraphics[width=.8\textwidth]{example-image-9x16} \captionof{figure}{The figure} \end{minipage}" and putting the % after the first \end{minipage} but that isn't doing the trick. Note that I am putting this after the first \end{minipage} and it is followed by \end{table}. Any other thoughts? – coding_heart Oct 01 '15 at 15:33
  • @coding_heart Works for me; see edit. – egreg Oct 01 '15 at 15:42
  • Excellent, thanks for the clarification there and supporting code. – coding_heart Oct 01 '15 at 15:57