GeneralHelp formatting TOC

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
ganda97
Posts: 13
Joined: Fri Mar 14, 2008 12:34 am

Help formatting TOC

Post by ganda97 »

I'm writing my dissertation and need help with my TOC. My knowledge of Latex is very limited. The TOC needs to look like this example:

1. Introduction

1.1 Motivation
1.2 Method

2. Background

3. Stuff

3.1 Stuff 1
3.2 Stuff 2

(The sections should be indented to the first letter in the chapter's name. That part is working but I couldn't format it in the e-mail). My current TOC looks like this:

1. Introduction
1.1 Motivation
1.2 Method

2. Background

3. Stuff
3.1 Stuff 1
3.2 Stuff 2

I need to put a blank line between the chapter and first section in each chapter. This is what I'm using on my main tex file:

\documentclass[12pt]{report}
\usepackage{amsmath,amsthm,amsfonts,amscd} % Some packages to write mathematics.
\usepackage{eucal} % Euler fonts
\usepackage{verbatim} % Allows quoting source with commands.
\usepackage{setspace}
\usepackage[usenames]{color}
\usepackage{colortbl}
\usepackage{hhline}
\usepackage{longtable}
\usepackage{graphicx}
\usepackage[square]{natbib}

Thanks for looking and any help you may provide,

Ariel

Recommended reading 2024:

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

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
Stefan Kottwitz
Site Admin
Posts: 10360
Joined: Mon Mar 10, 2008 9:44 pm

Help formatting TOC

Post by Stefan Kottwitz »

Hi Ariel!

One simple way is to insert after a \chapter call and before the next \section one line:

Code: Select all

\addtocontents{toc}{\protect\addvspace{10pt}}
That inserts 10pt into the toc in the right place. Of course you may change that value.

If you dont whant to repeat that inside each chapter, you could redefine the \@chapter macro.

Stefan
ganda97
Posts: 13
Joined: Fri Mar 14, 2008 12:34 am

Re: Help formatting TOC

Post by ganda97 »

Thanks. That worked great. Just out of curiosity, how would I modify the \@chapter macro?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10360
Joined: Mon Mar 10, 2008 9:44 pm

Re: Help formatting TOC

Post by Stefan Kottwitz »

You will find the definition of the \@chapter macro inside report.cls, it's defined like \def\@chapter[#1]#2{... \addcontentsline{toc}{chapter}{#1} ... more code ... }.
You could use \renewcommand\@chapter inside your preamble to modify this: copy the original code of \@chapter into it and insert \addtocontents{toc}{\protect\addvspace{10pt}} just after the original \addcontentsline{toc}{chapter}{#1}. And \makeatletter ... \makeatother around this redefinition is necessary because of the @-symbol inside the command names.

Stefan
Post Reply