# Highlighting a row in a table

I need to highlight rows 3rd and 5th in the following table. I the package xcolor with the optional argument table, but it doesn't work. And gives me an error.

\begin{table}[h]
\centering

\resizebox{0.8\textwidth}{!}{\begin{minipage}{\textwidth}
\caption{\textbf{State Table for Example 1}}
\label{table: state table1}

\hfil % This is new
\begin{tabular}{cc|cc}
x & y & X & Y \\
\hline
$\bar{0}$  & $\bar{0}$ & 1 &1 \\
\rowcolor{blue}[0.9] 0  & 1 & 0 &1 \\
$\bar{1}$  & $\bar{1}$ & 0 & 0 \\
\rowcolor{blue}[0.9] 1  & 0 & 1 &0 \\
\end{tabular}
\end{minipage}}

\end{table}

\end{document}


For example:

\documentclass{article}

\usepackage{graphicx}
\usepackage[table]{xcolor}

\begin{document}

\begin{table}[h]
\centering

\resizebox{0.8\textwidth}{!}{\begin{minipage}{\textwidth}
\caption{\textbf{State Table for Example 1}}
\label{table: state table1}

\hfil % This is new
\begin{tabular}{cc|cc}
x & y & X & Y \\
\hline
$\bar{0}$  & $\bar{0}$ & 1 &1 \\
\rowcolor{blue} 0  & 1 & 0 &1 \\
$\bar{1}$  & $\bar{1}$ & 0 & 0 \\
\rowcolor{blue!30} 1  & 0 & 1 &0 \\
\end{tabular}
\end{minipage}}

\end{table}

\end{document}


The second of blue rows is lighter, to show, how to obtain it.

• I do it, and got this error: ! LaTeX Error: Option clash for package xcolor. – Maryam Jun 16 '14 at 3:59
• @Maryam This error was on my example or some of its inclusion into your file? An error suggests that an option (probably table) is used in some other place. – Przemysław Scherwentke Jun 16 '14 at 4:03
• @ Przemysław I copied your codes, and added that package, then got the error – Maryam Jun 16 '14 at 4:05
• @Maryam And what packages have you got in your preamble? – Przemysław Scherwentke Jun 16 '14 at 4:08
• Thanks, I found the problem. That's here: tex.stackexchange.com/questions/51488/… – Maryam Jun 16 '14 at 4:09
\documentclass{article}
\usepackage{graphicx}
\usepackage{colortbl}
\begin{document}

\begin{tabular}{cc|cc}
x & y & X & Y \\
\hline
$\bar{0}$  & $\bar{0}$ & 1 &1 \\
\rowcolor[gray]{.9} 0  & 1 & 0 &1 \\
$\bar{1}$  & $\bar{1}$ & 0 & 0 \\
\rowcolor[gray]{.5} 1  & 0 & 1 &0 \\
\end{tabular}

\end{document}