4

How can one remove the line? Or is there a way to reset 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}

output of code

4 Answers 4

3

enter image description here

\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}
3
  • I just can't believe it!
    – Bernard
    Commented Jul 24, 2016 at 21:00
  • @Bernard you should have more faith:-) As Ulrike says for the simple MWE a simple \cline is a better idea, bit perhaps the real document needs hhline so it seemed worth providing for that. Commented Jul 24, 2016 at 21:02
  • I was kidding, but really, I'm in awe! I agree it's worth providing this solution.
    – Bernard
    Commented Jul 24, 2016 at 21:16
4

Why are you using \hhline? With \cline there is no problem:

\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}

enter image description here

3

Why not simply put \multirow after \hhline, with a negative number of rows?

\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} 

enter image description here

1

Here is a solution with {NiceTabular} of nicematrix and TikZ to draw some rules. The environment {NiceTabular} is similar to the classical environment {tabular} (as provided by array) but creates also PGF/TikZ nodes under the cells, rows and columns. Then it's possible to use those nodes with TikZ, in the so-called \CodeAfter, to draw whatever rule we wish.

\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}

You need several compilations (because of the PGF/TikZ nodes).

Output of the above code

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .