[Tex/LaTex] Change font size of TOC contents

fontsizetable of contentsthesis

I have been searching for a solution for the following problem:,
– How can I change the TOC (contents) font size (e.g. Introduction, Chapter 1 & so on.. ), I have tried with a lot of commands but haven't been being worked,

The following commands not working:

\renewcommand\cftchapfont{\fontsize{12}{12}\selectfont}
\renewcommand\cftsecfont{\fontsize{12}{12}\selectfont}

I am writing with report class, and packages of

\usepackage{fancyhdr}
\usepackage{hyperref}
\usepackage{tocloft}

Looking to hearing from anyone as soon as possible.

The code is below:

\documentclass[a4paper,12pt]{report}
%% Include packages
\usepackage{times} % timesnew roman font type setting 
\usepackage{titling}  % 
%\usepackage{indentfirst} 
\usepackage{setspace}  % Line spaceing  
\usepackage{titlesec}   % centering titles 
\usepackage{sectsty}
\usepackage{fancyhdr}
\usepackage{hyperref}
\usepackage{tocloft}
\usepackage{lipsum}
%%
%% For paragraph indent 
\setlength{\parindent}{4em}   % Paragraph indent 
%%%%%%
\renewcommand\cftchapfont{\fontsize{12}{12}\selectfont}
\renewcommand\cftsecfont{\fontsize{20}{12}\selectfont}
\addtocontents{toc}{\cftpagenumbersoff{chapter}}
\addtocontents{toc}{\cftpagenumbersoff{chapter}}
\addtocontents{toc}{\cftpagenumbersoff{section}} %% Similarly for subsection, figure... as you wish
\renewcommand{\cftdot}{}


\renewcommand{\cftchapfont}{\fontsize{12}{12}}
\renewcommand\cftsecfont{\fontsize{12}{12}\selectfont}


%%%%%

\makeatletter
\renewcommand{\@chapapp}{\fontsize{43}{0}\selectfont Chapter}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\input{titlepage}  % Title page

%\clearpage\mbox{}\clearpage  % for the blank page
\thispagestyle{empty}

 \vspace*{\fill}
 { \centering THIS PAGE IS INTENTIONALLY LEFT BLANK.\par}  % For intentionally left blank 
 \vspace{\fill}
\newpage

\pagenumbering{roman}

\begin{center}
    Geometrical Effect on the Energetic Size Effect Law\\
    \vspace{7mm}
    by\\
    \vspace{7mm}


    \vspace{7mm}
    Submitted to the Department of Mechanical Engineering\\ 
    On September 21, 2017 in Partial Fulfillment of the Requirements for the\\

\end{center} 
\input{abstract}  % Abstract 
\newpage
\begin{flushleft}
Acknowledgement
\end{flushleft} 
\par
I would like to thank so many. xxxxxxx.\newpage 

%Table of Contents

\hypersetup{hidelinks}
\tableofcontents



%\newpage 
%\listoffigures
%\newpage
%\listoftables
%\newpage
%\listofAcronyms
\titleformat{\chapter}[display]
{\normalfont\huge\bfseries\centering}{\chaptertitlename\ \thechapter}{0pt}{\huge}
\titlespacing*{\chapter}{0pt}{200pt}{40pt}
\include{chapter_one}
\chapter{exp}
\chapter{\fontsize{43}{1}\selectfont exp2}\clearpage

\section{example}
\chapter{\fontsize{43}{1}\selectfont hey}\clearpage


\chapter{\fontsize{43}{1}\selectfont Final}\clearpage

\section{finale}

\end{document}

Thanks,

Best Answer

The problem is, that all your fontsize statements are missing the unit. The following sets the chapter titles with times font in 43pt size. The toc entries have 12 pt size.

\documentclass[a4paper,12pt]{report}
%% Include packages
%\usepackage{times}% Obsolete for years
\usepackage{tgtermes}  % 
\usepackage{titling}  % 
%\usepackage{indentfirst} 
\usepackage{setspace}  % Line spaceing  
\usepackage{titlesec}   % centering titles 
\usepackage{sectsty}
\usepackage{fancyhdr}
\usepackage{hyperref}
\usepackage{tocloft}
\usepackage{lipsum}
%%
%% For paragraph indent 
\setlength{\parindent}{4em}   % Paragraph indent 
%%%%%%
\addtocontents{toc}{\cftpagenumbersoff{chapter}}
\addtocontents{toc}{\cftpagenumbersoff{chapter}}
\addtocontents{toc}{\cftpagenumbersoff{section}} %% Similarly for subsection, figure... as you wish
\renewcommand{\cftdot}{}





\begin{document}

\hypersetup{hidelinks}
\tableofcontents



\titleformat{\chapter}[display]
{\normalfont\fontsize{43pt}{50pt}\selectfont\bfseries\centering}{\chaptertitlename\ \thechapter}{0pt}{}
\titlespacing*{\chapter}{0pt}{200pt}{40pt}
\include{chapter_one}
\chapter{Capybara}
\chapter{Wombat}

\section{Ant}
\chapter{Bee}\clearpage


\chapter{Termite}\clearpage

\section{Duck}

\end{document}