[Tex/LaTex] How to change the appearance of `listof` headers

header-footertable of contentstocbibind

I'm an amateur user of LaTeX and I'm writing my PhD thesis using a template that I found in: PhDtemplateLATEX

Looking inside Classes/CUEDthesisPSnPDF.cls, I found that it uses fancyhdr for the customization of headers and footers. Specifically:

\pagestyle{fancy} 
\renewcommand{\chaptermark}[1]{\markboth{\MakeUppercase{\thechapter. #1 }}{}}    
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}   
\fancyhf{}    
\fancyhead[RO]{\bfseries\rightmark}    
\fancyhead[LE]{\bfseries\leftmark}    
\fancyfoot[C]{\thepage}    
\renewcommand{\headrulewidth}{0.5pt}    
\renewcommand{\footrulewidth}{0pt}    
\addtolength{\headheight}{0.5pt}    
\fancypagestyle{plain}{    
  \fancyhead{}    
  \renewcommand{\headrulewidth}{0pt}    
}

I have changed it, because I wanted the headers and footers with "small caps" style and "scriptsize" size.

The problem appears in the header of the frontmatter (the footer is ok), I mean: the table of contents, the list of figures and the list of tables. In this case, the header appears with bolded capitals, and I would want the same format of the rest of the document.

I've tried to change it introducing the "markboth" command in the following way:

\frontmatter    
\setcounter{secnumdepth}{3} % organisational level that receives a numbers    
\setcounter{tocdepth}{3}    % print table of contents for level 3    

\tableofcontents            % print the table of contents    
\markboth{\sc {\scriptsize \contentsname}}{\sc {\scriptsize \contentsname}}    

\listoffigures  % print list of figures    
\markboth{\sc {\scriptsize \listfigurename}}{\sc {\scriptsize \listfigurename}}

\listoftables  % print list of tables    
\markboth{\sc {\scriptsize \listtablename}}{\sc {\scriptsize \listtablename}}

… and it works, if the list has two pages. If the list has more than two pages, the last two pages have the desired format, but the rest of pages have the original format. For example, if the table of contents has six pages, the first page has no header (that's ok), pages 2-4 have the original format, and pages 5-6 have the desired format. This occurs with the table of contents and the list of figures (with the list of tables I haven't problems yet, because, for now, it has only two pages).

So… what can I do?

I will appreciate any help. Thanks.

————————————–EDIT—————————————-

Ok, I've tried the suggestion of @Johannes_B and my document has improved, but the problem is not completely solved.

Specifically, I've modified (using package etoolbox):

\frontmatter
\patchcmd{\tableofcontents}{%
  {\MakeUppercase\contentsname}{\MakeUppercase\contentsname}%
}{
{\scriptsize {\sc \contentsname}}{\scriptsize {\sc \contentsname}}%
}
{}{}

\patchcmd{\listoffigures}{%
  {\MakeUppercase\listfigurename}{\MakeUppercase\listfigurename}%
}{
{\scriptsize {\sc \listfigurename}}{\scriptsize {\sc \listfigurename}}%
}
{}{}

\patchcmd{\listoftables}{%
  {\MakeUppercase\listtablename}{\MakeUppercase\listtablename}%
}{
{\scriptsize {\sc \listtablename}}{\scriptsize {\sc \listtablename}}%
}
{}{}

\setcounter{secnumdepth}{3} % organisational level that receives a numbers
\setcounter{tocdepth}{3}    % print table of contents for level 3

\tableofcontents
\listoffigures
\listoftables

In the case of the table of contents, the header appears exactly as I want it: In scriptsize and small caps, so this is a great improvement. But, in the case of the list of figures and the list of tables, I have no changes: The headers are still in normal size and bolded capitals.

Any suggestions? Thanks.

Best Answer

After a bit of Sherlock Holmes deduction power the whole thing comes down a a very basic example and a very straight forward solution. The template file uses package tocbibind to print the \listofs and bibliography to the table of contents. tocbibind provides a hook that we can redefine without patching any stuff.

I defined a new macro to define the appearance called \listheaderfont. It is red now just to demonstrate. This has a huge advantage, all instances use this macro, so changing this changes the document in a more consistent way.

\documentclass{book}
\usepackage{tocbibind}
\usepackage{xcolor}
%defining the apperance of the listheaders
\newcommand{\listheaderfont}{\scriptsize\normalfont\scshape\color{red}}
\renewcommand{\tocetcmark}[1]{
\markboth{\listheaderfont #1}{\listheaderfont #1}}
\usepackage{pgffor}
\begin{document}

\tableofcontents
\listoffigures
\listoftables

\begin{table}\foreach \n in {1,...,70} {\caption{}}
\end{table}
\begin{figure}\foreach \n in {1,...,70} {\caption{}}
\end{figure}

\nocite{aristotle:physics}
\bibliographystyle{plain}
\bibliography{biblatex-examples}
\clearpage Look at the header
\end{document}

We can do this for the standard classes as well, again using a helper macro. This time, no handy package provides a hook we can use. We have to patch the stuff by hand.

\documentclass{book}
%defining the apperance of the listheaders
\newcommand{\listheaderfont}{\scriptsize\normalfont\scshape\color{red}}

\usepackage{etoolbox}
\usepackage{xcolor}
\patchcmd{\tableofcontents}{%
    {\MakeUppercase\contentsname}{\MakeUppercase\contentsname}%
}{
    {\listheaderfont \contentsname}{\listheaderfont \contentsname}%
}
{}{}

\patchcmd{\listoffigures}{%
    {\MakeUppercase\listfigurename}{\MakeUppercase\listfigurename}%
}{
    {\listheaderfont \listfigurename}{\listheaderfont \listfigurename}%
}
{}{}

\patchcmd{\listoftables}{%
    {\MakeUppercase\listtablename}{\MakeUppercase\listtablename}%
}{
    {\listheaderfont \listtablename}{\listheaderfont \listtablename}%
}
{}{}
\usepackage{pgffor}
\begin{document}

\tableofcontents
\listoffigures
\listoftables

\begin{table}\foreach \n in {1,...,70} {\caption{}}
\end{table}
\begin{figure}\foreach \n in {1,...,70} {\caption{}}
\end{figure}


\end{document}
Related Question