0

I setup local table of contents for each chapter in a document using the following code:

 \newcommand{\chaptertoc}[1][Contents]{%  
   \etocsettocstyle{\addsec*{#1}}{}%   
   \localtableofcontents%
 \noindent\makebox[\linewidth]{\rule{\textwidth}{0.4pt}} 
 }

The result looks like this:

enter image description here

Instead, I would like to have a line separation between the text Contents and the localtoc. It should look something similar to this:

enter image description here

I tried adding the line \noindent\makebox[\linewidth]{\rule{\textwidth}{0.4pt}} before \etocsettocstyle{\addsec*{#1}}{}% but it is not working as desired.

Could someone please help?

0

You can use the minitoc package:

\documentclass{book}
\usepackage{minitoc}
  
\begin{document}
\dominitoc
\tableofcontents

\chapter{Chapter title}
\minitoc

\section{Test 1}
hello
\section{Test 2}
hello
\section{Test 3}
hello

\end{document}

enter image description here

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.