3

I found out how to color table cells/columns/rows thanks to the answers here and here.

I followed the examples in the documentation. In the preamble, I put:

\usepackage{colortbl}
\definecolor{lightgray}{gray}{0.9}

And at the beginning of the row, I put a TeX box with:

\rowcolor{lightgray}

It does work, i.e. the table is generated with the desired color, but LyX always displays a bunch of "Misplaced \noalign" errors.

3

Solution 1

In my case, the problem was that the "row" I wanted to color was a multicolumn row, so it wasn't actually a real "row" anymore, but only one big, single cell.

Thus, I needed to use \cellcolor{lightgray} instead of \rowcolor{lightgray}.

Solution 2

This problem also occurs when you accidentally format the ERT / TeX code, for example by making it bold like this:

enter image description here

Select the whole ERT (not just the contents, but the whole red box). Remove the formatting, for example by pressing Ctrl+B, so it looks like this again:

enter image description here

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.