Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

enter image description here

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:

enter image description here

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.

share|improve this question
3  
It might help if you explain why you can't use tocloft. –  Joseph Wright Feb 9 '13 at 13:49

1 Answer 1

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.

enter image description here

\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}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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