Possible Duplicate:
Color merged and regular cells in a table individually

I tried to color only a cell of my table but I don't know how do it. I found the method to color an entire row.How could I color only a cell of my table of a precise color?


2 Answers 2


Here is a minimal working example (MWE) showing how it can be obtained using xcolor's table option - this loads colortbl:

enter image description here

\usepackage[table]{xcolor}% http://ctan.org/pkg/xcolor
  Some & \cellcolor{blue!25}coloured & contents \\

The line choices in the above MWE emphasizes the tabular structure. However, for aesthetically pleasing table construction, consider using booktabs.

  • 67
    xcolor gave me an options clash. colortbl also provides the \cellcolor command, so I used that instead
    – craq
    Nov 7, 2014 at 9:02
  • 5
    This works but . . . I use it to highlight one cell. However, I have horizontal lines btw the rows and the color overwrites the line. I use "\hline" to write the line. If I could write the line after I write the color then all would be well, but it seems that "hline" has to be the first thing in the row, doesn't work if it is the last thing. Any suggestions?
    – Wayne
    Mar 8, 2016 at 13:06
  • 1
    @Wayne: Do you see this problem at all zoom levels? This problem is typically browser/viewer-related. I know that Adobe (Acrobat) Reader suffers from missing lines, while SumatraPDF doesn't really. The rendering algorithms are different and it doesn't have anything to do with LaTeX.
    – Werner
    Mar 8, 2016 at 15:13
  • Werner -- thanks for pointing that out. I have now checked, it is worst in the default PDF used by TextStudio for Mac. Best in Adobe Acrobat. Middling bad in Apple's Preview. I ended up changing the textcolor in the cell -- something that seems to work equally well in the three.
    – Wayne
    Mar 8, 2016 at 19:11
  • I'd like to use this feature with the numprint package, but the number expands without formatting when the color is introduced.. Is there a solution to this?
    – Charles
    Jul 29, 2016 at 15:26

Use the colortbl package and its macro \cellcolor{<color>}.

%% Set some local commands and colors
\newcommand{\done}{\cellcolor{teal}done}  %{0.9}
\newcommand{\hcyan}[1]{{\color{teal} #1}}
\done & other\\

Not the answer you're looking for? Browse other questions tagged .