I am having some trouble removing the "white lines" from a colored table (where it says 3 and 4).

enter image description here



\definecolor{darkgray}{rgb} {0.50,0.50,0.50}

            \textbf{Binary}    & \textbf{ICDR}      & \textbf{ETDRS}                                             \\ \hline
            0                  & 0                  & No DR                                                      \\ \hline
            &\cellcolor{lightgray}1                   & \cellcolor{lightgray}Very mild NPDR   \\ \hhline{~|--} 
            &\cellcolor{lightgray}2                   & \cellcolor{lightgray}Mild NPDR        \\ \hhline{~|--}
            &\cellcolor{lightgray}                    & \cellcolor{lightgray}Moderate NPDR    \\ \hhline{~~|-}
            &\cellcolor{lightgray}                    & \cellcolor{lightgray}Severe NPDR      \\ \hhline{~~|-}
            &\cellcolor{lightgray}\multirow{-3}{*}{3} & \cellcolor{lightgray}Very Severe NPDR \\ \hhline{~|--}
            &\cellcolor{darkgray}                     & \cellcolor{darkgray}\begin{tabular}[c]{@{}c@{}}Mild - Moderate\\ PDR\end{tabular}          \\ \hhline{~~|-}
            &\cellcolor{darkgray}                     & \cellcolor{darkgray}High-Risk PDR                                                          \\ \hhline{~~|-}
            \multirow{-8}{*}{1}&\cellcolor{darkgray} \multirow{-3}{*}{4} & \cellcolor{darkgray}\begin{tabular}[c]{@{}c@{}}Advanced Diabetic\\ Eye Disease\end{tabular}\\ \hhline{---}
    \caption{\label{tab:dr_classes}Sample Caption.}


Any information is appreciated.

  • 4
    Please complete the code with documentclass and packages. The code is not compilable. – subham soni Feb 20 at 8:06
  • 1
    Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – Stefan Pinnow Feb 20 at 8:11
  • Apologies & thanks for the reminder. Code should be compilable now. – TexLover Feb 20 at 8:28
  • The document class might be relevant but you don't have a \documentclass command so the supplied code can't possibly compile. – Andrew Feb 20 at 8:29
  • Why not use \cline{3-3} instead of the \hhline? With \cline there are no white lines in the adjacent multirow cell. – leandriis Feb 20 at 9:49

i would redesign your table as follows:


\usepackage{array, booktabs, multirow}
\definecolor{darkgray}{rgb} {0.50,0.50,0.50}

    \begin{tabular}{      C{\dimexpr0.22\linewidth-0.66\arrayrulewidth}|@{}
        & \textbf{ICDR}
            & \textbf{ETDRS}        \\ \hhline{---}
    0   & 0 & No DR                 \\ \hhline{---}
        & 1 & Very mild NPDR        \\ \hhline{~|-|-}
        & 2 & Mild NPDR             \\ \hhline{~|-|-}
        &   & Moderate NPDR         \\ \lightline
        &   & Severe NPDR           \\ \lightline
        & \multirow{-3}{*}{3}
            & Very Severe NPDR      \\
    \begin{tabular}{     C{\dimexpr0.22\linewidth-0.66\arrayrulewidth}|
        &   & Mild - Moderate PD    \\ \darkline
        &   & High-Risk PDR         \\ \darkline
        & \multirow{-2}{*}{4}
            & Advanced Diabetic
              Eye Disease           \\ \hhline{---}
\caption{Sample Caption.}

enter image description here

still visible white lines are caused by artifacts of pdf previewer (i use sumatra). it should not be visible in printed document.

  • Playing with arrayrulecolor sounds like a really good idea, however the results seem to be the same. Is there a way to limit the size of the colored cell so that it doesn't write over the lines? So that we can use \cline instead of \hhline, which works correctly without color. – TexLover Feb 20 at 23:09
  • Marking this as an answer until someone comes up with a perfect solution. Seems to be the same problem as this one: tex.stackexchange.com/a/65235/181958 – TexLover Feb 20 at 23:14
  • there is no better answer with your colors. try to replace your colors with gray and white, you will see, that artifacts will gone. you can ask author of colortbl package for help. and don't accept my answer if it is not good. – Zarko Feb 20 at 23:28
  • Compared side to side, your answer improves it a lot. Thank you for that. And like you've said there doesn't seem to be any other option currently. Maybe tikz package could help: tex.stackexchange.com/a/409657/181958 adjustbox didn't solve the problem. So yours is the best currently. – TexLover Feb 20 at 23:36

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