如何从表中删除一列?

如何从表中删除一列?

我有这张表: 在此处输入图片描述

最左边有一列标有索引。我想删除此列,但当我尝试时,表格将不再编译。任何帮助都将不胜感激!另外抱歉,我还不确定如何在这个网站上发布代码!

这是我的代码:

\begin{table}[H]

\resizebox{\linewidth}{!}{%

\begin{tabular}{|l| c|c|c|c|c|c|c|c|c|c|c|c|} \hline

    & \multicolumn{4}{c|}{Jaro-Winkler} & \multicolumn{4}{c|}{TF-IDF} & \multicolumn{4}{c|}{TF-IDF (3-gram)} \\ \hline
    % & \multicolumn{3}{c|}{Soft TF-IDFT} & \multicolumn{3}{c|}{Soft TF-IDFT (3-gram)} \\ \hline

  Index  & {$Threshold$} & {$Purity$} & {$Zrand$} & {$NMI$}      &{$Threshold$} & {$Purity$} & {$Zrand$} & {$NMI$}
    & {$Threshold$} & {$Purity$} & {$Zrand$} & {$NMI$}  \\ \hline


   1 &0 &0.0023 &NaN    &0.4670     &0  &0.2789 &37.68  &0.7439     &0  &0.2395 &32.81  &0.7201 \\ \hline %Row 1

   2 &0.2   &0.0023 &NaN    &0.4670     &0.2    &0.9583 &463.18 &0.9003  &0.2   &0.8483 &271.59  &0.8872 \\ \hline %Row 2

   3 &0.4   &0.0023 &NaN    &0.4670     &0.4    &0.9907 &445.94 &0.9318  &0.4   &0.9861 &484.57  &0.9159 \\ \hline %Row 3

  4  &0.6   &0.0034 &0.5916 &0.4676  &0.6   &0.9976 &374.23 &0.9299 &0.6    &0.9942 &410.28 &0.9308 \\ \hline %Row 4

   5 &0.8   &0.1944 &16.18  &0.6317 &0.8    &0.9976 &283.43 &0.9285 &0.8    &0.9976 &326.86 &0.9291 \\ \hline %Row 5

   6 &1 &0.9629 &207.14 &0.9074     &1  &0.9976 &33.29  &0.9266     &1  &0.9976 &156.52 &0.9273 \\ \hline %Row 6

  A  &0.8942    &0.9548 &193.84 &0.9060 &0.5522 &0.9837 &470.70 &0.9156 &0.5943 &0.9814 &472.90  &0.9155 \\ \hline %Row 7

\end{tabular}}

\end{table}

答案1

您没有提到您遇到了哪些错误,但删除第一列的信息应该很容易完成。

您不应使用数学模式将第二行标题中的单词设为斜体,\textit而应使用。单词内间距将得到极大改善。

另外,如下面第二个表格所示,您可能需要考虑通过删除所有垂直线和大部分水平线来整理表格,以及(对于剩余的水平线)获得比仅使用更好的间距:\hline\booktabs软件包提供了命令\toprule\midrule\cmidrule带有修剪选项)和\bottomrule就是为了这个目的。最后,将数字与小数点符号对齐可能是一个好主意。

在此处输入图片描述

\documentclass{article}
\usepackage{graphicx,booktabs,dcolumn}
\newcolumntype{d}[1]{D{.}{.}{#1}}
\newcommand\mc[1]{\multicolumn{1}{@{}c@{}}{#1}}
\begin{document}
\begin{table}

\resizebox{\linewidth}{!}{%
\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|} \hline
\multicolumn{4}{|c|}{Jaro-Winkler} & 
\multicolumn{4}{c|}{TF-IDF} & 
\multicolumn{4}{c|}{TF-IDF (3-gram)} \\ 
\hline
\textit{Threshold} & \textit{Purity} & \textit{Zrand} & \textit{NMI} & 
\textit{Threshold} & \textit{Purity} & \textit{Zrand} & \textit{NMI} & 
\textit{Threshold} & \textit{Purity} & \textit{Zrand} & \textit{NMI}  \\  \hline
0 &0.0023 &NaN    &0.4670     &0  &0.2789 &37.68  &0.7439     &0  &0.2395 &32.81  &0.7201 \\ \hline %Row 1

0.2   &0.0023 &NaN    &0.4670     &0.2    &0.9583 &463.18 &0.9003  &0.2   &0.8483 &271.59  &0.8872 \\ \hline %Row 2

0.4   &0.0023 &NaN    &0.4670     &0.4    &0.9907 &445.94 &0.9318  &0.4   &0.9861 &484.57  &0.9159 \\ \hline %Row 3

0.6   &0.0034 &0.5916 &0.4676  &0.6   &0.9976 &374.23 &0.9299 &0.6    &0.9942 &410.28 &0.9308 \\ \hline %Row 4

0.8   &0.1944 &16.18  &0.6317 &0.8    &0.9976 &283.43 &0.9285 &0.8    &0.9976 &326.86 &0.9291 \\ \hline %Row 5

1 &0.9629 &207.14 &0.9074     &1  &0.9976 &33.29  &0.9266     &1  &0.9976 &156.52 &0.9273 \\ \hline %Row 6

0.8942    &0.9548 &193.84 &0.9060 &0.5522 &0.9837 &470.70 &0.9156 &0.5943 &0.9814 &472.90  &0.9155 \\ \hline %Row 7

\end{tabular}}

\bigskip

\resizebox{\linewidth}{!}{%

\begin{tabular}{@{} d{1.4}cd{3.4}c *{2}{d{1.4}cd{3.2}c} @{}} 
\toprule
\multicolumn{4}{@{}c}{Jaro-Winkler} & 
\multicolumn{4}{c}{TF-IDF} & 
\multicolumn{4}{c@{}}{TF-IDF (3-gram)} \\ 
\cmidrule(r){1-4} \cmidrule(r){5-8} \cmidrule{9-12}
\mc{\textit{Threshold}} &  \mc{\textit{Purity}} &  \mc{\textit{Zrand}} &  \mc{\textit{NMI}} &  
\mc{\textit{Threshold}} &  \mc{\textit{Purity}} &  \mc{\textit{Zrand}} &  \mc{\textit{NMI}} &  
\mc{\textit{Threshold}} &  \mc{\textit{Purity}} &  \mc{\textit{Zrand}} &  \mc{\textit{NMI}}  \\  
\midrule
0 &0.0023 &\mc{NaN}    &0.4670     &0  &0.2789 &37.68  &0.7439     &0  &0.2395 &32.81  &0.7201 \\  %Row 1

0.2   &0.0023 &\mc{NaN}    &0.4670     &0.2    &0.9583 &463.18 &0.9003  &0.2   &0.8483 &271.59  &0.8872 \\ %Row 2

0.4   &0.0023 &\mc{NaN}    &0.4670     &0.4    &0.9907 &445.94 &0.9318  &0.4   &0.9861 &484.57  &0.9159 \\ %Row 3

0.6   &0.0034 &0.5916 &0.4676  &0.6   &0.9976 &374.23 &0.9299 &0.6    &0.9942 &410.28 &0.9308 \\ %Row 4

0.8   &0.1944 &16.18  &0.6317 &0.8    &0.9976 &283.43 &0.9285 &0.8    &0.9976 &326.86 &0.9291 \\ %Row 5

1 &0.9629 &207.14 &0.9074     &1  &0.9976 &33.29  &0.9266     &1  &0.9976 &156.52 &0.9273 \\ %Row 6

0.8942    &0.9548 &193.84 &0.9060 &0.5522 &0.9837 &470.70 &0.9156 &0.5943 &0.9814 &472.90  &0.9155 \\ %Row 7 
\bottomrule 

\end{tabular}}
\end{table}
\end{document}

答案2

这是删除第一列的修改后的代码:

\documentclass{article}

\usepackage{float}
\usepackage{graphicx}

\begin{document}


\begin{table}[H]

\resizebox{\linewidth}{!}{%

\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|} \hline

   \multicolumn{4}{|c|}{Jaro-Winkler} & \multicolumn{4}{c|}{TF-IDF} & \multicolumn{4}{c|}{TF-IDF (3-gram)} \\ \hline
   % & \multicolumn{3}{c|}{Soft TF-IDFT} & \multicolumn{3}{c|}{Soft TF-IDFT (3-gram)} \\ \hline

   {$Threshold$} & {$Purity$} & {$Zrand$} & {$NMI$}      &{$Threshold$} & {$Purity$} & {$Zrand$} & {$NMI$}
   & {$Threshold$} & {$Purity$} & {$Zrand$} & {$NMI$}  \\ \hline


   0 &0.0023 &NaN    &0.4670     &0  &0.2789 &37.68  &0.7439     &0  &0.2395 &32.81  &0.7201 \\ \hline %Row 1

   0.2   &0.0023 &NaN    &0.4670     &0.2    &0.9583 &463.18 &0.9003  &0.2   &0.8483 &271.59  &0.8872 \\ \hline %Row 2

   0.4   &0.0023 &NaN    &0.4670     &0.4    &0.9907 &445.94 &0.9318  &0.4   &0.9861 &484.57  &0.9159 \\ \hline %Row 3

   0.6   &0.0034 &0.5916 &0.4676  &0.6   &0.9976 &374.23 &0.9299 &0.6    &0.9942 &410.28 &0.9308 \\ \hline %Row 4

   0.8   &0.1944 &16.18  &0.6317 &0.8    &0.9976 &283.43 &0.9285 &0.8    &0.9976 &326.86 &0.9291 \\ \hline %Row 5

   1 &0.9629 &207.14 &0.9074     &1  &0.9976 &33.29  &0.9266     &1  &0.9976 &156.52 &0.9273 \\ \hline %Row 6

   0.8942    &0.9548 &193.84 &0.9060 &0.5522 &0.9837 &470.70 &0.9156 &0.5943 &0.9814 &472.90  &0.9155 \\ \hline %Row 7

\end{tabular}}

\end{table}
\end{document} 

输出:

在此处输入图片描述

一些评论:

  1. 我会使用说明符h而不是H保留table“这里”,也就是说我会使用

    \begin{table}[h]
    
  2. 如果要强调某些文本,输入数学模式(如 ){$Threshold$}并不是正确的方法。请使用\emph\textit,例如\textit{Threshold}

答案3

您可能忘记了下面序言中使用的两个包之一。文档的其余部分仍未链接。如果您确实要删除第一列,请确认。

\documentclass{article}

\usepackage{here}
\usepackage{graphics}

\begin{document}


\begin{table}[H]

\resizebox{\linewidth}{!}{%

\begin{tabular}{|l| c|c|c|c|c|c|c|c|c|c|c|c|} \hline

    & \multicolumn{4}{c|}{Jaro-Winkler} & \multicolumn{4}{c|}{TF-IDF} & \multicolumn{4}{c|}{TF-IDF (3-gram)} \\ \hline
    % & \multicolumn{3}{c|}{Soft TF-IDFT} & \multicolumn{3}{c|}{Soft TF-IDFT (3-gram)} \\ \hline

  Index  & {$Threshold$} & {$Purity$} & {$Zrand$} & {$NMI$}      &{$Threshold$} & {$Purity$} & {$Zrand$} & {$NMI$}
    & {$Threshold$} & {$Purity$} & {$Zrand$} & {$NMI$}  \\ \hline


   1 &0 &0.0023 &NaN    &0.4670     &0  &0.2789 &37.68  &0.7439     &0  &0.2395 &32.81  &0.7201 \\ \hline %Row 1

   2 &0.2   &0.0023 &NaN    &0.4670     &0.2    &0.9583 &463.18 &0.9003  &0.2   &0.8483 &271.59  &0.8872 \\ \hline %Row 2

   3 &0.4   &0.0023 &NaN    &0.4670     &0.4    &0.9907 &445.94 &0.9318  &0.4   &0.9861 &484.57  &0.9159 \\ \hline %Row 3

  4  &0.6   &0.0034 &0.5916 &0.4676  &0.6   &0.9976 &374.23 &0.9299 &0.6    &0.9942 &410.28 &0.9308 \\ \hline %Row 4

   5 &0.8   &0.1944 &16.18  &0.6317 &0.8    &0.9976 &283.43 &0.9285 &0.8    &0.9976 &326.86 &0.9291 \\ \hline %Row 5

   6 &1 &0.9629 &207.14 &0.9074     &1  &0.9976 &33.29  &0.9266     &1  &0.9976 &156.52 &0.9273 \\ \hline %Row 6

  A  &0.8942    &0.9548 &193.84 &0.9060 &0.5522 &0.9837 &470.70 &0.9156 &0.5943 &0.9814 &472.90  &0.9155 \\ \hline %Row 7

\end{tabular}}

\end{table}
\end{document}

在此处输入图片描述

相关内容