KOMA 无法更改目录中章节的字体

KOMA 无法更改目录中章节的字体

我成功更改了章节、节等以及目录中的 chapterentry 的字体,但 sectionentry 的字体没有更改。如何将目录中的所有元素设置为相同的字体?

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

     ...

但是,由于该类基于 scrbook,因此无法设置 sectionentry。结果如下所示 在此处输入图片描述

答案1

您可以使用

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

例子:

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

结果:

在此处输入图片描述

相关内容