
我有一個LaTeX
文檔,其中有一個tabularx
環境,我需要將表中的所有行更改為灰色。我已經嘗試過這個命令\arrayrulecolor{grey}\hline
,但它只改變了底線的顏色,如何改變它們?
答案1
這些\arrayrulecolor
命令僅為以下規則設定顏色,而不為先前設定的規則設定顏色\arrayrulecolor
。此變更是「全域」的,因為它按照以下規則起作用,但不在tabular(x)
etc. 環境之外(請參閱範例)
\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}