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 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.

share|improve this question
    
have a look at Example of fancy table using TikZ package –  cmhughes Apr 13 '13 at 22:33

1 Answer 1

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

\documentclass{article}
\usepackage[table]{xcolor}
\usepackage{hhline}
\usepackage{multirow}
\begin{document}
\arrayrulecolor{black} 
\doublerulesepcolor{gray!40} 
\begin{tabular}{||>{\columncolor[gray]{0.9}\bfseries}c||c||c||c||c||}
\hhline{|t:=:t:=:t:=:t:=:t:=:t|}
\rowcolor{red!30}
\multirow{2}{*}{alfa} & \bfseries beta & \multicolumn{2}{|c||}{\bfseries beta} & \bfseries alfa \\
\hhline{||~|:=::=::=::=:|}
& beta & alfa & beta & alfa \\
\hhline{|:=::=::=::=::=:|}
alfa & beta & alfa & beta & alfa \\
\hhline{|:=::=::=::=::=:|}
alfa & beta & alfa & beta & alfa \\
\hhline{|:=::=::=::=::=:|}
\rowcolor{green!30} gamma & delta & gamma & delta & gamma \\
\hhline{|b:=:b:=:b:=:b:=:b:=:b|}
\end{tabular}
\end{document}
share|improve this answer
    
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. –  Harish Kumar 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

 
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.