# How to add spaces between items in TOC

The mini-document

\documentclass[12pt,openany,oneside]{book}
\usepackage{titletoc}
\usepackage{lipsum}
{\sffamily\bfseries PART \thecontentslabel\\*[.2pc]\large}

\title{Title}
\date{}
\author{pythonee}

\begin{document}
\maketitle

\frontmatter
\tableofcontents
\chapter{Front One}
\lipsum[1]

\mainmatter
\part{Introduction}
\chapter{history}
\lipsum

\backmatter
\chapter{Back One}
\lipsum[1]

\end{document}


The Toc output look like:

Now I want to make the space between \frontmatter and \mainmatter equals to \frontmatter and\mainmatter in Toc.

By the way. Why the PART doesn't display in TOC. I have customized it with titletoc.

-
I don't understand your first request; can you please explain in more detail what you want to achieve? – Gonzalo Medina May 4 '12 at 1:36
@GonzaloMedina In simple terms, just for this case. I want to add spaces between 1 history and Back One. I want to make it equals to the space between Front one and "I Introduction". – pythonee May 4 '12 at 2:03

For the second issue, you need to use the newparttocpackage option for titlesec and \titleformat for \part to make \titlecontents{part}... behave as expected (I find this somehow surprising; using scrbook instead of book this is not necessary, so I don't know if this was intentional by design).

For the spacing issue, you can redefine \backmatter as implemented in book.cls to add the desired vertical space.

Now that an additional request has been made in a comment to this answer, you can use \titlecontents to format the chapter entries.

Here's a complete example:

\documentclass[12pt,openany,oneside]{book}
\usepackage[newparttoc]{titlesec}
\usepackage{titletoc}
\usepackage{lipsum}

\titleformat{\part}[display]
{\centering\Huge\bfseries}{\partname~\thepart}
{1em}{\normalfont\bfseries}

{\sffamily\bfseries\MakeUppercase{\partname}~\thecontentslabel\\*[.2pc]\large}

\titlecontents{chapter}[0em]{}
{\bfseries\chaptername~\thecontentslabel\hspace{1em}}
{\bfseries}
{\hfill\bfseries\contentspage}

\makeatletter
\renewcommand\backmatter{%
\if@openright
\cleardoublepage
\else
\clearpage
\fi
\@mainmatterfalse}
\makeatother

\title{Title}
\date{}
\author{pythonee}

\begin{document}
\maketitle

\frontmatter
\tableofcontents
\chapter{Front One}
\lipsum[1]

\mainmatter
\part{Introduction}
\chapter{history}
\lipsum
\chapter{Some more history}
\lipsum

\backmatter
\chapter{Back One}
\lipsum[1]

\end{document}


-
Thank you for your answer, But if I can do this in my own style file, I think that would be better idea. I don't want to add toc line one by one. And How can I make 1 history to chapter 1 history. – pythonee May 4 '12 at 2:51
@pythonee please see my updated answer. – Gonzalo Medina May 4 '12 at 3:05
Yes, I want to add the vertical spacing. And your output is really what I want. But I think if I can remove **\addtocontents{toc}{\protect\addvspace{3pc}} **. And add vertical spacing between \mainmatter and \backmatter` on my style file. That will be better. – pythonee May 4 '12 at 3:09
@pythonee: answer updated. Is it something like that what you want? – Gonzalo Medina May 4 '12 at 3:16
Misunderstanded. I have updated my question. The chapters in one part should be compact. – pythonee May 4 '12 at 3:29