8

How to make indents as in the second image?

This is what it looks like now:

enter image description here

This is what it should look like:

enter image description here

MWE:

\documentclass[a4paper, 14pt, english]{extreport}

\usepackage[T2A]{fontenc}   
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{tocloft}
\usepackage[a4paper, left=25mm, right=10mm, top=20mm, bottom=20mm]{geometry}

\linespread{1.3} 
\renewcommand{\rmdefault}{ftm} 
\frenchspacing

\renewcommand{\cftchapfont}{\normalsize  } 
\renewcommand\cftchappagefont{\normalfont} 

\renewcommand{\cftbeforechapskip}{0em} 
\renewcommand{\cftparskip}{-1mm} 
\renewcommand{\cftdotsep}{1} 
\renewcommand{\cftpartleader}{\cftdotfill{\cftdotsep}} 
\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}}

\cftsetindents{chapter}{0pt}{10pt} 
\cftsetindents{section}{0pt}{30pt}
\cftsetindents{subsection}{0pt}{40pt}
\cftsetindents{subsubsection}{0pt}{50pt}



\begin{document}

\tableofcontents
\thispagestyle{empty} 
\addtocontents{toc}{\protect\thispagestyle{empty}}

\chapter{test}
\section{test} 
\section{test}
\section{test}
\section{test}
\section{test}
\section{test} 
\section{test}
\section{test}
\section{test}
\section{test}
\section{test} 
\section{test}
\section{test}
\section{test}
\section{test}

\end{document}
lockstep
  • 250,273
Vadim
  • 183

2 Answers2

8

The package tocloft supports this indirect. However this modification allows all settings by tocloft

\documentclass{book}
\usepackage{tocloft}
\makeatletter
\renewcommand{\numberline}[1]{%
  \setbox0\hbox{#1\quad}%
  \hb@xt@\wd0{\@cftbsnum #1\@cftasnum\hfil}\@cftasnumb}
\makeatother
\begin{document}

\tableofcontents
\chapter{foo}
\section{bar}
\section{bar}
\setcounter{section}{170}
\section{bar}
\section{bar}

\end{document}

enter image description here

Marco Daniel
  • 95,681
6

While I can't offer a tocloft solution, the desired layout can be achieved by using the tocstyle package (part of KOMA-Script) and its tocfullflat option.

\documentclass{report}

\usepackage[tocfullflat]{tocstyle}
\usetocstyle{allwithdot}
\settocstylefeature[0]{entryhook}{\normalfont}
\settocstylefeature[0]{entryvskip}{0pt}

\makeatletter
\renewcommand*{\@dotsep}{1}
\makeatother

\begin{document}

\tableofcontents

\chapter{test}
\section{test} 
\section{test}
\section{test}
\section{test}
\section{test}
\section{test} 
\section{test}
\section{test}
\section{test}
\section{test}
\section{test} 
\section{test}
\section{test}
\section{test}
\section{test}

\end{document}

enter image description here

lockstep
  • 250,273