[Tex/LaTex] Table with rounded corners

examplestables

enter image description here

This table I can create with this code:

\begin{tabular}{|l|l|}
  \hline
  \multicolumn{2}{|c|}{Team sheet} \\
  \hline
  GK & Paul Robinson \\
  LB & Lucus Radebe \\
  DC & Michael Duberry \\
  DC & Dominic Matteo \\
  RB & Didier Domi \\
  MC & David Batty \\
  MC & Eirik Bakke \\
  MC & Jody Morris \\
  FW & Jamie McMaster \\
  ST & Alan Smith \\
  ST & Mark Viduka \\
  \hline
\end{tabular}

But is there a possibility to use rounded corners? I'm talking about the 4 main corners and not the corners of each cell.

Best Answer

You can use a TikZ node with inner sep=0pt that holds the table, and then draw a rectangle around it.

Update: You can enclose this TikZ/tabular construct in a table environment to add a table caption and label to it.

\documentclass{article}
\usepackage{tikz}
\usepackage[bf]{caption}

\begin{document}

\begin{table}
\caption{A table with rounded corners}
\centering
\begin{tikzpicture}
\node (table) [inner sep=0pt] {
\begin{tabular}{l|l}
  \multicolumn{2}{c}{Team sheet} \\
  \hline
  GK & Paul Robinson \\
  LB & Lucus Radebe \\
  DC & Michael Duberry \\
  DC & Dominic Matteo \\
  RB & Didier Domi \\
  MC & David Batty \\
  MC & Eirik Bakke \\
  MC & Jody Morris \\
  FW & Jamie McMaster \\
  ST & Alan Smith \\
  ST & Mark Viduka \\
\end{tabular}
};
\draw [rounded corners=.5em] (table.north west) rectangle (table.south east);
\end{tikzpicture}
\label{tab1}
\end{table}

Table~\ref{tab1} can be referenced like any other.
\end{document}

table with TikZ rounded corners, caption and label