表格和图形以双列模式并排垂直对齐

表格和图形以双列模式并排垂直对齐

我正在使用 IEEE 的 spconf.sty 文件创建一个双列文档。我使用 floatrow 包并排放置了一个表格(其标题在上方)和一个图形(其两个子图及其标题在下方)。我希望表格的底部与标题的底部对齐。该命令将\BottomFloatBoxes表格的底部与图形标题的顶部对齐。

\documentclass{article}
\usepackage{spconf,amsmath,graphicx}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{subcaption}
\usepackage{floatrow}   % for placing table and figure side-by-side

\begin{document}
\begin{figure*}\BottomFloatBoxes
\begin{floatrow}
\ttabbox[0.75\Xhsize]
  {\centering
    \begin{tabular}{ccccccccc}%
    \toprule
    \multicolumn{3}{c}{Linear} & \multicolumn{3}{c}{RBF} & \multicolumn{3}{c}{Polynomial} \\
    \midrule
    $C$   & $\gamma$ & Accuracy (\%) & $C$   & $\gamma$ & Accuracy (\%) & $d$   & $\gamma$ & Accuracy (\%) \\
    \midrule
    0  & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
    0  & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
    0  & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
    0  & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
    0  & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
    0  & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
    0  & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
    0  & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
    0  & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
    0  & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
    \bottomrule
    \end{tabular}}%
    {\caption{Classification results for different SVM kernels}
    \label{tab:results}}%
    \killfloatstyle\ffigbox[\Xhsize]
    {\begin{subfloatrow}
    \ffigbox[0.5\Xhsize]
    {\caption{}
    \label{fig:models:subfig:good}}
    {\includegraphics[width=\linewidth]{box.png}}
    \ffigbox[\Xhsize]
    {\caption{}
    \label{fig:models:subfig:bad}}
    {\includegraphics[width=\linewidth]{box.png}}
    \end{subfloatrow}}
    {\caption{Examples of models. \ref{fig:models:subfig:good} is predicted as `good' and \ref{fig:models:subfig:bad} is predicted as `bad'.}
    \label{fig:models}}
\end{floatrow}
\end{figure*}%
\end{document}

使用上述 MWE 得到以下输出:

在此处输入图片描述

对于想要重现此 MWE 的人,可以找到样式文件 spconf.sty这里

答案1

如果可能的话,我会避免使用 floatrow。另外,我找不到 spfconf.sty。获取正确的数字计数器有点麻烦。注意:您可以使用\subref并丢失数字编号。

\documentclass[twocolumn]{article}
\usepackage{amsmath,graphicx}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{subcaption}

\begin{document}
\begin{figure*}
  \sbox0{\begin{tabular}[b]{ccccccccc}%
    \toprule
    \multicolumn{3}{c}{Linear} & \multicolumn{3}{c}{RBF} & \multicolumn{3}{c}{Polynomial} \\
    \midrule
    $C$   & $\gamma$ & Accuracy (\%) & $C$   & $\gamma$ & Accuracy (\%) & $d$   & $\gamma$ & Accuracy (\%) \\
    \midrule
    0  & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
    0  & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
    0  & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
    0  & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
    0  & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
    0  & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
    0  & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
    0  & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
    0  & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
    0  & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
    \bottomrule
    \end{tabular}}%
  \begin{minipage}[b]{\wd0}
    \captionof{table}{Classification results for different SVM kernels}
    \label{tab:results}%
    \usebox0
  \end{minipage}\hfill
  \begin{minipage}[b]{\dimexpr \textwidth-\wd0-\columnsep}
    \stepcounter{figure}%
    \begin{subfigure}{.45\linewidth}
      \includegraphics[width=\linewidth]{example-image}
      \caption{}\label{fig:models:subfig:good}
    \end{subfigure}\hfil
    \begin{subfigure}{.45\linewidth}
      \includegraphics[width=\linewidth]{example-image}
      \caption{}\label{fig:models:subfig:bad}
    \end{subfigure}
    \addtocounter{figure}{-1}%
    \caption{Examples of models. \ref{fig:models:subfig:good} is predicted as `good' and \ref{fig:models:subfig:bad} is predicted as `bad'.}
     \label{fig:models}%
  \end{minipage}
\end{figure*}%
\end{document}

演示

相关内容