I am using the fancyhdr package and I want to have a thicker line under my header and I want to have it colored, but my problem is, that this 2 commands:
\renewcommand{\headrule}{\vbox to 0pt{\hbox
to\headwidth{\textcolor{headercolor}{\hrulefill}}\vss}}
\renewcommand{\headrulewidth}{2pt}
Do not work together? So how can I get a more thicker line which is also colored?
Here is the complete code:
\documentclass{book}
\usepackage{geometry}
\geometry{left=4cm,right=3cm, top=2cm, bottom=2cm}
\usepackage{titlesec}
\titlespacing*{\chapter}{0pt}{-30pt}{20pt}
\titleformat{\chapter}[display]{\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}
\usepackage[ngerman]{babel}
\usepackage{mathptmx}
\usepackage{helvet}
\usepackage{wallpaper}
\usepackage{color}
\usepackage[final]{pdfpages}
\usepackage{xcolor,bookmark}
\usepackage{scrextend}
\usepackage{titlepic}
\usepackage{shorttoc}
\usepackage{courier}
%\usepackage{titlesec}
%\usepackage[titles]{tocloft}
\usepackage{type1cm}
\usepackage{zref-abspage}
\usepackage{makeidx}
\usepackage{graphicx}
\usepackage{multicol}
\usepackage{thmbox}
\usepackage{shadethm}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{marginnote}
%\usetocstyle{KOMAlike}
\usepackage{wrapfig}
\usepackage{paralist}
\usepackage{amssymb}
\usepackage[framemethod=tikz]{mdframed}
\usepackage{ulem}
\usepackage{fancyheadings}
%\usepackage{sectsty}
\definecolor{headercolor}{rgb}{0.6941,0.6745,0.4863}
\begin{document}
\mainmatter%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\include{part1}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[L]{ \textcolor{headercolor}\leftmark \text{ }\textcolor{headercolor}{\thesection}}
\fancyhead[R]{\textcolor{headercolor}{\thepage}}
%\renewcommand{\headrule}{\vbox to 0pt{\hbox
%to\headwidth{\textcolor{headercolor}{\hrulefill}}\vss}}
\renewcommand{\headrulewidth}{2pt}
test test\\ test test
\end{document}
Best Answer
You need to incorporate
\headrulewidth
inside your redefinition of\headrule
, since\hrulefill
uses a different width rule:Here's an informal MWE that uses the above technique to construct the page style
myheader
: