如何删除多列表格中的空白?

如何删除多列表格中的空白?

我正在制作一个多列表格。但是有些表格超出了纸张边距,我认为这是由于列之间的空白造成的。请问我该如何解决这个问题?

代码如下。

\documentclass[journal]{IEEEtran}
\bibliographystyle{IEEEtran}
% *** CITATION PACKAGES ***
\usepackage{cite}
\usepackage{makecell}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
\newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}
\usepackage{floatrow} 
\floatsetup[table]{capposition=top}
\usepackage{booktabs,siunitx} \sisetup{table-format=2.1}


\newcommand{\splitcell}[1]{%
    \begin{tabular}{@{}c@{}}\strut#1\strut\end{tabular}%
}

\begin{document}


\begin{table*}
\caption{Some caption}
\scriptsize 
    \centering
    \begin{tabular}{
            S[table-format=0.0]
            S[table-format=0.0]
            S[table-format=0.0]
            S[table-format=0.1]
            %%%% Overal metrics
            S[table-format=2.2]
            S[table-format=2.2]
            S[table-format=2.2]
            S[table-format=2.2]
            S[table-format=2.2]
            S[table-format=2.2]
            S[table-format=2.2]
            S[table-format=2.2]
            S[table-format=2.2]
            S[table-format=2.2]
            %%
            S[table-format=2.2]
            S[table-format=2.2]
            S[table-format=2.2]
            S[table-format=2.2]
            S[table-format=2.2]
        }

        \toprule
%       & \multicolumn{8}{c}{\bfseries Emissions} \\
%       \cmidrule(lr){2-9}
        \multicolumn{1}{c}{Study}
        &\multicolumn{1}{c}{Method}
        &\multicolumn{1}{c}{\makecell[tl]{Num. of\\ subjects}}
        &\multicolumn{1}{c}{Dataset}
        & \multicolumn{5}{c}{Overall metrics}
        & \multicolumn{5}{c}{Class-wise sensitivity} 
        & \multicolumn{5}{c}{Class-wise sensitivity} \\
        \cmidrule(lr){5-9}\cmidrule(lr){10-14}\cmidrule(lr){15-19}

        &&&
        & {Acc.}
        & {$\kappa$}
        & {MF1}
        & {Sens.}
        & {Spec.}
        %%% Class-wise sensitivity
        & {W}
        & {N1}
        & {N2} 
        & {N3}
        & {REM}
        %%% Class-wise selectivity
        & {W}
        & {N1}
        & {N2} 
        & {N3}
        & {REM}\\
        \midrule
        \cite{Mendonca2019} & {ARNN +RNN}    & {90}& {test} & 98.00 & 98.00 & 98.00 & 98.00& 98.00  & 98.00 & 98.00 & 98.00 & 98.00& 98.00  &98.00 & 98.00 & 98.00 &{--} & 98.00  \\
        \cite{Mendonca2019} & {ABC}    & {90}& {test} & 98.00 & 98.00 & 98.00 & 98.00& 98.00  & 98.00 & 98.00 & 98.00 & 98.00& 98.00  &98.00 & 98.00 & 98.00 &98.00 & 98.00  \\
            \cite{Mendonca2019} & {ABC}    & {90}& {test} & 98.00 & 98.00 & 98.00 & {--} & {--}   & 98.00 & 98.00 & 98.00 & 98.00& 98.00  &98.00 & 98.00 & 98.00 &98.00 & 98.00  \\
        \bottomrule
    \end{tabular}
\end{table*}


\end{document} 

答案1

将值设置\tabcolsep为 3.5pt 即可。

我擅自简化了代码(我不明白为什么前 4 列有 类型S,所以我用 替换了它们c)。另外,我认为用 来设置它们的列头看起来更好 multirow

\documentclass[journal]{IEEEtran}
\bibliographystyle{IEEEtran}
% *** CITATION PACKAGES ***
\usepackage{cite}
\usepackage{multirow, makecell}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
\newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}
\usepackage{floatrow}
\floatsetup[table]{capposition=top}
\usepackage{booktabs,siunitx} \sisetup{table-format=2.1}

\newcommand{\splitcell}[1]{%
    \begin{tabular}{@{}c@{}}\strut#1\strut\end{tabular}%
}

\begin{document}

\begin{table*}
\setlength{\tabcolsep}{3.5pt}
\caption{Some caption}
\scriptsize
    \centering
    \begin{tabular}{
            *{4}{c}
            %%%% Overal metrics
            *{15}{S[table-format=2.2]}
        }

        \toprule
% & \multicolumn{8}{c}{\bfseries Emissions} \\
% \cmidrule(lr){2-9}
        \multirow{2.5}{*}{Study}
        & \multirow{2.5}{*}{Method}
        & \multirowcell{2.5}{Num. of\\ subjects}
        & \multirow{2.5}{*}{Dataset}
        & \multicolumn{5}{c}{Overall metrics}
        & \multicolumn{5}{c}{Class-wise sensitivity}
        & \multicolumn{5}{c}{Class-wise sensitivity} \\
        \cmidrule(lr){5-9}\cmidrule(lr){10-14}\cmidrule(lr){15-19}

        &&&
        & {Acc.}
        & {$\kappa$}
        & {MF1}
        & {Sens.}
        & {Spec.}
        %%% Class-wise sensitivity
        & {W}
        & {N1}
        & {N2}
        & {N3}
        & {REM}
        %%% Class-wise selectivity
        & {W}
        & {N1}
        & {N2}
        & {N3}
        & {REM}\\
        \midrule
        \cite{Mendonca2019} & ARNN +RNN & 90 & test & 98.00 & 98.00 & 98.00 & 98.00& 98.00 & 98.00 & 98.00 & 98.00 & 98.00& 98.00 &98.00 & 98.00 & 98.00 &{--} & 98.00 \\
        \cite{Mendonca2019} & ABC & 90 & test & 98.00 & 98.00 & 98.00 & 98.00& 98.00 & 98.00 & 98.00 & 98.00 & 98.00& 98.00 &98.00 & 98.00 & 98.00 &98.00 & 98.00 \\
            \cite{Mendonca2019} & ABC & 90& test & 98.00 & 98.00 & 98.00 & {--} & {--} & 98.00 & 98.00 & 98.00 & 98.00& 98.00 &98.00 & 98.00 & 98.00 &98.00 & 98.00 \\
        \bottomrule
    \end{tabular}
\end{table*}

\end{document} 

在此处输入图片描述

相关内容