Como mudar a cor de todas as linhas do tabularx?

Como mudar a cor de todas as linhas do tabularx?

Tenho um LaTeXdocumento, onde possuo um tabularxambiente, e preciso alterar todas as linhas da tabela para cinza. Eu tentei este comando \arrayrulecolor{grey}\hline, mas mudou apenas a cor da linha inferior, como mudar todos eles?

Responder1

Os \arrayrulecolorcomandos definem a cor apenas para as regras a seguir, mas não para aquelas que foram definidas antes de \arrayrulecolorserem usadas. Esta mudança é 'global' no sentido de que atua de acordo com as seguintes regras, mas não fora do tabular(x)ambiente etc. (veja o exemplo)

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

insira a descrição da imagem aqui

informação relacionada