# A simple way to print an incomplete TOC

I would like to print a table of contents after each part of a book class document. This toc will show only the contents of the relevant part.

I could use the minitoc package but (1.) it primary intended to print toc after each chapter (not part) and (2.) it seems a very complex and heavy package (800 pages of doc) which modifies deeply titles formating.

So, I'm looking to a easier way to do this simple request. A solution which does not change the layout or fonts characteristics is preferable. In fact, I just want a way to use the classic \tableofcontents command several times but in order to show only the part 1, and then the part 2, 3, ... .

-
Actually the documentation is just 200 pages, the rest is irrelevant material. – egreg Feb 27 '14 at 9:45

You can simulate this behavior with the titletoc package.

At the beginning of each \part, issue a \startcontents command and at the end a \stopcontents command.

After that, start a new \chapter* and then issue a \printcontents command.

Having a look at the following MWE clarifies these things:

\documentclass{book}

\usepackage{titletoc}

\begin{document}

\startcontents[first]
\part{1st part}
\chapter{1st}
\section{A section}
\chapter{2nd}
\section{A section}
\chapter{3rd}
\section{A section}
\stopcontents[first]
\chapter*{\contentsname\markboth{\MakeUppercase\contentsname}{\MakeUppercase\contentsname}}
\printcontents[first]{}{0}{}

\startcontents[second]
\part{2nd part}
\chapter{1st}
\section{A section}
\chapter{2nd}
\section{A section}
\chapter{3rd}
\section{A section}
\stopcontents[second]
\chapter*{\contentsname\markboth{\MakeUppercase\contentsname}{\MakeUppercase\contentsname}}
\printcontents[second]{}{0}{}

\end{document}


ToC of the first part

and Toc of the second part

-
Thanks. For my good knowledge, could you explain \contentsname\markboth{\MakeUppercase\contentsname}{\MakeUppercase\contentsname‌​}? Why using markboth like it's called automatically by each chapter? – ppr Feb 27 '14 at 10:38
@ppr \contentsname expands to the name of the Table of Contents in your language. Note that \markboth is not issued by starred chapters (\chapter*), so if you don't add this you will have the headers of the previous starred chapter. – karlkoeller Feb 27 '14 at 11:21

You can achieve this with the following mark-up:

\documentclass{book}

\usepackage{etoc}

\begin{document}

\part{1st part}
\invisiblelocaltableofcontents \label{toc:part1}
\chapter{1st}
\section{A section}
\chapter{2nd}
\section{A section}
\chapter{3rd}
\section{A section}

\tableofcontents\ref{toc:part1}

\part{2nd part}
\invisiblelocaltableofcontents \label{toc:part2}

\chapter{1st}
\section{A section}
\chapter{2nd}
\section{A section}
\chapter{3rd}
\section{A section}

\tableofcontents \ref{toc:part2}

\end{document}


The TOC of Part 1:

The TOC of Part 2:

-