将 threeparttable 放在图形旁边

将 threeparttable 放在图形旁边

我想将 threeparttable 放在图形旁边,但无法做到(我找不到使用 threeparttable 的示例)。这是我尝试的(虽然这不起作用):

\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}

谢谢大家的想法。

答案1

使用标准方法\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}

在此处输入图片描述

相反的顺序:

\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}

请注意,%这会删除行尾添加的空格。

在此处输入图片描述

相关内容