2

Are there any decent alternatives to xcolor if I want to colour cells in a table? I want to highlight certain cells depending on my data, but not entire rows or columns.

I'm using Knitr and am having consistent problems with xcolor when I use the chunk option dev=tikz so would rather just avoid xcolor altogether.

Any suggestions appreciated.

dmt
  • 283
  • 1
    xcolor doesn't really colour tables, it just includes colortbl if you use the table option, so you can use colortbl and the standard color package (although I don't understand your comment about xcolor) – David Carlisle Jun 27 '14 at 08:45

1 Answers1

4

You don't have to use xcolor to color cells of a table. Just load the package colortbl.

\documentclass{article}

\usepackage{colortbl} %use in the preamble

\begin{document}

\begin{table}[h]
\begin{tabular}{|c|c|c|}\hline
H1           & H2       & H3 \\\hline
\cellcolor{red} I am colored & I am not & \cellcolor{green} I too am\\\hline
\end{tabular}
\end{table}

\end{document}
T. Verron
  • 13,552
theOne
  • 216