0

I'd like to edit the table of contents for a book-class file. The problem that I'm facing is that I have a lot of separate Chapters, with no sections, in the first part of the book. If I just use \tableofcontents it looks like this:

I Part
1. Chapter
   1.1 Section
II Part
   2. Chapter

etc. which is generally fine, but since I have a lot of chapters it looks somewhat ugly. I'd would like something like this

I Part
   I.1. Chapter
     I.1.1 Section
   I.2. Chapter

II Part
   II.1. Chapter

but I honestly have no idea how to realize that. I'll also add an example code here, since I'm not sure if there could be a problem with the subfile-package

\documentclass[a4paper, leqno, oneside]{book}
\usepackage{subfiles}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{amssymb,amsmath, amsthm,mathtools,latexsym}
\usepackage{mathrsfs}
\usepackage{geometry}
\usepackage{soul}

\begin{document}
\subfile{Preface.tex}
\tableofcontents
\subfile{Part1.tex}
\subfile{Part2.tex}
\subfile{Part3.tex}

\end{document}

Thanks for the help!

3
  • 1
    \renewcommand{\thechapter}{\thepart.\arabic{chapter}} and this is a clear duplicate of some question (I have to find it, however). Do you really need latexsym? I don't think so...
    – user31729
    Apr 22, 2018 at 11:03
  • First of all, thanks. I didn't finde a good answer to the question and your suggestion didn't really word for me ( imgur.com/a/qINxiXe , the text and numbers start overlapping). I'm sure there is a way to get this exactly like in my example above... I just don't know how.. And no, I don't need latexsym
    – Sito
    Apr 22, 2018 at 11:12
  • The overlapping is a a consequence, true, but that doesn't mean that it is not working. But you got an answer already
    – user31729
    Apr 22, 2018 at 12:30

1 Answer 1

1

In order to include the part number into the numbering scheme of chapters, sections,... and change the spacing in the table of contents you can use the tocloft package as shown in the following MWE:

\documentclass[a4paper, leqno, oneside]{book}
\usepackage{geometry}
\usepackage{tocloft}
\renewcommand{\thechapter}{\thepart.\arabic{chapter}}
\setlength{\cftchapindent}{2em}
\setlength{\cftsecindent}{4em}
\setlength{\cftsubsecindent}{6em}
\setlength{\cftchapnumwidth}{2em}
\setlength{\cftsecnumwidth}{3em}
\setlength{\cftsubsecnumwidth}{4em}

\begin{document}
\tableofcontents
\part{one}
\chapter{first chapter}
\section{section}
\subsection{subsection}
\chapter{second chapter}
\end{document}

\cft...indent controls the indentation from the left margin, while \cft...numwidth controls the space that can be occupied by the numbers. You can of course adjust them to suit your needs.

enter image description here

Not the answer you're looking for? Browse other questions tagged .