0

In the table of contents that is being generated with the following code notice that the size of the fonts of part, chapter, section are nearly the same, and also of the same family.

How can I adjust the font-type and size of part, to be different from that of chapter and section.

\documentclass[12pt]{report}
\usepackage{blindtext}
\title{My Report}
\author{A.U. Thor}
\begin{document}
\maketitle
 \tableofcontents
\part{Part 1}
\chapter{Introduction}
\section{Foo}
\section{Bar}
\blindtext
\chapter{An Overview}
\section{Fiddle}
\section{DeeDee}
\blindtext

\part{Part 2}
\chapter{Introduction}
\section{TweedleDum}
\section{TweedleDee}

\end{document}

enter image description here

  • One of the usual suspects to customize the visual appearance of the toc would be tocloft. – Johannes_B Dec 15 '18 at 7:06
  • A switch to a KOMA-class would take care of the problem from a few minutes earlier and also make this question much easier to answer. And probably also that indent part number to the left question. – Johannes_B Dec 15 '18 at 7:12
  • 1
    Another simple possibility is titletoc , which comes with package titlesec. – Bernard Dec 15 '18 at 9:59
2

With the tocloft package:

\documentclass{book} % or whatever
\usepackage{tocloft}
\renewcommand{\cftpartfont}{\Huge\itshape} % Part title in Huge Italic font
\begin{document}
\part{A Part}
\chapter{A Chapter}
\end{document}

You may want to change the Part's pagenumber to match by, for example:

\renewcommand{\cftpartpagefont}{\Huge\itshape}

but maybe not.

Read the manual (> texdoc tocloft) for more information.

2

With a KOMA-script class, you would have a set of tools that can get what you want easily.

smilingbuddhaToc

\documentclass[12pt,egregdoesnotlikesansseriftitles]{scrreprt}
\usepackage{blindtext}
\title{My Report}
\author{A.U. Thor}
\RedeclareSectionCommand[tocindent=-1em,tocentryformat=\sffamily\bfseries,tocpagenumberformat=\tiny]{part}
\begin{document}
\maketitle
 \tableofcontents
\part{Wombats}
\chapter{Introduction}
\section{Foo}
\section{Bar}
\blindtext
\chapter{An Overview}
\section{Fiddle}
\section{DeeDee}
\blindtext

\part{Capybaras}
\chapter{Introduction}
\section{TweedleDum}
\section{TweedleDee}

\end{document}

Note: The font of the part entry changed, the font of the pagenumber has changed differently, the part entry is indented and the page number was not reset after the title page. Three questions answered in one.

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.