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.

The title speaks for itself - how do I choose a background color for table cells in LyX?

share|improve this question
    
This isn't nearly as easy as you think it is. Short answer is that there is no easy way to do this in LyX. –  Seamus Apr 6 '11 at 14:58

2 Answers 2

up vote 5 down vote accepted

Please check out the (excellent!) Embedded Objects manual that comes with Lyx (directly available from the Help menu). Section 2.11 describes in detail how to color tables, table cells, and cell backgrounds.

As Martin has already pointed out, the solution is based on colortbl:

Lyx Screen Shot

which leads to this PDF output:

enter image description here

share|improve this answer
    
@Icoo it's a shame to choose one of your answers as Icoo gave the correct explanation and Daniel gave a great example. Would you consider merging your answers? –  Amir Rachum Jun 6 '11 at 12:25
    
@Amir Rachum: Merging answers is not possible and it is quite common that a question triggers more than one good answer. Just accept the one that has been most helpful for you. Having to choose is both, fate and fortune, of the questioner :-) –  Daniel Jun 6 '11 at 14:42
    
I'm well aware of the capabilities of SE, I was merely suggesting one of you editing the other's answer into his. Nevermind, thanks! –  Amir Rachum Jun 6 '11 at 18:16
    
@Amir Rachum: Ah, I see. However, simply editing Martin's answer (which is good "as is", there is no point in changing much) into mine would feel a bit like cheating on him. –  Daniel Jun 6 '11 at 21:15

I found this. Maybe it can help. It seems it's what you are looking for:

http://wiki.lyx.org/LyX/Tables#toc7

To create colored tables, we need the LaTeX-package colortbl, that is loaded in the preamble with the line

\usepackage{colortbl}

The color of a column is adjusted with the command

\columncolor{name of color}

inside the command >{ }. The following color names are predefined:

red, green, yellow, blue, cyan, magenta, black and white

We also define our own color with the command

\definecolor{color name}{color model}{color values}

The color model can be

cmyk: cyan magenta yellow black

rgb: red, green blue

gray

and the color values are comma separated numbers between 0 and 1 describing the factor for the corresponding color of the color model.

We can e.g. define the color "darkgreen" in the preamble with

\definecolor{darkgreen}{cmyk}{0.5, 0, 1, 0.5}
share|improve this answer
    
Could you add the relevant information from the link you provided? We like answers here to be self contained. –  Seamus Apr 6 '11 at 16:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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