删除乳胶中表格行之间的空格

删除乳胶中表格行之间的空格

我正在尝试更改长表乳胶中的行颜色。问题是,我合并了一些行,但是当我更改单元格的背景颜色时,合并的行之间会出现一个白色的空格。您可以在屏幕截图中看到它。

输出截图

\begin{scriptsize}

\setlength\tabcolsep{5pt}



\begin{longtable}{|l|l|l|l|l|l|l|l|l|l|l|l|l|l|l|l|l|l|l|l|l|l|l|l|l|}




\caption{Clustering Techniques}
\label{clusteringtechs}

\hline
\multirow{2}{*}{\#} &
\multirow{2}{*}{\begin{tabular}[c]{@{}l@{}}Clustering\\ Technique\end{tabular}} & \multirow{2}{*}{Year} & \rotatebox{90}{\multirow{2}{*}{\begin{tabular}[c]{@{}l@{}}Support\\Heterogeneity\end{tabular}}} & 
\multicolumn{2}{c|}{\begin{tabular}[c]{@{}c@{}}Role\\ of\\ CH\end{tabular}}&\rotatebox{90}{\centering \multirow{2}{*}{Routing}} &
\rotatebox{90}{\multirow{2}{*}{\begin{tabular}[c]{@{}l@{}}support\\Mobility\end{tabular}}} & \multicolumn{17}{c|}{Objectives} \\ \cline{5-6} \cline{9-25} 
 &  &  &  & \rotatebox{90}{Relay} & \rotatebox{90}{Fusion} &  &  & E & L & R & D & J & T & Y & P & C & O & F & B & A & M & S & U & H \\ \hline
 \endhead
 \toprule
% &  &  &  & \multicolumn{2}{c}{\begin{tabular}[c]{@{}c@{}}Role\\ of\\ CH\end{tabular}} &  &  & \multicolumn{17}{c|}{Objectives} \\ \cmidrule(lr){5-6} \cmidrule(l){9-25} 
%\multirow{-2}{*}{\#} & \multirow{-2}{*}{\begin{tabular}[c]{@{}l@{}}Clustering\\ Technique\end{tabular}} & \multirow{-2}{*}{Year} & \multirow{-2}{*}{\begin{tabular}[c]{@{}c@{}}Support\\ Heter\end{tabular}} & \multicolumn{1}{c|}{Relay} & Fusion & \multirow{-2}{*}{Routing} & \multirow{-2}{*}{\begin{tabular}[c]{@{}l@{}}support \\ Mobility\end{tabular}} & E & L & R & D & J & T & Y & P & C & O & F & B & A & M & S & U & H \\ \midrule
\rowcolor[HTML]{C0C0C0} 
\rowcolor[HTML]{C0C0C0} 

答案1

我尝试通过添加文档前言来编译您的代码,但代码中存在太多错误。

您正在使用书签-packagetoprule midrule等。无论是rowcolor还是都不会对规则上方和下方提供的cellcolor额外空间进行着色。此外,手册中记录了和朋友与垂直线不兼容。booktabstoprule

你可以hline尝试cline加载线包。但是,您随后将看到一些规则似乎在 PDF 查看器中消失了。

我建议您只使用水平线来构建表格,如书签手册。另外,删除rowcolor不必要的。此外,@{}在表格序言的开头和结尾添加 ad,以删除侧边距。

\begin{longtable}{@{}*{25}{l}@{}}  % 25 left aligned columns

如果你需要一个处理彩色单元格以及水平和垂直规则的多页表格环境,一个可能的解决方案是使用卡路里-包裹。

这是可校准的版本:

\documentclass[british, DIV=12, captions=tableheading, landscape]{scrartcl}
\usepackage{cals, url}
\usepackage{babel}
\usepackage{xcolor, lscape}
\RequirePackage[T1]{fontenc}

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

\addtokomafont{caption}{\sffamily\bfseries\small}
\setkomafont{captionlabel}{\normalfont}

\begin{document}
%\begin{landscape}
\begin{calstable}[c]

\captionaboveof{table}{Clustering Techniques}
\label{clusteringtechs}

% Defining columns relative to each other and relative to the margins
\colwidths{{\dimexpr(\columnwidth)/26\relax}
            {\dimexpr(\columnwidth)/26*2+4pt\relax}
            {\dimexpr(\columnwidth)/26\relax}
            {\dimexpr(\columnwidth)/26\relax}
            {\dimexpr(\columnwidth)/26\relax}
            {\dimexpr(\columnwidth)/26\relax}
            {\dimexpr(\columnwidth)/26\relax}
            {\dimexpr(\columnwidth)/26\relax}
            {\dimexpr(\columnwidth)/26\relax}
            {\dimexpr(\columnwidth)/26\relax}
            {\dimexpr(\columnwidth)/26\relax}
            {\dimexpr(\columnwidth)/26\relax}
            {\dimexpr(\columnwidth)/26\relax}
            {\dimexpr(\columnwidth)/26\relax}
            {\dimexpr(\columnwidth)/26\relax}
            {\dimexpr(\columnwidth)/26\relax}
            {\dimexpr(\columnwidth)/26\relax}
            {\dimexpr(\columnwidth)/26\relax}
            {\dimexpr(\columnwidth)/26\relax}
            {\dimexpr(\columnwidth)/26\relax}
            {\dimexpr(\columnwidth)/26\relax}
            {\dimexpr(\columnwidth)/26\relax}
            {\dimexpr(\columnwidth)/26\relax}
            {\dimexpr(\columnwidth)/26\relax}
            {\dimexpr(\columnwidth)/26\relax}
    }
% The tabular fills the text area if sum of all columns is 6

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

\setlength{\cals@paddingL}{3.2pt}
\setlength{\cals@paddingL}{3.2pt}

\def\blue{\ifx\cals@bgcolor\empty     % "Switch" to turn on and off colour
    \def\cals@bgcolor{blue!5}
\else \def\cals@bgcolor{} \fi}


% R1H1
\thead{\sffamily\scriptsize%           The first 5 rows are heading and vill be repeated on every page
\brow
    \alignC\blue\nc{lrt}
    \nc{lrt}
    \nc{lrt}
    \nc{lrt}
    \nc{lrt}
    \nc{lrt}
    \nc{lrt}
    \nc{lrt}
    \cell{\vfil X}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{\vfil X}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
\erow
%R2H2
\brow
    \nc{lrb}\sc{\vfil 145}
    \nc{lrb}\sc{\vfil DFCR[139]}
    \nc{lrb}\sc{\vfil 2015}
    \nc{lrb}\sc{\vfil No}
    \nc{lrb}\sc{\vfil }
    \nc{lrb}\sc{\vfil X}
    \nc{lrb}\sc{\vfil M}
    \nc{lrb}\sc{\vfil No}
    \nc{ltb}
    \nc{tb}
    \nc{ltb}
    \nc{tb}
    \nc{tb}
    \nc{tb}
    \nc{tb}
    \nc{tb}
    \nc{tb}
    \nc{tb}
    \nc{tb}
    \nc{tb}
    \nc{tb}
    \nc{tb}
    \nc{tb}
    \nc{tb}
    \nc{rtb}\alignC\sc{\vfil Fault Tolerance (CH failure)}\blue
\erow
%R3H3
\brow
   \nc{lrt}
    \nc{lrt}
    \nc{lrt}
    \nc{lrt}
    \nc{lrt}
    \nc{lrt}
    \nc{lrt}
    \nc{lrt}
    \cell{\vfil X}
    \cell{}
    \cell{}
    \cell{\vfil X}
    \cell{}
    \cell{\vfil X}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{\vfil X}
    \cell{}
    \cell{}
\erow
%R4H4
\brow
    \nc{lrb}\sc{\vfil 146}
    \nc{lrb}\sc{\vfil K-SCC[140]}
    \nc{lrb}\sc{\vfil 2015}
    \nc{lrb}\sc{\vfil No}
    \nc{lrb}\sc{\vfil }
    \nc{lrb}\sc{\vfil X}
    \nc{lrb}\sc{\vfil M}
    \nc{lrb}\sc{\vfil No}
    \nc{ltb}
    \nc{tb}
    \nc{ltb}
    \nc{tb}
    \nc{tb}
    \nc{tb}
    \nc{tb}
    \nc{tb}
    \nc{tb}
    \nc{tb}
    \nc{tb}
    \nc{tb}
    \nc{tb}
    \nc{tb}
    \nc{tb}
    \nc{tb}
    \nc{rtb}\alignC\sc{\vfil Improve security by providing authentication}
\erow
%R5H5
\brow
    \blue\cell{147}
    \cell{DECAR[141]}
    \cell{2015}
    \cell{No}
    \cell{}
    \cell{X}
    \cell{M}
    \cell{No}
    \cell{X}
    \cell{X}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{X}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}\blue
\erow
}
\tfoot{\lastrule\strut}
%R6B1
\brow
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
\erow
%R4B2
\brow
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
\erow

\makeatletter
\end{calstable}\par
%\end{landscape}
\end{document}

在此处输入图片描述

相关内容