Hi, I use package 'fancyhdr' and I noticed that I can add a headrule in the header section. I learned that I can change the thickness of the line, and from fnacyhdr manual, I can change the \headrule from solid line to a dotted line. However, I don't understand the command used in the above change. Now I want to have the \headrule like this.
=========================================
two-line style, solid line, the above one is thicker than the bottom one, with 1pt vertical space in between.
Is this possible to achieve? How to change the \headrule for this purpose?
I've looked up in Internet but I can't find a solution. Please help me. Any comment is appreciated. Thank you.
Page Layout ⇒ Double Rule in Header
Double Rule in Header
Last edited by niner on Fri Aug 12, 2011 2:55 am, edited 1 time in total.
Niner@Taiwan
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
Double Rule in Header
You have to dig in the code of the fancyhdr package and pick up the relevant part for the definition of the rule.
The blindtext package is only for creating dummy text. It is not part of the solution.
Best regards and welcome to the board
Thorsten
Code: Select all
\documentclass[11pt,english]{article}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{fancyhdr}
\usepackage{blindtext}
\makeatletter
\def\headrule{{%
\if@fancyplain\let\headrulewidth\plainheadrulewidth\fi
\hrule\@height\headrulewidth\@width\headwidth\vskip2pt%
\hrule\@height\headrulewidth\@width\headwidth\vskip-\headrulewidth\vskip-4pt
}}
\makeatother
\pagestyle{fancy}
\begin{document}
\blinddocument
\end{document}
Best regards and welcome to the board
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
Double Rule in Header
Thank you Thorsten. Your code solved my problem. I slightly modified the code to generate a double-line, different thickness header and footer. Please find below about the code I used.
Thank you again, Thorsten.
Thank you again, Thorsten.

Code: Select all
\documentclass[11pt,english]{report}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{fancyhdr}
\usepackage{blindtext}
\makeatletter
\def\headrule{{%
\if@fancyplain\let\headrulewidth\plainheadrulewidth\fi
\hrule\@height\footrulewidth\@width\headwidth\vskip1pt%
\hrule\@height\headrulewidth\@width\headwidth\vskip-\headrulewidth\vskip-4pt
}}
%
\def\footrule{{%
\if@fancyplain\let\footrulewidth\plainfootrulewidth\fi
\vskip-\footruleskip\vskip-\footrulewidth
\hrule\@height\headrulewidth\@width\headwidth\vskip1pt%
\hrule\@height\footrulewidth\@width\headwidth\vskip\footruleskip
}}
\makeatother
\pagestyle{fancy}
%
\renewcommand{\headrulewidth}{1.5pt}
\renewcommand{\footrulewidth}{0.5pt}
%
\begin{document}
\blinddocument
\end{document}
Niner@Taiwan
Double Rule in Header
Thanks Thorsten.
Solved my big problem that lasted for days, Mine required two head rules, the top being very thin compared to the thick one at the bottom, so this is what i used to get them into my latex fancy head. I simply added this code to my preamble.
Note the addition of thickness e.g.
Solved my big problem that lasted for days, Mine required two head rules, the top being very thin compared to the thick one at the bottom, so this is what i used to get them into my latex fancy head. I simply added this code to my preamble.
Code: Select all
\def\headrule{{%
\if@fancyplain\let\headrulewidth \plainheadrulewidth \fi
\hrule\@height\headrulewidth height 0.5pt\@width\headwidth\vskip2pt %
\hrule\@height\headrulewidth height 3pt \@width \headwidth\vskip-\headrulewidth\vskip-4pt %height2pt
}}
height 3pt
.