When using \part with tocloft (without fontspec) in pdflatex as suggested in the answer in this post Separate book into parts and chapters, I encounter a problem in the section numbering in the tableofcontents like this.
Contents
First Part
1 Chapter1
1 Sections1.1
1.1 Subsection1.1.1
2 Chapter2
1 Section2.1
1 Section2.2
1.1 Subsection2.2.1
Second part
3 Chapter3
2 Section3.1
2.1 Subsection3.1.1
The sectioning in the text however is fine.
Can someone help me out? Thanks.
The preamble is the following
\documentclass[a4paper,10pt]{book}
\usepackage{amsmath,amssymb,amsfonts,amsthm}
\usepackage{inputenc}
\usepackage{tabularx}
\usepackage{mathtools}
\usepackage{booktabs}
\usepackage{siunitx}
\usepackage{textcomp}
\usepackage{xpatch}
\usepackage{tikz}
\usepackage{tocloft}
\usepackage{inputenc}
\usepackage{xspace}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE,RO]{}
\fancyhead[RE,LO]{\textcopyright~ Prints 2019}
\fancyfoot[CE,CO]{}
\fancyfoot[LE,RO]{\thepage}
\everymath{\displaystyle}
\newtheorem{prop}{Proposition}[chapter]
\newtheorem{defn}{Definition}[chapter]
\newtheorem{lemma}{Lemma}
\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{corollary}[prop]{Corollary}
\newtheorem{remark}{Remark}
\newtheorem{example}{Example}[chapter]
\newcommand{\floorceil}[1]{\lceil #1 \rfloor}
\makeatletter
\xpatchcmd{\@thm}{\thm@headpunct{.}}{\thm@headpunct{}}{}{}
\makeatother
\renewcommand{\cftpartfont}{\bfseries\Large\hrule}%add line above part
\renewcommand{\cftpartpagefont}{\bfseries}
\renewcommand{\cftbeforepartskip}{5mm}
\renewcommand{\cftpartafterpnum}{\\\hrule}%add line below part
\cftpagenumbersoff{part}%get rid of part page numbers
\renewcommand{\cftsecindent}{8mm}%control spacing between number and sec title
\renewcommand{\cftsecnumwidth}{4mm}%section indent
\renewcommand{\cftparskip}{4mm}%control line spacing
\begin{document}
\tableofcontents
\part{First part}
\chapter{Chapter1}
\section{Sections1.1}
\subsection{Subsection1.1.1}
\chapter{Chapter2}
\section{Section2.1}
\section{Section2.2}
\subsection{Subsection2.2.1}
\part{Second part}
\chapter{Chapter3}
\section{Section3.1}
\subsection{Subsection3.1.1}
\end{document}
A snapshot of the toc is here.]2
\documentclass
and end with\end{document}
.