# Table Frames beyond simple lines

Is there a possibility to create frames for tabulars, that go beyond a simple line?

\begin{tabular}{|l|l|}
\hline
A & B\\
\hline
C & D\\
\hline
\end{tabular}


creates lines as a "frame", but these are indistinguishable from the lines that separate the rows and columns. I would like to have, for example thick lines for the frame. Or double lines that look good and not like the one I create like this

\begin{tabular}{||l|l||}
\hline \hline
A & B\\
\hline
C & D\\
\hline \hline
\end{tabular}


Any ideas?

-

Perhaps tikz can help here

Of course, because it's tikz, you can get much more adventurous with your affects if you want to.

\documentclass{article}

\usepackage{tikz}

\begin{document}

\tikz\node[draw=red,thick,double,inner sep=1pt]{
\begin{tabular}{l|l}
A & B\\
\hline
C & D\\
\end{tabular}};

\end{document}


If you'd like to apply the idea to every tabular, then you could use the etoolbox, perhaps something like the following- note the gradient shading :)

\documentclass{article}

\usepackage{tikz}
\usepackage{etoolbox}

\BeforeBeginEnvironment{tabular}{\tikzpicture\node[draw=red,thick,double,inner sep=1pt,top color=blue,bottom color=yellow]\bgroup}
\AfterEndEnvironment{tabular}{\egroup;\endtikzpicture}

\begin{document}

\begin{tabular}{l|l}
A & B\\
\hline
C & D\\
\end{tabular}

\end{document}


Perhaps you'd like rounded corners

\BeforeBeginEnvironment{tabular}{\tikzpicture\node[rounded corners=3pt,draw=red,thick,double,inner sep=1pt,top color=blue,bottom color=yellow]\bgroup}


You could even go completely crazy and surround the tabular in a circle or a star, but I'll leave that up to you :)

The possibilities are limited only by imagination- have fun, and check out the manual for more ideas and options.

-
Thanks, I got some nice frames from your examples. Although I dont think, that I need color at all in my tables! ;) –  Haatschii Nov 26 '12 at 3:07
@Haatschii you're very welcome :) glad it helped! –  cmhughes Nov 26 '12 at 3:14
With inner sep=.3pt+\pgflinewidth, .3pt being the half of double distance (initially .6pt), the outer lines just touch tabular's lines instead of drawing over them. –  Qrrbrbirlbel Nov 26 '12 at 3:30

You could be interested in the features provided by the tabu package: a simple example:

\documentclass{article}
\usepackage{xcolor}
\usepackage{tabu}

\begin{document}

{\arrayrulewidth=3pt
\begin {tabu}{|[5pt cyan!60!black]c|[5pt red!60!black] c|[5pt cyan!60!black]}
\taburulecolor{orange}
\hline
A & B \\
\hline
C & D \\
\hline
\end {tabu}
}

\end{document}


-
Not everything that can be done, should be done. –  Aditya Nov 26 '12 at 2:09
@Aditya wise words, indeed! –  Gonzalo Medina Nov 26 '12 at 2:14
I think this will work as well, maybe even more elegant. But I just completed it using cmhughes approach. Thanks nevertheless! –  Haatschii Nov 26 '12 at 3:05

Besides the TikZ solution where you can create very interesting  tables, there is the hhline package which is suited for just  tables.

## Code

\documentclass{article}
\usepackage{hhline}
\begin{document}
\begin{tabular}{||l|l||}
\hhline{#==#}
A & B \\ \hhline{|--|}
C & D \\ \hhline{#==#}
\end{tabular}

\begin{tabular}{||l|l||}
\hhline{|t:==:t|}
A & B \\ \hhline{||--||}
C & D \\ \hhline{|b:==:b|}
\end{tabular}
\end{document}


## Output

-

Have a look at the booktabs package on some guidelines for creating good looking tables. In general, it is not a good idea to use vertical lines in tables. The booktabs package also provides \toprule, \midrule and \bottomrule commands for rules of different thickness.

\documentclass[margin=3mm]{standalone}

\usepackage{booktabs}

\begin{document}
\begin{tabular}{ll}
\toprule
A & B \\
\midrule
C & D \\
E & F \\
\bottomrule
\end{tabular}
\end{document}


-
I know booktabs and use it most of the time. However in this case I am creating some kind of form sheet, that has to be filled out in printed form by other people. So I really want the vertical lines to make clear where to write. I don't think booktabs helps here. –  Haatschii Nov 26 '12 at 3:00