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?
1 Answer
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}
\arrayrulecolor
does not actbackwards
, only the following rules will have the new colour then , i.e. you have to use it beforetabularx
for all following rules.