Graphics, Figures & Tables ⇒ How to color a certain row in tabular* environment?
How to color a certain row in tabular* environment?
\begin{tabular*}{\textwidth}{@{\extracolsep{2cm plus 5cm minus 2cm}}lcl}
and for the rowcolor, I used:
\rowcolor[gray]{.95}
before each row that I needed colored. However the output is such that it appears that discrete cells are colored but there is space between the cells that is NOT colored. I believe the extracolsep is responsible for this, but I don't know how to take care of this. Any help you can provide would be most appreciated.
Thanks
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
How to color a certain row in tabular* environment?
Put this in preamble:
\usepackage[dvips]{color}
\usepackage{multicol}
\definecolor{Mygrey}{gray}{0.95}
Then put this statement above the line with the row contents that you want colored:
\makebox[0pt][l]{\fboxsep0pt\colorbox{Mygrey} {\strut\hspace*{\linewidth}}}
So, in my case, the relevant code looked like:
\makebox[0pt][l]{\fboxsep0pt\colorbox{Mygrey} {\strut\hspace*{\linewidth}}}
Deposit Money Bank Assets & $dkldby$ & 1.084$^{**}$ \\
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
How to color a certain row in tabular* environment?
Code: Select all
\usepackage[table]{xcolor}
Best regards
Thorsten¹
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10