[Tex/LaTex] How to change the Table of Contents to look like this

formattingtable of contents

The deadline for my final senior design report is a few weeks away and I'm trying to migrate away from Word (which I used to finish my previous reports) to Latex. I have most of the formatting done, but despite spending several hours, I'm not able to get the Table Of Contents formatting correct. Does anyone know how I can go about making my ToC look like this?

Sample ToC

The above is a picture from my preliminary report. The final report has specifications exactly the same as the one listed above.

The closest I've gotten is by using this:

\usepackage[tocflat]{tocstyle}
%Formatting of the TOC
\makeatletter
\renewcommand
\tableofcontents
{
  \begin{center}
  \begingroup
  \fontsize{12pt}{28.8pt}\selectfont
  \textbf{CONTENTS}
  \endgroup
  \\~\\
  \@starttoc{toc}%
  \end{center}
}
\makeatother

However, this doesn't fix the Section-SubSection-SubSubSection indentation and formatting issues.

As far as non-obvious formatting restrictions go, I'm required to have 2 (1.5 spaced) lines between the title (i.e. "CONTENTS") and the first two headers (i.e. "TABLES" and "FIGURES") and a one-line (1.5 spaced) space between "FIGURES" and the start of the remainder of the ToC.

Help in this matter would be greatly appreciated!

Best Answer

\documentclass{article}
\usepackage{titletoc}
\titlecontents{section}[2.3em]
  {}
  {\bfseries\contentslabel[\thecontentslabel.0]{2em}\MakeUppercase}
  {\hspace*{-2.3em}\bfseries\MakeUppercase}
  {\titlerule*[1pc]{.}\contentspage}
\titlecontents{subsection}[4.6em]
  {}
  {\bfseries\contentslabel{2em}}
  {\hspace*{-2.3em}\bfseries}
  {\titlerule*[1pc]{.}\contentspage}
\titlecontents{subsubsection}[6.9em]
  {}
  {\bfseries\contentslabel{2em}\itshape\space}
  {\hspace*{-2.3em}\bfseries}
  {\titlerule*[1pc]{.}\contentspage}

\makeatletter
\renewcommand\tableofcontents{%
  \section*{\centerline{\MakeUppercase{\contentsname}}
    \@mkboth
      {\MakeUppercase\contentsname}
      {\MakeUppercase\contentsname}
  }%
  \@starttoc{toc}%
}
\makeatother

\begin{document}

\tableofcontents
\clearpage

\pagenumbering{roman}
\section*{Tables}
\addcontentsline{toc}{section}{Tables}
\addtocontents{toc}{\vspace{1em}}
\clearpage

\pagenumbering{arabic}
\section{Introduction}
\section{Design project background}
\subsection{Problem definition}
\subsubsection{Firmware code}

\end{document}

output_crop