2

I am very new to Tex, I am working of a template that someone else has given me.

I am try to change the /part{Part I: my stuff} from looking like this in the TOC

 1 Introduction

 I  Part I: my stuff

 2  Procedure blah blah

 3  Procedure blah blah

 II Part II: my stuff

 4  Procedure blah blah

to something like:

 1 Introduction

 Part I: my stuff

    2  Procedure blah blah

    3  Procedure blah blah

 Part II: my stuff

    4  Procedure blah blah

Currently I have this

%% ---------------------------------------------------------------------- %%
\mainmatter

% Main matter
% -> Global Introduction
\input{Chapters/Introduction.tex} 
%% *****     PART 1     *****
\part*{<Insert Title of First Part>}

\input{Chapters/SummaryPartA.tex}

%% *****     PART 2     *****
\part*{<Insert Title of second Part>}

\input{Chapters/SummaryPartB.tex}

Thank you for your help

CromeX
  • 165

1 Answers1

3

The following works with the book document class, so I hope it will work with yours, too, since it is based on this one.

It seems to me that you want the indenting for \chapters starting with the second one. So we can add a line (requires the tocloft package)

\addtocontents{toc}{\protect\setlength{\cftchapindent}{2em}}

just after the first \chapter.

Also, to have no numbers in the ToC for numbered \parts, we can patch the command \@part through \patchcmd in this way (requires the etoolbox package)

\makeatletter
\patchcmd{\@part}
    {\addcontentsline{toc}{part}{\thepart\hspace{1em}#1}}
    {\addcontentsline{toc}{part}{#1}}
    {}
    {}
\makeatother

Complete MWE:

\documentclass{book}
\usepackage{tocloft}
\usepackage{etoolbox}
\makeatletter
\patchcmd{\@part}
    {\addcontentsline{toc}{part}{\thepart\hspace{1em}#1}}
    {\addcontentsline{toc}{part}{#1}}
    {}
    {}
\makeatother

\begin{document}

\tableofcontents

\chapter{Introduction}
\addtocontents{toc}{\protect\setlength{\cftchapindent}{2em}}
\part{Part I: my stuff}
\chapter{Procedure blah blah}
\chapter{Procedure blah blah}
\part{Part II: my stuff}
\chapter{Procedure blah blah}
\end{document} 

Output:

enter image description here

karlkoeller
  • 124,410