3

I have this table: enter image description here

On the far left there is a column labeled index. I want to remove this column but when I try the table will no longer compile. Any help would be appreciated! Also sorry I'm not sure how to post code on this site yet!

This is my code:

\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}
  • To highlight code, just select it and click the button marked {}. Blocks are indented by four spaces, inline code delimited by backticks (`). – Torbjørn T. Nov 16 '13 at 0:00
  • 3
    If you wish to remove a column, you don't have to do this physically. You can let LaTeX remove it for you. Follow the instructions in Easiest way to delete a column? – Werner Nov 16 '13 at 0:02
5

You don't mention which error(s) you're getting, but removing the information of the first column should be straightforward to accomplish.

You shouldn't use math mode to put the words in the second header row in italics; use \textit instead. The intra-word spacing will be greatly improved.

Separately, as is shown in the second table below, you may want to consider decluttering the table by getting rid of all vertical lines and most of the horizontal lines, as well as (for the horizontal lines that remain) get better spacing than is is possible with just \hline: the \booktabs package offers the commands \toprule, \midrule, \cmidrule (with trimming options), and \bottomrule for just this purpose. Finally, it may be a good idea to align the numbers on their decimal signs.

enter image description here

\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

This is the modified code to remove the first column:

\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} 

Output:

enter image description here

Some remarks:

  1. I would use the specifier h instead of H to keep the table "here", that is I would use

    \begin{table}[h]
    
  2. If you want to emphasize some text, entering math mode as in {$Threshold$} is not the right way. Use \emph or \textit instead, e.g. \textit{Threshold}.

1

You have probably forgotten one of two packages used in the preamble below. The rest of your document remains unchainged. If you really want to remowe the first column, please confirm.

\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}

enter image description here

  • 1
    Note that here is an obsolete package. Run texdoc here. – Fran Nov 16 '13 at 6:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.