页眉中的文本颜色错误

页眉中的文本颜色错误

我正在写一篇论文,遇到了一个奇怪的问题。我希望每页的页眉都显示章节名称。由于打印的原因,文本必须在偶数页和奇数页的对面。对于所有章节,它都运行良好,但目录除外,目录左侧的页眉与标题具有相同的颜色,而不是序言中指定的颜色。更改页眉颜色没有任何效果,但更改标题颜色也会更改页眉颜色。

任何帮助将不胜感激。

这是我设置目录和页眉的代码:

% Table of contents customization
\renewcommand{\contentsname}{\bfseries\color{titleBlue}Table of Contents}
\renewcommand{\cftaftertoctitle}{\vspace{0.1ex}\endgraf\rule{\linewidth\color{black}}{1.25pt}}
\renewcommand{\cftchapfont}{\Large\bfseries}
\renewcommand{\cftchappagefont}{\Large\bfseries}
\renewcommand{\cftsecfont}{\large}
\renewcommand{\cftsecpagefont}{\large}
\renewcommand{\cftsubsecfont}{\large}
\setlength{\cftbeforesecskip}{6pt}
\setlength{\cftbeforesubsecskip}{4pt}
\setcounter{tocdepth}{3}

% Header and footer settings
\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE]{
\normalfont
\color{headGrey}\nouppercase{\textit{\leftmark}}}

\fancyhead[RO]{
\normalfont
\color{headGrey}\nouppercase{\textit{\leftmark}}}
\cfoot{\thepage}
\setlength{\headheight}{24pt}
\renewcommand{\headrulewidth}{1pt}
\renewcommand{\headrule}{\color{headerBlue!40!white}\hdashrule[0.5ex]{1.\textwidth}{0.75mm}{0.75mm} }

示例目录的呈现

答案1

非常感谢您的评论。我认为将标题也包含在目录中可以保持文本的连贯性,因为它跨越多个页面。我已删除格式表单\contentsname并将其移动到\cfttoctitlefont,它按预期工作。

相关内容