3

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:

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
5

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[
  tocpagenumberbox={\makebox[3em][r]}% adjust the width to your needs
]{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:

enter image description here

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[
  tocpagenumberbox={\makebox[3em][r]}% adjust the width to your needs
]{chapter,section,subsection}

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[
  tocpagenumberwidth=3em% needs at least version 3.27.3161
]{chapter,section,subsection}

If you want to test this new option you can install the prerelease from the KOMA-Script website.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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