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

\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}%
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.

User avatar
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


\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}

Thank you
Post Reply