1

Often I read questions asking how to remove the gap between two \hlines in a table, but I like the gap and want to create it in the \hline as well, to have an equal effect for the column and row titles.

The code below makes a standard table

\documentclass{article}
\begin{document}
\begin{center}
\begin{tabular}{|c||c|c|c|}\hline
& A & B & C\\\hline\hline
A & 1 & 2 & 3\\\hline
B & 4 & 5 & 6\\\hline
C & 7 & 8 & 9\\\hline
\end{tabular}
\end{center}
\end{document}

The image shows what I am trying to accomplish.

enter image description here

Does a simple way to create this table exsist?

0

1 Answer 1

1

If such a setup is really needed use \cline{...} for the rules and add a very small 'empty' column as the 2nd one.

The empty row can be done with \multicolumn{5}{c}{} \\[-0.8\normalbaselineskip], for example.

\documentclass{article}

\begin{document}

\begin{center}
\begin{tabular}{|c|@{}p{2pt}@{}|c|c|c|}
  \cline{3-5}
  \multicolumn{1}{c}{}  & &  A & B & C\\
   \cline{3-5}
  \multicolumn{5}{c}{} \\[-0.8\normalbaselineskip]
  \cline{1-1} \cline{3-5}
  A && 1 & 2 & 3 \\
\cline{1-1} \cline{3-5}
B && 4 & 5 & 6\\
\cline{1-1} \cline{3-5}
C && 7 & 8 & 9\\
\cline{1-1} \cline{3-5}
\end{tabular}
\end{center}
\end{document}

enter image description here

2
  • Thank you Christian! What is the reasoning to say "if it is really needed"? Is this typographically incorrect, or is it in your opinion not astatically pleasing?
    – Douwe66
    Mar 2, 2016 at 20:12
  • 1
    @Douwe66: typographically incorrect is a stretchable term. There might be occasions where such a table is nice (i.e. in a fill - in form, for example), or in education to show some specific content. I would not use it for larger tables, however
    – user31729
    Mar 2, 2016 at 20:15

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