2

I successfully changed the font for the chapters, sections etc. and for the chapterentry in ToC, but it doesn't change the font for sectionentry. How can I set all elements in the ToC to have the same font?

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{JVAthesis}[]
\LoadClass[fontsize=12pt, a4paper, headsepline, footsepline, twoside=off, numbers=noenddot]{scrbook}

    \RequirePackage{setspace}
    \onehalfspacing

    \RequirePackage{fontspec}
    \setmainfont{DejaVu Serif}%{Calibri}
    \newfontfamily{\EXO}{Exo 2}

    \setkomafont{disposition}{\EXO}
    \setkomafont{chapterentry}{\EXO}
    \setkomafont{chapterentrypagenumber}{\EXO}

    \setkomafont{pagenumber}{\EXO}
    \renewcommand{\headfont}{\EXO}

     \setkomafont{chapter}{\normalfont\huge\scshape\color{BZLblue}\EXO}
     \setkomafont{section}{\normalfont\Large\scshape\color{BZLblue}\EXO}
     \setkomafont{subsection}{\normalfont\large\scshape\color{BZLblue}\EXO}

     ...

However, setting the sectionentry is not possible because the class is based on scrbook. Result looks like this enter image description here

1
2

You can use

\RedeclareSectionCommands[
  tocentryformat=\usekomafont{disposition},
  tocpagenumberformat=\usekomafont{disposition}
]{chapter,section,subsection,subsubsection,paragraph,subparagraph}

Example:

\documentclass[fontsize=12pt, a4paper, headsepline, footsepline, twoside=off, numbers=noenddot,headlines=1.4]{scrbook}
\usepackage[ngerman]{babel}
\usepackage{blindtext}% only for dummy text
\usepackage{xcolor}
\colorlet{BZLblue}{blue!70!black}

\usepackage{setspace}
\onehalfspacing

\usepackage{fontspec}
\setmainfont{DejaVu Serif}
\newfontfamily{\EXO}{Exo 2}

\setkomafont{disposition}{\normalfont\EXO}

\setkomafont{pagenumber}{\usekomafont{disposition}}
\setkomafont{pageheadfoot}{\usekomafont{disposition}}

\setkomafont{chapter}{\huge\color{BZLblue}}
\setkomafont{section}{\Large\color{BZLblue}}
\setkomafont{subsection}{\large\color{BZLblue}}

\RedeclareSectionCommands[
  tocentryformat=\usekomafont{disposition},
  tocpagenumberformat=\usekomafont{disposition}
]{chapter,section,subsection,subsubsection,paragraph,subparagraph}

\begin{document}
\tableofcontents
\Blinddocument
\end{document}

Result:

enter image description here

1
  • Thanks, works perfectly fine! – vonAlenberg Oct 3 '20 at 7:45

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.