I am finishing up my Master's thesis and need to modify the formatting of the heading for the Table of Contents (TOC). My university's guidelines require "TABLE OF CONTENTS" to appear in all caps in the top-center of the page.

I am working with a modified version of the ucthesis.cls template. The original template defines the TOC as:

[Code A]

\def\tableofcontents{\@restonecolfalse
\if@twocolumn\@restonecoltrue\onecolumn\fi
\chapter*{\contentsname
\@mkboth{\uppercase{\contentsname}}{\uppercase{\contentsname}}
}%
{\ssp\@starttoc{toc}}\if@restonecol\twocolumn\fi}


My workaround to make "TABLE OF CONTENTS" appear correctly has been to rewrite this part of the template as:

[Code B]

\def\tableofcontents{\@restonecolfalse
\if@twocolumn\@restonecoltrue\onecolumn\fi
\clearpage
\begin{center}
\MakeUppercase{\contentsname}
\end{center}
{\ssp\@starttoc{toc}}\if@restonecol\twocolumn\fi}


This works as expected, but removing the \chapter*{} line has the side effect of removing indentations before section and subsection numbers in the TOC, as defined by the following lines of code included in the ucthesis.cls template

\def\l@section{\@dottedtocline{1}{1.5em}{2.3em}}
\def\l@subsection{\@dottedtocline{2}{3.8em}{3.2em}}


Below are the outputs from code snippets A and B, respectively.

I don't have much experience with LaTeX templates or macros and have found it difficult to dig up some documentation on what things like \@mkboth do. If anyone can shed some light on why the TOC needs to be included as a chapter and how I might be able to change the appearance of the header, it would be greatly appreciated--Thanks!

• Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. Feb 21, 2014 at 11:41

Quick fix:

Redefine \contentsname

\renewcommand{\contentsname}{TABLE OF CONTENTS}


and apply a patch to \@makeschapterhead locally only for the ToC, that means, when you have to issue \tableofcontents, write the lines:

{\makeatletter
{\raggedright}
{\centering}
{}
{}
\tableofcontents
\makeatother}


MWE:

\documentclass{ucthesis}

\usepackage{etoolbox}

\begin{document}

{\makeatletter
{\raggedright}
{\centering}
{}
{}
\tableofcontents
\makeatother}

\listoffigures
\listoftables
\chapter{Test}
\section{A section}

\end{document}


Output:

The following redefinition worked for me:

\def\tableofcontents{\@restonecolfalse
\if@twocolumn\@restonecoltrue\onecolumn\fi
%\chapter*{\,%\contentsname
%     \@mkboth{\uppercase{\contentsname}}{\uppercase{\contentsname}}
%    }%
%\clearpage
\begin{center}
\MakeUppercase{\contentsname}
\end{center} \par
%
{\ssp\@starttoc{toc}}\if@restonecol\twocolumn\fi}


I think the \par at the end of the the \center environment did the trick. I appreciate the answer, karlkoeller, but I understand this approach a little bit better and it preserves the \normalsize font for the TABLE OF CONTENTS header that I need.