LaTeX forum ⇒ Graphics, Figures & TablesLine on top cells Topic is solved

Information and discussion about graphics, figures & tables in LaTeX documents.
bstex
Posts: 27
Joined: Mon Oct 23, 2017 10:22 am

Line on top cells

Postby bstex » Sat Nov 04, 2017 6:11 pm

Hi,
I have made this table:
Screen Shot 2017-11-04 at 18.10.10.png
Screen Shot 2017-11-04 at 18.10.10.png (54.28 KiB) Viewed 161 times

with this code:
  1. \documentclass[11pt,a4paper]{book}
  2.  
  3. \usepackage[table]{xcolor}
  4.  
  5. \begin{document}
  6.  
  7. \begin{table}
  8. \centering\arrayrulecolor{black}
  9. \begin{tabular}{l|ccccc|}
  10. \cline{2-6}
  11. \rowcolor{red}\multicolumn{1}{c|}{\cellcolor{white}A} & B & C & D & E & F \\ \hline
  12. \multicolumn{1}{|l|}{G} & H & I & J & K & L \\ \hline
  13. \multicolumn{1}{|l|}{M} & N & O & P & Q & R \\ \hline
  14. \multicolumn{1}{|l|}{S} & T & U & V & W & X \\ \hline
  15. \end{tabular}
  16. \end{table}
  17.  
  18. \end{document}


but the cline on the top of the table is not visible?
How can I make it visible?
Thank you.

User avatar
Stefan Kottwitz
Site Admin
Posts: 8522
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Sat Nov 04, 2017 6:56 pm

This shifts the line a bit up to make it visible:

\cline{2-6}\noalign{\vskip.3pt}

Stefan
Site admin

bstex
Posts: 27
Joined: Mon Oct 23, 2017 10:22 am

Postby bstex » Sun Nov 05, 2017 4:30 pm

I still can't believe that I had to MOVE the line just to make it be seen.
Come on, LaTeX does billion of things, it cannot make a line to be seen over a colorful cell? :shock:
Thank you very much for the solution, Stefan. ;)

User avatar
Johannes_B
Site Moderator
Posts: 3582
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Sun Nov 05, 2017 5:03 pm

The line is drawn first, the colour added on top of it.

Something many users trip over.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

bstex
Posts: 27
Joined: Mon Oct 23, 2017 10:22 am

Postby bstex » Mon Nov 06, 2017 1:01 pm

I'm fine with the solution you provided, Stefan and thank you again.
I just want to add this:
I was trying to manage making the cline be seen with transparent colors, but I couldn't make it. I thought that if the background of the red cells was transparent, maybe the cline would be visible.
Is it possible?

User avatar
Stefan Kottwitz
Site Admin
Posts: 8522
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Mon Nov 06, 2017 3:48 pm

I think the normal color support does not work with transparency. But TikZ does. So one could create a table using TikZ, with transparent colors, see here for example:


TikZ can be used with layers. So it is possible, to have all table lines on the foreground layer, and the color filling on the background layer.

Stefan
Site admin

bstex
Posts: 27
Joined: Mon Oct 23, 2017 10:22 am

Postby bstex » Mon Nov 06, 2017 3:54 pm

Cool. I'll play with it and post if I find a solution.
Thank you.


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 4 guests