我在从彩色表格(其中显示 3 和 4)中删除“白线”时遇到了一些麻烦。
\documentclass{report}
\usepackage{wrapfig}
\usepackage{colortbl}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{hhline}
\usepackage[table,xcdraw]{xcolor}
\usepackage{graphicx}
\definecolor{lightgray}{rgb}{0.75,0.75,0.75}
\definecolor{darkgray}{rgb} {0.50,0.50,0.50}
\begin{document}
\begin{wraptable}[12]{r}[0cm]{5cm}
\vspace{-1cm}
\resizebox{5cm}{!}{
\begin{tabular}{c|c|c}
\hline
\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{---}
\end{tabular}}
\caption{\label{tab:dr_classes}Sample Caption.}
\end{wraptable}]
\end{document}
任何提供的信息都将受到赞赏。
答案1
我会重新设计你的表格如下:
\documentclass{report}
\usepackage{wrapfig}
\usepackage{array, booktabs, multirow}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\usepackage[table,xcdraw]{xcolor}
\definecolor{lightgray}{rgb}{0.75,0.75,0.75}
\definecolor{darkgray}{rgb} {0.50,0.50,0.50}
\usepackage{hhline}
\newcommand\lightline{%
\hhline{~|>{\arrayrulecolor{lightgray}}-%
>{\arrayrulecolor{black}}|-}%
}
\newcommand\darkline{%
\hhline{~|>{\arrayrulecolor{gray}}-%
>{\arrayrulecolor{black}}|-}%
}
\usepackage{lipsum}
\begin{document}
\lipsum[1]
\begin{wraptable}[12]{r}[0cm]{5cm}
\setlength\tabcolsep{0pt}
\footnotesize
\vspace{-\baselineskip}
\begin{tabular}{ C{\dimexpr0.22\linewidth-0.66\arrayrulewidth}|@{}
>{\columncolor{lightgray}}C{\dimexpr0.21\linewidth-0.66\arrayrulewidth}|
>{\columncolor{lightgray}}C{\dimexpr0.57\linewidth-0.66\arrayrulewidth}
}
\hhline{---}
\rowcolor{white}
\textbf{Binary}
& \textbf{ICDR}
& \textbf{ETDRS} \\ \hhline{---}
\rowcolor{white}
0 & 0 & No DR \\ \hhline{---}
& 1 & Very mild NPDR \\ \hhline{~|-|-}
& 2 & Mild NPDR \\ \hhline{~|-|-}
& & Moderate NPDR \\ \lightline
& & Severe NPDR \\ \lightline
\multirow{2}{*}{1}
& \multirow{-3}{*}{3}
& Very Severe NPDR \\
\end{tabular}\\[-1pt]
\begin{tabular}{ C{\dimexpr0.22\linewidth-0.66\arrayrulewidth}|
>{\columncolor{darkgray}}C{\dimexpr0.21\linewidth-0.66\arrayrulewidth}|
>{\columncolor{darkgray}}C{\dimexpr0.57\linewidth-0.66\arrayrulewidth}
}
\hhline{~|-|-}
& & Mild - Moderate PD \\ \darkline
& & High-Risk PDR \\ \darkline
& \multirow{-2}{*}{4}
& Advanced Diabetic
Eye Disease \\ \hhline{---}
\end{tabular}
\caption{Sample Caption.}
\label{tab:dr_classes}
\end{wraptable}
\lipsum[2]
\end{document}
仍然可见的白线是由 pdf 预览器的伪影引起的(我使用苏门答腊)。它在打印的文档中不应该可见。