特定のセルに色をつけた表の罫線について

特定のセルに色をつけた表の罫線について

- 匿名 希望 の投稿
返信数: 2
特定のセルに色をつけた表で \cline{} を用いると罫線が部分的に表示されないことがあります.
下記のソースでは b と d のセルの間の罫線が消えてしまっています.
これをきちんと表示させるにはどうしたらよろしいでしょうか?

\documentclass{article}
\usepackage{colortbl}
\begin{document}
\begin{tabular}{|*{3}{c|}}
\hline
& a & b \\
\cline{2-3}
& c & \multicolumn{1}{>{\columncolor[gray]{0.8}}c|}{d} \\
\hline
\end{tabular}
\end{document}
匿名 希望 への返信

Re: 特定のセルに色をつけた表の罫線について

- 匿 名 の投稿

10 Less fun with \cline Lines produced by \cline are coloured if you use \arrayrulecolor but you may not notice as they are covered up by any colour pannels in the following row. This is a ‘feature’ of \cline. If using this package you would probably better using the - rule type in a \hhline argument, rather than \cline.


と,colortbl のマニュアルにありますので,

\documentclass{article}
\usepackage{colortbl}%%% ←ドライバを指定したほうがいいかもしれません.
\usepackage{hhline}%%% ←追加
\begin{document}
\begin{tabular}{|*{3}{c|}}
\hline
& a & b \\
%\cline{2-3}%%%  ←変更
\hhline{|~|-|-|}%%% ←変更
& c & \multicolumn{1}{>{\columncolor[gray]{0.8}}c|}{d} \\
\hline
\end{tabular}
\end{document} 

でうまくいきませんか?

匿 名 への返信

Re: 特定のセルに色をつけた表の罫線について

- 匿名 希望 の投稿
ご回答ありがとうございました.
きちんと罫線を表示させることができました.
数時間悩んでいたので, 非常に助かりました.
\hhline という命令は知らなかったので, 勉強になりました.