LaTeX forum ⇒ Graphics, Figures & TablesInaccurate 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

Postby TesTT » Sat Aug 18, 2012 2:44 pm

Hey,

I have the following code
  1. \documentclass[11pt]{article}
  2. \usepackage[T1]{fontenc}
  3.  
  4. \begin{document}
  5. The quick brown fox jumps over the lazy dog.
  6.  
  7. \begin{tabular}{
  8. >{\centering\arraybackslash}p{1.2cm}
  9. >{\centering\arraybackslash}p{1.4cm}|
  10. >{\centering\arraybackslash}p{2.0cm}
  11. >{\centering\arraybackslash}p{2.0cm}|
  12. >{\centering\arraybackslash}p{2.0cm}
  13. >{\centering\arraybackslash}p{2.0cm}
  14. }\hline
  15. & & \multicolumn{2}{c}{Time} & \multicolumn{2}{c}{Iterations} \\
  16. A & B & C1 & C2 & D1 & D2 \\ \hline
  17. 1 & 45 & 0.051 & 0.075 & 4 & 18 \\
  18. 2 & 300 & 0.052 & 0.099 & 7 & 47 \\
  19. 3 & 530 & 0.063 & 0.131 & 7 & 73 \\
  20. \end{tabular}
  21. \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
  1. \multicolumn{2}{|c}{Iterations}

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

User avatar
Stefan Kottwitz
Site Admin
Posts: 9501
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Sat Aug 18, 2012 2:58 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:

  1. \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
table.png (37.4 KiB) Viewed 1162 times


Stefan
Site admin

TesTT
Posts: 12
Joined: Wed Aug 15, 2012 6:52 pm

Postby TesTT » Sat Aug 18, 2012 3:05 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
tabular-vertical-line.jpg (8.94 KiB) Viewed 1079 times


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 8 guests