No hyphenation in TOC entries, please
Since you are using a KOMA class, the way to go is to use the tocstyle
package:
The code:
\documentclass{scrreprt}
\usepackage[ngerman]{babel}
\usepackage[tocflat]{tocstyle}
\newtocstyle{raggedstyle}{%
\settocstylefeature[0]{entryhook}{\bfseries}
\settocstylefeature[0]{leaders}{\hfill}
\settocfeature{raggedhook}{\raggedright}
\settocfeature{spaceafternumber}{17pt}
}
\usetocstyle{raggedstyle}
\begin{document}
\tableofcontents
\chapter{Introduction}
\section{This kind of problem, that kind of problem, other ones and further considerations}
\section{More problems, even more problems, much worse than these, headline with no hyphenation and somo more text goes here for the example}
\end{document}
Refer to the package documentation for further adjustments.
I think I'd be inclined to use Gonzalo Medina's answer given you are using scrreprt
(and skip loading tocloft
), but a tocloft
solution isn't too tricky (and also useful for memoir
users):
\documentclass{scrreprt}
\usepackage[ngerman]{babel}
\usepackage{tocloft}
\cftsetindents{section}{0mm}{12mm}
\cftsetindents{chapter}{0mm}{12mm}
\makeatletter
% \renewcommand{\@tocrmarg}{2.55em plus1fil}
\renewcommand{\@tocrmarg}{\@pnumwidth plus1fil} % <-- Revised
\makeatother
\begin{document}
\tableofcontents
\chapter{Introduction}
\section{This kind of problem, that kind of problem, other ones and further considerations}
\section{More problems, even more problems, much worse than these, headline hyphenation, and blablablablablablablablabla and XYZ-blablablablablablablablabla}
\end{document}
You should, in general, make sure the revised value for \@tocrmarg
(TOC Right MARGin) is greater than that for \@pnumwidth
(Page NUMber WIDTH).
A solution with the titletoc
package:
\documentclass{scrreprt}
\usepackage[showframe]{geometry}
%\usepackage[ngerman]{babel}
\usepackage{ragged2e}
\usepackage{fmtcount}
\usepackage{titletoc}
\titlecontents{chapter}[12mm]
{\contentsmargin{10mm}\bigskip\sffamily\bfseries\Large}
{\contentslabel[\MakeUppercase{\romannumeral\thecontentslabel}]{12mm}}
{}
{\hfill\contentspage}[\medskip]
\titlecontents{section}[12mm]
{ \rightskip=10mm plus 1fil\hyphenpenalty=10000\contentsmargin{2mm}}%
{\contentslabel[\thecontentslabel.]{12mm}}
{}
{\hskip2pt\titlerule*[6pt]{.}\contentspage}
\begin{document}
\tableofcontents
\setcounter{page}{100}
\chapter{Introduction}
\section{This kind of problem, that kind of problem, other ones and further considerations}
\section{More problems, even more problems, much worse than these, headline hyphenation, and blablablablablablablablabla and XYZblablablablablablablablabla}
\end{document}