How to add header (containing chapter, section titles) to toc-entry and delete any headings in body? The purpose of doing this is I have lot of chapters, sections, subsection and paragraphs with lots of diagrams and these headings are occupying a full page and increasing number of pages. My goal is to use the minimum number of pages. Please find below a MWE:
\documentclass{report}
\usepackage{listings}
\usepackage{fancyhdr}
\pagestyle{fancy}
\lhead{\nouppercase{\rightmark} (\nouppercase{\leftmark})}
\chead{}
\rhead{}
\newcommand\chap[1]{%
\chapter*{#1}%
\addcontentsline{toc}{chapter}{#1}}
\begin{document}
\tableofcontents
\part{Humanoid Introduction}
\chapter{Obstacle Avoidance}
\section{detecting wall}
\chapter{Face Recognition}
\section{Shape Recognition}
\subsection{Face Recognisation}
\subsection{Hand Recognisation}
\end{document}
\chap
like this\newcommand\chap[1]{\addcontentsline{toc}{chapter}{#1}}