Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

In the following standard \documentclass{book} all headers are in upper case.

How can I modify the code below to make lower case headers?

The even pages show the chapter number and name, and the odd pages show the section number and name. The first page of a chapter has no header, only the page number in the footer. The other pages show the page numbers on the headers: odd pages on the right and even pages on the left, as shown.

It was created with

\documentclass{book}
\usepackage{lipsum}

\begin{document}

\title{Standard \LaTeX{} Book}
\author{The Author}
\date{The Date}
\maketitle
\tableofcontents

\chapter{Test Chapter One}
\section{Test Section One}
\lipsum[1-6]
\section{Test Section Two}
\lipsum[1-6]
\section{Test Section Three}
\lipsum[1-6]

\chapter{Test Chapter Two}
\section{Test Section One}
\lipsum[1-6]
\section{Test Section Two}
\lipsum[1-6]

\end{document}

Remark: the question Page header - Upper and lower case is not sufficiently similar to this one to help me to find a possible solution by my own.

share|improve this question

2 Answers 2

up vote 13 down vote accepted

This is in my opinion the worse design error in the book class. Not because of the uppercase default (which I consider bad anyway), but because there's no way to easily change it. And the \MakeUppercase is hardwired in the macros.

You can change the behavior by loading the fancyhdr package, and adding

\usepackage{fancyhdr}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{#1}}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE,RO]{\thepage}
\fancyhead[LO]{\itshape\nouppercase{\rightmark}}
\fancyhead[RE]{\itshape\nouppercase{\leftmark}}
\renewcommand{\headrulewidth}{0pt}

to your preamble. You can also load \usepackage{emptypage} to remove headers and footers with the empty pages produced by \cleardoublepage.

The rule below headers is produced by default, so if you want it, comment out the \renewcommand{\headrulewidth}{0pt} line.

Or using a class that provides for changing the default, for instance memoir or scrbook.

share|improve this answer
    
Many thanks! This solves my problem too and replies to the additional question on how to add a headrule. –  Américo Tavares Oct 21 '12 at 17:04
    
Is it possible to change the header from italic to normal, by adding some code? –  Américo Tavares Jun 16 '13 at 13:26
    
@AméricoTavares Just use \normalfont instead of \itshape. –  egreg Jun 16 '13 at 13:30
    
Many thanks! Done, worked as expected. –  Américo Tavares Jun 16 '13 at 13:43

The regexpatch package can help you to remove the \MakeUppercase macros from \tableofcontents and the \chaptermark and \sectionmark macros:

\usepackage{regexpatch}% http://ctan.org/pkg/regexpatch
\makeatletter
% \*patchcmd{<cmd>}{<search>}{<replace>}{<success>}{<failure>}
\xpatchcmd{\chaptermark}{\MakeUppercase}{}{}{}%
\xpatchcmd{\sectionmark}{\MakeUppercase}{}{}{}%
\xpatchcmd*{\tableofcontents}{\MakeUppercase}{}{}{}%
\makeatother

\chaptermark and \sectionmark adds \MakeUppercase to all headings supplied, which is removed by the first two \xpatchcmd commands. \tableofcontents sets its own heading in \MakeUppercase, and is therefore not handled by \chaptermark - the reason for this is that it is actually a \chapter* and requires special attention. \xpatchcmd* does a search-and-replace-all on \MakeUppercase.

share|improve this answer
    
There are other places where the dreadful \MakeUppercase appears; a real case of bad design, IMO. :-( –  egreg Oct 21 '12 at 16:36
    
Many thanks! This solves my problem. To add a headrule does one need to define headers and footers by means of \fancyhf? –  Américo Tavares Oct 21 '12 at 16:43
    
@AméricoTavares: Yes, and I see that egreg already suggested a fancyhdr solution. –  Werner Oct 21 '12 at 17:12
    
Thanks for the confirmation. –  Américo Tavares Oct 21 '12 at 17:16
    
@AméricoTavares Well, one does not need to use \fancyhf, but it is a complicated task, and why do it again if someone else has prepared a nice package for you to use? :) –  yo' Oct 21 '12 at 20:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.