Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
% 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.

share|improve this question

2 Answers 2

up vote 2 down vote accepted

Try this:

\makeatletter
\renewcommand*\l@section{\bprot@dottedtocline{1}{0em}{2.3em}}% no indentation
\renewcommand{\@pnumwidth}{3em}
\renewcommand{\@tocrmarg}{4em}
\makeatother
share|improve this answer
    
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}
% setup the table of contents
\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}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.