6

I want to color hline, e.g.:

\hline[color=red,width=2mm,dashed]

or something.

Below is a feeble attempt which fails. I put textcolor gray around {|} to try and make it gray. Ideally, I want it gray and dashed. Also note textcolor gray around the {\hline} tag. Any help would be appreciated using latex syntax.

Are there attributes for \hline? If so, where is the documentation?. There is a reason I love php.net for my other programing needs.

    \begin{array}{c\textcolor{gray}{|}cccccccccc}
 & \textcolor{gray}{P_1} & \textcolor{gray}{P_2} & \textcolor{gray}{P_3} & \textcolor{gray}{P_4}  & \textcolor{gray}{P_5} & \textcolor{gray}{P_6} & \textcolor{gray}{P_7} & \textcolor{gray}{P_8} & \textcolor{gray}{P_9} & \textcolor{gray}{P_{10}}\\
 \textcolor{gray}{\hline}
\textcolor{gray}{P_1}   &0&0&0&0&0&0&0&0&0&0\\
\textcolor{gray}{P_2}   & 0&0&0&0&0&0&0&0&0&0\\
\textcolor{gray}{P_3}   &0&0&0&0&0&0&0&0&0&0\\
\textcolor{gray}{P_4}   &0&1&1&0&0&0&0&0&0&0\\
\textcolor{gray}{P_5}   &1&1&0&0&0&0&0&0&0&0\\
\textcolor{gray}{P_6}   &0&0&0&0&0&0&0&0&0&0\\
\textcolor{gray}{P_7}   &1&1&0&0&1&1&0&0&0&0\\
\textcolor{gray}{P_8}   &1&0&0&1&0&1&0&0&0&0\\
\textcolor{gray}{P_9}   &0&0&1&0&0&0&0&0&0&0\\
\textcolor{gray}{P_{10}}  &0&0&0&0&0&1&0&1&0&0
\end{array}
4

2 回答 2

7

首先,导入颜色包,如下所示:

\usepackage{color} 

然后使用arydshln 包,并执行此操作(在表格上下文中):

\textcolor{gray}{\hdashline}
于 2010-10-09T17:07:10.267 回答
1

只需使用官方软件包;)

在序言中写下:

\usepackage{xcolor}
\usepackage{colortbl}
%It sets your colour line and then sets back to default (black)
\newcommand{\grayline}{\arrayrulecolor{gray}\hline\arrayrulecolor{black}}

\grayline完全像\hline在你的桌子上一样使用。

于 2021-07-22T15:54:54.480 回答