Graphics, Figures & Tablescolortbl | Cell Color in a Table

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Ailicec
Posts: 18
Joined: Wed Jan 18, 2012 12:16 pm

colortbl | Cell Color in a Table

Post by Ailicec »

Hello. I am trying to fill a cell with color by the the colortbl package using the \cellcolor{gray} command but it is not working. I am managing to do \textcolor{gray} within the table, but the cell color is not working (nothing shows up).

This is the code I am using. I can see the 'Hello' in row 2 showing up as gray. But row 3 is not shaded gray.

Code: Select all

Code, edit and compile here:
\begin{table}[htbp]
\renewcommand
\caption{XXXX.}
\begin{tabular}{c c c c }
\toprule
1 & 2 & 3 & 4 \\
\midrule
Hello & \textcolor{gray}{Hello} & \cellcolor{gray} & Hello \\
Hello & \textcolor{gray}{Hello} & \cellcolor{gray} & Hello \\
\bottomrule
\end{tabular}%
\label{tab:}%
\end{table}%
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
I thank you in advance for your help. It would be greatly appreciated.

Cecilia
Last edited by localghost on Sat Jun 23, 2012 10:30 am, edited 1 time in total.

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

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

colortbl | Cell Color in a Table

Post by localghost »

For an adequate problem description and in order to avoid guesses and random shots please prepare a minimal example that contains all necessary but only relevant information in form of code.


Thorsten
Ailicec
Posts: 18
Joined: Wed Jan 18, 2012 12:16 pm

colortbl | Cell Color in a Table

Post by Ailicec »

I have now identified an incompatability between the mdwtab and xcolor packages (once I remove the mdwtab package the colour shows up), but I would like to know if there is a way around it

Code: Select all

Code, edit and compile here:
\documentclass[12pt, oneside, a4paper]{memoir}
\pagenumbering{arabic}
\usepackage{graphicx}
\usepackage{epsfig}
\usepackage{amsmath}
\usepackage[table]{xcolor}
\usepackage{mdwtab}
\begin{document}
\begin{table}[htbp]
\renewcommand
\caption{XXXX.}
\begin{tabular}{c c c c }
\toprule
1 & 2 & 3 & 4 \\
\midrule
Hello & \textcolor{gray}{Hello} & \cellcolor{gray} & Hello \\
Hello & \textcolor{gray}{Hello} & \cellcolor{gray} & Hello \\
\bottomrule
\end{tabular}%
\label{tab:}%
\end{table}%
\end{document}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Thank you
Post Reply