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.

Possible Duplicate:
Color entire table

How can I color the background of a tabular environment?

\documentclass{scrartcl}
\usepackage[ngerman]{babel}
\usepackage{color}

\begin{document}

\mbox{}\hfill\begin{tabular}{|lp{10cm}|}
\hline
\multicolumn{2}{|c|}{\textbf{Test}}\\
\hline
Test: & Test\\
Test: & Test\\
\hline
\end{tabular}\hfill\mbox{}

\end{document}
share|improve this question

marked as duplicate by Ignasi, Andrew Swann, lockstep, Kurt, Thorsten Dec 12 '12 at 16:08

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1  
Welcome to TeX.sx!. Check this related question –  texenthusiast Dec 12 '12 at 14:53
    
I think you will find the answer in Color entire table. If not, please, explain it better. –  Ignasi Dec 12 '12 at 14:58

1 Answer 1

up vote 3 down vote accepted

Xcolor

Try xcolor You can even set alternating colors

\documentclass[table]{scrartcl}
\usepackage[ngerman]{babel}
\usepackage{xcolor}

\begin{document}
\colorbox{red}{
 \begin{tabular}{|lp{10cm}|}
  \hline
  \multicolumn{2}{|c|}{\textbf{Test}}\\
  \hline
   Test: & Test\\
   Test: & Test\\
  \hline
 \end{tabular}
 }

\rowcolors*{1}{red}{red}
\begin{tabular}{|lp{10cm}|}
\hline
\multicolumn{2}{|c|}{\textbf{Test}}\\
\hline
Test: & Test\\
Test: & Test\\
\hline
\end{tabular}

\end{document}

enter image description here

(Just for my sake i'd like to say that typographically spoken vertical rules are odd. Avoid them. And i stripped \mbox{}.. cause i can't see the purpose. )

Tabu

The tabu Package provides you with some more convenient commands

\documentclass[table]{scrartcl}
\usepackage{xcolor}
\usepackage{tabu}

\begin{document}




\taburowcolors [1] 7 {green .. brown}

\begin{tabu}{|lp{10cm}|}
\hline
\multicolumn{2}{|c|}{\textbf{Test}}\\
\hline
Test: & Test\\
Test: & Test\\
Test: & Test\\
Test: & Test\\
Test: & Test\\
Test: & Test\\
\hline
\end{tabu}


\end{document}

enter image description here

share|improve this answer
    
I get the error: "LaTeX Error: File `colortbl.sty' not found." –  guest Dec 12 '12 at 15:04
    
Ok, I guess the [table] option belongs to xcolor. –  guest Dec 12 '12 at 15:07

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