Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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, ... .

share|improve this question
    
Actually the documentation is just 200 pages, the rest is irrelevant material. –  egreg Feb 27 at 9:45

2 Answers 2

up vote 6 down vote accepted

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

enter image description here

and Toc of the second part

enter image description here

share|improve this answer
    
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 at 10:38
1  
@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 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:

toc part 1

The TOC of Part 2:

toc part 2

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.