[Tex/LaTex] How to customise the table of contents

sectioningspacingtable of contents

I am new to LaTeX, please I need you help.
I am writing my thesis and I face problem with table of content, I want to remove the space between the first part of my table of content which is

AUTHOR'S DECLARATION i
ABSTRACT ii
ACKNOWLEDGEMENTS iii
TABEL OF CONTENT iv
LIST OF FIGURES v
LIST OF ABBRAVIATIONS

Then PUT DOUBLE SPACING using vertical space by 0.5cm
then the second part of table of content appear which is

CHAPTER ONE INTRODUCTION 1
1.1 rst section 1
1.2 second section 1
CHAPTER TWO INTRODUCTION 2
2.1 rst section 2
2.2 second section 2

Note : between the chapter one and two vertical space by 0.3 cm .
I used as the following:

    %\documentclass[a4paper]{article}
    \documentclass[12pt,english]{report}

    \setlength{\parindent}{1.27cm}

    \usepackage{setspace}
    \onehalfspacing
    \usepackage{titlesec, blindtext, color}
    \usepackage[font=small,labelfont=bf,justification=centering]{caption}
    \usepackage{geometry}

    \geometry{
      verbose,
      tmargin=2cm,
      bmargin=2.5cm,
      lmargin=3.8cm,
      rmargin=2.5cm
    }
    \newcommand{\mychapter}[3][]{%
    \setcounter{chapter}{#3}
    \setcounter{section}{0}
    \chapter*{#2}
    \if\relax\detokenize{#1}\relax
      \addcontentsline{toc}{chapter}{#2}
    \else
      \addcontentsline{toc}{chapter}{#1}
    \fi
    }
\usepackage{tocloft}  % use for th next command in order to remove dots
\renewcommand{\cftdot}{} % remove dots of table of content
\renewcommand{\cfttoctitlefont}{\hfil\bf} 
    \begin{document}
    \pagenumbering{roman}
    \setcounter{page}{1}
      \titlespacing*{\chapter}{10pt}{0pt}{10pt}
      \titleformat{\chapter}[display]
          {\centering\normalfont\large\bfseries}{ \chaptertitlename\ \thechapter}{0pt}{\large}

          \include{declartion}

          \addcontentsline{toc}{chapter}{\numberline{} AUTHOR'S  DECLARATION} \vspace*{-1cm} %

          %\abstract{\addtocontents{toc}

          \newpage

          \addcontentsline{toc}{chapter}{\numberline{}ABSTRACT} {\vspace*{6cm}}%
          \include{abstract}
          \newpage
          \chapter*{ACKNOWLEDGEMENTS}%
          \addcontentsline{toc}{chapter}{\numberline{}ACKNOWLEDGEMENTS} {\vspace{7em}}%
          \newpage

          \tableofcontents

          \addcontentsline{toc}{chapter}{\numberline{}TABEL OF CONTENT} %{\vspace{-5em}}%

          \newpage
          \listoffigures
          \addcontentsline{toc}{chapter}{\numberline{}LIST OF FIGURES} %{\vspace{-6em}}%
          \addcontentsline{toc}{chapter}{\numberline{}LIST OF ABBRAVIATIONS} % {\vspace{-6em}}%
          \newpage


          \newpage
          \tableofcontents

           \titlespacing*{\chapter}{10pt}{0pt}{10pt}
            \titleformat{\chapter}[display]
                {\centering\normalfont\large\bfseries}{ \chaptertitlename\ \thechapter}{40pt}{\large}
\mychapter[CHAPTER ONE INTRODUCTION]{CHAPTER ONE\\INTRODUCTION}{1} % the problem if happen fron centering
\pagenumbering{arabic}
sfsdfsf
sfsdfsf
\section{first section}
This is section one in chapter one.
\section{second section }

This is section two  in chapter one.
\mychapter[CHAPTER TWO RELATED WORK]{CHAPTER TWO \\RELATED WORD}{2} % the problem if happen fron centering
\section{first section}
This is section one in chapter TWO.
\section{second section }
This is section two  in chapter TWO.
          \end{document}

enter image description here

Best Answer

Maybe some hints from my point of view.

  • I can't understand why you are defining the command \mychapter. I think you can achieve the same with chapter with some modifications:

    \titleformat{\chapter}[hang]{\centering\normalfont\large\bfseries}{}{0pt}{\large}
    \renewcommand\thesection{\arabic{section}}
    \setlength{\cftchapnumwidth}{0pt}
    \renewcommand\thechapter{}
    

    Please Note that you will have a lot of equal section numbers.

  • You can work with the package tocbibind getting the toc, lof, etc into the table of contents.

  • Why do you use \numberline? It's result in an usual and unwanted space. Simple:

    \addcontentsline{toc}{chapter}{ACKNOWLEDGEMENTS}
    
  • The space before any chapter entry in the toc is defined by tocloft with \cftbeforechapskip. So you can change it everywhere with \addtocontents (see example)
  • Personally I prefer \clearpage instead of newpage.

BTW Allow me a small hint the a new documentclass like memoir or KOMA. KOMA provides the command addchap which makes an unnumbered entry in the toc.

Here your modified MWE:

\documentclass[12pt,english]{report}
\usepackage{setspace}\onehalfspacing
\usepackage{titlesec, blindtext, color}
\usepackage[]{tocbibind}
\usepackage{tocloft} 
\renewcommand{\cftdot}{} % remove dots of table of content
\renewcommand{\cfttoctitlefont}{\hfil\bf} 
\titleformat{\chapter}[hang]{\centering\normalfont\large\bfseries}{}{0pt}{\large}
\renewcommand\thesection{\arabic{section}}
\setlength{\cftchapnumwidth}{0pt}
\renewcommand\thechapter{}
\titlespacing*{\chapter}{10pt}{0pt}{10pt}
\begin{document}
\pagenumbering{roman}
\addtocontents{toc}{\protect\setlength{\cftbeforechapskip}{0em}}%


%\include{declartion}

\addcontentsline{toc}{chapter}{AUTHOR'S  DECLARATION}

\clearpage
\addcontentsline{toc}{chapter}{ABSTRACT}
\include{abstract}
\clearpage
\chapter*{ACKNOWLEDGEMENTS}%
\addcontentsline{toc}{chapter}{ACKNOWLEDGEMENTS}

\clearpage
\tableofcontents

\clearpage
\listoffigures
\addcontentsline{toc}{chapter}{LIST OF ABBRAVIATIONS}

\clearpage
\addtocontents{toc}{\protect\setlength{\cftbeforechapskip}{1.0em plus 1pt}}%

\chapter[CHAPTER ONE INTRODUCTION]{CHAPTER ONE\\INTRODUCTION}
\pagenumbering{arabic}
sfsdfsf
sfsdfsf
\section{first section}
This is section one in chapter one.
\section{second section }
This is section two  in chapter one.

\chapter[CHAPTER TWO RELATED WORK]{CHAPTER TWO \\RELATED WORD}
\section{first section}
This is section one in chapter TWO.
\section{second section }
This is section two  in chapter TWO.
\end{document}

enter image description here