[Tex/LaTex] Framing cells in a table

framedtables

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)

Best Answer

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

Related Question