[Tex/LaTex] Add ‘Page’ above page numbers in Table of Contents

sectioningtable of contents

I am using my school's latex cls file. Unfortunately, since this package was last updated, we are now required to add the word 'Page' above the topmost page number on each page of the Table of Contents. This cls file includes the following bit of code, which puts 'Page' at the top of the first page, but not any subsequent pages (see attached)

\newcommand\chapteruaf{
\if@arabic\relax\else\if@chapterone\setcounter{page}{1}\else\relax\fi\fi
\@chapteronefalse
                    \if@openright\cleardoublepage\else\clearpage\fi
                    \thispagestyle{myheadings}%                                                                               
                    \global\@topnum\z@
                    \@afterindentfalse
                    \secdef\@chapter\@schapteruaf}
\def\@schapteruaf#1{\if@twocolumn
                   \@topnewpage[\@makeschapterheaduaf{#1}]%                                                                   
                 \else
                   \@makeschapterheaduaf{#1}%                                                                                 
                   \@afterheading
                 \fi}
\def\@makeschapterheaduaf#1{%                                                                                                 
  {\parindent \z@ \centering
    \reset@font
    \normalsize \bfseries  #1\par                                                                                             
    \vspace{-18.3pt}\hspace{143mm} Page                                                                                       
    \nobreak
  }}

First page of the TOC:
alt text

second page of the TOC:
alt text

Any thoughts here? I have played with this a bit, and can't get it to work. Thanks.

Best Answer

A table of contents is often less than 3 pages so you can simply insert the command into the toc file. With the package afterpage you do not have to know where the pagebreak will happen:

\documentclass[a5paper]{article}
\usepackage{afterpage}
\begin{document}

\tableofcontents

\addtocontents{toc}{~\hfill\textbf{Page}\par}
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\addtocontents{toc}{\protect\afterpage{~\hfill\textbf{Page}\par\medskip}}
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage

\end{document}

For other lists, eg List of Figures, use

\addtocontents{lof}{~\hfill\textbf{Page}\par}
...
\addtocontents{lof}{\protect\afterpage{~\hfill\textbf{Page}\par\medskip}}

and so on.

Related Question