1

right now I am using the tocloft-package for spacing in my toc. This results into the problem of not having a header on the page. Do you know a way to replace tocloft with KOMA-script commands or do you know a way to create the same header while using tocloft? Furthermore I need the command to turn the page numbers in toc to normalfont.

enter image description here

Minimal example:

\documentclass[a4paper]{scrartcl}

%HEADER
\usepackage[headsepline=0.75pt]{scrlayer-scrpage}
\renewcommand*{\headfont}{\normalfont\sffamily}
\clearpairofpagestyles
\automark[section]{section}         
\ihead{\headmark} 
\ohead{\pagemark}                

%Spacing TOCLOFT
\usepackage{tocloft} 
\cftsetindents{sec}{0cm}{0.9cm}
\cftsetindents{subsec}{0.3cm}{1.25cm}
\cftsetindents{subsubsec}{0.6cm}{1.355cm}
\renewcommand{\cftsecfont}{\normalfont}


\begin{document}
\tableofcontents
\newpage
\section{Ein erster Abschnitt}
\subsection{Unterabschnitt}
\subsubsection{Unter-Unterabschnitt}
\end{document}

2 Answers 2

2

It is not recommended to use package tocloft with a KOMA-Script class. You could change indent and numwidth in ToC using \RedeclareSectionCommand or \DeclareTOCStyleEntry.

Example:

\documentclass[a4paper]{scrartcl}

\usepackage[headsepline=0.75pt]{scrlayer-scrpage}
\setkomafont{pagehead}{\normalfont\sffamily}% <- changed
\clearpairofpagestyles
\automark[section]{section}
\ihead{\headmark} 
\ohead{\pagemark}

\RedeclareSectionCommand[
  tocindent=0cm,
  tocnumwidth=0.9cm
]{section}
\RedeclareSectionCommand[
  tocindent=0.3cm,
  tocnumwidth=1.25cm
]{subsection}
\RedeclareSectionCommand[
  tocindent=0.6cm,
  tocnumwidth=1.355cm
]{subsubsection}
\setkomafont{sectionentry}{\normalfont}

\begin{document}
\tableofcontents
\clearpage
\section{Ein erster Abschnitt}
\subsection{Unterabschnitt}
\subsubsection{Unter-Unterabschnitt}
\end{document}

or

\documentclass[a4paper]{scrartcl}

\usepackage[headsepline=0.75pt]{scrlayer-scrpage}
\setkomafont{pagehead}{\normalfont\sffamily}% <- changed
\clearpairofpagestyles
\automark[section]{section}
\ihead{\headmark} 
\ohead{\pagemark}

\DeclareTOCStyleEntry[
  indent=0cm,
  numwidth=0.9cm
]{tocline}{section}
\DeclareTOCStyleEntry[
  indent=0.3cm,
  numwidth=1.25cm
]{tocline}{subsection}
\DeclareTOCStyleEntry[
  indent=0.6cm,
  numwidth=1.355cm
]{tocline}{subsubsection}
\setkomafont{sectionentry}{\normalfont}

\begin{document}
\tableofcontents
\clearpage
\section{Ein erster Abschnitt}
\subsection{Unterabschnitt}
\subsubsection{Unter-Unterabschnitt}
\end{document}
0
0

Option for tocloft:

\usepackage[titles]{tocloft} 
\renewcommand{\cftsecpagefont}{\normalfont}

Still would like to use KOMA instead.

You must log in to answer this question.

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