
LaTeX
環境があるドキュメントがありtabularx
、テーブル内のすべての行を灰色に変更する必要があります。このコマンドを試しました\arrayrulecolor{grey}\hline
が、一番下の行の色だけが変更されました。すべてを変更するにはどうすればよいでしょうか?
答え1
コマンド\arrayrulecolor
は、次のルールに対してのみ色を設定しますが、使用前に設定されたルールに対しては色を設定しません\arrayrulecolor
。この変更は、次のルールに対して作用するという意味では「グローバル」ですが、etc. 環境の外部には作用しませんtabular(x)
(例を参照)。
\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}