In this MWE, how come my two-column table of contents gets stretched out into one column upon loading the tocloft package? How can I prevent this?

\documentclass{scrartcl}

\usepackage{multicol}

\begin{document}

\BeforeStartingTOC[toc]{\begin{multicols}{2}}
\AfterStartingTOC[toc]{\end{multicols}}
\tableofcontents

\section{Section 1}
\subsection{Subsection 1.1}
\subsection{Subsection 1.2}
\subsection{Subsection 1.3}
\section{Section 2}
\subsection{Subsection 2.1}
\subsection{Subsection 2.2}
\subsection{Subsection 2.3}
\section{Section 3}
\subsection{Subsection 3.1}
\subsection{Subsection 3.2}
\subsection{Subsection 3.3}
\section{Section 4}
\subsection{Subsection 4.1}
\subsection{Subsection 4.2}
\subsection{Subsection 4.3}

\end{document}

• If you search the site, you will notice that tocloft is probably not compatible with the class you are using. – daleif Oct 1 '17 at 13:01
• @daleif I see. Is there a compatible package that provides similar functionality as tocloft for creating lists of custom counters as done in this question? – Casimir Oct 1 '17 at 13:06
• No idea, I never use the koma classes. Other answers suggest trying the tocstyle package. Not sure if it adds the same features. – daleif Oct 1 '17 at 13:08
• The class you are using can do it. Have a look for tocbasic in the manual. – Johannes_B Oct 1 '17 at 13:48
• @Johannes_B Thanks for the tip. I did get it to work but somehow, separate list entries don't start on a new line. Rather the list looks like a continuous piece of text. I declared \DeclareNewTOC{cases} and added \phantomsection\addxcontentsline{cases}{usecase}{\protect\numberline{\theusecase}#1}\par} to my custom usecase environment. Can you by any chance see what the problem is? – Casimir Oct 1 '17 at 14:22

Try \usepackage[titles]{tocloft}.

MWE:

\documentclass{scrartcl}

\usepackage{multicol}
\usepackage[titles]{tocloft}

\begin{document}

\BeforeStartingTOC[toc]{\begin{multicols}{2}}
\AfterStartingTOC[toc]{\end{multicols}}
\tableofcontents

\section{Section 1}
\subsection{Subsection 1.1}
\subsection{Subsection 1.2}
\subsection{Subsection 1.3}
\section{Section 2}
\subsection{Subsection 2.1}
\subsection{Subsection 2.2}
\subsection{Subsection 2.3}
\section{Section 3}
\subsection{Subsection 3.1}
\subsection{Subsection 3.2}
\subsection{Subsection 3.3}
\section{Section 4}
\subsection{Subsection 4.1}
\subsection{Subsection 4.2}
\subsection{Subsection 4.3}

\end{document}


But you should probably check the Koma doc for tocbasic/tocstyle.

• tocstyle is ... kinda ... dead. – Johannes_B Oct 1 '17 at 13:49
• @Johannes_B ah ok. texdoc -l koma brings up dozens of entries but now all point to a single html page giving basically only a link to scrguien.pdf and then one has to search inside pdf. I only checked there were indeed hits for tocstyle in this manual, after getting the impression tocbasic did not provide tocloft style customization. – user4686 Oct 1 '17 at 13:53
• (cont.) reading a bit more I see that tocbasic is destined to incorporate the tocstyle functionalities in future. (and perhaps already does...) – user4686 Oct 1 '17 at 13:54