GeneralHow to shade the background of a table + caption

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
bar_ba_dos
Posts: 3
Joined: Fri Feb 23, 2007 1:23 pm

How to shade the background of a table + caption

Post by bar_ba_dos »

Hi guys,

I would like to set the background of a table and its accompanying caption with a grey color. I have tried many things (shadbox,colorbox) without success. The table is defined on a twocolumn document and has the following form:

Code: Select all

\begin{table}[h]
\centering
\begin{tabular}{...}
....
\end{tabular}
\caption{...}
\end{table}
Any help on this problem is appreciated.

Cheers,
Bar_ba_dos.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Kris
Posts: 56
Joined: Sun Jan 14, 2007 4:04 pm

How to shade the background of a table + caption

Post by Kris »

Hi bar_ba_dos!

here some tricky code for that ;)

Code: Select all

\documentclass{article}
\usepackage[table]{xcolor}
\begin{document}
\begin{table}[h]
\centering
\colorbox{gray!20}{
\begin{minipage}{.5\textwidth}
 \centering
 \begin{tabular}{ccc}
   test & test & test\\
   test & test & test
   \end{tabular}
	\caption{testcaption}
\end{minipage}}
\end{table}
\end{document}
Regards
Kris
Post Reply