Page LayoutModify header rule length and maintain consistency

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
jordi
Posts: 2
Joined: Sun Dec 06, 2009 3:10 pm

Modify header rule length and maintain consistency

Post by jordi »

Hello,

I'm typesetting a book and there's a page layout question that I'm unable to find out how to implement. I've been modifying certain commands and environments of the book class in order to set a header rule length different from the default size (which is a length equal to \textwidth and a thickness (actually named by LaTeX as "width")). I have tried almost every aspect of fancyhdr.sty (headoffset, headrule, etc.) but I cannot get what this fake images illustrate

Left-odd page:
Left-odd page.
Left-odd page.
lo.png (10.4 KiB) Viewed 13748 times
Right-even page:
Right-even page.
Right-even page.
re.png (24.79 KiB) Viewed 13748 times
Note that I use a symmetrical (sidemargin from odd to even differs) twoside layout.

I'd appreciate some help.
Thanks ppl.

Recommended reading 2024:

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

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

Modify header rule length and maintain consistency

Post by localghost »

Actually the fancyhdr package offers all the resources to get this work. The inner offset of the head rule has to be shortened by half of the text width. A possible solution is shown below.

Code: Select all

\documentclass[11pt,a4paper,english]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{fancyhdr}
\usepackage{blindtext}
\usepackage{arev}
\usepackage{microtype}

\fancyhf{}
\fancyhead[LE,RO]{\bfseries\thepage}
\fancyhead[LE]{\small Author Name}
\fancyhead[RO]{\small Compilation Title}
\fancyfoot[LE,RO]{\thepage}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0pt}
\fancyheadoffset[RE,LO]{-0.5\textwidth}
\pagestyle{fancy}

\begin{document}
  \Blinddocument
\end{document}
Note that the reduction of the head width lets you no more place any contents in the inner header of the pages.


Best regards and welcome to the board
Thorsten
jordi
Posts: 2
Joined: Sun Dec 06, 2009 3:10 pm

Re: Modify header rule length and maintain consistency

Post by jordi »

I tried different ways to use the \textwidth parameter, but not this... (imho, it is sometimes confusing to use certain parameters inside commands correctly).

Thanks localghost.
Post Reply