# Automatic partial toc at every chapter using titletoc

This great answer Minitoc and memoir describes know how to put a chapter toc at the beginning of every chapter with the package titletoc using

\startcontents[chapters]
\printcontents[chapters]{}{1}{}

I am looking for a way to automate this for every non-starred chapter in scrbook (in the sense that one does not have to type the two lines after every \chapter command), probably modifying the chapter definition slightly.

## 1 Answer

This should do it (now tested).

\usepackage{xparse}
\let\originalchapter\chapter
\RenewDocumentCommand{\chapter}{som}{%
\IfBooleanTF{#1}
{\originalchapter*{#3}}
{\IfNoValueTF{#2}
{\originalchapter{#3}}
{\originalchapter[#2]{#3}}%
}%
\startcontents[chapters]
\printcontents[chapters]{}{1}{}
}
• There is a problem, it appears also on the main toc page, the listoffigures and listoftables pages also. How to turn it off on these pages? – Anh-Thi DINH Apr 5 '18 at 9:05