I'm using fancyhdr for editing the header of my document.
I have the following code:
\documentclass[a4paper,12pt,oneside,titlepage]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[italian]{babel}
\usepackage{lmodern}
\usepackage{microtype}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\rhead{\small\bfseries\leftmark\quad\thepage}
\renewcommand{\headrulewidth}{0.4pt}
\fancypagestyle{plain}{
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}}
\renewcommand{\chaptermark}[1]{
\markboth{\thechapter.\ #1}{}}
\begin{document}
\tableofcontents
\markboth{\contentsname}{\contentsname}
\listoftables
\markboth{\listtablename}{\listtablename}
\listoffigures
\markboth{\listfigurename}{\listfigurename}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\chapter{Test}
\end{document}
which correctly display chapter number, chapter name (in lower case), page number and a line below, in the top right corner of each page, except the first of each chapter.
I only have an issue with the table of contents: the second page show "INDEX ii", while the third (correctly) show "Index iii".
Why I have this inconsistency?
Best Answer
I still can't reproduce your problem as you've stated it. I'm now extrapolating what you might be trying to do: I'm assuming you're using a manual
\markboth
command for the table of contents, such as something similar to:and then the
\markboth
command only takes effect on the last page of the table of contents, as one can expect.So, not sure now if I'm answering your question, but speculating: if you don't want the header to be upper cased, you can use the following code:
LaTeX uses
\MakeUppercase
when defining the marks for e.g. the table of contents (you can check inbook.cls
source), so the\renewcommand
makes it now ineffective. The braces ensure that\MakeUppercase
will continue to behave normally in the rest of the document.Also, with the
book
document class, I getContents
in the header, notIndex
as you describe. If you want to change that, you can useBut I'd expect
Index
is usually rather used for a lookup index at the end of the book, with keywords and pages where those terms appear.