如何固定表格列的大小,以便长文本可以放在下一行?

如何固定表格列的大小,以便长文本可以放在下一行?

在此处输入图片描述

\begin{multicols}{2}
\begin{table*}[t]
\setlength{\tabcolsep}{0.1\tabcolsep}
\caption{Comparison with other state of art detection tools} 
\label{tab:example}
\small
\centering
\begin{tabular}{lcccccc}
\toprule\toprule
\textbf{Detection Techniques} & \textbf{Algorithm} & \textbf{Detection 
Time} & \textbf{RAM 
Usage} & \textbf{CPU usage} & \textbf{Database Creation time} \\ 
\midrule\midrule 
\\   
NAYATDROID & DRG-122 & Item 3 & Item 4 & Item 4  & Item 4\\ \\
DroidSG & FNV Hash & Item 3 & Item 4 & Item 4  & Item 4\\ \\
PTVDT& GHU Hash, FNV hash, Nim hash  & Item 3 & Item 4 & Item 4  & Item 
4\\ \\
BGHFT& FVB Hash  & Item 3 & Item 4 & Item 4  & Item 4\\ \\
VFFG & CDC Hash, FNV hash & Item 3 & Item 4 & Item 4  & Item 4\\ \\
VBGFD & GBR Hash  & Item 3 & Item 4 & Item 4  & Item 4\\
\bottomrule \bottomrule
\end{tabular}
\end{table*}
\end{multicols}enter code here

答案1

这是该makecell软件包的一个可能的解决方案,它允许在标准列的单元格中进行换行,并对列标题进行通用格式设置:

    \documentclass[twoside]{article}
    \usepackage{multicol, booktabs}
    \usepackage{makecell}
    \renewcommand{\theadfont}{\small\bfseries}
    \setlength{\tabcolsep}{4pt}

    \begin{document}

    \begin{multicols}{2}
      \begin{table*}[t]
    \caption{Comparison with other state of art detection tools}
    \label{tab:example}
    \small
    \centering
    \begin{tabular}{lcccccc}
    \toprule\toprule
    \thead{Detection\\ Techniques} & \textbf{Algorithm} & \thead{Detection\\ Time} & \thead{RAM \\%
    Usage} & \thead{CPU\\ usage} & \thead{Database\\ Creation time} \\
    \midrule\midrule
    \\
    NAYATDROID & DRG-122 & Item 3 & Item 4 & Item 4 & Item 4\\ \\
    DroidSG & FNV Hash & Item 3 & Item 4 & Item 4 & Item 4\\ \\
    PTVDT& \makecell{GHU Hash,\\ FNV hash,\\ Nim hash} & Item 3 & Item 4 & Item 4 & Item 4\\ \\
    BGHFT& FVB Hash & Item 3 & Item 4 & Item 4 & Item 4\\ \\
    VFFG & \makecell{CDC Hash,\\ FNV hash} & Item 3 & Item 4 & Item 4 & Item 4\\ \\
    VBGFD & GBR Hash & Item 3 & Item 4 & Item 4 & Item 4\\
    \bottomrule \bottomrule
    \end{tabular}
    \end{table*}
    \end{multicols}

    \end{document} 

在此处输入图片描述

相关内容