7

Any idea of how to create a mini table of contents (TOC) in the beginning of a chapter? Not the ordinary TOC in the beginning of the report, but a mini TOC in the beginning of a chapter (like, containing the specific chapter).

7
  • 1
    Aloha to a new TeX.SX user! You want to have a look on etoc perhaps. minitoc is unmaintained for years now, although it's a quite a nice package. Please provide some minimal document to work with too – user31729 May 21 '15 at 15:58
  • Tthe minitoc package, and the titletoc (part of titlesec) packages are designed for such things. – Bernard May 21 '15 at 15:58
  • This question is duplicate? – juanuni May 21 '15 at 15:59
  • Thank you very much. The etoc was exactly was i was looking for. – Anders May 21 '15 at 16:10
  • @ChristianHupfer any idea if the etoc is not working with memoir or any other packages? – Anders May 21 '15 at 16:37
12

Here is a quick (stock) answer for this:

The easiest way is to use etoc package and its \localtableofcontents macro, at the appropriate place. The manual is at https://ctan.org/pkg/etoc.

\documentclass{book}

\usepackage{etoc}


\begin{document}
\tableofcontents % Global toc
\chapter{First}
\localtableofcontents % local toc
\section{First section}

\chapter{Second}
\localtableofcontents

\section{First section of 2nd chapter}

\end{document}

enter image description here

Edit Here is the memoir version.

For some reasons I can't figure out (the manual of etoc is not really clear in this case) it's necessary to use \localtableofcontents*. The individual tocdepth can be controlled with the \etocsettocdepth.toc{sectionlevel} command (note the .toc in the macro name`)

\documentclass{memoir}

\usepackage{blindtext}
\usepackage{etoc}


\setsecnumdepth{subsection}
\etocsettocdepth{subsection}
\begin{document}

\tableofcontents % Global toc
\chapter{First}
\etocsettocdepth.toc{section}

\localtableofcontents*
\section{First section}
\subsection{First subsection -- not in the local toc}

\blindtext

\chapter{Second}
\etocsettocdepth.toc{subsection}
\localtableofcontents*

\section{First section of 2nd chapter}
\subsection{First subsection of first section of 2nd chapter}

\end{document}

enter image description here

2
  • The screenshot shows the local toc for the 2nd chapter – user31729 May 21 '15 at 16:04
  • 1
    The non-starred \localtableofcontents obey memoir's convention to create (by default) for each TOC a chapter like entry in the .toc file. This creates a bit of havoc, which can be circumvented via issuing (after the global TOC): \etocmemoirtoctotocfmt {section}{\contentsname} to have the .toc file contain a section, not a chapter entry. The starred variants obey again memoir's convention to not create a .toc entry. In both cases issuing \etocarticlestyle after the main toc is recommended in order to use section headings and not chapter headings as per memoir default. – user4686 Aug 29 '15 at 21:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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