Hello!
I need to create a 4-column table with the horizontal rule for the second row having the following feature:
for column 1 the horizontal rule must be blue in color while for the next 3 columns it must be black. Is there a way to achieve this with LaTeX? A solution with \hhline will be most helpful, but any other are welcome as well.
Thank you all in advance.
Regards, Martin
Graphics, Figures & Tables ⇒ custom color for parts of the horizontal rule in tabular
NEW: TikZ book now 40% off at Amazon.com for a short time.
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
custom color for parts of the horizontal rule in tabular
The colortbl manual (Section 9 — More fun with \hhline, p. 6) introduces a concrete example. Furthermore it mentions something like below.
Adapting the code to your needs should be no big deal.
Thorsten
Code: Select all
\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[dvipsnames,table]{xcolor} % »table« optons loads »colortbl« package
\begin{document}
\begin{tabular}{*4c}\arrayrulecolor{blue}\cline{1-1}\arrayrulecolor{black}\cline{2-4}
Table Head & Table Head & Table Head & Table Head \\\arrayrulecolor{blue}\cline{1-1}\arrayrulecolor{black}\cline{2-4}
Some Values & Some Values & Some Values & Some Values \\
Some Values & Some Values & Some Values & Some Values \\
Some Values & Some Values & Some Values & Some Values \\ \arrayrulecolor{blue}\cline{1-1}\arrayrulecolor{black}\cline{2-4}
\end{tabular}
\end{document}
Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
custom color for parts of the horizontal rule in tabular
localghost,
Thank you very much for your reply. Actually, I rather need a solution with \hhline than with cline. I read thoroughly the documentation for colortbl, but obviously I am missing something. Here is a minimal working example that I think should work, but it doesn't:
Here I want to create a 2x2 table with the horizontal rule for the first column black and for the second - blue. There are simply no rules printed, however. Any ideas?
Regards,
Martin
Thank you very much for your reply. Actually, I rather need a solution with \hhline than with cline. I read thoroughly the documentation for colortbl, but obviously I am missing something. Here is a minimal working example that I think should work, but it doesn't:
Code: Select all
\documentclass[utf8]{beamer}
\mode<presentation>
{ \usetheme{Darmstadt}
\setbeamercovered{transparent}
}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage{hhline}
\usepackage{colortbl}
\usepackage{helvet}
\usepackage{array}
\begin{document}
\begin{frame}[plain]{}
\newcommand\rainbowline{
\hhline{%
>{\arrayrulecolor{black}}-%
>{\arrayrulecolor{blue}}-%
}}
\begin{tabular}{*2{>{\columncolor[gray]{1}}c}}
\rainbowline
1&2 \\
\rainbowline
bla & bla \\
\rainbowline
\end{tabular}
\end{frame}
\end{document}
Regards,
Martin