TransWikia.com

KOMA-Script and long part numbers

TeX - LaTeX Asked by Najib Idrissi on May 18, 2021

I’m using KOMA-script (e.g. scrartcl) with polyglossia and the French language. Parts are therefore numbered like "Première partie", "Deuxième partie"…, instead of "Part I", "Part II"…

In English, KOMA-Script replaces "Part I" with just "I" in the table of contents, so the part number does not overlap the part title. But in French, this is for some reason not the case and the table of contents looks horrible. For example,

documentclass{scrartcl}
usepackage{polyglossia}
setmainlanguage{french}
begin{document}
tableofcontents
part{AAAAAA}
part{BBBBBB}
end{document}

gives this output:

example output

How can I fix this? I tried to modify thepart but it does not seem to do anything; I even tried to put garbage (undefined commands) in it and the document still compiled fine so it’s apparently not even used… I also know that there is the toc=flat option, but this looks really bad in my opinion.

I am aware of this Q&A, but it deals with the memoir class and is not applicable here. As far as I can tell this is pretty much a bug in KOMA-Script, but since I am not able to read German I have no idea where to go on their website to report this so I’d settle for a quick and dirty fix.

One Answer

KOMA-script supports auto-sizing the width needed for the numbers in the TOC. You'll need at least three LaTeX runs to get the correct results (one to build the .toc file, one to measure the widest entry, one to get the results).

The following makes the necessary changes to part to achieve this.

documentclass{scrartcl}
usepackage{polyglossia}
setmainlanguage{french}
RedeclareSectionCommand[tocdynnumwidth=true]{part}
begin{document}
tableofcontents
part{AAAAAA}
part{BBBBBB}
end{document}

enter image description here

Correct answer by Skillmon on May 18, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP