# KOMA-Script and long part numbers

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:

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.

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}


• Thanks, this works perfectly! Do you know where this is documented in the KOMA-script manual? I couldn't find anything about tocdynnumwidth. – Najib Idrissi Sep 16 '20 at 13:15
• @NajibIdrissi search for dynnumwidth, that's a key available for \DeclareTOCStyleEntry. Those keys are available to \RedeclareSectionCommand with a prepended toc. – Skillmon Sep 16 '20 at 13:21