3

I want to create a rectangle with cells that are labeled on the outside, yet I can't get it to work without some lines sticking out.

Here is my code

\documentclass{article}
\begin{document}

\begin{tabular}{ c | c | c | c |  }
& Label & Label & Label \\ 
\hline
Label & & & \\ 
\hline
Label & & & \\ 
\hline
Label & & & \\ 
\hline
Label & & & \\ 
\hline
\end{tabular}

\end{document}

enter image description here

4
  • Welcome to the TeX.SE. What is your complete .tex code, please? Can you put it, please?
    – Sebastiano
    Jun 10, 2021 at 22:20
  • @Sebastiano I'm not sure what you mean, I put the code in the post, and there are no dependencies. Do you mean that I should put \documentclass{article} \begin{document} ... \end{document}?
    – nancytrain
    Jun 10, 2021 at 22:24
  • Yes :-) It is important to put also the packages. Thank you very much.
    – Sebastiano
    Jun 10, 2021 at 22:25
  • 1
    Okay fair enough! I updated the post
    – nancytrain
    Jun 10, 2021 at 22:26

3 Answers 3

4

With {NiceTabular} of nicematrix.

\documentclass{article}
\usepackage{nicematrix}

\begin{document}

\begin{NiceTabular}{ccc}[first-row,first-col,hvlines]
      & Label & Label & Label \\
Label \\
Label \\
Label \\
Label \\
\end{NiceTabular}

\end{document}

Output of the above code

3

You can use the facilities of the blkarray package:

\documentclass{article}
\usepackage{blkarray, array}
\setlength{\BAextrarowheight}{3pt}

\begin{document}

\begin{blockarray}{rlll}
 & Label & Label & Label \\ \cline{2-4}
\begin{block}{r|l|l|l|}
 Label & & & \\ \cline{2-4}
  Label & & & \\ \cline{2-4}
  Label & & & \\ \cline{2-4}
 \end{block}
\end{blockarray}

\end{document}

enter image description here

0
2

Created (quickly) with https://www.tablesgenerator.com/: into the blank {} you can put anything.

\documentclass{article}
\begin{document}

\begin{tabular}{llll}
 & Label                 & Label                 & Label                 \\ \cline{2-4} 
\multicolumn{1}{l|}{Label} & \multicolumn{1}{l|}{} & \multicolumn{1}{l|}{} & \multicolumn{1}{l|}{} \\ \cline{2-4} 
\multicolumn{1}{l|}{Label} & \multicolumn{1}{l|}{} & \multicolumn{1}{l|}{} & \multicolumn{1}{l|}{} \\ \cline{2-4} 
\multicolumn{1}{l|}{Label} & \multicolumn{1}{l|}{} & \multicolumn{1}{l|}{} & \multicolumn{1}{l|}{} \\ \cline{2-4} 
\multicolumn{1}{l|}{Label} & \multicolumn{1}{l|}{} & \multicolumn{1}{l|}{} & \multicolumn{1}{l|}{} \\ \cline{2-4} 
\end{tabular}

\end{document}

enter image description here

You must log in to answer this question.

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