12 Comments

  1. Hi, Can the the xcolor package be used for completely coloring the table in one color – something like this table: http://www.iom.edu/Reports/2011/Breast-Cancer-and-the-Environment-A-Life-Course-Approach/~/media/Files/Report%20Files/2011/Breast-Cancer-Environment/BC_tableforweb.jpg I am trying to replicate that table design for my report. The colortbl has a pretty limited palette. Do you have any pointers on how to replicate that table design? Thanks!

    • You can always define your own color and use it to color columns. Here is an example:

      \documentclass[11pt]{article}
      \usepackage{colortbl}
      \begin{document}
      \definecolor{lightblue}{rgb}{0.53,0.8,0.98}
      \newcolumntype{C}{>{\columncolor{lightblue}}c}
      \begin{table}[ht]
      \caption{default}
      \begin{center}
      \begin{tabular}{|C|C|}
      \hline
      a&a\\
      b&b\\
      \hline
      \end{tabular}
      \end{center}
      \label{default}
      \end{table}
      \end{document}

      Have a look at this article.

      Cheers, Tom.

  2. Christiaan Pauw

    Sometimes the last row contains totals etc. and one does not want to color that but separate it with a libne from the rest of the table: How is that done?

    • Hi Christiaan,

      You could always overwrite the color using \rowcolor on the last row.

      \documentclass[11pt]{article}
      \usepackage[table]{xcolor}
      \definecolor{lightgray}{gray}{0.9}
      \begin{document}
      \begin{table}[ht]
      \caption{Current month expenses}
      \begin{center}
      \rowcolors{1}{}{lightgray}
      \begin{tabular}{lr}
      	\hline
      	Expenses & Amount\\
      	\hline
      	Movies & 20 \\
      	Shopping & 50 \\
      	Groceries & 80 \\
      	Other & 50 \\
      	\hline\hline
      	\rowcolor{white}
      	Total&200\\\hline
      \end{tabular}
      \end{center}
      \end{table}
      \end{document}
  3. S.Karim

    Hi tom,,,
    how can we define the width of \hline ? mean bold etc,
    secondly, if we to produce a dotted line (……..) or (_ _ _ _ _), etc, can this be done via \hline command???
    thanks.

  4. Julien Gamba

    Hi, thanks for your article. I think there is a typo in the addendum, don’t you want to load the xcolor package instead of color? The color package does not have a table option. It works well with the xcolor package though.

Leave a Reply to Nikos AlexandrisCancel reply