Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

This question already has an answer here:

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

completelines

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

incompletelines

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}
share|improve this question

marked as duplicate by Mico, Adam Liter, Christian Hupfer, Jubobs, Malipivo Jul 28 at 18:31

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2  
Apart from the recommendation about vertical lines, what about \cline{} and \multicolumn{} approach? –  Christian Hupfer Jul 28 at 16:34
1  
This may come in handy: tablesgenerator.com –  izabera Jul 28 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 at 16:56

2 Answers 2

up vote 5 down vote accepted

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}

enter image description here

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

share|improve this answer

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} 

enter image description here

share|improve this answer

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