# How can I typeset a table whose lines do not extend to row and column headings? [duplicate]

Is there an easy way to convert this table (with complete lines)

into that one (with incomplete lines; the image is "Photoshopped" for illustration)?

Note that I want to get rid of the initial part of the lines (vertical and horizontal). All solutions are welcomed but I would prefer a solution that doesn't require additional packages, if possible.

This is the code for the first image:

\documentclass{article}
\begin{document}
\begin{tabular}{l|c|c|}
& A & B \\ \hline
a & 0  & 1 \\ \hline
b & 10 & 11\\ \hline
c & 20 & 21\\ \hline
d & 30 & 31\\ \hline
\end{tabular}
\end{document}

-

## marked as duplicate by Mico, Adam Liter, Christian Hupfer, Jubobs, MalipivoJul 28 '14 at 18:31

Apart from the recommendation about vertical lines, what about \cline{} and \multicolumn{} approach? – Christian Hupfer Jul 28 '14 at 16:34
This may come in handy: tablesgenerator.com – izabera Jul 28 '14 at 16:54
Related question (starts with a solution to your exact question) Creating tables with spanning rows/columns. See also Making an odd shaped table – Alan Munn Jul 28 '14 at 16:56

Either use (if needed at all) \multicolumn{1}{c}{A} etc. for the centered header cells or \multicolumn{1}{|c|}{0} etc. for the data cells, if \begin{tabular}{lcc} is used, i.e. without the vertical lines, but this would involve many cell entries to be changed.

Restricting horizontal lines to particular columns can be done with \cline{2-3} for example

\documentclass{article}
\begin{document}
\begin{tabular}{l|c|c|}
\multicolumn{1}{l}{}  & \multicolumn{1}{c}{A} & \multicolumn{1}{c}{B} \\
\cline{2-3}
a & 0  & 1 \\
\cline{2-3}
b & 10 & 11\\
\cline{2-3}
c & 20 & 21\\
\cline{2-3}
d & 30 & 31\\
\cline{2-3}
\end{tabular}
\end{document}


Note: The usage of vertical lines in tables is discouraged, the number of horizontal lines should be limited to a minimum

-

It's rather simple:

\documentclass{article}

\begin{document}

\begin{tabular}{l|c|c|}
\multicolumn{1}{c}{} & \multicolumn{1}{c}{A }& \multicolumn{1}{c}{B} \\
\cline{2-3}
a & 0  & 1 \\
\cline{2-3}
b & 10 & 11\\
\cline{2-3}
c & 20 & 21\\
\cline{2-3}
d & 30 & 31\\
\cline{2-3}
\end{tabular}

\end{document}


-