scrbook: Roman page numbers in TOC are wider than textwidth?

Consider the following Minimum Working Example (MWE):

\documentclass{scrbook}

\begin{document}

\pagenumbering{Roman}%
\tableofcontents

\chapter{Roman Chapter}
\chapter{Roman Chapter}
\chapter{Roman Chapter}
\chapter{Roman Chapter}
\chapter{Roman Chapter}
\chapter{Roman Chapter}
\chapter{Roman Chapter}
\chapter{Roman Chapter}
\chapter{Roman Chapter}
\chapter{Roman Chapter}
\chapter{Roman Chapter}
\chapter{Roman Chapter}

\pagenumbering{arabic}%

\chapter{Arabic Chapter}
\chapter{Arabic Chapter}
\chapter{Arabic Chapter}

\end{document}


Screenshot of the result:

Description of the issue:

As you can see, the Roman letters are wider than the \textwidth what looks really ugly. How can I right align the Roman numbers below each other in one row?

Update: While playing around with \documentclass{book}, suddenly the TOC does appear like expected. Now I am curious - what could be the issue in scrbook?

• If you add sections to the part with Roman page numbers you will get the same issue with standard classes. – esdd Jul 30 at 20:03

By the default the pagenumbers are right aligned in box of \@pnumwidth (default is 1.55em). This box is to small for the Roman numbers.

Assuming there are only chapters with Roman page numbers:

\RedeclareSectionCommand[
tocpagenumberbox=\mbox
]{chapter}


or

\RedeclareSectionCommand[
]{chapter}


Example:

\documentclass{scrbook}

\RedeclareSectionCommand[
tocpagenumberbox=\mbox
]{chapter}

\begin{document}
\pagenumbering{Roman}
\tableofcontents
\chapter{Roman Chapter}
\chapter{Roman Chapter}
\chapter{Roman Chapter}
\chapter{Roman Chapter}
\chapter{Roman Chapter}
\chapter{Roman Chapter}
\chapter{Roman Chapter}
\chapter{Roman Chapter}
\chapter{Roman Chapter}
\chapter{Roman Chapter}
\chapter{Roman Chapter}
%\section{Roman Section}
\chapter{Roman Chapter}

\cleardoubleoddpage
\pagenumbering{arabic}%
\chapter{Arabic Chapter}
\chapter{Arabic Chapter}
\chapter{Arabic Chapter}
\end{document}


Result:

If there are also sections etc. with Roman pagenumbers, then you could change \@pnumwidth (works for standard classes too):

\makeatletter
\renewcommand\@pnumwidth{3em}
\makeatother


or you could use \RedeclareSectionCommands:

\RedeclareSectionCommands[

The next KOMA-Script version 3.27 will provide an option pagenumberwidth for the TOC entry style tocline. With prefix toc (topagenumberwidth) this option can be used in \RedeclareSectionCommand or \RedeclareSectionCommands.
\RedeclareSectionCommands[