2

I have a similar problem as in Remove white line in painted multirow tabular. Some PDF viewers like Adobe Reader and Evince display white lines inside my multirow cell.

thead/makecell doesn't work because I need to place the "Big Cell" at that exact position next to the three rows on the right. nicematrix sounds like a good solution, but unfortunately it's not available on my system (texlive2019).

\documentclass{article}

\usepackage[table]{xcolor}
\usepackage{multirow}
\usepackage{hhline}
\usepackage{tabularx}
\renewcommand{\arraystretch}{1.5}
\setlength\arrayrulewidth{1pt}

\newcommand{\cellgrey}[1]{\cellcolor{gray!40}{#1}}

\begin{document}

\renewcommand{\arraystretch}{2}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
\begin{tabularx}{\textwidth}{ |*{5}{Y|} }
    
    \hhline{|-|-|-|-|-|}
    
    \cellgrey{} & \cellgrey{1} & \cellgrey{2} & \cellgrey{3} & \cellgrey{4}\\
    \hhline{|*1{>{\arrayrulecolor{gray!40}}-}>{\arrayrulecolor{black}}|*4{-|}}

    \cellgrey{} & \cellgrey{5} & \cellgrey{6} & \cellgrey{7} & \cellgrey{8}\\
    \hhline{|*1{>{\arrayrulecolor{gray!40}}-}>{\arrayrulecolor{black}}|*4{-|}}
    
    \multirow{-3}{*}{\cellgrey{Big Cell}} & \cellgrey{9} & \cellgrey{10} & \cellgrey{11} & \cellgrey{12}\\
    \hhline{|-|-|-|-|-|}
    
\end{tabularx}
\renewcommand{\arraystretch}{1.2}

\end{document}

enter image description here

1
  • Welcome to TeX.SE. Any chance you could upgrade to TeXLive2022? The reason I ask is that I am unable to reproduce the issue you say you're getting on my fully updated MacTeX2022 system.
    – Mico
    Aug 30, 2022 at 17:16

2 Answers 2

1

This white lines seems tO be pdf viewer artifact. I can reproduce them with ma recent MiKTeX and Sumatra pdf viewer. However, using tabularray package, they disappear (the same will happen if you will use nicematrix package for setting of your table):

\documentclass{article}

\usepackage{xcolor}
\usepackage{tabularray}

\begin{document}

\begin{tblr}{hlines=1pt, vlines=1pt,
             colspec = {*{5}{X[c]}},
             rowsep  = 5pt,
             rows    = {bg=gray!40}
             }
\SetCell[r=3]{c}    Big Cell
    & 1 & 2 & 3 & 4     \\
    & 1 & 2 & 3 & 4     \\
    & 1 & 2 & 3 & 4     \\
\end{tblr}

\end{document}

enter image description here

0

These thin white lines appear in some PDF viewers. More precisely, they appear in the PDF viewers which use the PDF renderers PDF.js (eg: Firefox, DropBox, Papeeria) or MuPDF (eg; SumatraPDF). They don't appear in Adobe Reader but, with that PDF reader, the rules seem to vanish under the colored panels at some levels of zoom.

The package nicematrix provides an environment {NiceTabular} with tools to avoid such problems.

\documentclass{article}
\usepackage{nicematrix}

\begin{document}

\renewcommand{\arraystretch}{1.4}

\begin{NiceTabular}{*{5}{X[c]}}[hvlines]
\CodeBefore
  \arraycolor{gray!40}
\Body
  \Block{3-1}{Big Cell} & 1 & 2 & 3 & 4 \\
                        & 1 & 2 & 3 & 4 \\
                        & 1 & 2 & 3 & 4 \\
\end{NiceTabular}

\end{document}

You need several compilations (because nicematrix uses PGF/TikZ nodes under the hood).

Output of the above code

You must log in to answer this question.

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