Randy Yates
2004-10-26 15:39:08 UTC
Hi,
I'm trying to fancy up my tables a bit by adding color and I've run
into a snag. If I use the standard \rowcolors command, the result
is that the color extends outside my black ruled borders. I know
the reason - my "borders" are not really border but rules in a
column in which I've suppressed the intercolumn spacing with @{}.
I can't see a way to get both colors and vertical border rules.
Suggestions would be welcomed.
Here's a short LaTeX source file illustrating the problem:
\documentclass[10pt]{article}
\usepackage{colortbl}
\usepackage{xcolor}
% Fat and skinny vertical and horizontal rules, for tables that need lines
\newlength{\fattablelinesize}
\setlength{\fattablelinesize}{1.5pt}
\newlength{\skinnytablelinesize}
\setlength{\skinnytablelinesize}{0.3pt}
\newcommand{\Vr}{\vrule width \fattablelinesize}
\newcommand{\vr}{\vrule width \skinnytablelinesize}
\newcommand{\Hr}{\noalign{\hrule height \fattablelinesize}}
\newcommand{\hr}{\noalign{\hrule height \skinnytablelinesize}}
\begin{document}
\section{Colored Table Test}
\rowcolors[\hr]{2}{green!25}{red!25}
\begin{table}[htb]
\vskip\smallskipamount
\begin{center}
\leavevmode
\begin{tabular}{@{}l@{\hspace{\tabcolsep}}c@{\hspace{\tabcolsep}}c@{\hspace{\tabcolsep}}cl@{}}
\noalign{\hrule height 1.5pt}
\Vr & {\bf Root Index} & \Vr & {\bf Root} & \Vr \\
\Hr
\Vr & 1 & \vr & 1.00 & \Vr \\
\hr
\Vr & 2 & \vr & 2.03 & \Vr \\
\hr
\Vr & 3 & \vr & 3.20 & \Vr \\
\hr
\Vr & 4 & \vr & 8.09 & \Vr \\
\Hr
\end{tabular}
\end{center}
\end{table}
\end{document}
I'm trying to fancy up my tables a bit by adding color and I've run
into a snag. If I use the standard \rowcolors command, the result
is that the color extends outside my black ruled borders. I know
the reason - my "borders" are not really border but rules in a
column in which I've suppressed the intercolumn spacing with @{}.
I can't see a way to get both colors and vertical border rules.
Suggestions would be welcomed.
Here's a short LaTeX source file illustrating the problem:
\documentclass[10pt]{article}
\usepackage{colortbl}
\usepackage{xcolor}
% Fat and skinny vertical and horizontal rules, for tables that need lines
\newlength{\fattablelinesize}
\setlength{\fattablelinesize}{1.5pt}
\newlength{\skinnytablelinesize}
\setlength{\skinnytablelinesize}{0.3pt}
\newcommand{\Vr}{\vrule width \fattablelinesize}
\newcommand{\vr}{\vrule width \skinnytablelinesize}
\newcommand{\Hr}{\noalign{\hrule height \fattablelinesize}}
\newcommand{\hr}{\noalign{\hrule height \skinnytablelinesize}}
\begin{document}
\section{Colored Table Test}
\rowcolors[\hr]{2}{green!25}{red!25}
\begin{table}[htb]
\vskip\smallskipamount
\begin{center}
\leavevmode
\begin{tabular}{@{}l@{\hspace{\tabcolsep}}c@{\hspace{\tabcolsep}}c@{\hspace{\tabcolsep}}cl@{}}
\noalign{\hrule height 1.5pt}
\Vr & {\bf Root Index} & \Vr & {\bf Root} & \Vr \\
\Hr
\Vr & 1 & \vr & 1.00 & \Vr \\
\hr
\Vr & 2 & \vr & 2.03 & \Vr \\
\hr
\Vr & 3 & \vr & 3.20 & \Vr \\
\hr
\Vr & 4 & \vr & 8.09 & \Vr \\
\Hr
\end{tabular}
\end{center}
\end{table}
\end{document}
--
Randy Yates
Sony Ericsson Mobile Communications
Research Triangle Park, NC, USA
***@sonyericsson.com, 919-472-1124
Randy Yates
Sony Ericsson Mobile Communications
Research Triangle Park, NC, USA
***@sonyericsson.com, 919-472-1124