我的目录中的页眉字体与文档中的页眉字体不同。我该如何更改?
\documentclass[a4paper,12pt]{scrreprt}
\usepackage[ngerman]{babel}
\usepackage{color,
mathptmx,
fancyhdr,tikz}
\definecolor{myblue}{rgb} {0,0,0}%{0.15,0.15,0.25}
\newcommand{\changefont}[3]{
\fontfamily{#1} \fontseries{#2} \fontshape{#3} \selectfont}
\pagestyle{fancy}
\fancyhead{}
\fancyfoot{}
\fancyhead[R]{\color{myblue} \changefont{ppl}{m}{n} \rightmark \hspace{-20mm}}
\renewcommand{\headrule}{\color{myblue} \hrule width 185mm
}
\begin{document}
\tableofcontents
\chapter{Testchapter}
\section{Testsection}
%several chapters and sections
\end{document}
请看下面的图片...谢谢!
答案1
也许最好使用scrlayer-scrpage
。此包也是 KOMA-Script 包的一部分:
\documentclass[12pt]{scrreprt}
\usepackage[ngerman]{babel}
\usepackage{mathptmx}
\usepackage{microtype}
\usepackage{xcolor}
\definecolor{myblue}{rgb}{0,0,0}%{0.15,0.15,0.25}
\usepackage[
headwidth=\the\paperwidth-\the\hoffset-1in-\the\oddsidemargin:0pt,
headsepline,
automark,
markcase=upper
]{scrlayer-scrpage}
\clearpairofpagestyles
\ohead{\rightmark\hspace{5mm}}
\addtokomafont{pagehead}{\normalfont\fontfamily{ppl}\selectfont\color{myblue}}
\usepackage{blindtext}
\begin{document}
\tableofcontents
\blinddocument\blinddocument\blinddocument\blinddocument\blinddocument
\blinddocument\blinddocument\blinddocument\blinddocument\blinddocument
\blinddocument\blinddocument\blinddocument\blinddocument\blinddocument
\end{document}