1

I have the following document

\documentclass[chapterprefix=true]{scrbook}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{blindtext}
\colorlet{chaptercolor}{black}

\setkomafont{chapter}{\normalfont\color{chaptercolor}\Huge}
\setkomafont{chapterprefix}{\Large}
\renewcommand*{\raggedchapter}{\raggedleft}
\renewcommand*{\chapterformat}{%
    \MakeUppercase{\chapappifchapterprefix{}}%
    \rlap{\enskip\resizebox{!}{1.2cm}{\thechapter} \rule{15cm}{1.2cm} }%
}

\RedeclareSectionCommand[beforeskip=30pt,afterskip=20pt]{chapter}
\renewcommand*\chapterheadmidvskip{\par\nobreak\vspace{10pt}}

\begin{document}
\tableofcontents
\chapter{Amazing 1}
\blindtext
\section{Amazing 2}
\end{document}

I am very happy with the chapter design as it is, but when using the above code the table of contents looks really strange. The font seems to be different and it is neither as bold nor as big as chapters usually are. The same is true for the design of sections, subsections etc.

enter image description here enter image description here

How can I only change the chapters appearance without changing the appearance of the toc and other sections?

2

If I run the MWE in the question I get a different result:

enter image description here

enter image description here

Note that the section heading and the chapter entry in ToC are bold and sans serif.

I am not sure if I understood how the desired result look like. Assuming unnumbered chapters like TOC should get the default font without customization:

\documentclass[chapterprefix=true]{scrbook}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{blindtext}
\colorlet{chaptercolor}{black}

\newkomafont{chapterwithprefix}{\normalfont\Huge\color{chaptercolor}}
\setkomafont{chapterprefix}{\Large}
\renewcommand*{\raggedchapter}{\raggedleft}
\renewcommand*{\chapterformat}{%
    \MakeUppercase{\chapappifchapterprefix{}}%
    \rlap{\enskip\resizebox{!}{1.2cm}{\thechapter} \rule{15cm}{1.2cm} }%
}

\RedeclareSectionCommand[beforeskip=30pt,afterskip=20pt,innerskip=10pt]{chapter}
\renewcommand\chapterlineswithprefixformat[3]{%
  \ifstr{#1}{chapter}
    {\IfArgIsEmpty{#2}{}{\usekomafont{chapterwithprefix}}#2#3}
    {#2#3}%
}

\begin{document}
\tableofcontents
\chapter{Amazing 1}
\blindtext
\section{Amazing 2}
\end{document}

enter image description here

enter image description here

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.