![tabularx のすべての線の色を変更するにはどうすればいいですか?](https://rvso.com/image/330752/tabularx%20%E3%81%AE%E3%81%99%E3%81%B9%E3%81%A6%E3%81%AE%E7%B7%9A%E3%81%AE%E8%89%B2%E3%82%92%E5%A4%89%E6%9B%B4%E3%81%99%E3%82%8B%E3%81%AB%E3%81%AF%E3%81%A9%E3%81%86%E3%81%99%E3%82%8C%E3%81%B0%E3%81%84%E3%81%84%E3%81%A7%E3%81%99%E3%81%8B%3F.png)
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}