# How to change the font of page numbers in TOC LOT LOF without “tocloft”?

It can be easily done with tocloft, however, as there are already many settings for the whole document, using it caused the changing of spacing, and some conflicts with other packages, etc, compared to the original style for book class.

So how to change the font of page numbers for chapters, sections , tabs and figs.. in front matter, without use of tocloft package.

Edit 1:

Using tocloft

\usepackage[ ]{tocloft}
\renewcommand{\cftchappagefont}{\bfseries \sffamily}
\renewcommand{\cftsecpagefont}{ \sffamily}
\renewcommand{\cftsubsecpagefont}{ \sffamily}
\renewcommand{\cftsubsubsecpagefont}{ \sffamily}
\renewcommand{\cftfigpagefont}{ \sffamily}
\renewcommand{\cfttabpagefont}{ \sffamily}


The error:

The following commands have been commented:

% \setcounter{tocdepth}{3}
% \setcounter{secnumdepth}{3}


I dont know if tocloft is conflicted with \usepackage[nottoc]{tocbibind}.

Besides, the spacing between entries in TOC, LOT, LOF are enlarged, and the blank pages are also removed which is created by default in book class.

-
It might help if you explain why you can't use tocloft. –  Joseph Wright Feb 9 '13 at 13:49

The formatting of these lines is controlled by macros \l@chapter \l@section etc. In book class, \l@chapter has a custom definition but all the rest are defined in terms of \@dottedcontentsline so it is enough to redefine just those two commands to use a custom font. Here I use italic and colour to highlight the effect.

\documentclass{book}

\usepackage{color}

\makeatletter
\let\oldl@chapter\l@chapter
\def\l@chapter#1#2{\oldl@chapter{#1}{\textcolor{red}{\itshape#2}}}

\let\old@dottedcontentsline\@dottedtocline
\def\@dottedtocline#1#2#3#4#5{%
\old@dottedcontentsline{#1}{#2}{#3}{#4}{{\textcolor{green}{\itshape#5}}}}

\makeatother
\begin{document}
\tableofcontents
\listoffigures
\chapter{bbaa}

\section{zax}

aaa
\begin{figure}\caption{fff}\end{figure}
\begin{figure}\caption{ggg}\end{figure}

\section{xxzz}
bb
\chapter{bbaa}

\end{document}

-