8

Consider the Code below:

\documentclass[%
    paper=A4,
    twoside=true,
    fontsize=12pt,
    titlepage=true,
    listof=totoc,
    bibliography=totoc,
    listof=flat,
    open=right,
    cleardoublepage=empty,
    headsepline=true,
    footsepline=false,
    captions=tableheading,
    numbers=noendperiod,
    parskip=half-,
    headings=normal]{scrbook}
\usepackage[a4paper]{geometry}
\geometry{
    includehead=true,
    hmarginratio=1:2,
    vmarginratio=3:5,
    textwidth=170mm,
    textheight=230mm,
    headheight=20pt,
    footskip=15mm,
    bindingoffset=6mm}
\usepackage{showframe}
\usepackage{blindtext}
\usepackage[tocindentauto]{tocstyle}
\usetocstyle{KOMAlike}
\begin{document}
\frontmatter
\tableofcontents
\cleardoublepage
\mainmatter
\blinddocument\blindtext
\pagenumbering{Roman}
\setcounter{page}{20}
\appendix
\blinddocument
\end{document}

The roman pagenumbers in the table of contents are too wide. How to fix this? table of contents

10

One way, compatible with the package tocstyle you are using, is to add

\settocstylefeature{pagenumberbox}{\hbox}

MWE

\documentclass[%
    paper=A4,
    twoside=true,
    fontsize=12pt,
    titlepage=true,
    listof=totoc,
    bibliography=totoc,
    listof=flat,
    open=right,
    cleardoublepage=empty,
    headsepline=true,
    footsepline=false,
    captions=tableheading,
    numbers=noendperiod,
    parskip=half-,
    headings=normal]{scrbook}
\usepackage[a4paper]{geometry}
\geometry{
    includehead=true,
    hmarginratio=1:2,
    vmarginratio=3:5,
    textwidth=170mm,
    textheight=230mm,
    headheight=20pt,
    footskip=15mm,
    bindingoffset=6mm}
\usepackage{showframe}
\usepackage{blindtext}
\usepackage[tocindentauto]{tocstyle}
\usetocstyle{KOMAlike}
\settocstylefeature{pagenumberbox}{\hbox}
\begin{document}
\frontmatter
\tableofcontents
\cleardoublepage
\mainmatter
\blinddocument\blindtext
\pagenumbering{Roman}
\setcounter{page}{20}
\appendix
\blinddocument
\end{document} 

Output:

enter image description here

  • 1
    Or \settocstylefeature{pagenumberbox}{\hbox}. – Gonzalo Medina Feb 20 '15 at 17:23
  • @GonzaloMedina Yes, that's the same. – karlkoeller Feb 20 '15 at 17:24

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.