Using the scrrprt 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}
\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:

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.

-

Try this:

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

-
beautiful, spot on! –  kongo09 Oct 21 '11 at 9:33

The (key-value) KOMA option toc=flat is currently not recognized by tocstyle. Replace it with the tocstyle package option tocflat.

\documentclass[10pt,a5paper,DIV12,BCOR8.25mm,twoside,parskip=half]{scrreprt}
\usepackage[tocbreaksstrict,tocflat]{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}

-