Document ClassesChange TOC Heading

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
nettel
Posts: 14
Joined: Wed Oct 08, 2008 11:25 pm

Change TOC Heading

Post by nettel »

im using \usepackage{titletoc} to generate table of contents and my document class is "article". This gives a default heading for the toc as "Contents". I want to change this heading to "Table of Contents" instead. How can i do this? Sample code attached.

cheers

Code: Select all

\documentclass[a4paper]{article}
\usepackage{titletoc}

\begin{document}
\begin{center}
\tableofcontents
\end{center}
\section{Introduction}\label{intro}
\subsection{Background}
\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Change TOC Heading

Post by localghost »

You have to redefine the internal name of the ToC.

Code: Select all

\renewcommand{\contentsname}{Table of Contents}
This solution is independent of titletoc or any other package that modifies the ToC.



Best regards
Thorsten¹
nettel
Posts: 14
Joined: Wed Oct 08, 2008 11:25 pm

Re: Change TOC Heading

Post by nettel »

Thanks for the reply worked a treat.
LineEB
Posts: 3
Joined: Thu Dec 18, 2008 12:24 am

Re: Change TOC Heading

Post by LineEB »

I have a similar problem. But I can't get the \renewcommand{\contentsname}{Indholdsfortegnelse} to work. I am using [danish]{babel}.

I have the same problem with the glossary.

In the glossary I have a problem with the header, I get the word 'gloseliste' in the header of the first page of the glossary and on all the following pages. I simply want it to disappear.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Change TOC Heading

Post by localghost »

LineEB wrote:I have a similar problem. But I can't get the \renewcommand{\contentsname}{Indholdsfortegnelse} to work. I am using [danish]{babel}. [...]
When using the babel, renaming works slightly different.

Code: Select all

\addto{\captionsdanish}{%
  \renewcommand{\contentsname}{Indholdsfortegnelse}
}
Other redefinitions go there in the same way.
LineEB wrote:I have the same problem with the glossary.

In the glossary I have a problem with the header, I get the word 'gloseliste' in the header of the first page of the glossary and on all the following pages. I simply want it to disappear.
It is necessary to know the way you create your glossary. If you do that with the glossaries package, there is an important hint in Section 8 (Multilingual support, p. 122ff) of its manual. For the second issue it would be good to have a minimal working example (MWE) because it seems that you set the headers manually at this point. A solution could be to use the \markboth command.


Best regards and welcome to the board
Thorsten¹
LineEB
Posts: 3
Joined: Thu Dec 18, 2008 12:24 am

Change TOC Heading

Post by LineEB »

Thanks I got the TOC headers now.

I use the glossary package

Code: Select all

\usepackage{glossary
\makeglossary 
\begin{document}
\tableofcontents
\newpage
\input{forord.tex}
\input{indledning.tex}
\newpage
\printglossary
\addcontentsline{toc}{section}{Ordliste}
\end{document}
I haven't defined any markboth yet.
LineEB
Posts: 3
Joined: Thu Dec 18, 2008 12:24 am

Change TOC Heading

Post by LineEB »

And ad MWE...

Code: Select all

\documentclass[12pt,twoside]{article} 
\usepackage[danish]{babel}
\usepackage{glossary}
\makeglossary
\addto{\captionsdanish}{%
  \renewcommand{\glossaryname}{Ordliste}
}
\pagestyle{myheadings}
\begin{document}
An example of something written bla bla bla \glossary{name={test}, description={test}}
\newpage
\printglossary
\addcontentsline{toc}{section}{Ordliste}
\newpage
And even more... bla bla
\end{document}
Post Reply