Hello, I would like to ask for some help. When I create a table with background color some horizontal lines disappears. I'm using \usepackage[table,xcdraw]{xcolor}.
Example in attachement.
If needed I can upload source code.
Example:
2 & \cellcolor[HTML]{3166FF}2. ORANGE & 2. GREEN & 2. GREEN & \cellcolor[HTML]{FFC702}2. ORANGE & 2 \\ \hline
Thank you for help.
PS Sorry for my English.
Graphics, Figures & Tables ⇒ Table with background color
Table with background color
- Attachments
-
- table.png (66.72 KiB) Viewed 20328 times
NEW: TikZ book now 40% off at Amazon.com for a short time.

- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
Table with background color
Hi,
welcome to the forum!
Yes, please upload the source code as a minimal compilable example, so we can test it. We don't see the table column settings and other commands, maybe you use
As a remark: such grid tables are very bad to read. Some people think that tables must look like Excel tables, but even in Excel the grid is for inputting data, not for printing and reading. Such boxed cells are bad for reading. A very good style is using no blocking lines at all, maybe only a few horizontal lines below and above and separating the header. But no vertical lines if the reading flow is horizontal.
A table sample showing what I mean by using few lines:
Or a slightly colored table:
BUT WRITING ALL IN CAPITAL LETTERS, AS I'M DOING NOW, IS ALSO HARDLY READABLE AND NOT SEEN IN GOOD BOOKS OR TABLES.
Stefan
welcome to the forum!
Yes, please upload the source code as a minimal compilable example, so we can test it. We don't see the table column settings and other commands, maybe you use
\cline
which could cause this, in contrast to \hline
normally.As a remark: such grid tables are very bad to read. Some people think that tables must look like Excel tables, but even in Excel the grid is for inputting data, not for printing and reading. Such boxed cells are bad for reading. A very good style is using no blocking lines at all, maybe only a few horizontal lines below and above and separating the header. But no vertical lines if the reading flow is horizontal.
A table sample showing what I mean by using few lines:
Code: Select all
Code, edit and compile here:
% Stefan Kottwitz, LaTeX Cookbook, Packt Publishing, 2015% Chapter 5, Designing Tables% Merging cells\documentclass{article}\usepackage{array}\usepackage{booktabs}\usepackage{metalogo}\renewcommand{\arraystretch}{1.6}\begin{document}\begin{tabular}{@{}p{1.5cm}p{1.6cm}>{\raggedleft}p{1cm}>{\raggedright}p{1.6cm}r@{}}Compiler & \multicolumn{2}{c}{Input}& \multicolumn{2}{c}{Output} \\\cmidrule(r){1-1}\cmidrule(lr){2-3}\cmidrule(l){4-5}& Encoding & Images & Fonts & Format \\\cmidrule(lr){2-2}\cmidrule(lr){3-3}\cmidrule(lr){4-4}\cmidrule(l){5-5}\LaTeX & utf8, ascii, applemac, latin1, \ldots& EPS & Type 1, Type 3 & DVI \\pdf\LaTeX & utf8, ascii, applemac, latin1, \ldots& PDF PNG JPG & Type 1, Type 3 & PDF \\\XeLaTeX, \LuaLaTeX & utf8& PDF PNG JPG & Type 1, Type 3,OpenType, Graphite, TrueType & PDF \\\end{tabular}\end{document}
Code: Select all
Code, edit and compile here:
% Stefan Kottwitz, LaTeX Cookbook, Packt Publishing, 2015% Chapter 5, Designing Tables% Coloring a table\documentclass{article}\usepackage[table]{xcolor}\rowcolors{2}{gray!15}{white}\newcommand{\head}[1]{%\textcolor{white}{\textbf{#1}}}\renewcommand{\arraystretch}{1.5}\pagestyle{empty}\begin{document}\begin{table}[ht]\centering\sffamily\begin{tabular}{rlr}\rowcolor{black!75}& \head{Distribution} & \head{Hits} \\1 & Mint & 2364 \\2 & Ubuntu & 1838 \\3 & Debian & 1582 \\4 & openSUSE & 1334 \\5 & Fedora & 1262 \\6 & Mageia & 1219 \\7 & CentOS & 1171 \\8 & Arch & 1040 \\9 & elementary & 899 \\10 & Zorin & 851 \\\end{tabular}\end{table}\end{document}

Stefan
LaTeX.org admin
Re: Table with background color
Thank you for reply.
I've already solved this problem.
Horizontal lines are not showing only on monitor. When I print the table everything is OK.
I've already solved this problem.
Horizontal lines are not showing only on monitor. When I print the table everything is OK.
