1

I used the following package and commands to change the headers of my thesis, so to remove the default uppercaseness and make them look nice:

\documentclass[12pt, a4paper]{book}

\usepackage{fancyhdr}

\pagestyle{fancy}\addtolength{\headwidth}{20pt} 
\renewcommand{\chaptermark}[1]{\markboth{\thechapter.\ #1}{}} 
\renewcommand{\sectionmark}[1]{\markright{\thesection \ #1}{}} 
\cfoot{} 

\begin{document}
\frontmatter

\tableofcontents
\listoffigures
\listoftables

\mainmatter
\chapter{Introduction}

\chapter{Second chapter}

\end{document}

In the example, the header of chapter 1 looks nice; however, these commands do not affect the Contents headers (and neither those of the List of Figures and List of Tables sections), that remain written in capital letters. How can I fix this?

  • Can you show us (i) what document class you are using and (ii) how you produce your bibliography and table of contents? Ideally you would show us a minimal example document that we can just copy, paste and compile, see tex.meta.stackexchange.com/q/228/35864 – moewe Sep 5 '18 at 20:36
  • Sorry, I'm quite new to this, I'll edit the post now – Mary Sep 5 '18 at 20:52
2

This is because the ToC/LoF/LoT all explicitly issue a \MakeUppercase as part of setting the headers. For example, here's the definition of \tableofcontents from book.cls:

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

\listofofigures and \listoftables have similar \MakeUppercases. You can restrict the workings of \MakeUppercase on these \...name macros by making them robust (etoolbox provides \robustify). That is, add the following to your preamble:

\usepackage{etoolbox}

\robustify\contentsname
\robustify\listfigurename
\robustify\listtablename

If you're loading \usepackage[<language>]{babel}, the following might be a viable alternative to the above solution:

\let\oldtableofcontents\tableofcontents
\renewcommand{\tableofcontents}{{%
  \let\MakeUppercase\relax
  \oldtableofcontents
}}
\let\oldlistoffigures\listoffigures
\renewcommand{\listoffigures}{{%
  \let\MakeUppercase\relax
  \oldlistoffigures
}}
\let\oldlistoftables\listoftables
\renewcommand{\listoftables}{{%
  \let\MakeUppercase\relax
  \oldlistoftables
}}

The intent is to set \MakeUppercase to do nothing (\relax) within a grouped call to set the ToC/LoF/LoT.

  • I noticed your suggestion perfectly works, unless, in the long list of packages I'm using in my thesis, I add the following: \usepackage[english]{babel}. For some weird reason I really don't get, it is like adding this line nullifies the previous command you suggested, restoring the uppercaseness. Do you know why? – Mary Sep 6 '18 at 9:12
  • @Mary: Try with the added solution at the end of my answer. It works on my end. – Werner Sep 6 '18 at 15:40

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.