3

I draw line with \cline in my table starting from the second column, because the first two rows are a merged cell. That works well as long as I do not use coloring of the cells. If I colorize the rows the \cline drawn line kind of bleaches out. I still can see some very faint border on the screen which presumably vanishes entirely if printed.

Does anyone knows a way around that problem?

Here is my minimal working example:

   \documentclass{article}  
\usepackage{longtable}
\usepackage{array}
\usepackage{rotating}
\usepackage{hhline}
\usepackage{colortbl}
\usepackage{multirow}
\usepackage{titlesec}


\begin{document}  

\newcounter{magicrownumbers}
\newcommand\rownumber{\stepcounter{magicrownumbers}\arabic{magicrownumbers}}

 \begin{table}
\centering
\begin{tabular}{|r|l|l|l|}
\hline
\rowcolor[gray]{.90}    
\multirow{2}{*}{\centering\rownumber}& \multicolumn{3}{c|}{\begin{minipage}{14cm}{\vspace{2mm}The text here\vspace{2mm}}\end{minipage}} \\
\cline{2-4}
\rowcolor[gray]{.90}    
 & Score: 1 & Remark: XXX & Substitute: KKKKK\\ 
 \hline
% rowcolor[gray]{.90}    
\multirow{2}{*}{\centering\rownumber}& \multicolumn{3}{c|}{\begin{minipage}{14cm}{\vspace{2mm}The text here\vspace{2mm}}\end{minipage}} \\
\cline{2-4}
%\rowcolor[gray]{.90}    
 & Score: 1 & Remark: XXX & Substitute: KKKKK\\ 
 \hline
\end{tabular}
\end{table}

\end{document}  
  • 1
    take a look at: http://tex.stackexchange.com/questions/65231/cellcolor-overwrites-partial-horizontal-lines-cline – d-cmst Jan 08 '14 at 09:09
  • when all else fails you can look at the package documentation, colortbl has a section with title "Less fun with \cline (the previous section having title "More fun with \hhline") – David Carlisle Jan 08 '14 at 09:39

2 Answers2

1

Thank you that worked.

Here the fixed version (if you zoom in you can still see a faint something for the new gray line on gray background is drawn through the box, but I doubt that any printer is actually capable of printing that fine difference (or I see because of my retina display...dunno)

  \documentclass{article}  
\usepackage{longtable}
\usepackage{array}
\usepackage{rotating}
\usepackage{hhline}
\usepackage{colortbl}
\usepackage{multirow}
\usepackage{titlesec}

\definecolor{gray}{rgb}{0.9,0.9,0.9}

\begin{document}  

\newcounter{magicrownumbers}
\newcommand\rownumber{\stepcounter{magicrownumbers}\arabic{magicrownumbers}}

 \begin{table}
\centering
\begin{tabular}{|r|l|l|l|}
\hline
\rowcolor[gray]{.90}    
\multirow{2}{*}{\centering\rownumber}& \multicolumn{3}{c|}{\begin{minipage}{14cm}{\vspace{2mm}The text here\vspace{2mm}}\end{minipage}} \\
\hhline{|>{\arrayrulecolor{gray}}->{\arrayrulecolor{black}}|---|}
\rowcolor[gray]{.90}    
 & Score: 1 & Remark: XXX & Substitute: KKKKK\\ 
 \hline
% rowcolor[gray]{.90}    
\multirow{2}{*}{\centering\rownumber}& \multicolumn{3}{c|}{\begin{minipage}{14cm}{\vspace{2mm}The text here\vspace{2mm}}\end{minipage}} \\
\hhline{|>{\arrayrulecolor{white}}->{\arrayrulecolor{black}}|---|}
%\rowcolor[gray]{.90}    
 & Score: 1 & Remark: XXX & Substitute: KKKKK\\ 
 \hline
\end{tabular}
\end{table}

\end{document}  
1

You can do that with {NiceTabular} of nicematrix.

\documentclass{article}  
\usepackage{nicematrix}

\begin{document}

\newcounter{magicrownumbers} \newcommand\rownumber{\stepcounter{magicrownumbers}\arabic{magicrownumbers}}

\begin{table} \centering \begin{NiceTabular}{rlll}[hvlines] \CodeBefore \rowcolor[gray]{.90}{1,2} \Body \Block{2-1}{\rownumber}& \multicolumn{3}{c}{\begin{minipage}{14cm}{\vspace{2mm}The text here\vspace{2mm}}\end{minipage}} \ & Score: 1 & Remark: XXX & Substitute: KKKKK\ \Block{2-1}{\rownumber} & \multicolumn{3}{c}{\begin{minipage}{14cm}{\vspace{2mm}The text here\vspace{2mm}}\end{minipage}} \ & Score: 1 & Remark: XXX & Substitute: KKKKK\ \end{NiceTabular} \end{table}

\end{document}

You need several compilations (because nicematrix uses PGF/Tikz nodes).

Output of the above code

F. Pantigny
  • 40,250