0

There are chapters, sections, and subsections. Subsections are not numbered. I want the TOC to look like this, that is, to squeeze all subsections into one or more lines:

TOC with subsections in one line with separator and no numbers

How do I do that? Basically, I am using KOMA-Script -- if that helps answering the question. I created this mock-up in Word.

  • 1
    What should be taken into account? The dot spacing? Or only the numbering scheme? – Skillmon Aug 17 '17 at 12:04
  • The picture represents the requirements. Although, fonts and spacing are supportive only. – Marcel Taeumel Aug 19 '17 at 10:14
  • So my answer is enough to get you where you need to be? – Skillmon Aug 19 '17 at 10:29
4

The following is a hacky way and does have its limitations at the moment. I'm trying to fix these in the future. Some of the limitations are visible in the image below. But the ToC comes yours pretty close I think.

\documentclass[numbers=enddot]{scrreprt}

\newif\ifadditionalssec
%\setcounter{secnumdepth}{1} % not necessary anymore


\AtEndDocument{\addtocontents{toc}{\par}}

\newdimen\ssectocindent\ssectocindent=1.5cm
\makeatletter
\RedeclareSectionCommand[%
    toclinefill=\section@dotfill,%
    toconstartlowerlevel={\afterssecs},%
    tocpagenumberbox=\hbox]
    {section}
\RedeclareSectionCommand[%
    toclinefill=\chapter@dotfill,%
    toconstartlowerlevel={\afterssecs},%
    tocpagenumberbox=\hbox]
    {chapter}
\newcommand*{\chapter@dotfill}{%
    \def\@dotsep{0.072}\TOCLineLeaderFill[\textbf{.}]}
\newcommand*{\section@dotfill}{%
    \def\@dotsep{0.072}\TOCLineLeaderFill}
\def\afterssecs{%
    \def\numberline##1{\scr@numberline{##1}}\par\additionalssecfalse}
\def\l@subsection#1#2{%
    \def\numberline##1{}%
    \ifadditionalssec%
        $\cdot$ % this is the delimiting dot, change it to your liking
    \else%
        \par%
        \hangindent\ssectocindent%
        \parindent\ssectocindent%
        \rightskip\ssectocindent%
        \global\additionalssectrue%
    \fi#1}
\makeatother

\begin{document}
\tableofcontents

\chapter{Foo}
\section{Bar}
\subsection{Baz}
\subsection{Baz}
\subsection{Baz2}
\subsection{Baz3}
\subsection{Baz}
\subsection{Baz2}
\subsection{Baz3}
\subsection{Baz}
\subsection{Baz2}
\subsection{Baz3}
\subsection{Baz}
\subsection{Baz2}
\subsection{Baz3}
\section{Bar}
\subsection{Baz}
\subsection{Baz2}
\subsection{Baz3}

\chapter{Foo}
\section{Bar}
\subsection{Baz}
\subsection{Baz2}
\subsection{Baz3}
\section{Bar}
\subsection{Baz}
\subsection{Baz2}
\subsection{Baz3}
\subsection{Baz}
\subsection{Baz2}
\subsection{Baz3}
\subsection{Baz}
\subsection{Baz2}
\subsection{Baz3}
\subsection{Baz}
\subsection{Baz2}
\subsection{Baz3}
\subsection{Baz}
\subsection{Baz2}
\subsection{Baz3}

\end{document}

enter image description here

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.