I want to draw a table using threepartable. I want the following structure: 1- the first line includes 2 rows:\multirow 2- the second line includes also two rows 3-the third line include 3 rows 4- fourth row includes 1 5- 5th includes 5 rows 6- 6th includes 6 rows.

My question: how can alternate the color in the table?

This is an example including the first three rows

\begin{adjustbox}{max width=\textwidth}
    \textbf{Approach}& \textbf{X}& \textbf{Y}& \textbf{Z}&\textbf{W}&\textbf{O}\\ 
    \multirow{2}{*}{ligne 1} 
    &\multirow{2}{*}{\shortstack[m]{BL BLA\\ bla}}
    & \multirow{2}{*}{aa} 
    &\multirow{2}{*}{dd} \\\rowcolor{Gray}
    &\multirow{2}{*}{\shortstack[m]{BL BLA\\ blq}}
    & \multirow{2}{*}{aa2} 
    &\multirow{2}{*}{dd2} \\
    &\multirow{3}{*}{\shortstack[m]{bla\\ bla}}
    & \multirow{3}{*}{aa3} 
    &\multirow{3}{*}{\shortstack[m]{ccc3\\ ccc3\\ccc3}}

By default, the header of the table is dark gray. I need the line 1 to be white, then line 2 gray, line 3 white, etc

  • 1
    How the table itself looks like is not very clear to me. Could you post a compilable (complete) code?
    – Bernard
    Sep 11, 2020 at 8:29
  • 1
    A minimal working example showing such a table without the colors, as well as a sketch that illustrates which rows should have which color would be really helpful here. Could you please add this information to your question?
    – leandriis
    Sep 11, 2020 at 8:31
  • Please make your example code compilable by adding the documentclass as well as the relevant packages. How is the \headrow command defined?
    – leandriis
    Sep 11, 2020 at 9:05
  • Is this the output you want to achieve? i.stack.imgur.com/HfniC.png If so, take a look at the \rowcolors command from the xcolor package (when loaded with the tables option) and the makecell package instead of the combination of \shortstack and \multirow.
    – leandriis
    Sep 11, 2020 at 9:13
  • Please post MWE from \documentclass to \end{document}...
    – MadyYuvi
    Sep 11, 2020 at 12:36

1 Answer 1


With the help of makecell from the makecell package instead of the combination of \multirow and \shortstack. In order to add the alternating row colors, I have used the \rowcolors command, that is available when loading the xcolor package with the tables option:

enter image description here


    \textbf{Approach}& \textbf{X}& \textbf{Y}& \textbf{Z}&\textbf{W}&\textbf{O}\\ 
     ligne 1 
    &\makecell{BL BLA\\ bla}
    &dd \\  
    &\makecell{BL BLA\\ blq}
    &dd2 \\
    &\makecell{bla\\ bla}
    &\makecell{ccc3\\ ccc3\\ccc3}


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .