# Adding arrayrulecolor command removes top rule

The code below results in the image below.

\documentclass{beamer}
\usetheme{Montpellier}
\usecolortheme[named=gray]{structure}
\usepackage{colortbl}
\usepackage{array}
\newcommand{\gr}[1]{\textcolor{gray}{#1}}
\begin{document}
\definecolor{light-gray}{gray}{0.92}
\frame{
%\arrayrulecolor{light-gray}
\renewcommand{\arraystretch}{1.2}
\begin{tabular}{|>{\raggedright}m{2.45cm}|>{\raggedright\arraybackslash}m{3.4cm}
|>{\raggedright\arraybackslash}m{3.63cm}|}\cline{2-3}
\multicolumn{1}{c|}{} & \multicolumn{1}{c|}{\gr{short}} & \multicolumn{1}{c|}{\gr{short}}\\\hline
\gr{short text} & very, very long text here & very, very long text here\\\hline
\end{tabular}
}
\end{document}


When I try to change the arrayrulecolor to light-gray (by removing the percent symbol at the start of line 10), I get the image below. Note that the top rule has disappeared.

I tried using the hhline package and replacing \cline{2-3} with \hhline{~|-|-|} but I get the same results.

How do I get the table in the first image but with the rule color set to light gray? I am using pdfLaTeX.

• @jsbibra How does that help? \arrayrulecolor is exactly what is causing the problem here... Aug 14 '20 at 12:31

There seems to be problems with coloured \clines in beamer. Here is a workaround, using \cmidrule from booktabs. I had to neutralise the vertical padding below the rule. I simplified a bit the code: instead of loading colortbl, I added the table option to beamer, which passses it to xcolor, which loads colortbl.

\documentclass[table]{beamer}
\usetheme{Montpellier}
\usecolortheme[named=gray]{structure}
\usepackage{array, booktabs}
\newcommand{\gr}[1]{\textcolor{gray}{#1}}

\begin{document}

\definecolor{light-gray}{gray}{0.92}
\frame{\arrayrulecolor{light-gray}
\renewcommand{\arraystretch}{1.2}
\begin{tabular}{|>{\raggedright}m{2.45cm}|>{\raggedright\arraybackslash}m{3.4cm}
|>{\raggedright\arraybackslash}m{3.63cm}|}
\cmidrule{2-3}\noalign{\vskip -\belowrulesep}
\multicolumn{1}{c|}{} & \multicolumn{1}{c|}{\gr{short}} & \multicolumn{1}{c|}{\gr{short}}\\\hline
\gr{short text} & very, very long text here & very, very long text here\\\hline
\end{tabular}
}

\end{document}


• Erm, your code does not quite correspond to the description you give in the text... Aug 14 '20 at 12:29
• @campa: Oh! es. A copy-paste accident again! I should have checked. Fixed it. Thank you for pointing it! Aug 14 '20 at 12:34
• Thank you very much. It works perfectly. Aug 14 '20 at 13:38

You can obtain what you want directly with {NiceTabular} of nicematrix. A key hvlines draws all the expected rules excepted in the corners (specified by corners).

\documentclass{beamer}
\usetheme{Montpellier}
\usecolortheme[named=gray]{structure}

\usepackage{nicematrix}

\begin{document}

\begin{frame}
\renewcommand{\arraystretch}{1.2}
\begin{NiceTabular} [ rules/color=gray!20 , corners = NW , hvlines ]
{wl{2.45cm}m[l]{3.4cm}m[l]{3.63cm}}
\RowStyle{\color{gray}\centering}
& short & short \\
short text & very, very long text here & very, very long text here\\
\end{NiceTabular}
\end{frame}

\end{document}


Following the informations given in this question, here is a patch of \cline (in fact \@cline which is used by \cline) which solves the problem.

The command \cline is defined in standard LaTeX. It's not overwritten by the package array but it is by the package colortbl.

In the following code, I have added kern \z@ in the redefinition done by colortbl.

\documentclass{beamer}
\usetheme{Montpellier}
\usecolortheme[named=gray]{structure}
\usepackage{colortbl}
\usepackage{array}
\newcommand{\gr}[1]{\textcolor{gray}{#1}}

\makeatletter
\def\@cline#1-#2\@nil{%
\omit
\@multicnt#1%
\ifnum\@multicnt=\@ne\@firstofone{&\omit}\fi
\@multicnt#2%
\cr
\noalign{\vskip-\arrayrulewidth}}
\makeatother

\begin{document}
\definecolor{light-gray}{gray}{0.92}
\frame{
\arrayrulecolor{light-gray}
\renewcommand{\arraystretch}{1.2}
\begin{tabular}{|>{\raggedright}m{2.45cm}|>{\raggedright\arraybackslash}m{3.4cm}
|>{\raggedright\arraybackslash}m{3.63cm}|}\cline{2-3}
\multicolumn{1}{c|}{} & \multicolumn{1}{c|}{\gr{short}} & \multicolumn{1}{c|}{\gr{short}}\\\hline
\gr{short text} & very, very long text here & very, very long text here\\\hline
\end{tabular}
}
\end{document}


• Thank you for this. Aug 15 '20 at 13:34