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!
Page Layout ⇒ Header/Footer Problem
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
Header/Footer Problem
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.
The titlesec package offers much more stuff which is explained in its manual.
Best regards and welcome to the board
Thorsten
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}
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