1

The page number is in the footer not in the header, I used the answer of @cmhughes in this link and it was good but as it is well known that the ToC may last for 4 or 5 pages not only one, that is, the first page numbering is still in the footer while the other pages were corrected. I need to make the page number of the first page of the ToC to be in the right side of the header. I used this code in the class:

%%%%%%%%%%% Table of Contents started here %%%%%%%%%%%%%%%%%%%

\renewcommand{\contentsname}{TABLE OF CONTENTS}
\addtocounter{secnumdepth}{1}
\setcounter{tocdepth}{6}
\newcounter{dummy}
\newcommand\addtotoc[1]{
\refstepcounter{dummy}
\addcontentsline{toc}{chapter}{#1}}
\renewcommand\tableofcontents{
\btypeout{TABLE OF CONTENTS}

\begin{spacing}{1}{

\setlength{\parskip}{1pt}
\if@twocolumn
  \@restonecoltrue\onecolumn
\else
  \@restonecolfalse
\fi
\chapter{\contentsname
    \@mkboth{
       \MakeUppercase\contentsname}{\MakeUppercase\contentsname}}
\@starttoc{toc}
\if@restonecol\twocolumn\fi
\cleardoublepage
}\end{spacing}
}
%%%%%%%%%%% Table of Contents ended here %%%%%%%%%%%%%%%%%%%

and in the main file of my thesis I used this code:

\fancyhf{}
\fancyhead[R]{\thepage}
\pagestyle{fancy}
\tableofcontents  % Write out the Table of Contents
\cleardoublepage
  • How can I thank you @Werner :) , thank you very much, it is working very good, thanks – Montadar Jul 9 '13 at 16:43
0

By default, \chapters set their first pages in the plain page style using \thispagestyle{plain}. A crude yet feasible solution would be to include

\let\ps@plain\ps@fancy% Plain page style = Fancy page style

as part of your redefinition of \tableofcontents. This overwrites the plain page style (stored in \ps@plain) with that of fancy (stored in \ps@fancy). Placing it inside a group will localize the change.

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.