2

I have a LaTeX document, where I have a tabularx environment, and I need to change all lines in the table to grey. I have tried this command \arrayrulecolor{grey}\hline, but it changed just the colour of the bottom line, how to change them all?

Lucky_girl
  • 1,365
  • 1
    \arrayrulecolor does not act backwards, only the following rules will have the new colour then , i.e. you have to use it before tabularx for all following rules. –  Mar 25 '16 at 15:39

1 Answers1

3

The \arrayrulecolor commands sets the colour only for the following rules but not for those that were set before \arrayrulecolor was used. This change is 'global' in the sense that it acts on the following rules, but not outside of the tabular(x) etc. environment (see the example)

\documentclass{book}

\usepackage[table]{xcolor}

\usepackage{tabularx}


\begin{document}

\begin{tabularx}{\linewidth}{lX}
  \hline
  foo & foobar \tabularnewline
  \arrayrulecolor{red}
  \hline
\end{tabularx}

\begin{center}
Another table with black rules
\end{center}

\begin{tabularx}{\linewidth}{lX}
  \hline
  foo & foobar \tabularnewline
  \hline
\end{tabularx}

\begin{center}
Another table with red rules
\end{center}


\begin{tabularx}{\linewidth}{lX}
  \arrayrulecolor{red}
  \hline
  foo & foobar \tabularnewline
  \hline
\end{tabularx}


\end{document}

enter image description here