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.

I want to add borders to a set of cells in a table. But not just a border for the single cells because then I imagine I could just put the cell content in an fbox. Instead I want a frame which "merges" some cells. Hm I think I will try some ASCII to show how I mean:

---------------------------------------------------
Col 1    Col 2    Col 3    Col 4    Col 5    Col 6 
---------------------------------------------------
 bla      bla      bla      bla      bla      bla  

 bla      bla      bla      bla      bla      bla  
+---------------------+
|ble      ble      ble|     bla      bla      bla  
+---------------------+
 bla      bla      bla      bla      bla      bla  

I looked into the hhline package but soon realised that it had to do with horizontal lines. It seems very difficult to add those two vertical lines which only are between two cells and do not go all the way through the table. I know that \cline could probably be used for drawing the horizontal lines, but how do I make the vertical ones? (and preferably so it looks good and forms a box, not only four lines with space between them)

share|improve this question

1 Answer 1

up vote 14 down vote accepted

The horizontal partial lines are done with the \cline command. For the vertical lines you have to use \multicolumn to specify new column properties.

\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\begin{document}
  \begin{tabular}{*6{c}}\hline
    Col 1 & Col 2 & Col 3 & Col 4 & Col 5 & Col 6 \\\hline
    bla   & bla   & bla   & bla   & bla   & bla \\
    bla   & bla   & bla   & bla   & bla   & bla \\ \cline{1-3}
    \multicolumn{1}{|c}{ble} & ble & \multicolumn{1}{c|}{ble} & bla & bla & bla \\ \cline{1-3}
    bla   & bla   & bla   & bla   & bla   & bla \\ \hline
  \end{tabular}
\end{document}

enter image description here

share|improve this answer
    
Ha! You beat me by one second! Your answer is essentially the same as mine, but with more detail, so I'll delete mine. –  TH. Oct 29 '10 at 9:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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