KOMA-Script:如何仅为章节编号着色

KOMA-Script:如何仅为章节编号着色

我为我的论文添加了一抹色彩,发现它看起来相当漂亮。主题是:章节和节标题是深蓝色,编号是更亮的蓝色。

我设法对此类中的\part和部分执行了此操作,但是我似乎找不到方法来使用对其他部分唯一明显可用的控件:。\chapterscrreprt\othersectionlevelsformat{sectioning name}{}{counter output}

\section \subsection我如何更改、\subsubsection和的编号颜色\paragraph?我是否必须开始使用该titlesec包?

以下是我的 MWE。谢谢

\documentclass[
DIV=11,
%fontsize=12,
twoside,
headinclude=false,
titlepage=firstiscover,
abstract=true,
headsepline=true,
footsepline=true,
chapterprefix=true, %this allows for editing of the chapter titles
headings=big,
bibliography=totoc,%adds unnumbered Bibliography chapter to toc
captions=tableheading
]{scrreprt}

%%% Packages
\usepackage[left=2cm,right=2cm,top=2.5cm,bottom=3cm]{geometry}
\usepackage{setspace}
\usepackage{graphicx}
\usepackage[svgnames,x11names]{xcolor}
\usepackage{minitoc} 
\usepackage{notoccite}
\usepackage{kpfonts}
\usepackage[T1]{fontenc}
%\usepackage{biblatex}
%\usepackage{mathchars}
%\usepackage{acro}
%\usepackage[hidelinks
%,bookmarksopen=true,bookmarksopenlevel=4 %This is for the appendix command formulated
%]{hyperref}
\usepackage{tensor}
\usepackage{siunitx}
\usepackage{wasysym}

\linespread{1.5} %imperial uses 1.5 
\flushbottom

%%%%%%%%%%% ToC DEPTH LEVEL
\setcounter{secnumdepth}{4} % number subsubsection
\setcounter{tocdepth}{4} % list subsubsection
\setcounter{minitocdepth}{4}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Entry of TOC LOF LOT
\def\body{
    \pagenumbering{roman}
    \cleardoublepage
\linespread{1.25}
    %%% MINITOC
    \dominitoc
    % MINITOC styling
    \renewcommand{\mtcfont}{\normalsize\fontfamily{jkpss}\selectfont}
    \renewcommand{\mtcSfont}{\normalsize\bf\fontfamily{jkpss}\selectfont}

    \mtcsettitlefont{minitoc}{\bf\fontfamily{jkpss}\selectfont}
    \mtcsettitle{minitoc}{Contents \textcolor{white}{mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmn} Page}

    %%% TOC
    \tableofcontents
    \addtocontents{toc}{~\hfill\textbf{Page}\par} %Adds the word Page
    \cleardoublepage

    %%% LOF
    \listoffigures \addcontentsline{toc}{section}{List of Figures}
    \addtocontents{lof}{~\hfill\textbf{Page}\par} %Adds the word Page
    \cleardoublepage

    %%% LOT
    \listoftables \addcontentsline{toc}{section}{List of Tables} 
    \addtocontents{lot}{~\hfill\textbf{Page}\par} %Adds the word Page
    \cleardoublepage


    \pagestyle{headings}
    \pagenumbering{arabic}


    %%% CHAPTER STYLING
    \addtokomafont{chapterprefix}{\raggedleft \linespread{1}}
    \setkomafont{chapter}{\color{DodgerBlue4}\fontsize{40}{30}\selectfont}

    \addtokomafont{section}{\color{DodgerBlue4}\fontsize{20}{24}\selectfont}
    \addtokomafont{subsection}{\color{DodgerBlue4}\fontsize{18}{22}\selectfont}
    \addtokomafont{subsubsection}{\color{DodgerBlue4}\fontsize{16}{19}\selectfont}
    \addtokomafont{paragraph}{\color{DodgerBlue4}\fontsize{15}{19}\selectfont}

    \renewcommand*{\chapterformat}{%
    \mbox{\scalebox{0.80}{\chapappifchapterprefix{\nobreakspace}}%
    \scalebox{3.5}{\color{DeepSkyBlue2}\thechapter}\enskip}}

}

\begin{document}

\body

\chapter{First Chapter}
\linespread{1}
\dictum[Neil deGrasse Tyson]{The good thing about science is that it's true whether or not you believe in it.}


\minitoc

Here is some introduction

\section{Here is a section for the minitoc}
Bla bla.

\subsection{And why not a subsection too}
Just to spice things up a bit.

\end{document}

答案1

\renewcommand*{\othersectionlevelsformat}[3]{\textcolor{DeepSkyBlue2}{#3}\autodot\enskip}

稍微解释一下:

正如你在问题中所说,\othersectionlevelsformat给出了 3 个参数,因此,当你(重新)定义它时,它需要有 3 个参数,因此[3]。并且定义仅使用第三个参数(给出计数器的位置),因此你只需要使用#3

顺便说一句,scrguien.pdf 第 97 和 98 页中的示例是不言自明的。

相关内容