2

This issue occurs while using xcolor to alternate the table color, while also using makecell to put multiple lines in a table cell. In this specific scenario, where a larger cell is in a colored line, the coloring will stop just before the end of the table.

\documentclass{article}
\usepackage[table]{xcolor}
\usepackage{makecell}

\rowcolors{2}{gray!20}{white}

\begin{document}
    \begin{tabular}{ |c|c| } 
    \rowcolor{gray!50}
    \hline
    \textbf{One} & \textbf{Two}\\
    \hline
    Text & More Text\\
    Even More & \makecell{Multiple \\ Lines}\\
    \hline
    \end{tabular}
\end{document}

enter image description here

  • I don't think makecell is a good way to make multi-line cells – user156344 May 5 at 4:57
4

I would not use makecell to do such things.

\documentclass{article}
\usepackage[table]{xcolor}
\usepackage{array}

\rowcolors{2}{gray!20}{white}
\newcolumntype{C}{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{2cm}}
% https://tex.stackexchange.com/a/12712/156344
\begin{document}
\begin{tabular}{|C|C|} 
    \rowcolor{gray!50}
    \hline
    \textbf{One} & \textbf{Two}\\
    \hline
    Text & More Text\\
    Even More & Multiple Lines\\
    \hline
\end{tabular}
\end{document}

enter image description here

2

You could use \Gape.

\documentclass{article}
\usepackage[table]{xcolor}
\usepackage{makecell}

\rowcolors{2}{gray!20}{white}

\begin{document}
    \begin{tabular}{ |c|c| } 
    \rowcolor{gray!50}
    \hline
    \textbf{One} & \textbf{Two}\\
    \hline
    Text & More Text\\
    Even More & \Gape[0pt][2pt]{\makecell{Multiple \\ Lines}}\\
    \hline
    \end{tabular}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.