LaTeX forum ⇒ Graphics, Figures & Tablesremoving vertical lines in tables

Information and discussion about graphics, figures & tables in LaTeX documents.
suzanne hugo
Posts: 7
Joined: Wed Jan 28, 2009 11:25 am

removing vertical lines in tables

Postby suzanne hugo » Wed Jan 28, 2009 11:37 am

i want to make a table that only has continuous vertical lines that span a part of the table and not the whole table, for example from rows 4 to 8. As far as i know, when the tabular environment is created, you have to declare where the vertical lines go and so these vertical lines span the entire length of the table. To be more specific, i want to do for vertical lines what \cline does for horizontal lines. i have searched the internet for resources such as this and can't seem to find anything. please help.

Link:
BBcode:
HTML:
Hide post links
Show post links

User avatar
localghost
Site Moderator
Posts: 9206
Joined: Fri Feb 02, 2007 12:06 pm
Location: Braunschweig, Germany

Postby localghost » Wed Jan 28, 2009 11:41 am

You should avoid vertical lines in general to improve readability of your tables. Show us an example (code) and describe exactly where you want to remove those lines.


Best regards and welcome to the board
Thorsten¹
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 13.1 (Linux 3.11.10), TeX Live 2013 (vanilla), TeXworks 0.5 (r1351)
² Posting stopped indefinitely due to offenses

Link:
BBcode:
HTML:
Hide post links
Show post links

suzanne hugo
Posts: 7
Joined: Wed Jan 28, 2009 11:25 am

Postby suzanne hugo » Wed Jan 28, 2009 11:49 am

Okay, here is an example of what the table does at the moment...i would like to remove the vertical line on the right for the first two rows, so that the numbers are enclosed in a box, with the labels on the outside. Thank you!

  1. \begin{tabular}{c c|c c c c|}
  2. \multicolumn{2}{c}{} & Piano & Trumpet & Flute & Viola\\
  3. \multicolumn{2}{c}{}& \textbf{pno} & \textbf{tpt} & \textbf{flt} & \textbf{vla}\\
  4. \cline{3-6}
  5. Piano & \textbf{pno} & 0 & 0.5 & 0.25 & 0.75\\
  6. Trumpet & \textbf{tpt} & 0 & 0 & 0.25 & 0.5\\
  7. Flute & \textbf{flt} & 0 & 0 & 0 & 0.75\\
  8. Viola & \textbf{vla} & 0& 0 & 0 & 0\\
  9. \cline{3-6}
  10. \end{tabular}

Link:
BBcode:
HTML:
Hide post links
Show post links

Keta
Posts: 63
Joined: Tue Nov 25, 2008 1:00 pm

Postby Keta » Wed Jan 28, 2009 12:59 pm

You can put these cells inside a multicolumn of just one column:

  1. \documentclass[a4paper]{article}
  2.  
  3. \usepackage[T1]{fontenc}
  4. \usepackage[utf8]{inputenc}
  5.  
  6. \begin{document}
  7.  
  8. \begin{tabular}{c c|c c c c|}
  9. \multicolumn{2}{c}{} & Piano & Trumpet & Flute & \multicolumn{1}{c}{Viola}\\
  10. \multicolumn{2}{c}{}& \textbf{pno} & \textbf{tpt} & \textbf{flt} & \multicolumn{1}{c}{\textbf{vla}}\\
  11. \cline{3-6}
  12. Piano & \textbf{pno} & 0 & 0.5 & 0.25 & 0.75\\
  13. Trumpet & \textbf{tpt} & 0 & 0 & 0.25 & 0.5\\
  14. Flute & \textbf{flt} & 0 & 0 & 0 & 0.75\\
  15. Viola & \textbf{vla} & 0& 0 & 0 & 0\\
  16. \cline{3-6}
  17. \end{tabular}
  18.  
  19. \end{document}

Link:
BBcode:
HTML:
Hide post links
Show post links

suzanne hugo
Posts: 7
Joined: Wed Jan 28, 2009 11:25 am

Postby suzanne hugo » Wed Jan 28, 2009 1:34 pm

thank you so much, it works perfectly!

Link:
BBcode:
HTML:
Hide post links
Show post links


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 5 guests