How to change the title of ToC?
How you change the title of the table of contents depends on if you're using the babel
package or not.
Without babel or polyglossia
You can change the name of the table of contents by redefining \contentsname
as the following illustrates:
\documentclass{article}
\renewcommand{\contentsname}{Whatever}
\begin{document}
\tableofcontents
\section{Section}
\subsection{Subsection}
\end{document}
With babel or polyglossia
If you use either the babel
or polyglossia
package you'll have to change the name for the particular language you use with babel or polyglossia. Say that you load babel or polyglossia with english
, then you do the following:
\documentclass{article}
\usepackage[english]{babel}
\addto\captionsenglish{% Replace "english" with the language you use
\renewcommand{\contentsname}%
{Whatever}%
}
\begin{document}
\tableofcontents
\section{Section}
\subsection{Subsection}
\end{document}
Either way you'll end up with the following result:
An alternative to N.N's solution that some might prefer if they're using the Memoir
class is to redefine \printtoctitle
instead of changing \contentsname
directly. The reason for this is that often (and apparently by default) the ToC will list a reference to its own page within itself, and it will use \contentsname
for both the ToC title and the reference, which can produce a jarring discontinuity of style with other chapter listings within the ToC.
With printtoctitle
you can avoid this problem, since as described on page 147 of the Memoir manual, it's used to call \contentsname
during ToC title creation, so you can shift all the formatting there instead.
Here's an example:
\documentclass[openany]{memoir}
\usepackage{memsty}
% This works well.
\renewcommand{\printtoctitle}[1]{\Huge\sffamily #1}
% This won't work well.
%\renewcommand{\contentsname}{\Huge\sffamily Contents}
\begin{document}
\tableofcontents
\chapter{Foo}
\end{document}