TransWikia.com

Insert Table of Contents in chapter

TeX - LaTeX Asked on July 9, 2021

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

One Answer

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

Answered by user31729 on July 9, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP