4

I would like to move sections in my TOC more to the right =) The picture will explain all:

enter image description here

Here is my code so far (This code will give me the upper part in the picture):

\newgeometry{hmargin={3cm,3cm},vmargin={3cm,4cm}}
% SISÄLLYSLUETTELO

\setlength{\cftsecindent}{2cm}
\dottedcontents{section}[1.5em]{}{1.3em}{.6em}
\renewcommand{\contentsname}{Sisällysluettelo}

\doublespacing
\large \tableofcontents
\singlespacing

\restoregeometry 

Now even if I try to modify the length in \setlength{\cftsecindent}{2cm} the section stays where it is...any ideas why? What am I doing wrong x) Thank you for your help! =)

UPDATE =) If I remove the \dottedcontents{section}[1.5em]{}{1.3em}{.6em} from the code above, I get this:

enter image description here

Now the subsections stay where they are and section goes to bold :/

7
\documentclass{article}
\usepackage{titletoc,tocloft}
\setlength{\cftsubsecindent}{2cm}
\setlength{\cftsubsubsecindent}{4cm}
\dottedcontents{section}[1.5em]{}{1.3em}{.6em}

\begin{document}
\tableofcontents
\section{foo}
\subsection{bar}
\subsubsection{baz}
foobar
\end{document}

enter image description here

  • +1 Thank you for your answer =) Unfortunately it doesn't help me...the section stays where it is...I noticed that If I remove the \dottedcontents I can change the indentations, but then the section goes to bold and looses the dots... :S I think your code moves subsection and subsubsection? =) Or should I replace sections in my code with subsections? =) My document structure at the moment is : PART --> SECTION --> SUBSECTION. Should it be: SECTION --> SUBSECTION --> SUBSUBSECTION? =) – jjepsuomi Apr 30 '13 at 7:07
  • 1
    as long as you do not provide a complete example I do not know what you really mean. – user2478 Apr 30 '13 at 7:13
  • +1 Don't worry about it =) I got it already using your answer =) I just changed all \parts to \sections etc. and your code started to work =) Thank you for your help! =) – jjepsuomi Apr 30 '13 at 7:27
3

In order to modify indentation in the table of contents, you can modify the definition of \l@chapter, l@section or l@subsection (as you wish). The first value (1.5em in the example below) affects the global indent and the second (3.0em) increase the indentation between number and section name. Add these three lines in the main source file to add an extra indent between the number and the text of all sections (with respect to the official book.cls)

\makeatletter
\renewcommand*\l@section{\@dottedtocline{1}{1.5em}{3.0em}}
\makeatother
  • +1 for not requirering additional packages. – Martin Apr 25 '18 at 7:08

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.