0

I produce a table of content with \tableofcontents and do not see how to add a bit of separating space between the section number and the title - they are run together. What should I change?

I read the answer which refers in the title to Roman Numerals which is not my case; the answer nevertheless partially applicable, but most of the advice is for an obsolete package (tocstyle) and it is therefore somewhat tricky to identify the parts still valid. The current KOMA version has much simpler solutions, which I think should be searchable in StackExchange.

My MWE is:

\documentclass[
headings=standardclasses,     % to use serif font for titles 
a4paper,    
10pt,
notitlepage
]{scrartcl}


\usepackage{fontspec}
\usepackage[english]{babel}

\usepackage{csquotes}  

\makeindex

\addtokomafont{part}{\LARGE} % reduce size of part
\addtokomafont{partnumber}{\LARGE}

\counterwithin{section}{part}
\renewcommand{\thepart}{\arabic{part}}


\usepackage{bookmark}

\begin{document}
\tableofcontents    
    \section{should be 0.1}
    
    Each page shows :
    
    \section{should be 0.2}
    
    The index pages list automatically.
    
    \part{is Part 1}
    
    \section{should be 1.1}
    Some nonsense text
    
    \subsubsection{should be 1.1.1}
    The tufte style does discourage
    
    \part{is Part 2}
    
    \section{should be 2.1}
    
    References 
    
\end{document}

and the output shows no space between section numbers and titles::

enter image description here

5
  • Have a look at the dynnumwidth option of the tocbasic KOMA configuration options (see KOMA manual). It essentially determines such run-ins in previous runs and adds space in the next run. In my experience, it usually works.
    – TeXnician
    Jun 5, 2023 at 23:34
  • 3
    \DeclareTOCStyleEntry[dynnumwidth]{tocline}{section} should work. Also move the \counterwithin{section}{part} behind the bookmark package so that hyperref updates also the target names for the links. Jun 6, 2023 at 7:56
  • 5
    Does this answer your question? Roman numerals become “too wide” in table of contents See, i.e., esdd's answer
    – cabohah
    Jun 6, 2023 at 9:05
  • @UlrikeFischer: with your advice and some more search I found that adding toc=flat in the options for the documentclass sufficient and even simpler. Anything wrong with this?
    – user855443
    Jun 8, 2023 at 18:53
  • well it gives another look. Take the one you prefer. Jun 8, 2023 at 18:54

1 Answer 1

0

The simplest solution I found is to include toc=flat in the documentclass options like:

\documentclass[
      headings=standardclasses,     % to use serif font for titles 
      a4paper,
      10pt,
      toc=flat,  
      notitlepage 
  ]{scrartcl}

As Ulrike Fischer pointed out, it changes some other aspect of the ToC and her solution may be preferable in some cases.

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .