35

I want to remove the border of the top left table cell (top-border and left border of this cell). My table looks like this:

\begin{table}[!ht]  
    \centering
    \begin{tabular}{|c|c|c|c|}    \hline
             &  Item1 & Item2 & Item3 \\ \hline
    Group1 & 0.8 & 0.1 & 0.1 \\ \hline
    Group2 & 0.1 & 0.8 & 0.1 \\ \hline
    Group3 & 0.1 & 0.1 & 0.8 \\ \hline
    Group4 & 0.34& 0.33& 0.33 \\ \hline
    \end{tabular}
\end{table}

Does somebody have a hint how i can do this?

3 Answers 3

62

You need to use a column-specific line \cline as well as a \multicolumn{1}{c|} entry to remove the rules from the top left cell:

enter image description here

\documentclass{article}
\usepackage{booktabs}% http://ctan.org/pkg/booktabs
\begin{document}
\begin{table}[!ht]  
  \centering
  \begin{tabular}{|c|c|c|c|}
    \cline{2-4}
    \multicolumn{1}{c|}{} & Item1 & Item2 & Item3 \\ \hline
    Group1 & 0.8   & 0.1   & 0.1  \\ \hline
    Group2 & 0.1   & 0.8   & 0.1  \\ \hline
    Group3 & 0.1   & 0.1   & 0.8  \\ \hline
    Group4 & 0.34  & 0.33  & 0.33 \\ \hline
  \end{tabular}

  \bigskip

  \begin{tabular}{cccc}
    \toprule
           & Item1 & Item2 & Item3 \\ \midrule
    Group1 & 0.8   & 0.1   & 0.1  \\
    Group2 & 0.1   & 0.8   & 0.1  \\
    Group3 & 0.1   & 0.1   & 0.8  \\
    Group4 & 0.34  & 0.33  & 0.33 \\ \bottomrule
  \end{tabular}
\end{table}
\end{document}​

I've also added a booktabs variant, which is still clear in terms of the presentation, and looks cleaner.

0
2

With tabularray and siunitx (loaded as Tblr Library) packages:

\documentclass{article}
\usepackage{tabularray}
\UseTblrLibrary{siunitx}

\begin{document}
    \begin{table}[!ht]
    \centering
\begin{tblr}{hline{1}={2-Z}{solid}, hline{2-Z}={solid},
             vline{1}={2-Z}{solid}, vline{2-Z}={solid},
             colspec = {l *{3}{Q[c, si={table-format=1.2}]}}
             }
        & {{{Item1}}}   & {{{Item2}}}   & {{{Item3}}}   \\
Group1  &   0.8         &   0.1         &   0.1         \\ 
Group2  &   0.1         &   0.8         &   0.1         \\ 
Group3  &   0.1         &   0.1         &   0.8         \\ 
Group4  &   0.34        &   0.33        &   0.33        \\ 
\end{tblr}
    \end{table}
\end{document}​

enter image description here

1

With {NiceTabular} of nicematrix, you have a key corners to specify corners that will be computed with the empty cells of that corners. Then, the key hvlines draws all the rules excepted in the corners.

\documentclass{article}
\usepackage{nicematrix}

\begin{document}

\begin{table}[!ht]  
    \centering
    \begin{NiceTabular}{cccc}[hvlines,corners=NW] % NW = north west
             &  Item1 & Item2 & Item3 \\ 
    Group1 & 0.8 & 0.1 & 0.1 \\ 
    Group2 & 0.1 & 0.8 & 0.1 \\ 
    Group3 & 0.1 & 0.1 & 0.8 \\ 
    Group4 & 0.34& 0.33& 0.33 \\
    \end{NiceTabular}
\end{table}

\end{document}

You need several compilations (because nicematrix uses PGF/Tikz nodes under the hood).

Output of the above code

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .