I've got a multirow cell and I need to make it all have one background colour, but I'm having trouble achieving this. I've defined my color (lightgreen) in the preamble, but don' know how to apply it to the multirow. So, in LyX I've got this Tex Code:


Then of course I've got my text, which isn't in a Tex Code block, following by


I've tried putting \cellcolor{lightgreen} in various places with mixed results, but usually it only colours the top row of the multirow.

I realise that there are a few similar questions to this on here, but they are all written in LaTeX directly, rather than in LyX. I don't know LaTeX really and don't really have time to learn it fully right now, so any help getting this to work in LyX would be greatly appreciated!

  • I think you can find here what you are looking for. tex.stackexchange.com/questions/13971/… – gcedo Apr 21 '12 at 8:28
  • 1
    Have you tried something like this (using \cellcolor in every row and placing the \multirow command in the last row with a negative first argument)? \begin{tabular}{ll} \cellcolor{red} & text \\cellcolor{red}& text \\cellcolor{red}\multirow{-3}{2.5cm}{text}& text \end{tabular} (sorry, but code format gets lost in the comments). – Gonzalo Medina Apr 21 '12 at 13:46
  • @GonzaloMedina Using your idea I got it working in LyX. Do you want to add an answer, or should I do it, also explaining how to implement it with LyX? – Torbjørn T. Apr 21 '12 at 17:28
  • @TorbjørnT. Please add the answer (I have no idea how to implement my solution using LyX). – Gonzalo Medina Apr 21 '12 at 22:52

The method suggested by Gonzalo Medina in a comment works also in LyX.

Having created your table, add an ERT (TeX code box, with Ctrl + L) and type \cellcolor{LightGreen} in the first cell that your multirow should cover. Copy this ERT to the rest of the cells, and in the bottom one, write \multirow{-8}{2.5cm}{<your text>} after the \cellcolor. Note the negative number in the first argument.

In addition, you have to remove the lines above/below the cells that are part of the multirow with the buttons on the toolbar:

enter image description here

If not, the lines will be above the colored area.

LyX and PDF-view (click to enlarge): enter image description here

A final note (you are probably aware of this):

Unless the multirow feature in LyX has been used elsewhere, you have to add that package to the preamble, in Document --> Settings --> LaTeX preamble. The xcolor package with the table option must be loaded to be able to color the cells:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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