2

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.

  • Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user31729 Oct 7 '14 at 13:20
  • Possibly related: \addtocontents at end of document not getting written to .toc file? -- that was when I was trying to get various page styles attached to front matter lists. – Mike Renfro Oct 7 '14 at 13:23
  • Christian, I don't know how to do what you are asking for, sorry. I mean, I don't know how to gather all the information distributed in the main file.tex and the class file. But, in the link of the template, there is a compilable example (with chapters and so on), that could be helpful. – Red Langosta Oct 7 '14 at 14:06
  • Mike, I will read carefully your link, but I need some time to understand it. Thank you anyway. – Red Langosta Oct 7 '14 at 14:09
  • Does this help? tex.stackexchange.com/questions/185310/… – musarithmia Oct 7 '14 at 15:49
2

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}
  • I'm so sorry, but I'm stupid. The class I provided is not exactly the same class I'm using, but a modified version (I haven't realized till now). The class that I'm actually using is: <openwetware.org/wiki/LaTeX_template_for_PhD_thesis. If I use your MWE with Classes/CUEDthesisPSnPDF.cls it works, but If I use your MWE with Latex/Classes/PhDthesisPSnPDF.cls (the class that I'm using) it doesn't work: the header of table of contents is ok, but the header of list of figures and tables are in normal size and bolded capitals. Sorry again and thanks for your patience. – Red Langosta Nov 4 '14 at 11:29
  • I've modified the information of the question with the real template. – Red Langosta Nov 4 '14 at 11:35
  • Please see the updated answer. – Johannes_B Nov 4 '14 at 14:38
  • Ok, using the first solution of your answer (the one that uses tocbibind), the headers of list of figures and tables are correctly modified, but the header of the table of contents has no changes; The second solution (the one that uses etoolbox) modifies the header of the table of contents, but it doesn't change the header of the list of figures/talbes. So, I've combined both solutions: I've used the first solution, adding etoolbox package and the patchmd code related to the table of contents... And the problem is solved! All the headers looks as I want. Thank you very very much. – Red Langosta Nov 4 '14 at 18:46
  • Please compile the first example as it is, is the header of the toc red as well? The template uses the option notoc to not print the toc to the toc (which is a good idea) and hence doens't take control over it. I didn't test this case, sorry. I think, the package should take over. – Johannes_B Nov 5 '14 at 15:51
1

A simple solution not involving any additional packages is the following: Simply redefine \contentsname or \listtablename so that it contains a \lowercase command.

To get the standard names while preserving lowercase headers, use the following definitions:

\renewcommand\contentsname{C\lowercase{ontents}}
\renewcommand\listtablename{L\lowercase{ist of} T\lowercase{ables}}

When passed to the small-caps command, the lowercase characters will be respected.

  • 1
    Thanks, using lowercase made it look right for me. Seems a bit hacky, but thanks a lot! – Carsten Hagemann Aug 28 at 9:34

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.