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.

  • Where is the figure in your code? I'm guessing you're after something like the second part of this answer: Table and figure side-by-side with independent captions You can place the whole threeparttable in a minipage. (By the way, you're missing the closing brace for the \caption.) – Torbjørn T. Oct 1 '15 at 15:01
  • How is the C column type defined? Should the figure have a caption of its own? – Gonzalo Medina Oct 1 '15 at 15:01
  • Apologies, mis-copied the code. Now updated! (Also, changed C to P for columns) – coding_heart Oct 1 '15 at 15:03
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

  • 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 1 '15 at 15:20
  • @coding_heart You probably forgot the % after the first \end{minipage} – egreg Oct 1 '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 1 '15 at 15:33
  • @coding_heart Works for me; see edit. – egreg Oct 1 '15 at 15:42
  • Excellent, thanks for the clarification there and supporting code. – coding_heart Oct 1 '15 at 15:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.