[Tex/LaTex] etoc: How to remove the title of local table of contents and add top/bottom horizontal rules

etoctable of contents

I would like to use package etoc for getting local toc at the start of each chapter.
However, I struggle to:

  1. hide the title "Contents"
  2. add horizontal rules above and under this local toc entries
  3. typeset the chapter content (mini toc with text) immediately after the chapter heading not on the chapter third page (the second is blank)

\documentclass{scrbook}

\usepackage{lipsum}
\usepackage{etoc}

\begin{document}

\chapter{Chapter 1}
\localtableofcontents 

\section{Section 1}
\lipsum[1-20]
\section{Section 2}
\lipsum[1-20]

\end{document}

enter image description here

Best Answer

The \etocsettocstyle command provides means to set some stuff before and after the ToC, i.e. the horizontal rules. Using it in a very primitive way, it will also prevent the page break etc.

\documentclass{scrbook}

\usepackage{lipsum}
\usepackage{etoc}


\newlength\tocrulewidth
\setlength{\tocrulewidth}{1.5pt}

\begin{document}

\tableofcontents
\chapter{Chapter 1}
\begingroup
\parindent=0em
\etocsettocstyle{\rule{\linewidth}{\tocrulewidth}\vskip0.5\baselineskip}{\rule{\linewidth}{\tocrulewidth}}
\localtableofcontents 
\endgroup


\section{Section 1}
\lipsum[1-20]
\section{Section 2}
\lipsum[1-20]

\end{document}

enter image description here