i am writing on a LaTeX document. There are many tables in it. Now i
want to set the background color of some cells to green or red. Is
there any possibility to set the cell backgound??
Thanks!!
Regards,
Pet
you should use the usepackage "colorbtl"
as shown in the following.
You dont need the package "tabularx" better use "booktabs"
\documentclass{article}
\usepackage{tabularx,colortbl}
\begin{document}
\begin{tabularx}{120mm}{l|X} \hline
\rowcolor{red}column 1&column 2\\
row 1&row 1\\
row 2&row 2\\ \hline
\end{tabularx}
Thomas
Peter Jakobi schrieb:
Thomas referenced already \rowcolor.
There is also \columncolor to set the background of a single cell.
I often define
\newcolumntype{G}{>{\columncolor{lightgray}}}
to be able to use `G' as `grey' column specifier prefix in tabular preambles.
E.g., to write \begin{tabular}{lGll} to get a grey middle column.
Cheers,
Joachim
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Joachim Schrod Email: jsc...@acm.org
Roedermark, Germany
xcolor has a very handy feature that enhances colortbl with alternating
row colors:
\documentclass{article}
\usepackage{colortbl}
\usepackage[table]{xcolor}
\begin{document}
\rowcolors[]{1}{blue!20}{blue!0}
\begin{tabular}{ll}
\rowcolor{red!30}
\textbf{First name} & \textbf{Last name}\\
Els & Danie \\
Smith & John \\
Doe & John \\
Doe & Jane \\
\end{tabular}
\end{document}
Danie Els (dnjels at sun dot ac dot za)
>>i am writing on a LaTeX document. There are many tables in it. Now i
>>want to set the background color of some cells to green or red. Is
>>there any possibility to set the cell backgound??
>
>
> xcolor has a very handy feature that enhances colortbl with alternating
> row colors:
>
> \documentclass{article}
> \usepackage{colortbl}
this statement is not needed, xcolor loads colortbl anyway
in fact of the option [table]
> \usepackage[table]{xcolor}
Herbert
--
http://TeXnik.de/
http://PSTricks.tug.org/
ftp://ftp.dante.de/tex-archive/info/math/voss/mathmode/Mathmode.pdf
http://www.dante.de/faq/de-tex-faq/
http://www.tex.ac.uk/cgi-bin/texfaq2html?introduction=yes