1

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,

  • Welcome to TeX SE! Please add a minimal working example (MWE) that illustrates your problem. – TH. Jun 9 '17 at 17:25
  • \documentclass[a4paper,12pt]{report} Include packages \input{package} \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}\selectfont} \renewcommand\cftsecfont{\fontsize{12}{12}\selectfont} – Refat_Gir Jun 9 '17 at 18:56
  • 1
    I meant edit your answer to provide the code. The comment isn't readable at all. Make sure your example is complete and can be compiled. – TH. Jun 9 '17 at 19:07
  • Your base font is set to 12pt (from \documentclass[...,12pt]). So, using \renewcommand{\cftchapfont}{\fontsize{12}{12}\selectfont} would not really do anything except set a smaller baseline skip than what's usually the case. Instead, use something like \renewcommand{\cftchapfont}{\large} which sets the font size relative to the base font. Also, don't add font changes in your titles like \chapter{\fontsize{..}{..}\selectfont ...}. – Werner Jun 10 '17 at 4:57
  • Werner, Thanks for your reply. The problem is the title should be in every chapter about 43 times new roman and the titles in the TOC should be normal about 12 pt. \renewcommand{\cftchapfont}{\large} was applied but it wasn't worked. – Refat_Gir Jun 10 '17 at 10:01
1

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}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.