# set table of content page font size ,chapter, section and subsection font size each to value

i have a template with this code for the table of content

\newcommand{\tocheader}{{%
\underline{\textbf{\larger{Title}}} \hfill \underline{\textbf{\larger{Page}}}\large
\par\bigskip% After heading
}}
\newcommand{\AtBeginShipoutClear}{\gdef\AtBegShi@Hook{}}

\renewcommand\tableofcontents{%
\cleardoublepage\phantomsection\addchaptertocentry{\normalfont\contentsname}
\section*{\Large\centering\contentsname \\[2cm]
\underline{\textbf{\larger{Title}}} \hfill \underline{\textbf{\larger{Page}}}\large
\@mkboth{%
\MakeUppercase\contentsname}{\MakeUppercase\contentsname}}
\AtBeginShipoutNext{%
\tocheader
}
}
\onehalfspacing\@starttoc{toc}%
}


i made the title and page to appear in every page with this \tocheader

The problem page numbering font size is not fixed i want it all to be 12 or \normalsize

i tried \usepackage{tocloft}

Font changes to ToC content of sectional units

\renewcommand{\cftchappagefont}{\normalfont}


but it also not working and remove some chapters

i also tried the font size for chapter section and subsection and it also make the page number the same as the chapter or section

\renewcommand{\cftpartfont}{\normalfont\sffamily\bfseries}% \part font in ToC
\renewcommand{\cftchapfont}{\normalfont\large\itshape}    % \chapter font in ToC
\renewcommand{\cftsecfont}{\normalfont\slshape}           % \section font in ToC
\renewcommand{\cftsubsecfont}{\normalfont\itshape}        % \subsection font in ToC


I want the chapters font 16, section 14 and subsection 12 and spacing is 1.5 cm and the page number font size is 12

• Please try to provide a MWE (minimal working example) following the demands you find here: tex.meta.stackexchange.com/q/228/231952, so that we can better understand the problem you are encountering.
– Ivan
Apr 25 '21 at 13:15

## 1 Answer

I have tried to cobble together an MWE based on the code in your question. It seems to do the job except for the ToC header but that is your code.

% tocprob.tex  SE 594371
\documentclass[12pt]{book}
\usepackage{tocloft}

\newcommand{\tocheader}{{%
\underline{\textbf{\larger{Title}}} \hfill \underline{\textbf{\larger{Page}}}\large
\par\bigskip% After heading
}}
\newcommand{\AtBeginShipoutClear}{\gdef\AtBegShi@Hook{}}

\renewcommand\tableofcontents{%
\cleardoublepage\phantomsection\addchaptertocentry{\normalfont\contentsname}
\section*{\Large\centering\contentsname \\[2cm]
\underline{\textbf{\larger{Title}}} \hfill \underline{\textbf{\larger{Page}}}\large
\@mkboth{%
\MakeUppercase\contentsname}{\MakeUppercase\contentsname}}
\AtBeginShipoutNext{%
\tocheader
}
}
%  \onehalfspacing\@starttoc{toc}% % where is \onehalfspacing defined????
%}  % this is one } too many

\renewcommand{\cftpartfont}{\normalfont\sffamily\bfseries}% \part font in ToC
\renewcommand{\cftchapfont}{\normalfont\Large\itshape} % \chapter font in ToC
\renewcommand{\cftsecfont}{\normalfont\large\slshape}  % \section font in ToC
\renewcommand{\cftsubsecfont}{\normalfont\itshape}     % \subsection font in ToC

\begin{document}
\tableofcontents
\chapter{First chapter}
\section{First section}
\subsection{First subsection}

\end{document}


As far as I can tell it produces the kind of ToC you are after (page numbers all same size). I know that the font for the chapter page is bold, but if you don't want that then use \renewcommand{\cftchappagefont}{\normalfont} as you gave in one of your code lines.