[Tex/LaTex] Separate book into parts and chapters

book-designchapterspartstable of contents

I am working with the book document class and want to create something like this. Moreover, in the Table of Contents I want the "Part" to be under- and over-lined and not to be numbered. I think of using the \part command but don't know how to do this. Any help will be highly appreciated.

Part I

  1. Introduction………. 1
  2. Main results ……… 15

Best Answer

Hey this should get the job done. I would like to work on one thing, however.

  1. Distance between upper line on part entry and lower entry should be exactly equal and easily changed.

I will update this code when I find a better solution.

\documentclass{book}
\usepackage{fontspec}
\usepackage{tocloft}

\renewcommand{\cftpartfont}{\bfseries\Large\hrule}%add line above part
\renewcommand{\cftpartpagefont}{\bfseries}
\renewcommand{\thepart}{}%removes part roman numerals
\renewcommand{\cftbeforepartskip}{5mm}
\renewcommand{\cftpartafterpnum}{\\\hrule}%add line below part
\cftpagenumbersoff{part}%get rid of part page numbers
\renewcommand{\cftpartaftersnumb}{}%disable part number
\renewcommand{\thesection}{\arabic{part}}%add number to section without subnum
\renewcommand{\cftsecaftersnum}{.}%add . after sec #
\renewcommand{\cftsecindent}{8mm}%control spacing between number and sec title
\renewcommand{\cftsecnumwidth}{4mm}%section indent
\renewcommand{\cftparskip}{4mm}%control line spacing

\begin{document}
\tableofcontents
\chapter{Elephants Eating (Chapter)}
\part{Peanuts}
\section{With Shells}
\part{Grass}
\section{Fresh}
\part{Leaves}
\section{From Oak Trees}

\end{document}

Example of Parts with Underlines and Overlines

Related Question