I am trying to make a table with colored cells and white grid lines, in it there are some cells that cover several rows. The problem is that when I use \multirow and \cellcolor to achieve this, the horizontal line in the \multirow cel is still appearing. This is what I am getting:
And here is my code:
\documentclass{article}
\usepackage[a4paper,margin=1in]{geometry}
\usepackage[svgnames]{xcolor}
\usepackage{tabularx,multirow,hhline,colortbl}
\usepackage{hhline}
\definecolor{headers}{RGB}{0,137,182}
\definecolor{M1}{RGB}{163,195,217}
\definecolor{M2}{RGB}{155,214,220}
\begin{document}
\setlength\arrayrulewidth{1pt}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\begin{tabularx}{\textwidth}{>{\raggedright\arraybackslash}m{0.25\textwidth} !{\color{white}\vrule width 1pt} L !{\color{white}\vrule width 1pt} >{\raggedright\arraybackslash}p{0.25\textwidth}l}
\rowcolor{headers}
\centering\textbf{\textcolor{white}{Ministries}} & \centering\textbf{\textcolor{white}{National Agencies}} & \textbf{\textcolor{white}{Regional Agencies}}\\
\arrayrulecolor{white}\hline
\rowcolor{M1}
Ministry of the Interior&&Regional Council of Souss-Massa\\
\arrayrulecolor{white}\hline
\cellcolor{M2}&\cellcolor{M2}National Office for Electricity and Drinking Water (ONEE)&\cellcolor{M2}\\
\hhline{~--}
\cellcolor{M2}&\cellcolor{M2}&\cellcolor{M2}&\\
\hhline{~--}
\cellcolor{M2}&\cellcolor{M2}&\cellcolor{M2}&\\
\hhline{~--}
\cellcolor{M2}&\cellcolor{M2}&\cellcolor{M2}&\\
\hhline{~--}
\cellcolor{M2}&\cellcolor{M2}&\cellcolor{M2}&\\
\hhline{~--}
\multirow{-6}{0.25\textwidth}{\cellcolor{M2}Ministry of Energy, Mines, and Sustainable Development}&\cellcolor{M2}&\cellcolor{M2}&\\
\end{tabularx}
\end{document}
Thank you for any guidance!
Best Answer
lie this?
what you see as rules in your table are actually gaps between cells with size of rules thicknes. they appear as rules since you have all rules in white color ...
this gaps can be colored with part of rule in
multirow
cell:in above mwe i use
thead
frommakecel
for column headers and also change the way how to color table. with this the table code is shorter and more clear. I also removed not used last columnl
.Addendum: After almost four year ... Now is available new table type
tabularray
, which is based on LaTeX3. It introduce new paradigm of table settings. In your case using it the packageshhline
,makecell
,multirow
andtabularx
are not needed anymore, the code is simpler and more concise (and consequently shorter).In comparison to the first solution, the result is much better as before (no problems with
hline
s: