I am looking to add borders to some cells in a table, such that the borders surround the contents and there is a space between each cell. The best image I could find that shows sort of what I want to achieve is this:

enter image description here

This is possible in HTML via the cellspacing setting in tables. How can I achieve the same in LaTeX? I would only want a few of the table cells to have this internal border, not all of them.

The closest I have come is by using fbox, but I couldn't get them to extend all the way to the edges of the table cells.


For simple tables an easy solution is the hhline package, but I think that is not a good solution for complex tables with \multiwrow and \multicolumn cells, as showed in your question.

In this MWE are showed both problems:

enter image description here

\multirow{2}{*}{alfa} & \bfseries beta & \multicolumn{2}{|c||}{\bfseries beta} & \bfseries alfa \\
& beta & alfa & beta & alfa \\
alfa & beta & alfa & beta & alfa \\
alfa & beta & alfa & beta & alfa \\
\rowcolor{green!30} gamma & delta & gamma & delta & gamma \\
  • You can put multirow in the second row: ` & \bfseries beta & \multicolumn{2}{|c||}{\bfseries beta} & \bfseries alfa \\hhline{||~|:=::=::=::=:|} \multirow{-2}{*}{alfa}& beta & alfa & beta & alfa \\ ` so that the text doesn't get clipped. – user11232 Apr 10 '13 at 23:52
  • @HarishKumar, yes, much better in this way. But the multirow cell still have 3 colors. Too much for my taste! – Fran Apr 11 '13 at 0:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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