我尝试将表格的规则颜色改为红色。不幸的是,表格单元格中的内容也受到了干扰,如下图所示。边距框架规则也变成了红色,这不是它应该的样子。
我不知道应该重新定义哪些参数来改变表规则的颜色。
\documentclass[dvips,dvipsnames,rgb]{book}
\usepackage[a4paper,hmargin=10mm,vmargin=40mm,showframe]{geometry}
\usepackage{longtable}
\usepackage{array}
\usepackage{calc}
\usepackage{lscape}
\setlength{\tabcolsep}{2mm}
\setlength{\arrayrulewidth}{2mm}
\newcounter{No}
\renewcommand{\theNo}{\arabic{No}}
\newenvironment{MyTable}[4]%
{%
\newcolumntype{O}[1]%
{%
>{%
\begin{minipage}%
{%
##1\linewidth-2\tabcolsep-1.5\arrayrulewidth%
}%
\vspace{\tabcolsep}%
}%
c%
<{%
\vspace{\tabcolsep}%
\end{minipage}%
}%
}%
\newcolumntype{I}[1]%
{%
>{%
\begin{minipage}%
{%
##1\linewidth-2\tabcolsep-\arrayrulewidth%
}%
\vspace{\tabcolsep}%
}%
c%
<{%
\vspace{\tabcolsep}%
\end{minipage}%
}%
}%
\setcounter{No}{0}%comment out this if you want to continuous numbering for all tables.
\begin{longtable}%
{%
|>{\stepcounter{No}\centering\scriptsize\theNo}O{#1}<{}%
|>{\centering}I{#2}<{\input{\jobname.tmp}}%
|>{\centering\lstinputlisting{\jobname.tmp}}I{#3}<{}%
|>{\scriptsize}O{#4}<{}%
|%
}%
\hline\ignorespaces%
}%
{%
\end{longtable}%
}
\newcommand{\Comment}[1]{&&\tabularnewline\hline}
\usepackage{listings}
\lstset{%
language={PSTricks},
breaklines=true,
basicstyle=\ttfamily\scriptsize,%
keywordstyle=\color{blue},
backgroundcolor=\color{yellow!30}%
}
\usepackage{fancyvrb}
\def\MyRow{%
\VerbatimEnvironment%
\begin{VerbatimOut}{\jobname.tmp}%
}
\def\endMyRow{%
\end{VerbatimOut}%
}
\usepackage{pstricks,pst-node}
\newpsstyle{gridstyle}{%
gridwidth=0.4pt,%default: 0.8pt
gridcolor=Red!20,%default: black
griddots=0,%default: 0
%
gridlabels=3pt,%default: 10pt
gridlabelcolor=Blue,%default: black
%
subgriddiv=5,%default: 5
subgridwidth=0.2pt,%default: 0.4pt
subgridcolor=Green!20,%default: gray
subgriddots=0%default: 0
}
\usepackage{lipsum}
\begin{document}
{\color{Red}%
%\clearpage
%\pagestyle{empty}
%Landscape starts here.
%\begin{landscape}
\begin{MyTable}{0.05}{0.3}{0.3}{0.35}%
%=============
\begin{MyRow}
\pspicture*[showgrid](3,3)
\pnode(1,1){A}
\pnode(3,3){B}
\ncline{A}{B}
\endpspicture
\end{MyRow}
\Comment{\lipsum[1]}
%=============
\begin{MyRow}
\begin{pspicture}[showgrid](3,3)
\psframe*[linecolor=red!30](3,2)
\end{pspicture}
\end{MyRow}
\Comment{\lipsum[2]}
%=============
\begin{MyRow}
\pspicture[showgrid](3,3)
\psframe*[linecolor=green!30](3,2)
\endpspicture
\end{MyRow}
\Comment{\lipsum[3]}
%=============
\begin{MyRow}
\pspicture[showgrid](3,3)
\psframe*[linecolor=yellow!30](3,2)
\endpspicture
\end{MyRow}
\Comment{\lipsum[4]}
%=============
\begin{MyRow}
\pspicture[showgrid](3,3)
\psframe*[linecolor=Maroon!30](3,2)
\endpspicture
\end{MyRow}
\Comment{\lipsum[5]}
%=============
\end{MyTable}
%\end{landscape}
%Landscape stops here.
%\pagestyle{plain}
}%
\end{document}
编辑1:
单元格 (1,2) 和单元格 (1,3) 共享的垂直规则行为异常。它不应该是黑色的。:-)
答案1
\documentclass{article}
\usepackage[table]{xcolor}
\begin{document}
\bgroup
\arrayrulecolor{blue!70}
\begin{tabular}{|*6{c|}}\hline
a & b & c & d & e & f\\\hline
a & b & c & d & e & f\\\hline
\end{tabular}
\egroup
\end{document}