GeneralHeading Rule Color

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
jspencer46
Posts: 1
Joined: Thu Nov 20, 2008 9:29 pm

Heading Rule Color

Post by jspencer46 »

I am trying to set a colored rule in the heading. I found some macro code that put me on the \renewcommand{\headrule} trail, but I cannot get it to work. Rule still prints black. Here is what I am using:

\documentclass[10pt]{article}
\usepackage{graphicx} % Figure manipulation
\usepackage{color}
\usepackage[plain, headings]{nccfancyhdr}
\definecolor{heading}{rgb}{0.106,0.147,0.203}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{2pt}
\makeatletter
\renewcommand{\headrule}{
\setlength\@tempdima{\headrulewidth}
\textcolor{heading}{\hrule\@height\@tempdima\@width\headwidth}
\vskip -2\@tempdima}
\makeatother

\begin{document}
Sample Text.
\end{document}

Can anyone help correct this code, or point me in another (better) direction? Thanks!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Heading Rule Color

Post by gmedina »

Hi,

your code produces the expected result; at least on my system. Maybe the color that you are defining is too close to black that you do not appreciate the difference; try

Code: Select all

\definecolor{heading}{rgb}{0.5,1,0}
instead of

Code: Select all

\definecolor{heading}{rgb}{0.106,0.147,0.203}
the rule now should be "greenish". The documentation of the xcolor package (by the way, I would also suggest you to use xcolor instead of color) contains some useful information about defining colors.

If the problem persists, please let us know.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Post Reply