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.

Loading the xcolor package with the [table] option provides the command(s) \rowcolors(*) for alternate table row coloring. Any attempt, however, to use \hiderowcolors and \showrowcolors inside table rows within from LyX -- both in- and outisde a LyX table-float -- results in failing to compile a PDF. The error message is: Undefined control sequence.

It seems that there is no discussion/question upon this on either LyX-Users' mailing list or tex.stackexchange itself. It certainly is preferable to resolve this in a clean way, i.e. with a correct usage of the above mentioned commands.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

I suspect that you simply haven't left any space between the ERT containing \hiderowcolors/\showrowcolors, so that TeX reads the letter(s) after the command as part of the command. E.g. if you put \hiderowcolors at the start of a table cell, and then write text right after the ERT, without spaces, TeX will see the command \hiderowcolorstext, which is undefined.

Solution: Put a pair of empty braces after \hiderowcolors, within the ERT. (You could also add a space after the ERT, but that will lead to wrong alignment.)

enter image description here

share|improve this answer
    
I (remember that I) did try that! Will re-try ASAP. –  Nikos Alexandris Jun 27 '12 at 12:18
    
Grrr... it works! (...I really used a pair of empty braces... :-?) –  Nikos Alexandris Jun 27 '12 at 12:20
    
Wouldn't it be nice though to be able to instruct \rowcolors{no. of starting row}{no. of ending row}{1st color}{2nd color}? –  Nikos Alexandris Jun 27 '12 at 12:24
    
@NikosAlexandris You could always ask a new question about that (is it possible/how to do it). –  Torbjørn T. Jun 27 '12 at 12:29
    
I think this could be seen as an enhancement request to xcolor... So it'd better be directed to xcolor directly. This is why I did not already asked for that. –  Nikos Alexandris Jun 27 '12 at 12:37
add comment

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.