2

I have employed fancyhdr to modify the headers of the chapters and sections to fit my taste. They are now written in lower case and alternate on even and odd pages:

\documentclass[a4paper]{book}
\usepackage[finnish]{babel}

\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\fancyhead{} % clear all header fields
\fancyfoot{} % clear all footer fields.
\fancyhead[LE]{\textsl{\leftmark}}   % L = left;  E = even pages
\fancyhead[RO]{\textsl{\rightmark}}  % R = right; O = odd pages
\fancyhead[RE]{\thepage}             % R = right; E = even pages
\fancyhead[LO]{\thepage}             % L = left;  O = odd pages

\begin{document}
\tableofcontents
\chapter{Xxx}
\section{Yyy}
\section{Yyy}
\section{Yyy}
\chapter{Xxx}
\section{Yyy}
\section{Yyy}
\section{Yyy}
\chapter{Xxx}
\section{Yyy}
\section{Yyy}
\section{Yyy}
\chapter{Xxx}
\section{Yyy}
\section{Yyy}
\section{Yyy}
\chapter{Xxx}
\section{Yyy}
\section{Yyy}
\section{Yyy}
\chapter{Xxx}
\section{Yyy}
\section{Yyy}
\section{Yyy}
\chapter{Xxx}
\section{Yyy}
\section{Yyy}
\section{Yyy}
\chapter{Xxx}
\section{Yyy}
\section{Yyy}
\section{Yyy}
\chapter{Xxx}
\section{Yyy}
\section{Yyy}
\section{Yyy}
\chapter{Xxx}
\section{Yyy}
\section{Yyy}
\section{Yyy}
\chapter{Xxx}
\section{Yyy}
\section{Yyy}
\section{Yyy}
\chapter{Xxx}
\section{Yyy}
\section{Yyy}
\section{Yyy}
\section{Yyy}
\section{Yyy}
\section{Yyy}
\chapter{Xxx}
\section{Yyy}
\section{Yyy}
\section{Yyy}
\chapter{Xxx}
\section{Yyy}
\section{Yyy}
\section{Yyy}
\chapter{Xxx}
\section{Yyy}
\section{Yyy}
\section{Yyy}
\chapter{Xxx}
\section{Yyy}
\section{Yyy}
\section{Yyy}
\chapter{Xxx}
\section{Yyy}
\section{Yyy}
\section{Yyy}
\chapter{Xxx}
\section{Yyy}
\section{Yyy}
\section{Yyy}
\chapter{Xxx}
\section{Yyy}
\section{Yyy}
\section{Yyy}
\end{document}

The headers on the table of contents pages are still in uppercase. How can I extend my mofifications to apply the table of contents pages in full as well? I have included the call to babel in case it matters.

2

Use no \nouppercase which is provided by fancyhdr for the header and footer fields:

\documentclass[a4paper]{book}
\usepackage[finnish]{babel}

\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\fancyhf{} % clear all header and footer fields
\fancyhead[LE]{\textsl{\nouppercase{\leftmark}}}%<- changed
\fancyhead[RO]{\textsl{\nouppercase{\rightmark}}}%<- changed
\fancyhead[RE]{\thepage}
\fancyhead[LO]{\thepage}

\usepackage{lipsum}% only for dummy text
\begin{document}
\tableofcontents
\chapter{Xxx}
\section{Yyy}
\lipsum[1-50]
\end{document}

enter image description here

0

You can add this to your preamble:

\makeatletter
\renewcommand\tableofcontents{%
 \if@twocolumn
 \@restonecoltrue\onecolumn
 \else
 \@restonecolfalse
 \fi
 \chapter*{\contentsname
 \@mkboth{%
 \contentsname}{\contentsname}}%
 \@starttoc{toc}%
 \if@restonecol\twocolumn\fi
 }
\makeatother

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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