12

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.

3 Answers 3

11

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.

7
  • 1
    @Herbert I have a table of contents of 3 pages and so your suggestion just helped get the word page on the 2nd page of TOC and not on the 3rd page. Is there any other solution to this problem? Sep 11, 2015 at 14:34
  • @ShraySharan: Add the line \addtocontents{toc}{\protect\afterpage{~... again where the second page break appears in your document
    – user2478
    Sep 11, 2015 at 14:37
  • @Herbert And what change should i make in the command if I want to add the word Page in the List of figures as well Sep 11, 2015 at 14:59
  • \addtocontents{lof}{... the first argument is the file extension, in this case ListOfFigures. See my edited answer
    – user2478
    Sep 11, 2015 at 15:02
  • @Herbert Thanks a lot... And with this my document is complete... I had another question... I just used the 2nd command out of the 2 commands that you mentioned and the word page was added in both toc and lof. Could you please explain what each of these 2 commands do in the document? Sep 11, 2015 at 15:24
4

You can use the tocloft package to customize the layout of the table of contents, list of figures, list of tables, etc.

\documentclass{article}
\usepackage{tocloft}
\renewcommand\contentsname{Table of Contents}
\renewcommand\cfttoctitlefont{\hfill\normalsize\bfseries}
% On the same line
%\renewcommand\cftaftertoctitle{\hfill\llap{\bfseries Page}}
% On the next line
\renewcommand\cftaftertoctitle{\hfill\null\\\null\hfill\textbf{Page}}
\begin{document}
\tableofcontents
\section{asdf}
\section{qwer}
\section{zxcv}
\end{document}

The commented out line should be used if you want the Page to appear on the same line as Table of Contents and the uncommented line should be used if you want it to be on the next line.

You can also add the dot leaders to sections (or chapters, if you're using chapters) with

\renewcommand\cftsecdotsep{\cftdotsep}

or

\renewcommand\cftchapdotsep{\cftdotsep}
4
  • Hmm, when I \usepackage{tocloft}: ! LaTeX Error: Command \c@lofdepth already defined. Or name \end... illegal, see p.192 of the manual. I am guessing this comes down to something from the cls file... Jan 5, 2011 at 14:36
  • 1
    per this thread: mail-archive.com/[email protected]/msg16706.html, if \usepackage[subfigure]{tocloft} is called, things work fine. Unfortunately, this solution seems to still only place 'Page' on the first page of the TOC, and nothing else. Also for some reason it is killing the pagebreak between the TOC and LOF and is altering the fonts and layout of the front matter significantly. Jan 5, 2011 at 14:52
  • @mrdillon: Ah, I misunderstood. I thought you only wanted it at the top. Herbert's approach seems like a good approach. tocloft allows a fair bit of customization, so it doesn't surprise me that it changes the layout, but it gives you a uniform way to change the layout.
    – TH.
    Jan 5, 2011 at 20:38
  • @mrdillon: You should be using the subfig package instead of the older subfigure. Then there's no need to use the subfigure option to tocloft.
    – TH.
    Jan 5, 2011 at 20:47
0

Hey, as it turns out we go to the same school, and are dealing with the same uafthesis bugs! I've been fixing mine on github at http://github.com/jesusabdullah/uafthesis.

Fwiw, I read the handbook, and it says we only need "page" above the first page, from what I can tell.

1
  • From the 09/10 Handbook: 4.10 Table of Contents The title block “Table of Contents” must appear at the upper margin of the first page and be centered. The title block is not repeated on any subsequent pages. Dotted leaders are preferred between headings and page numbers. The word “Page” should be typed above the listing of the page numbers on each page of the Table of Contents. May 11, 2011 at 4:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .