Page LayoutHeader/Footer Problem

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

Header/Footer Problem

Post by gdickens »

I am working on a book that needs a header and footer on every page, including the opening chapter page. The left-hand page needs to have the word "CHAPTER" and the chapter number; the right-hand side page needs to have the chapter title only (no uppercase). The problem I am having is that the chapter title in the right-hand header is all uppercase. Also, I do not know how to get the header on the opening chapter page. This is what I have been using:

\usepackage{fancyhdr}
\setlength{\headheight}{15pt}

\pagestyle{fancy}
\fancyhf{}
\fancyfoot{}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\fancyhead[RO]{\series \nouppercase \leftmark}
\fancyhead[LE]{\series {\MakeUppercase\chaptername \ \thechapter} \rightmark}
\fancyfoot[LE,RO]{\thepage}


Any help you can provide would be greatly appreciated!

Recommended reading 2024:

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

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

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Header/Footer Problem

Post by localghost »

I'd prefer the titlesec package for customizing pages styles because it is more flexible than fancyhdr. If I understood you right, the code below should do what you want.

Code: Select all

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

\newpagestyle{main}{%
  \sethead[\MakeUppercase{\chaptername}\quad\thechapter][][]{}{}{\chaptertitle}
  \setfoot[\thepage][][]{}{}{\thepage}
  \headrule
}
\assignpagestyle{\chapter}{main}
\pagestyle{main}

\begin{document}
  \Blinddocument
\end{document}
The titlesec package offers much more stuff which is explained in its manual.


Best regards and welcome to the board
Thorsten
Post Reply