Graphics, Figures & Tablescolortbl | Problem with coloring Table

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Kirlian
Posts: 2
Joined: Mon Oct 03, 2011 3:13 pm

colortbl | Problem with coloring Table

Post by Kirlian »

Hi there.
i want to color the background of a table with the 'colortbl'-package. This is working in some way but i getting ugly white lines between the cells. This is very disturbing when you use multirows/columns.

My Code:

Code: Select all

\begin{table}[ht]
\begin{tabular*}{\textwidth}{|l c c c|}
\rowcolor{time_tbl_bg}
 & geplante Dauer & benötigte Dauer & Differenz\\
\rowcolor{time_tbl_bg}
\multirow{-2}{*}{Zeitaufwand:} & Xh & Xh & Xh\\
\end{tabular*}
\end{table}
Does somebody know how to get rid of this lines or a better way to color a table backgound?

Cheers Michael
Attachments
table-background.jpg
table-background.jpg (25.64 KiB) Viewed 4362 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

colortbl | Problem with coloring Table

Post by localghost »

It would be very kind if you mention when doing a crossposting [1]*. This is only fair because it prevents others from double efforts and waste of time.


* According to the rules you are obliged to do so.

[1] Tabelle einfärben mit 'colortbl' - mrunix.de


Thorsten
Kirlian
Posts: 2
Joined: Mon Oct 03, 2011 3:13 pm

Re: colortbl | Problem with coloring Table

Post by Kirlian »

Sorry, just wanted reach a greater audience. didnt know this 2 forums are connected.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10348
Joined: Mon Mar 10, 2008 9:44 pm

Re: colortbl | Problem with coloring Table

Post by Stefan Kottwitz »

Hi Kirlian,

the problem is not that users read in several forums. If would be worse if nobody would do it, resulting in users wasting time solving your problem in one forum where in the other forum already might be a solution.

Would you call 2 or 3 pizza services for having a greater chance of getting a pizza? Surely not, because their work is not free...

Many think, that it would be a problem if users visit several forums - just because they were caught doing hidden crosspostings! And they tell you. We visit several forums to be able to help more users.

Just put a link in each forum to the other posting and everything is better, also regarding sharing solutions.

Stefan
LaTeX.org admin
User avatar
Stefan Kottwitz
Site Admin
Posts: 10348
Joined: Mon Mar 10, 2008 9:44 pm

colortbl | Problem with coloring Table

Post by Stefan Kottwitz »

Hi Kirlian,

a workaround can be using \\[-1pt] and @{\hspace{...}} or similar, such as:

Code: Select all

\begin{table}[ht]
\begin{tabular*}{\textwidth}{|l@{\quad}c@{\quad}c@{\quad}c|}
\rowcolor{time_tbl_bg}
& geplante Dauer & benötigte Dauer & Differenz\\[-1pt]
\rowcolor{time_tbl_bg}
\multirow{-2}{*}{Zeitaufwand:} & Xh & Xh & Xh\\[-1pt]
\end{tabular*}
\end{table}
red colored rows
red colored rows
colortbl.png (9.61 KiB) Viewed 4353 times
If you think it's useful, please let also the other forum know.

Stefan
LaTeX.org admin
Post Reply