## LaTeX forum ⇒ Graphics, Figures & Tables ⇒ Inaccurate vertical Table Line Topic is solved

Information and discussion about graphics, figures & tables in LaTeX documents.
TesTT
Posts: 12
Joined: Wed Aug 15, 2012 6:52 pm

### Inaccurate vertical Table Line

Hey,

I have the following code
\documentclass[11pt]{article}\usepackage[T1]{fontenc} \begin{document}   The quick brown fox jumps over the lazy dog.    \begin{tabular}{     >{\centering\arraybackslash}p{1.2cm}     >{\centering\arraybackslash}p{1.4cm}|     >{\centering\arraybackslash}p{2.0cm}     >{\centering\arraybackslash}p{2.0cm}|     >{\centering\arraybackslash}p{2.0cm}     >{\centering\arraybackslash}p{2.0cm}   }\hline     & & \multicolumn{2}{c}{Time} & \multicolumn{2}{c}{Iterations} \\     A & B & C1 & C2 & D1 & D2 \\ \hline     1 & 45 & 0.051 & 0.075 & 4 & 18 \\     2 & 300 & 0.052 & 0.099 & 7	& 47 \\     3 & 530 & 0.063 & 0.131 & 7	& 73 \\   \end{tabular}\end{document}

The thing is that the 2nd vertical line doesnt cover the entire height of the table. In the first line there is a piece missing. What has happened?

I tried to use
\multicolumn{2}{|c}{Iterations}

so that the entire height is covered, but it looks just a little bit crooked to me. :/

Stefan Kottwitz
Posts: 9601
Joined: Mon Mar 10, 2008 9:44 pm
It's caused by the format change by \multicolumn. You can change it by adding a | in the \multicolumn argument too, similar to what you tried, but at the right of the Time cell:

\multicolumn{2}{c|}{Time}

Tables with vertical lines are harder to read row by row. That's why good books often don't use vertical lines, but a few horizontal lines to structure a table, i.e. top line and bottom line, and separating a head row, possibly grouping related entries.

A quick design example from Creating tables in LaTeX:

table.png (37.4 KiB) Viewed 1280 times

Stefan

TesTT
Posts: 12
Joined: Wed Aug 15, 2012 6:52 pm
As I said in my first post, if I do what you suggest then my table looks crooked (see attachment).

:/

Edit:
Oh, my bad, you were right, of course. it all looks terrific now. Thanks.
Attachments
tabular-vertical-line.jpg (8.94 KiB) Viewed 1197 times