Graphics, Figures & TablesRow color error

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
workerbee
Posts: 43
Joined: Sat Nov 22, 2008 1:53 am

Row color error

Post by workerbee »

Hi All,

So I was creating a table where the contents of the column are aligned by their decimals and then I wanted to highlight a row. Unfortunately, when I "highlight" with the \rowcolor option, I end up losing a part of the entry.

Attached is a screen capture of what happened (the left "0" ends up looking like a left parenthesis).

Here's part of the code I'm using:

Code: Select all

\usepackage{colortbl}
.
.
.
\begin{tabular}[t]{| l | r@{.}l r@{.}l r@{.}l | r@{.}l r@{.}l r@{.}l |}
.
.
.
stubborn & \textbf{0}&\textbf{815*} & -0&046 & 0&011 & \textbf{0}&\textbf{880*} & 0&031 & -0&217 \\
breaks rules & 0&467* & 0&343* & 0&013 & \textbf{0}&\textbf{756*} & 0&064 & -0&166 \\
\rowcolor[gray]{.85}\color{black}harms others \& property & -0&007 & \textbf{0}&\textbf{628*} & 0&307* & 0&448* & 0&025 & 0&359 \\
.
.
.
*I don't know if the entire code for the table is needed here since it pretty much follows what's there with different numbers and labels.
Attachments
Odd result with \rowcolor
Odd result with \rowcolor
rowcolor.jpg (36.46 KiB) Viewed 8588 times

Recommended reading 2024:

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

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

walleeva
Posts: 1
Joined: Mon Apr 12, 2010 7:14 am

Re: Row color error

Post by walleeva »

hello I have the same problem, just wonder have you got the solution yet? Many thanks. I'm a newbie to LaTex
workerbee
Posts: 43
Joined: Sat Nov 22, 2008 1:53 am

Re: Row color error

Post by workerbee »

Sorry for the long wait in my reply. No, I don't believe I found a solution for this. I think we ended up bolding the left column entry to indicate the rows which would have been highlighted.
User avatar
shadgrind
Posts: 140
Joined: Thu Jul 16, 2009 12:39 am

Row color error

Post by shadgrind »

Use the dcolumn package:

Code: Select all

\documentclass{article}
\usepackage{colortbl}
\usepackage{dcolumn}
\newcolumntype{.}{D{.}{.}{-1}}
\begin{document}
\begin{center}
\begin{tabular}[t]{| l | . . . | . . . |}
stubborn & \textbf{0}.\textbf{815*} & -0.046 & 0.011 & \textbf{0}.\textbf{880*} & 0.031 & -0.217\\
breaks rules & 0.467* & 0.343* & 0.013 & \textbf{0}.\textbf{756*} & 0.064 & -0.166\\
\rowcolor[gray]{.85}\color{black}harms others \& property & -0.007 & \textbf{0}.\textbf{628*} & 0.307* & 0.448* & 0.025 & 0.359\\
\end{tabular}
\end{center}
\end{document}
System: TeX Live 2012, Fedora 18 x86_64, GNU Emacs 24.2
pisoir
Posts: 8
Joined: Thu Aug 06, 2009 4:10 pm

Re: Row color error

Post by pisoir »

I have exactly the same problem. I believe there is a bug in the colortbl package. Until someone doesn't fix the bug in the package, all other solutions are not good.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Row color error

Post by localghost »

pisoir wrote:[…] I believe there is a bug in the colortbl package. Until someone doesn't fix the bug in the package, all other solutions are not good.
If you think so, you should send a bug report to the maintainer of the package. It is very unlikely that he reads this thread or that someone else fixes the supposed bug.


Thorsten
fharteaga
Posts: 1
Joined: Thu Jul 25, 2013 6:35 pm

Re: Row color error

Post by fharteaga »

Any solution yet?
Post Reply