使用 KOMA 脚本或 tocloft 和可见标题在目录中留出间距

使用 KOMA 脚本或 tocloft 和可见标题在目录中留出间距

现在我正在使用-package 来为我的目录中的间距。这导致页面上tocloft没有 的问题。您知道如何用命令替换 tocloft 吗?或者您知道如何在使用 时创建相同的内容吗?此外,我需要命令将目录中的页码转换为 normalfont。headerKOMA-scriptheadertocloft

在此处输入图片描述

最小示例:

\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}

答案1

不建议使用tocloft带有 KOMA-Script 类的包。您可以在 ToC 中使用或更改indent和。numwidth\RedeclareSectionCommand\DeclareTOCStyleEntry

例子:

\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}

或者

\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}

答案2

tocloft 选项:

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

仍然想使用 KOMA。

相关内容