TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

As using tocloft in book class produces some unexpected side-effect, I wonder how to change the chapter font (e.g. 1 Introduction) as sans serif without using any other packages?

For example, change the highlighted text to sans serif font.


\usepackage[lining ]{libertine}
\usepackage[ T1 ]{fontenc}

\usepackage[ ]{titlesec} 
  {\LARGE \color{DarkBlue}}
  {\vspace{-1 em} \flushright   \normalsize \color{black}  \MakeUppercase{  \bfseries \sffamily  \chaptertitlename } \hspace{1 em}  { \fontsize{70}{70}\selectfont \color{black} \sffamily \thechapter }} {20 pt} { \bfseries \sffamily \LARGE}    

\titleformat{\section} {\Large \bfseries \sffamily \color{DarkBlue}}     {\thesection}{1 em}{}
\titleformat{\subsection}  {\large \bfseries \sffamily  \color{DarkBlue}}      {\thesubsection}{1 em}{}
\titleformat{\subsubsection}  {\normalsize \sffamily  \bfseries      \color{DarkBlue}}  {\thesubsubsection}{1 em}{}  %\slshape
\setcounter{tocdepth}{3}   % table of content depth




\chapter{How to make nuclear bomb}

enter image description here

share|improve this question
Without using any package or also without providing a minimal working example (MWE)? – lockstep Feb 5 '13 at 16:29
The simplest manner would be to redefine \l@chapter, the document class must be known before saying more. – jfbu Feb 5 '13 at 16:30
What is the unexpected side-effct you are seeing? – Peter Wilson Feb 5 '13 at 19:06
@PeterWilson, the spacing of TOC is changed as well as the blank page for LOF,LOT with book class – KOF Feb 5 '13 at 19:54
I don't think that the spacing of the TOC is changed. The manual does say that with chapters (e.g., book class) the LOF and LOT do not necessarily start on new pages. If you want that then add \clearpage or \cleardoublepage before calling for the LOF or LOT. – Peter Wilson Feb 5 '13 at 20:49
up vote 1 down vote accepted

This is not really tested for lack of copy-pastable code, but should work in the book class. Put in the preamble:

\ifnum \c@tocdepth >\m@ne \addpenalty {-\@highpenalty }\vskip 1.0em \@plus\p@
\setlength \@tempdima {1.5em}\begingroup \parindent \z@ \rightskip\@pnumwidth
\parfillskip -\@pnumwidth \leavevmode \bfseries \advance \leftskip \@tempdima
\hskip -\leftskip {\sffamily #1}\nobreak \hfil \nobreak \hb@xt@ \@pnumwidth 
{\hss #2}\par \penalty \@highpenalty \endgroup \fi}

Update: if you want to achieve similar effect with memoir or scrbook then use rather the following code:

\def\l@chapter#1#2{\originall@chapter{{\sffamily #1}}{#2}}

The above is actually preferable to the one I proposed earlier, also for the book class, as it will less encumber your preamble. Nevertheless the advantage of the first proposal is that you can also in case of need customize the hard-coded lengths therein.


\makeatletter \def\l@chapter#1#2{%
  \ifnum \c@tocdepth >\m@ne \addpenalty {-\@highpenalty }\vskip 1.0em \@plus\p@
  \setlength \@tempdima {1.5em}\begingroup \parindent \z@ \rightskip\@pnumwidth
  \parfillskip -\@pnumwidth \leavevmode \bfseries \advance \leftskip \@tempdima
  \hskip -\leftskip {\sffamily #1}\nobreak \hfil \nobreak \hb@xt@ \@pnumwidth
  {\hss #2}\par \penalty \@highpenalty \endgroup \fi} \makeatother















And with the code provided in the question, one obtains:


share|improve this answer
It works perfectly! – KOF Feb 5 '13 at 16:47
rather than redefining \l@chapter the way I did, one could save the old definition, and encapsulate it in a new one with the first parameter #1 replaced by {\sffamily #1}. Both methods are compatible with hyperref. Note though that I had to put \sffamily #1 in a group to limit the scope of the font change. I think this will be in 99.9% of the cases with no after-effect elsewhere. – jfbu Feb 5 '13 at 16:54
@KOF: please not that if you change your document class to memoir or scrbook then the proposed method is not the good one. It would be better to do the alternative I mentioned in my comment. – jfbu Feb 5 '13 at 16:57
only original document classes are used for my writting :), because I don't know what kind of weird settings in these classes. – KOF Feb 5 '13 at 17:22
memoir actually has most (if not all, I don't know) of the tocloft commands and functionalities. Both memoir and scrbook are well documented: memman and scrguien – jfbu Feb 5 '13 at 17:31

Your Answer


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.