I am using the scrbook document class. I would like to change the style of chapters and sections in the Appendices as illustrated here. It works very well except for the word Chapter in the black rectangle when \appendix is utilized. How to change the word to Appendix accordingly?
- 325
1 Answers
Replace \chaptername by \chapapp and add option numbers=noenddot.¹
Example:
\documentclass[numbers=noenddot]{scrbook}% <- changed
\usepackage[T1]{fontenc}
\usepackage{xcolor}
\usepackage{charter}
\definecolor{mybluei}{RGB}{28,138,207}
\definecolor{myblueii}{RGB}{131,197,231}
\addtokomafont{disposition}{\usefont{T1}{qhv}{b}{n}\selectfont\color{myblueii}}
\addtokomafont{chapter}{\fontsize{30pt}{30pt}\selectfont}
\newkomafont{chapternumber}{\fontsize{50}{120}\selectfont\color{white}}
\newkomafont{chaptername}{\itshape\rmfamily\small\color{white}}
\addtokomafont{section}{\fontsize{14pt}{14pt}\selectfont}
\newkomafont{sectionnumber}{\fontsize{18pt}{18pt}\selectfont\rmfamily\color{white}}
\addtokomafont{subsection}{\fontsize{12pt}{12pt}\selectfont}
\newkomafont{subsectionnumber}{\fontsize{16pt}{16pt}\selectfont\rmfamily\color{white}}
\renewcommand\chapterformat{%
\raisebox{-6pt}{\colorbox{mybluei}{%
\parbox[b][60pt]{45pt}{\centering%
{\usekomafont{chaptername}{\chapapp}}% <- changed
\vfill{\usekomafont{chapternumber}{\thechapter}}% <- changed
\vspace{6pt}%
}}}\enskip}
\renewcommand\sectionformat{%
\setlength\fboxsep{5pt}%
\raisebox{-4pt}{\colorbox{mybluei}{%
\enskip\usekomafont{sectionnumber}{\thesection\autodot}\enskip}%
\quad%
}}
\renewcommand\subsectionformat{%
\setlength\fboxsep{5pt}%
\raisebox{-4pt}{\colorbox{mybluei}{%
\enskip\usekomafont{subsectionnumber}{\thesubsection\autodot}\enskip}%
\quad%
}}
\makeatletter
\renewcommand\sectionlinesformat[4]{%
\makebox[0pt][l]{\rule[-5pt]{\textwidth}{1pt}}%
@hangfrom{#3}{#4}%
}
\makeatother
\usepackage{blindtext}% only for dummy text
\begin{document}
\tableofcontents
\chapter{Chapter Title}
\section{Section Title}
\blindtext
\addsec{Unnumbered Section Title}
\blindtext
\subsection{Subsection Title}
\blindtext
\subsubsection{Subsubsection Title}
\blindtext
\blinddocument
\appendix% <- added
\chapter{Appendix Chapter Title}
\blindtext
\end{document}
¹ Note that I have changed my linked answer too.
- 85,675


Chapterdoesn't show up in the rectangle for each chapter due to some interference somehow. I post it in another thread here. Could you please kindly help me solve this issue? Thanks! – livemyaerodream Apr 29 '22 at 14:21