单元格颜色与单元格边框重叠

单元格颜色与单元格边框重叠

这个问题似乎经常被问到,所以我为重复道歉。我查看了已经给出的答案并尝试了其中的几个,但似乎没有一个能解决我的问题。正如您所见,单元格的颜色会使随机单元格边框消失,但不是全部。如果放大,会出现更多边框,但同样不是全部。我对 LaTeX 很陌生,对它了解不多,所以我真的很感激一些帮助。

\documentclass{scrreprt}

\def\widesplit#1{%
\cleardoublepage
\def\row##1##2{##1}%
#1%
\clearpage
\def\row##1##2{##2}%
#1%
\clearpage
}
\usepackage{multirow}
\usepackage{hhline}
\usepackage{longtable}
\usepackage{color}
\usepackage[table]{xcolor}

\begin{document}

\widesplit{
\begin{tabular}{|>{\bfseries}l|l|l|l|l|l|l|l|l|l|l|l|}
\hline
Gene
\row{ & \cellcolor{red!50} \textbf{10015-1-A1} & \cellcolor{red!50}
\textbf{10015-4-A1}  & \cellcolor{red!50} \textbf{10015-5-A1} & \cellcolor{cyan!50} \textbf{10015-6-K} & \cellcolor{cyan!50} \textbf{10015-7-K} }{& \cellcolor{cyan!50}\textbf{10015-8-K}& \cellcolor{cyan!50} \textbf{10015-9-K}& \cellcolor{red!50} \textbf{10015-10-A1} & \cellcolor{cyan!50} \textbf{10015-11-K} & \textbf{Score}}\\ \hline
CRCP
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{cyan!15}hom&\cellcolor{red!15}het}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{cyan!15}hom & 8/9}\\ \hline
GGN
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{cyan!15}hom & 9/9}\\ \hline
LRP3
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{cyan!15}hom & 9/9}\\ \hline
GAD2
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{cyan!15}hom&\cellcolor{red!15}het}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{cyan!15}hom & 8/9}\\ \hline
PRKCG
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{cyan!15}hom}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{cyan!15}hom & 7/9}\\ \hline
IFT122
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{cyan!15}hom&\cellcolor{red!15}het}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{red!15}het & 7/9}\\ \hline
SLC7A6OS
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{cyan!15}hom}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{red!15}het & 7/9}\\ \hline
KNTC1
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{cyan!15}hom}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{cyan!15}hom & 8/9}\\ \hline
TMPRSS11F
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{cyan!15}hom&\cellcolor{red!15}het}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{red!15}het & 7/9}\\ \hline
NAALAD2
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{cyan!15}hom&\cellcolor{red!15}het}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{cyan!15}hom & 8/9}\\ \hline
PION
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{cyan!15}hom&\cellcolor{red!15}het}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{cyan!15}hom & 8/9}\\ \hline
DDX18
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{red!15}het & 6/9}\\ \hline
TMEM87B
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{red!15}het & 6/9}\\ \hline
PRR14L
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{cyan!15}hom}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{red!15}het & 7/9}\\ \hline
RPAP3
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{red!15}het & 6/9}\\ \hline
FRMD4A
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{cyan!15}hom&\cellcolor{red!15}het}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{red!15}het & 7/9}\\ \hline
CARD6
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{cyan!15}hom & 7/9}\\ \hline
SLC38A4
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{red!15}het & 6/9}\\ \hline
TIGIT
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{cyan!15}hom&\cellcolor{red!15}het}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{red!15}het & 7/9}\\ \hline
CSMD2
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}hom&\cellcolor{red!15}het}{&\cellcolor{red!15}het&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{cyan!15}hom & 6/9}\\ \hline
BMP8B
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het}{&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{cyan!15}hom & 6/9}\\ \hline
ZNF643
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{cyan!15}hom & 7/9}\\ \hline
HIVEP3
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{cyan!15}hom & 7/9}\\ \hline
SZT2
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{cyan!15}hom & 7/9} \\ \hline
DYSF
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{cyan!15}hom & 7/9} \\ \hline
DIRC1
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom}{&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het & 7/9}\\ \hline
FGD5
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{cyan!15}hom}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{cyan!15}hom & 8/9} \\ \hline
\end{tabular}%
}

\end{document}

在此处输入图片描述 在此处输入图片描述

此外,既然我已经在寻求帮助,传统的 \caption 在这里不起作用。我并不介意它只出现在表格的末尾,但它不会发生。提前非常感谢。

答案1

这些规则实际上没有问题,如果你打印或放大,它们都在那里,有些 pdf 查看器在显示它们方面比其他的更好。

在此处输入图片描述

如果您对它们在查看器中来来去去感到困扰,那么一个选择就是不使用它们,因为它们实际上并没有真正帮助您理解表格。

唯一的问题是桌子太宽了

 Overfull \hbox (57.0684pt too wide) in paragraph at lines 81--81

所有的宽度都来自标题,我不知道你是否能将 10015-A-A1 分成两行或者以较小的字体显示它或者其他什么。

事实上,如果采用更压缩的格式,你可能会得到两个都表格的两半放在同一页面上,因为它似乎只是一个二进制列表 het/hom?

对于标题,你要么需要将每个表格包装在一个table环境中,以便你可以使用

\caption{.,....}

或者使用capt-of允许您使用外部标题table和图形的包,语法如下

\captionof{table}{my caption goes here}

答案2

如果你希望使用任何 PDF 阅读器在所有缩放级别下都能看到这些规则,你可以使用以下方法排版这些表格卡路里

\documentclass[DIV=11]{scrartcl}
\usepackage{cals, xcolor}


\let\nc=\nullcell                                                  % Shortcuts
\let\sc=\spancontent

\begin{document}

\begin{calstable}[c]

% Defining column relativ to each other and relativ to the margins
\colwidths{{\dimexpr(\columnwidth)/12*2\relax}
            {\dimexpr(\columnwidth)/12\relax}
            {\dimexpr(\columnwidth)/12\relax}
            {\dimexpr(\columnwidth)/12\relax}
            {\dimexpr(\columnwidth)/12\relax}
            {\dimexpr(\columnwidth)/12\relax}
            {\dimexpr(\columnwidth)/12\relax}
            {\dimexpr(\columnwidth)/12\relax}
            {\dimexpr(\columnwidth)/12\relax}
            {\dimexpr(\columnwidth)/12\relax}
            {\dimexpr(\columnwidth)/12\relax}
            }
% The tabular fills the text area

% Set up the tabular
\makeatletter
\def\cals@framers@width{0.4pt}   % Outside frame rules, reduce if the rule is too heavy
\def\cals@framecs@width{0.4pt}
\def\cals@bodyrs@width{0.4pt}
\cals@setpadding{Ag}
\cals@setcellprevdepth{Al}
\def\cals@cs@width{0.4pt}             % Inside rules, reduce if the rule is too heavy
\def\cals@rs@width{0.4pt}
\def\cals@bgcolor{}

\def\dred{\ifx\cals@bgcolor\empty
\def\cals@bgcolor{red!50}
\else \def\cals@bgcolor{} \fi}

\def\dcyan{\ifx\cals@bgcolor\empty
\def\cals@bgcolor{cyan!50}
\else \def\cals@bgcolor{} \fi}

\def\red{\ifx\cals@bgcolor\empty
\def\cals@bgcolor{red!15}
\else \def\cals@bgcolor{} \fi}

\def\cyan{\ifx\cals@bgcolor\empty
\def\cals@bgcolor{cyan!15}
\else \def\cals@bgcolor{} \fi}


% R1H1
\thead{\small\bfseries
\brow
    \cell{Gene}
    \dred\cell{10015-1-A1}
    \cell{10015-4-A1}
    \cell{10015-5-A1}\dred
    \dcyan\cell{10015-6-K}
    \cell{10015-7-K}
    \cell{10015-8-K}
    \cell{10015-9-K}\dcyan
    \dred\cell{10015-10-A1}\dred
    \dcyan\cell{10015-11-K}\dcyan
    \cell{Score}
\erow
\mdseries
}
% R2B1
\brow
    \cell{\bfseries CRCP}
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \cyan\cell{hom}\cyan
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \cell{8/9}
\erow
% R3B2
\brow
    \cell{\bfseries GGN}
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \cyan\cell{hom}\cyan
    \cyan\cell{hom}\cyan
    \cyan\cell{hom}\cyan
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \cell{9/9}
\erow
% R4B3
\brow
    \cell{\bfseries LRP3}
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \cyan\cell{hom}\cyan
    \cyan\cell{hom}\cyan
    \cyan\cell{hom}\cyan
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \cell{9/9}
\erow
% R5B4
\brow
    \cell{\bfseries GAD2}
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \cyan\cell{hom}\cyan
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \cell{8/9}
\erow
% R6B5
\brow
    \cell{\bfseries PRKCG}
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \cyan\cell{hom}\cyan
    \cyan\cell{hom}\cyan
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \cell{7/9}
\erow
% R7B6
\brow
    \cell{\bfseries IFT122}
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \cyan\cell{hom}\cyan
    \red\cell{het}\red
    \red\cell{het}\red
    \cell{7/9}
\erow
% R8B7
\brow
    \cell{\bfseries SLC7A6OS}
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \cyan\cell{hom}\cyan
    \cyan\cell{hom}\cyan
    \red\cell{het}\red
    \red\cell{het}\red
    \cell{7/9}
\erow
% R9B8
\brow
    \cell{\bfseries KNTC1}
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \cyan\cell{hom}\cyan
    \cyan\cell{hom}\cyan
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \cell{8/9}
\erow
% R10B9
\brow
    \cell{\bfseries TMPRSS11F}
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \cyan\cell{hom}\cyan
    \red\cell{het}\red
    \red\cell{het}\red
    \cell{7/9}
\erow
% R10B9
\brow
    \cell{\bfseries NAALAD2}
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \cyan\cell{hom}\cyan
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \cell{8/9}
\erow
% R11B10
\brow
    \cell{\bfseries PION}
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \cyan\cell{hom}\cyan
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \cell{8/9}
\erow
% R12B11
\brow
    \cell{\bfseries DDX18}
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \cyan\cell{hom}\cyan
    \red\cell{het}\red
    \red\cell{het}\red
    \cell{6/9}
\erow
% R13B12
\brow
    \cell{\bfseries TMEM87B}
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \cyan\cell{hom}\cyan
    \red\cell{het}\red
    \red\cell{het}\red
    \cell{6/9}
\erow
% R14B13
\brow
    \cell{\bfseries PRR14L}
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \cyan\cell{hom}\cyan
    \cyan\cell{hom}\cyan
    \red\cell{het}\red
    \red\cell{het}\red
    \cell{7/9}
\erow
% R15B14
\brow
    \cell{\bfseries RPAP3}
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \cyan\cell{hom}\cyan
    \red\cell{het}\red
    \red\cell{het}\red
    \cell{6/9}
\erow
% R16B15
\brow
    \cell{\bfseries FRMD4A}
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \cyan\cell{hom}\cyan
    \red\cell{het}\red
    \red\cell{het}\red
    \cell{7/9}
\erow
% R17B16
\brow
    \cell{\bfseries CARD6}
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \cyan\cell{hom}\cyan
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \cell{7/9}
\erow
% R18B17
\brow
    \cell{\bfseries SLC38A4}
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \cyan\cell{hom}\cyan
    \red\cell{het}\red
    \red\cell{het}\red
    \cell{6/9}
\erow
% R19B18
\brow
    \cell{\bfseries TIGIT}
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \cyan\cell{hom}\cyan
    \red\cell{het}\red
    \red\cell{het}\red
    \cell{7/9}
\erow
% R20B19
\brow
    \cell{\bfseries CSMD2}
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \red\cell{het}\red
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \cell{6/9}
\erow
% R21B20
\brow
    \cell{\bfseries BMP8B}
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \red\cell{het}\red
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \cell{6/9}
\erow
% R22B21
\brow
    \cell{\bfseries ZNF643}
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \cyan\cell{hom}\cyan
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \cell{7/9}
\erow
% R23B22
\brow
    \cell{\bfseries HIVEP3}
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \cyan\cell{hom}\cyan
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \cell{7/9}
\erow
% R24B23
\brow
    \cell{\bfseries SZT2}
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \cyan\cell{hom}\cyan
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \cell{7/9}
\erow
% R25B24
\brow
    \cell{\bfseries DYSF}
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \cyan\cell{hom}\cyan
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \cell{7/9}
\erow
% R26B25
\brow
    \cell{\bfseries DIRC1}
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \cyan\cell{hom}\cyan
    \cyan\cell{hom}\cyan
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \cell{7/9}
\erow
% R27B26
\brow
    \cell{\bfseries FGD5}
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \cyan\cell{hom}\cyan
    \cyan\cell{hom}\cyan
    \red\cell{het}\red
    \cyan\cell{hom}\cyan
    \cell{8/9}
\erow
\makeatletter
\end{calstable}\par % \par to align the tabular

\end{document}

在此处输入图片描述

答案3

该软件包中nicematrix有专门用于解决此类问题的工具。

在您的代码中,我已用键替换了{tabular}{NiceTabular}color-inside键指定表格中将有颜色说明)。

当然,我已经加载nicematrix(并卸载了几个未使用的包)。

在生成的 PDF 中,无论您使用哪种 PDF 查看器,在各种缩放级别下,规则似乎都不会消失。

但是,您需要进行多次编译(因为nicematrix在后台使用了 PGF/Tikz 节点)。

\documentclass{scrreprt}

\def\widesplit#1{%
\cleardoublepage
\def\row##1##2{##1}%
#1%
\clearpage
\def\row##1##2{##2}%
#1%
\clearpage
}
% \usepackage{multirow}
% \usepackage{hhline}
% \usepackage{longtable}
\usepackage{xcolor}
\usepackage{nicematrix}

\begin{document}

\widesplit{
\begin{NiceTabular}{|>{\bfseries}l|l|l|l|l|l|}[color-inside]
\hline
Gene
\row{ & \cellcolor{red!50} \textbf{10015-1-A1} & \cellcolor{red!50}
\textbf{10015-4-A1}  & \cellcolor{red!50} \textbf{10015-5-A1} & \cellcolor{cyan!50} \textbf{10015-6-K} & \cellcolor{cyan!50} \textbf{10015-7-K} }{& \cellcolor{cyan!50}\textbf{10015-8-K}& \cellcolor{cyan!50} \textbf{10015-9-K}& \cellcolor{red!50} \textbf{10015-10-A1} & \cellcolor{cyan!50} \textbf{10015-11-K} & \textbf{Score}}\\ \hline
CRCP
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{cyan!15}hom&\cellcolor{red!15}het}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{cyan!15}hom & 8/9}\\ \hline
GGN
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{cyan!15}hom & 9/9}\\ \hline
LRP3
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{cyan!15}hom & 9/9}\\ \hline
GAD2
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{cyan!15}hom&\cellcolor{red!15}het}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{cyan!15}hom & 8/9}\\ \hline
PRKCG
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{cyan!15}hom}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{cyan!15}hom & 7/9}\\ \hline
IFT122
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{cyan!15}hom&\cellcolor{red!15}het}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{red!15}het & 7/9}\\ \hline
SLC7A6OS
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{cyan!15}hom}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{red!15}het & 7/9}\\ \hline
KNTC1
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{cyan!15}hom}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{cyan!15}hom & 8/9}\\ \hline
TMPRSS11F
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{cyan!15}hom&\cellcolor{red!15}het}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{red!15}het & 7/9}\\ \hline
NAALAD2
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{cyan!15}hom&\cellcolor{red!15}het}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{cyan!15}hom & 8/9}\\ \hline
PION
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{cyan!15}hom&\cellcolor{red!15}het}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{cyan!15}hom & 8/9}\\ \hline
DDX18
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{red!15}het & 6/9}\\ \hline
TMEM87B
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{red!15}het & 6/9}\\ \hline
PRR14L
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{cyan!15}hom}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{red!15}het & 7/9}\\ \hline
RPAP3
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{red!15}het & 6/9}\\ \hline
FRMD4A
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{cyan!15}hom&\cellcolor{red!15}het}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{red!15}het & 7/9}\\ \hline
CARD6
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{cyan!15}hom & 7/9}\\ \hline
SLC38A4
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{red!15}het & 6/9}\\ \hline
TIGIT
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{cyan!15}hom&\cellcolor{red!15}het}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{red!15}het & 7/9}\\ \hline
CSMD2
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}hom&\cellcolor{red!15}het}{&\cellcolor{red!15}het&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{cyan!15}hom & 6/9}\\ \hline
BMP8B
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het}{&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{cyan!15}hom & 6/9}\\ \hline
ZNF643
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{cyan!15}hom & 7/9}\\ \hline
HIVEP3
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{cyan!15}hom & 7/9}\\ \hline
SZT2
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{cyan!15}hom & 7/9} \\ \hline
DYSF
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{cyan!15}hom & 7/9} \\ \hline
DIRC1
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom}{&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het & 7/9}\\ \hline
FGD5
\row{&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{red!15}het&\cellcolor{cyan!15}hom}{&\cellcolor{cyan!15}hom&\cellcolor{cyan!15}hom&\cellcolor{red!15}het&\cellcolor{cyan!15}hom & 8/9} \\ \hline
\end{NiceTabular}%
}

\end{document}

上述代码的输出

相关内容