14 Comments

  1. Thanks for those tips! This is exactly the problem I struggled with in the last two week. Too bad the submission deadline for my documentation was last friday; but thanks to your post, I can handle this issue it in the future 🙂

    • tom

      Hi Christophe,

      Thanks for your comment, I completely agree. However, when I mentioned Apple all I had in mind was alternate coloring of rows. This simple trick increases the readability of a tables which is ultimately what the post is about. I could have been more clear on that point.
      Thanks for the link, really cool animation…

      Tom

  2. I’m definitely looking for a way to colour rows not alternatively like here above, but once every nth rows (like I can do in MS Excel…), but automatically, like for even and odd row colours. Would somebody know how this is feasible?

    • tom

      Coloring every even and odd row with a different color can be done as shown here. For a different pattern, you would probably have to do it manually.

      Cheers, Tom.

  3. Raphael

    Hi Tom, this is an excellent post and helped me already a lot. The only problem I am struggling with and on which I did not find a solution yet is the text alignment of the multirow cells. I don’t want the text to be aligned in the center of the multirow cells but at the top. Do you have any suggestions on that?

    Thanks and best regards,
    Raphael

    • tom

      Hi Raphael,

      Could you just place the content in the top cell then? Would that be a problem? Please provide a minimal working example.

      Thanks, Tom

    • tom

      Hi Alex,

      Thanks for your question and the link to the example. Given the table, there are several issues that arise when trying to color alternate rows as shown in the post above. For more complex tables, it may sometimes be easier to manually color individual rows and additional cells.

      Cheers, Tom

  4. Hani

    Hi Tom,

    Thanks a lot for your technique. I’ve been struggling with it lately and your post helped me a lot. Just one question, how can I color two consecutive rows and still have the solid border line between? When you color them the border line is gone (\hline is still present in the latex code but it doesn’t show up in the table!)

    Thanks,
    Hani

    • tom

      Hi Hani,

      Thanks for your question. In the minimal example below, the line between two colored rows is visible. Please provide a similar example that illustrates your problem.

      Thanks, Tom.

      \documentclass[border=10pt]{standalone}
      \usepackage[table]{xcolor}
      \begin{document}
      \begin{tabular}{cc}\hline
      \rowcolor{green}c&d\\\hline
      \rowcolor{blue}a&b\\\hline
      \end{tabular}
      \end{document}

Leave a Reply