如何删除该行?或者有办法重置 doublerulesepcolor 吗?
\documentclass{article}
\usepackage[table,svgnames]{xcolor}
\usepackage{colortbl}
\usepackage{hhline}
\usepackage{multirow}
\begin{document}
\begin{tabular}{|m{5cm}||m{2cm}|}
\hhline{|-||-|}
Table & \cellcolor{black!10} A\\
\hhline{:=:|>{\doublerulesepcolor{black!10}\arrayrulecolor{black!10}}=>{\doublerulesepcolor{black! 0}\arrayrulecolor{black!100}}|}
\cline{2-2}
\multirow{2}{5cm}{\centering\textbf{Text without a line.}} & 1\\
\hhline{|~||-|}
& 2\\
\hhline{|-||-|}
\end{tabular}
\end{document}
答案1
\documentclass{article}
\usepackage[table,svgnames]{xcolor}
\usepackage{colortbl}
\usepackage{hhline}
\usepackage{multirow}
\begin{document}
\begin{tabular}{|m{5cm}||m{2cm}|}
\hhline{|-||-|}
Table & \cellcolor{black!10} A\\
\hhline{:=:|>{\doublerulesepcolor{black!10}\arrayrulecolor{black!10}}=>{\doublerulesepcolor{black! 0}\arrayrulecolor{black!100}}|}
\cline{2-2}
\multirow{2}{5cm}{\centering\textbf{Text without a line.}} & 1\\
\noalign{\makeatletter
\global\let\CT@drsc@old\CT@drsc@
\global\let\CT@drsc@\relax}
\hhline{|~||-|}
\noalign{\makeatletter
\global\let\CT@drsc\CT@drsc@old}
& 2\\
\hhline{|-||-|}
\end{tabular}
\end{document}
答案2
为什么要使用 \hhline?使用 \cline 不会有问题:
\documentclass{article}
\usepackage[table,svgnames]{xcolor}
\usepackage{hhline}
\usepackage{multirow}
\begin{document}
\begin{tabular}{|m{5cm}||m{2cm}|}
\hhline{|-||-|}
Table & \cellcolor{black!10} A\\
\hhline{:=:|>{\doublerulesepcolor{black!10}\arrayrulecolor{black!10}}=>{\doublerulesepcolor{black! 0}\arrayrulecolor{black!100}}|}
\cline{2-2}
\multirow{2}{5cm}{\centering\textbf{Text without a line.}} & 1\\
\cline{2-2}
%\hhline{|~||-|}
& 2\\
\hhline{|-||-|}
\end{tabular}
\end{document}
答案3
为什么不简单地说\multirow
后 \hhline
,行数为负数?
\documentclass{article}
\usepackage[table,svgnames]{xcolor}
\usepackage{colortbl}
\usepackage{hhline}
\usepackage{multirow}
\begin{document}
\begin{tabular}{|m{5cm}||m{2cm}|}
\hhline{|-||-|}
Table & \cellcolor{black!10} A \\
\hhline{:=:|>{\doublerulesepcolor{black!10}\arrayrulecolor{black!10}}=>{\doublerulesepcolor{black! 0}\arrayrulecolor{black!100}}|}
\cline{2-2}
& 1 \\
\hhline{|~||-|}
\multirow{-2}{5cm}{\centering\textbf{Text without a line.}} & 2 \\
\hhline{|-||-|}
\end{tabular}
\end{document}
答案4
这是使用 和 TikZ 绘制一些规则的解决方案。环境类似于经典环境(由 提供),但还会在单元格、行和列下创建 PGF/TikZ 节点。然后可以使用这些节点与 TikZ(所谓的{NiceTabular}
)一起绘制我们想要的任何规则。nicematrix
{NiceTabular}
{tabular}
array
\CodeAfter
\documentclass{article}
\usepackage{nicematrix,tikz}
\begin{document}
\renewcommand{\arraystretch}{1.4}
\begin{NiceTabular}{w{l}{5cm}w{l}{2cm}}[color-inside]
Table & \Block[hvlines]{3-1}{}\cellcolor{gray!50} A \\
\Block[c]{2-1}{\textbf{Text without a line}} & 1 \\
& 2 \\
\CodeAfter
\begin{tikzpicture}
\draw (1-|1) rectangle ([xshift=-2pt,yshift=2pt]2-|2) ;
\draw (2-|1) rectangle ([xshift=-2pt]4-|2) ;
\end{tikzpicture}
\end{NiceTabular}
\end{document}
您需要多次编译(因为 PGF/TikZ 节点)。