使表格适合列

使表格适合列

我的表格太大,无法放入列中,有没有办法使它变薄并适合列中? 在此处输入图片描述

\documentclass[10pt,conference]{IEEEtran} 
\IEEEoverridecommandlockouts

\usepackage{cite}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{algorithmic}
\usepackage{algorithm}
\usepackage{graphicx}
\usepackage{changepage}
\usepackage{lipsum}
\usepackage{ctable}% http://ctan.org/pkg/ctable
\usepackage{color, colortbl}
\begin{table}[]

\caption{Quantifying the requirement-to-method Input Gold Standard}
\label{GoldStandardInputCompleteness}
\begin{adjustwidth}{-1cm}{-1cm}
    \begin{tabular}{|c|c|c|c|c|c|c|c|}
        \hline   \textbf{App}
        & \textbf{T\textsubscript{m}(\#)} & \textbf{N\textsubscript{m}(\#)} & \textbf{E\textsubscript{m}(\#)} & \textbf{T\textsubscript{m}(\%)} & \textbf{N\textsubscript{m}(\%)} & \textbf{E\textsubscript{m}(\%)} & \textbf{Total} \\ \hline
        \textbf{Chess} & 563 & 2389 & 3064 & 9.36 & 39.71 & 50.93 & 6016 \\ \hline
        \textbf{Gantt} & 1429 & 26842 & 61963 & 1.58 & 24.75 & 68.67 & 90234 \\ \hline
        \textbf{iTrust} & 307 & 7173 & 159358 & 0.18 & 4.30 & 95.52 & 166838 \\ \hline
        \textbf{JHot.} & 936 & 13382 & 122602 & 0.68 & 9.77 & 89.54 & 136920 \\ \hline
    \end{tabular}
\end{adjustwidth}

\end{table}
\end{document}

答案1

对于您的表格,最简单的方法似乎是改变列间距,例如\setlength{\tabcolsep}{4.1pt}

\documentclass[10pt,conference]{IEEEtran} 
\IEEEoverridecommandlockouts

\usepackage{cite}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{algorithmic}
\usepackage{algorithm}
\usepackage{graphicx}
\usepackage{changepage}
\usepackage{lipsum}
\usepackage{ctable}% http://ctan.org/pkg/ctable
\usepackage{color, colortbl}

\begin{document}

\lipsum[2]

\begin{table}[htbp]
\caption{Quantifying the requirement-to-method Input Gold Standard}
\label{GoldStandardInputCompleteness}
%\begin{adjustwidth}{-1cm}{-1cm}
\setlength{\tabcolsep}{4.1pt}
    \begin{tabular}{|c|c|c|c|c|c|c|c|}
        \hline   \textbf{App}
        & \textbf{T\textsubscript{m}(\#)} & \textbf{N\textsubscript{m}(\#)} & \textbf{E\textsubscript{m}(\#)} & \textbf{T\textsubscript{m}(\%)} & \textbf{N\textsubscript{m}(\%)} & \textbf{E\textsubscript{m}(\%)} & \textbf{Total} \\ \hline
        \textbf{Chess} & 563 & 2389 & 3064 & 9.36 & 39.71 & 50.93 & 6016 \\ \hline
        \textbf{Gantt} & 1429 & 26842 & 61963 & 1.58 & 24.75 & 68.67 & 90234 \\ \hline
        \textbf{iTrust} & 307 & 7173 & 159358 & 0.18 & 4.30 & 95.52 & 166838 \\ \hline
        \textbf{JHot.} & 936 & 13382 & 122602 & 0.68 & 9.77 & 89.54 & 136920 \\ \hline
    \end{tabular}
%\end{adjustwidth}

\end{table}

\lipsum
\end{document}

在此处输入图片描述

答案2

\begin{table}
\caption{Quantifying the requirement-to-method Input Gold Standard}
\label{GoldStandardInputCompleteness}
\tabcolsep=2.5pt
    \begin{tabular}{|c|c|c|c|c|c|c|c|}
        \hline   \textbf{App}
        & \textbf{T\textsubscript{m}(\#)} & \textbf{N\textsubscript{m}(\#)} & 
        \textbf{E\textsubscript{m}(\#)} & \textbf{T\textsubscript{m}(\%)} & 
        \textbf{N\textsubscript{m}(\%)} & \textbf{E\textsubscript{m}(\%)} & 
        \textbf{Total} \\ \hline
        \textbf{Chess} & 563 & 2389 & 3064 & 9.36 & 39.71 & 50.93 & 6016 \\ \hline
        \textbf{Gantt} & 1429 & 26842 & 61963 & 1.58 & 24.75 & 68.67 & 90234 \\ 
        \hline
        \textbf{iTrust} & 307 & 7173 & 159358 & 0.18 & 4.30 & 95.52 & 166838 \\ 
        \hline
        \textbf{JHot.} & 936 & 13382 & 122602 & 0.68 & 9.77 & 89.54 & 136920 \\ 
        \hline
    \end{tabular}
 \end{table}

在此处输入图片描述

答案3

您可以将列写为行,将行写为列。如下所示:

输出

\documentclass[10pt,conference]{IEEEtran} 
\IEEEoverridecommandlockouts

\usepackage{cite}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{algorithmic}
\usepackage{algorithm}
\usepackage{graphicx}
\usepackage{changepage}
\usepackage{lipsum}
\usepackage{ctable}% http://ctan.org/pkg/ctable
\usepackage{color, colortbl}

\begin{document}

\lipsum[2]

\begin{table}[htbp]
\centering
\caption{Quantifying the requirement-to-method Input Gold Standard}
\label{GoldStandardInputCompleteness}
    \begin{tabular}{|c|c|c|c|c|}
        \hline   
        \textbf{App}                    & \textbf{Chess}    & \textbf{Gantt}    & \textbf{iTrust}   & \textbf{JHot.}\\\hline
        \textbf{T\textsubscript{m}(\#)} & 563               & 1429              & 307               & 936           \\\hline
        \textbf{N\textsubscript{m}(\#)} & 2389              & 26842             & 7173              & 13382         \\\hline
        \textbf{E\textsubscript{m}(\#)} & 3064              & 61963             & 159358            & 122602        \\\hline
        \textbf{T\textsubscript{m}(\%)} & 9.36              & 1.58              & 0.18              & 0.68          \\\hline
        \textbf{N\textsubscript{m}(\%)} & 39.71             & 24.75             & 4.30              & 9.77          \\\hline
        \textbf{E\textsubscript{m}(\%)} & 50.93             & 68.67             & 95.52             & 89.54         \\\hline
        \textbf{Total}                  & 6016              & 90234             & 166838            & 136920        \\\hline
    \end{tabular}
\end{table}

\lipsum
\end{document}

答案4

我会按照您在 { 中的大表相同的方式制作这张表上一个问题):

在此处输入图片描述

\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts

\usepackage{xcolor}                             % changed
\usepackage{array, booktabs, makecell, multirow}% new
\renewcommand\theadfont{\small\bfseries}
\renewcommand\theadgape{}
\usepackage{siunitx}
\usepackage{etoolbox}

\usepackage{lipsum}
\begin{document}
\lipsum[66]
\begin{table}[htb]
\caption{Quantifying the requirement-to-method Input Gold Standard}
\label{GoldStandardInputCompleteness}
\setlength\tabcolsep{0pt}
\sisetup{group-four-digits}
\begin{tabular*}{\columnwidth}{@{\extracolsep{\fill}}
             >{\bfseries}c
                         S[table-format=4.0]
                         S[table-format=5.0]
                         S[table-format=6.0]
                         S[table-format=1.2]
                    *{2}{S[table-format=2.2]}
                         S[table-format=6.0]
            }
    \toprule
App     & {\thead{T\textsubscript{m}(\#)}} & {\thead{N\textsubscript{m}(\#)}}
        & {\thead{E\textsubscript{m}(\#)}} & {\thead{T\textsubscript{m}(\%)}}
        & {\thead{N\textsubscript{m}(\%)}} & {\thead{E\textsubscript{m}(\%)}}
        & {\thead{Total}}                                       \\
    \midrule
Chess   & 563  & 2389  & 3064   & 9.36 & 39.71 & 50.93 & 6016   \\
Gantt   & 1429 & 26842 & 61963  & 1.58 & 24.75 & 68.67 & 90234  \\
iTrust  & 307  & 7173  & 159358 & 0.18 & 4.30 & 95.52  & 166838 \\
JHot.   & 936  & 13382 & 122602 & 0.68 & 9.77 & 89.54  & 136920 \\
    \bottomrule
\end{tabular*}
\end{table}
\lipsum[66]
\end{document}

相关内容