(edit) Added MWE at the end of the question.
Maybe it has something to do with redefining \thepage?
If so, I don't know how to make sure otherwise that all pages other than ToC, \chapter and \part are in the new fancyhrd style.
I am trying to get rid of the fancyhdr
header (including the page number in my definition) for my table of content, which is 3 pages long.
I've already tried multiple related answers, but none of them seem to work in my case. For example, I tried:
\begingroup
\makeatletter
\let\ps@fancy\ps@emptystyle
\tableofcontents
\clearpage
\endgroup
suggested here, but it doesn't seem to do anything.
I also tried:
\tableofcontents
\thispagestyle{empty}
\addtocontents{toc}{\protect\thispagestyle{empty}}
suggested here, which works in removing the fancyhdr
header from page 1 and 3 of the ToC, but not the second.
Any idea what else can I try to get this working?
\documentclass[11pt, a4paper, final]{report}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{hyperref}
\hypersetup{hidelinks}
\usepackage[capitalise,noabbrev,nameinlink]{cleveref}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead[R]{\thepage}
\fancyhead[L]{\textit{\nouppercase{\leftmark}}}
\fancyfoot{}
\fancypagestyle{plain}{
\fancyhf{}
\fancyhead[R]{\thepage}
\fancyfoot{}}
\begin{document}
\tableofcontents
\thispagestyle{empty}
\addtocontents{toc}{\protect\thispagestyle{empty}}
\setcounter{page}{0}
\Blinddocument
\Blinddocument
\Blinddocument
\Blinddocument
\Blinddocument
\Blinddocument
\Blinddocument
\Blinddocument
\Blinddocument
\Blinddocument
\Blinddocument
\Blinddocument
\Blinddocument
\Blinddocument
\Blinddocument
\Blinddocument
\Blinddocument
\Blinddocument
\Blinddocument
\Blinddocument
\end{document}
Best Answer
If you can load package tocbasic, then you can use
Note that
tocbasic
can not be used together withtocloft
.Code: