如何将该表放入 IEEE 格式的一列中?

如何将该表放入 IEEE 格式的一列中?

我试图让这张表适合我的研究论文的一列,我尝试使用\setlength{\tabcolsep}{1pt}命令,但没有成功。

\begin{table}[ht]  
\setlength{\tabcolsep}{1pt}
    \centering
      \vspace{-0.5cm}
        \begin{tabular}{|c||c|c|c|c|c|c|}
            \hline
            \multicolumn{7}{|c|}{Precision} \\
            \hline
            Classifier & Text-specific (1) & N-grams (2) & Post-specific (3) & 1 \& 2 & 1 \& 3 & All\\
            \hline
            \perceptron & 0.78 & 0.82 & 0.24 & 0.81 & 0.77 & 0.83\\
            \decisiontree & 0.65 & 0.79 & 0.56 & 0.75 & 0.65 & 0.73\\
            \svm & 0.74 & 0.72 & 0.50 & 0.80 & 0.73 & 0.85\\
            \isolationforest & 0.54 & 0.51 & 0.52 & 0.53 & 0.54 & 0.53\\
            \hline
        \end{tabular}
    \caption{Precision results of the classifiers for different feature subsets. 1 \& 2 is the combination of text-specific features
\& n-grams. 1 \& 3 is the combination of text- and post-specific
features.}
\label{table:classifier_feature_subsets_prec} 
\end{table}

序言部分:

\def\year{2018}\relax
%File: formatting-instruction.tex
\documentclass[letterpaper]{article} %DO NOT CHANGE THIS
\usepackage{aaai18}  %Required
\usepackage{times}  %Required
\usepackage{helvet}  %Required
\usepackage{courier}  %Required
\usepackage{url}  %Required
\usepackage{graphicx}  %Required

\usepackage[usenames,dvipsnames,table,xcdraw]{xcolor}
\usepackage{todonotes}
\usepackage{hyperref}
\usepackage{csquotes}
\usepackage{xspace}
\usepackage{pgfplots}
\usepackage{chapterbib}
\newcommand{\decisiontree}{Decision Tree\xspace}
\newcommand{\decisiontrees}{Decision Tree\xspace}
\newcommand{\svm}{One-Class~SVM\xspace}
\newcommand{\svms}{One-Class~SVMs\xspace}
\newcommand{\perceptron}{Perceptron\xspace}
\newcommand{\perceptrons}{Perceptrons\xspace}
\newcommand{\isolationforest}{Isolation Forest\xspace}
\newcommand{\isolationforests}{Isolation Forests\xspace}


\frenchspacing  %Required
\setlength{\pdfpagewidth}{8.5in}  %Required
\setlength{\pdfpageheight}{11in}  %Required
%PDF Info Is Required:
  \pdfinfo{

答案1

替代 ...

使用threepartabletabular*

\documentclass[letterpaper, twocolumn]{article}
\usepackage[margin=1in]{geometry}

\usepackage{booktabs,threeparttable}

\usepackage{lipsum}

\begin{document}
\lipsum[11]
\begin{threeparttable}[htb]
    \caption{Precision results of the classifiers for different feature subsets.}
\label{table:classifier_feature_subsets_prec}
    \small
    \setlength\tabcolsep{0pt}
\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}} l cc cc cc @{}}
    \toprule
&   \multicolumn{6}{c}{Precision} \\
        \cmidrule{2-7}
Classifier          & (1)\tnote{a}  
                            & (2)\tnote{b}
                                    & (3)\tnote{c} 
                                            & (1\&2)\tnote{d}  
                                                    & (1\&3)\tnote{e}  
                                                            & All\\
        \midrule
Perceptron          & 0.78  & 0.82  & 0.24  & 0.81  & 0.77  & 0.83\\
Decision Tree       & 0.65  & 0.79  & 0.56  & 0.75  & 0.65  & 0.73\\
One-Class~SVM       & 0.74  & 0.72  & 0.50  & 0.80  & 0.73  & 0.85\\
Isolation Forest    & 0.54  & 0.51  & 0.52  & 0.53  & 0.54  & 0.53\\
        \bottomrule
\end{tabular*}
\begin{tablenotes}[para,flushleft,small]
\item[a] 1: Text-specific,
\item[b] 2: N-grams,
\item[c] 3: Post-specific,
\item[d] (1\&2): combination of Text-specific and  N-grams,
\item[e] (1\&3): combination of Text-specific and  Post-specific
\end{tablenotes}
\end{threeparttable}
\end{document}

在此处输入图片描述

答案2

以下是两种可能的解决方案。

  • 第一种是采用基本布局(看上去相当杂乱,有很多垂直线),然后切换到环境tabularx以便内容可以适应。请注意,仍然需要切换到环境\footnotesize并且几乎不使用任何列间空白。

  • 第二种解决方案力求使表格看起来更开放,方法是删除所有垂直线,并使用间距适当的水平线代替\hline。这种方法的一个(有益的)副产品是可以使用\small代替\footnotesize并使用更多的列间空白。请注意,我还简化了标题,方法是将表格图例中真正的一部分移到表格本身的正下方。

在此处输入图片描述

\documentclass[letterpaper]{article}
\usepackage{aaai18} % from http://www.aaai.org/Conferences/AAAI/2018/aaai18call.php
\usepackage{times,helvet,courier,xcolor}
\usepackage{tabularx,ragged2e,booktabs,caption}
\newcolumntype{C}{>{\Centering\arraybackslash}X} % 
\frenchspacing
\begin{document}

\begin{table}[h]  
\footnotesize
\setlength{\tabcolsep}{1pt} % hardly any whitespace between columns!
\setlength\extrarowheight{1pt}
\textcolor{red}{Table with vertical lines}

\begin{tabularx}{\columnwidth}{|l||*{6}{C|}}
    \hline
    \multicolumn{7}{|c|}{Precision} \\
    \hline
    Classifier    & Text-specific (1) 
    & N-grams (2) & Post-specific (3) 
    & 1 \& 2      & 1 \& 3     & All\\
    \hline
    Perceptron       & 0.78 & 0.82 & 0.24 & 0.81 & 0.77 & 0.83\\
    Decision Tree    & 0.65 & 0.79 & 0.56 & 0.75 & 0.65 & 0.73\\
    One-Class SVM    & 0.74 & 0.72 & 0.50 & 0.80 & 0.73 & 0.85\\
    Isolation Forest & 0.54 & 0.51 & 0.52 & 0.53 & 0.54 & 0.53\\
    \hline
\end{tabularx}

\caption{Precision results of the classifiers for different feature subsets. 
1 \& 2 is the combination of text-specific features and n-grams. 
1 \& 3 is the combination of text- and post-specific features.}
\label{table:classifier_feature_subsets_prec} 
\end{table}


\begin{table}[h]
\small % "\footnotesize" not needed here
\captionsetup{size=small}
\textcolor{red}{No vertical lines; well-spaced horizontal lines; simplified caption}

\setlength{\tabcolsep}{2pt} % a bit more whitespace
\begin{tabularx}{\columnwidth}{@{} l *{5}{C} c @{}}
    \toprule
     Classifier & \multicolumn{6}{c@{}}{Precision} \\
    \cmidrule(l){2-7}
    & Text-specific (1) & N-grams (2) & Post-specific (3)
    & 1 \& 2 & 1 \& 3 & All\\
    \midrule
    Perceptron       & 0.78 & 0.82 & 0.24 & 0.81 & 0.77 & 0.83\\
    Decision Tree    & 0.65 & 0.79 & 0.56 & 0.75 & 0.65 & 0.73\\
    One-Class SVM    & 0.74 & 0.72 & 0.50 & 0.80 & 0.73 & 0.85\\
    Isolation Forest & 0.54 & 0.51 & 0.52 & 0.53 & 0.54 & 0.53\\
    \bottomrule
\end{tabularx}

\smallskip
1 \& 2 is the combination of text-specific features and n-grams.

1 \& 3 is the combination of text- and post-specific features.

\caption{Precision results of classifiers for various feature subsets.}
\label{table:new}
\end{table}

\end{document} 

相关内容