0

The header font in my ToC is different than the header font in the document. How can I change that?

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

Please have a look at the picture below... Thank you!

enter image description here

1

Maybe it is better to use scrlayer-scrpage. This package is also part of the KOMA-Script bundle:

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.