fancyhdr は tocloft によって上書きされます

fancyhdr は tocloft によって上書きされます

私は toc 内のドットの数と分布を変更したかったので、次のように tocloft パッケージで変更してみました。

\usepackage{tocloft}
\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}}
\renewcommand{\cftdotsep}{3}

しかし、そうすると、新しいパッケージを組み込んだ後、ヘッダーが単に消えてしまうため、すべての fancyhdr 設定が変更/削除されると思います。

これが私の現在の序文です:

\usepackage[ngerman]{babel}

\usepackage{mathptmx}

\usepackage{graphicx}
\graphicspath{{images/}}

\usepackage[left=4cm, right=2cm, top=2.5cm, bottom=2.5cm]{geometry}

\usepackage{tocloft}
\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}}
\renewcommand{\cftdotsep}{3}

% Header and Footer
\usepackage{fancyhdr}
\usepackage{nameref}
\usepackage{titleref}

\pagestyle{fancy}

\fancyhead{\currenttitle}
\fancyhead[C]{Praxisarbeit}
\fancyhead[R]{\thepage}

\usepackage{biblatex}
\addbibresource{quellen.bib}

MWE:

\documentclass[12pt]{article}
\usepackage[ngerman]{babel}

\usepackage[left=4cm, right=2cm, top=2.5cm, bottom=2.5cm]{geometry}


%----the issue----%
%\usepackage{tocloft}
%\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}}
%\renewcommand{\cftdotsep}{3}

\usepackage{fancyhdr}
\pagestyle{fancy}

\fancyhead{\leftmark}
\fancyhead[C]{title}
\fancyhead[R]{\thepage}
\fancyfoot{}
\fancyfoot[L]{}

\begin{document}

\pagenumbering{Roman} %römische Seitenzahlen
%--------Inhaltsverzeichnis------------
\tableofcontents
\addcontentsline{toc}{section}{Inhaltsverzeichnis}
\newpage
%--------Abbildungsverzeichnis---------
\listoffigures
\addcontentsline{toc}{section}{Abbildungsverzeichnis}
%--------Abkürzungsverzeichnis---------
\newpage \section*{Abkürzungsverzeichnis}
\addcontentsline{toc}{section}{Abkürzungsverzeichnis}
%---------------ENDE-------------------


\newpage \pagenumbering{arabic} %arabische Seitenzahlen
%--------Einleitung---------
\newpage \section{section 1}
\subsection{subsection 1}
\subsection{subsection 2}
\subsection{subsection 3}

%--------Theoretischer Rahmen---------
\newpage \section{section 2}
\subsection{subsection 1}
\subsection{subsection 2}
\subsubsection{subsubsection 1}
\subsubsection{subsubsection 2}

%--------Methodik---------
\newpage \section{section 3}
\subsection{subsection 1}
\subsection{subsection 2}
\subsection{subsection 3}

\end{document}

関連情報