[Tex/LaTex] Toc spacing in KOMA

koma-scripttable of contents

I am currently using the class scrreprt which means I need a solution compatible to KOMA. I have the following ToC:

picture

Now I want to reduce the space between the chapters. Another thing I want is that the dots should reach the page number. Is this possible without tocloft?

\documentclass[
12pt, 
numbers=noenddot, 
listof=entryprefix
]{scrreprt}

\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc} 
\usepackage[T1]{fontenc}
\usepackage[onehalfspacing]{setspace} 

\usepackage{lmodern}

\setlength{\parindent}{0pt} 

\setcounter{secnumdepth}{3} 
\setcounter{tocdepth}{2} 

\usepackage[tmargin=3cm, lmargin=3cm, rmargin=2.5cm, bmargin=2cm,      headheight=27.18335pt,footnotesep=2\baselineskip]{geometry}


\begin{document}


\tableofcontents

\chapter{Chap 1}
\section{Sec 1}
\subsection{Subsec 1}
\section{Sec 2}
\section{Sec 3}
\chapter{Chap 2}
\chapter{Chap 3}

\end{document}

Best Answer

You can change the distance before the entries using option tocbeforeskip of command \RedeclareSectionCommand.

You can change the width of the page number column redefining \@pnumwidth.

\documentclass[
12pt, 
numbers=noenddot, 
listof=entryprefix
]{scrreprt}

\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc} 
\usepackage[T1]{fontenc}
\usepackage[onehalfspacing]{setspace} 

\usepackage{lmodern}

%\setlength{\parindent}{0pt}% You should not switch of paragraph indention
                            % without selecting another paragraph formatting,
                            % e.g., using option parskip.

\setcounter{secnumdepth}{3} 
\setcounter{tocdepth}{2} 

\usepackage[tmargin=3cm, lmargin=3cm, rmargin=2.5cm, bmargin=2cm,      headheight=27.18335pt,footnotesep=2\baselineskip]{geometry}

\RedeclareSectionCommand[tocbeforeskip=1ex plus 1pt minus 1pt]{chapter}
\makeatletter
\renewcommand*{\@pnumwidth}{1em}% Width of the page number column in the table
                                % of contents.
\makeatother


\begin{document}


\tableofcontents

\chapter{Chap 1}
\section{Sec 1}
\subsection{Subsec 1}
\section{Sec 2}
\section{Sec 3}
\chapter{Chap 2}
\chapter{Chap 3}

\end{document}

results in

enter image description here

instead of

enter image description here

If you want, you can set both to 0, but I don't like the result:

enter image description here