I am encountering a weird problem.

I've been trying to get a header into my Contents page. For reason using \thispagestyle{fancy} along with \usepackage{fancyhdr} in the preamble does not "recognize" my first page of the table of contents. Not only is the header missing, but the page number in the table of contents starts with Page number IV although the contents page starts at III. Do you have any idea what I might be doing wrong? Please find my code below:

%% Language and font encodings


{\centering\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{0.5em}{}


%% Sets page size and margins


%% Useful packages
\usepackage[colorlinks=true, allcolors=black]{hyperref}
% For Tables: 


\usepackage{array, makecell}
%Chinese Language packets


\title{some title}
% Update supervisor and other title stuff in title/title.tex





\addcontentsline{toc}{chapter}{List Of Tables\dotfill}

\addcontentsline{toc}{chapter}{List of Figures\dotfill}
  • 1
    Please extend your example to a full (there is no document class), self contained example (you are using \input on files we do not have access to, so we cannot test your code)
    – daleif
    Dec 21, 2021 at 10:59

1 Answer 1


The problem is with this line:


You do the \thispagestyle{fancy} after the tableofcontents, so it affects only the last page of it. And then you add "Contents\dotfill" to the ToC, but then it is already on the last page, so you will get that page number.

Replace that line with the following:

  • Thanks a lot!!! Worked like a charm! I did try this actually but I was missing the \newpage command :-/.
    – Kayoshin
    Dec 21, 2021 at 14:35
  • Yes, you should always make sure that you are on the proper page before making changes to the page style (and other page related stuff, like using the current page number in the ToC). Dec 21, 2021 at 15:08

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.