7

Problem:

How do I make chapter titles bold in the below MWE?

Minimal working example:

\documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage[titles]{tocloft}

\begin{document}

%: ----------------------- Table of contents ------------------------
\renewcommand{\contentsname}{Table of contents}
\renewcommand{\cftchapfont}{\normalfont}
\renewcommand{\cftchappagefont}{\normalfont}
\renewcommand{\cftdotsep}{1}
\renewcommand{\cftchapleader}{\cftdotfill{\cftsecdotsep}}

% Organisational level that receives a numbers
\setcounter{secnumdepth}{2}

% Print table of contents for level 2
% Levels are: 0 - chapter, 1 - section, 2 - subsection, 3 - subsubsection
\setcounter{tocdepth}{2}

% Print the table of contents
\tableofcontents

% Creates a chapter, section and subsection
\chapter{Chapter 1}
\section{Section 1}
\subsection{Subsection 1}

% Creates a chapter, section and subsection
\chapter{Chapter 2}
\section{Section 2}
\subsection{Subsection 2}

\end{document}
7

This changes the chapter titles, leaders and page numbers to bold since it would be unusual to want the titles in bold but not the accompaniments. However, if you just want the titles in bold for whatever reason, simply revert the other 2 lines to your original code. The comments explain which line changes which thing.

\documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage[titles]{tocloft}
\renewcommand{\contentsname}{Table of contents}
\renewcommand{\cftchapfont}{\normalfont\bfseries}% titles in bold
\renewcommand{\cftchappagefont}{\normalfont\bfseries}% page numbers in bold
\renewcommand{\cftdotsep}{1}
\renewcommand{\cftchapleader}{\bfseries\cftdotfill{\cftsecdotsep}}% dot leaders in bold
\begin{document}

  \setcounter{secnumdepth}{2}

  \setcounter{tocdepth}{2}

  \tableofcontents

  \chapter{Chapter 1}
  \section{Section 1}
  \subsection{Subsection 1}

  \chapter{Chapter 2}
  \section{Section 2}
  \subsection{Subsection 2}

\end{document}

bold chs in toc

EDIT

As Mico points out, if this is all there is to it, just removing the lines setting the font to \normalfont will reinstate the default formatting, and you just need to and the dot fill:

\documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage[titles]{tocloft}
\renewcommand{\contentsname}{Table of contents}
\renewcommand{\cftdotsep}{1}
\renewcommand{\cftchapleader}{\bfseries\cftdotfill{\cftsecdotsep}}% dot leaders in bold
\begin{document}

  \setcounter{secnumdepth}{2}

  \setcounter{tocdepth}{2}

  \tableofcontents

  \chapter{Chapter 1}
  \section{Section 1}
  \subsection{Subsection 1}

  \chapter{Chapter 2}
  \section{Section 2}
  \subsection{Subsection 2}

\end{document}
|improve this answer|||||
  • Even simpler: Just comment out (or delete...) the OP's instructions \renewcommand{\cftchapfont}{\normalfont} and \renewcommand{\cftchappagefont}{\normalfont}. In the book document class, chapter-level entries andthei associated page numbers are typeset in bold by default. Why override it first with \normalfont and the re-instate it with \bfseries? – Mico Feb 7 '15 at 23:03
  • @Mico Well, it depends what else is going on in the real file, of course. If this is all there is, you're right. I was assuming there was some reason to have these commands in the first place and, hence, that merely removing them wasn't a solution. – cfr Feb 7 '15 at 23:08
  • @Mico Edited. Maybe they got added by the OP as part of trying to add the dot leaders? – cfr Feb 7 '15 at 23:14

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.