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.

I have a multi-row table in LyX, with black horizontal borders at the top and bottom of the table. I would like to insert other horizontal borders inside the table that are grey rather than black. Does anyone know how to accomplish this?

I have tried looking in the manuals and online forums to no avail so far.

share|improve this question
    
Welcome to TeX.SX. Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Accepting and upvoting answers is the preferred way here to say "thank you" to users who helped you. –  Claudio Fiandrino Apr 25 '13 at 17:43
2  
you can load colortbl then use the \arrayrulecolor command. –  David Carlisle Apr 25 '13 at 17:50
add comment

1 Answer 1

up vote 4 down vote accepted

This is a workaround since LyX does not support the package colortbl at the moment. Please check below steps carefully!

  1. Add \usepackage{colortbl} to the LaTeX Preamble (under "Document > Settings").

  2. Coloring the top rule

    To color the top rule in "blue" put the TeX code/ERT \arrayrulecolor{blue}\hline at the beginning of the first table cell. (If the colored rule did not completely cover original rule you needed to remove the top rule in the LyX table editor.)

  3. Coloring another horizontal rule

    To color a rule below a certain table row in "red" put \tabularnewline\arrayrulecolor{red}% at the end of the last cell of that row.

    Please check the result by using "View Source". The trick is that by using % we make the remaining line a comment. Everything that we make a comment (that is, comes after the %) must be repeated by us in front of \arrayrulecolor.

    For example, if a concerned line ends with \tabularnewline, we will put exactly this in front of \arrayrulecolor, that is, we write \tabularnewline[4ex]\arrayrulecolor{red}%. Or, if the line ends with \tabularnewline[4ex] then we have to put the TeX code \tabularnewline[4ex]\arrayrulecolor{red}%.

  4. Finally, we might want to reset the color to "black" as describe in previous case.

Following all above steps we get a table like this: LyX colortbl

The output is:

PDF output

Note that you can close a TeX code inset by right click "Close Inset": enter image description here

share|improve this answer
    
Nice and creative solution. –  scottkosty Apr 26 '13 at 0:50
    
Great - so easy! –  galen Apr 28 '13 at 17:36
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.