Document Classes"Table of Contents" and titletoc

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
meho_r
Posts: 823
Joined: Tue Aug 07, 2007 5:28 pm

"Table of Contents" and titletoc

Post by meho_r »

Hi,

Is there a way to change/customize "Table of Contents" name for table of contents using titletoc and titlesec package?

I need to set up some space before and after "Table of Contents" and to make it uppercase. Any idea?

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
Stefan Kottwitz
Site Admin
Posts: 10322
Joined: Mon Mar 10, 2008 9:44 pm

"Table of Contents" and titletoc

Post by Stefan Kottwitz »

Hi meho_r,

yes, there is. You could use \titleformat and \titlespacing for \section, the toc name is set this way. Just a quick example that you can test:

Code: Select all

\documentclass[a4paper,10pt]{article}
\usepackage{titlesec,titletoc}
\titleformat{\section}{\large\bfseries\MakeUppercase}{\thesection}{1em}{} 
\begin{document}
\tableofcontents
\bigskip
\section{Test}
Text
\end{document}
For details have a look at the titlesec documentation.

Stefan
LaTeX.org admin
meho_r
Posts: 823
Joined: Tue Aug 07, 2007 5:28 pm

Re: "Table of Contents" and titletoc

Post by meho_r »

Thanks. But I had some difficulties with MakeUppercase. If I use it for sections, all sections that have \\ or \\* in its name report errors. So I've done it this way:

1. For sections I used \uppercase instead of \MakeUppercase (but this doesn't work for the name of table of contents)
2. I put separate \titleformat... command with \MakeUppercase (the one you suggested) just before \tableofcontents command and it works nice.
Post Reply