[Tex/LaTex] How to no-indent section headings in scrrprt table of contents

indentationkoma-scripttable of contentstocstyle

Using the scrreprt class of KOMA-Script with xelatex, I'd like to have my section entries in the table of contents appear without indenting. My current code is:

\documentclass[10pt,a5paper,DIV12,BCOR8.25mm,twoside,parskip=half]{scrreprt}
% setup the table of contents
\usepackage[tocbreaksstrict]{tocstyle}
\usetocstyle{standard}
\settocfeature{raggedhook}{\raggedright}
\makeatletter
\renewcommand{\@pnumwidth}{3em}
\renewcommand{\@tocrmarg}{4em}
\makeatother
\KOMAoptions{toc=flat} 
\setcounter{secnumdepth}{0}
\begin{document}
\tableofcontents
\section{First Section}
\section{Second Section}
\end{document}

which results in the following output:

Section heading normal toc

However, I'd like to have the lines in the toc flush left with the rest.

Ideally, this would work with tocstyle, which most probably prohibits the use of tocloft to do this. The reason I'm using tocstyle is that it seems to get me best results in typesetting a very large table of contents of a ~2000 pages book with hundreds of sections. Many section titles used to extend into the right margin and push out the page numbers. This seems to be largely fixed by the two \renewcommand settings. However, I also needed the \raggedright to avoid the toc to be set in funny looking justified style. That's when tocstyle came into the game.

If there is need to change over to tocloft, I'm happy to do that provided it works with my long section titles not shown in the example above.

Best Answer

Try this:

\makeatletter
\renewcommand*\l@section{\bprot@dottedtocline{1}{0em}{2.3em}}% no indentation
\renewcommand{\@pnumwidth}{3em}
\renewcommand{\@tocrmarg}{4em}
\makeatother
Related Question