I have found a very cool custom style for chapter and section headings (It is from Customizing Chapter style in scrbook):
\documentclass[
11pt,
pagesize=auto,
version=last,
chapterprefix=true
]{scrbook}
\usepackage[T1]{fontenc}
\usepackage[explicit]{titlesec}
\usepackage{xcolor}
\usepackage{charter}
\definecolor{mybluei}{RGB}{28,138,207}
\definecolor{myblueii}{RGB}{131,197,231}
\newcommand\ChapterFont{\usefont{T1}{qhv}{b}{n}\selectfont\huge}
\newcommand\SectionFont{\usefont{T1}{qhv}{b}{n}\selectfont}
\titleformat{\chapter}[display]
{\normalfont\ChapterFont\huge\color{myblueii}}
{}
{0pt}
{\parbox[b]{70pt}{\mbox{}}%
\parbox[b]{50pt}{\colorbox{mybluei}{%
\parbox[b][60pt][t]{45pt}{\centering%
\color{white}%
{\itshape\rmfamily\small\chaptertitlename}%
\vfill{\fontsize{50}{120}\selectfont\thechapter}%
}%
}%
}\hspace{15pt}%
\parbox[b]{\dimexpr\textwidth-150pt}{%
\raggedright\scshape#1\vskip6pt%
}%
}
\titleformat{name=\chapter,numberless}[display]
{\normalfont\ChapterFont\huge\color{myblueii}}
{}
{0pt}
{\parbox[b]{70pt}{\mbox{}}%
\hspace{15pt}%
\parbox[b]{\dimexpr\textwidth-150pt}{%
\raggedright\scshape#1\vskip6pt%
}%
}
\titleformat{\section}
{\normalfont\small\sffamily\SectionFont\color{myblueii}}
{\colorbox{mybluei}{%
\parbox[c][16pt][c]{40pt}{%
\centering\textcolor{white}{\SectionFont\Large\rmfamily\thesection}%
}%
}%
}
{1em}
{#1}
[\vspace{-1.2\baselineskip}%
\color{myblueii}\hspace*{\dimexpr40pt+2\fboxsep\relax}%
\rule{\dimexpr\textwidth-40pt-2\fboxsep\relax}{1pt}%
]
\begin{document}
\chapter{Preliminaries}
\section{Test section}
\end{document}
I have two problems with it.
First, I want the chapter heading a bit bigger and the name of the section heading should also be bigger. How can this be done?
Second, I want the chapter heading to be not indented, i.e it should be left centered.
Edit: I have now tried out the approach by esdd for not breaking the KOMA-class and I have now several problems:
In the list of contents the chapter titles are in blue but the section titles are in black. Is it possible to have also the chapter titles in black?
Is it possible to make the line a bit lower as in the example of Benjaming? For me this lower line looks better. Please see the image below.
Benjamin also made subsubsection title without a numbering (because otherwise it is too much styling). Please also see the image below. Is this also possible?
Edit 2: Now everything is almost perfect except the line below the title. In your example it looks great but if I use it in my document the line appears lower. I tried different things but I can't find the solution. Do you see where the problem is? I also don't know if my template is perfect or if there are other mistakes. Please see below the example.
main.tex
\documentclass[a4paper,twoside,12pt,chapterprefix=false]{scrbook}
\usepackage{amsmath,amssymb,amsthm}
\usepackage[footnotesize,sl,SL,hang,tight]{subfigure}
\usepackage{longtable}
\usepackage[font={small,sl},hang,labelfont=bf]{caption}
\usepackage{booktabs}
\ifpdfoutput{%
\usepackage[pdftex]{graphicx}
\usepackage[]{pdfpages}
}{%
\usepackage{graphicx}
}
\usepackage{rotating}
\usepackage{scrlayer-scrpage}
\KOMAoptions{headinclude}
% **** Defining chapter style start ****
\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{chapterentry}{\normalcolor}% entrys in tableofcontents not blue
\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}}
\setcounter{secnumdepth}{\subsectionnumdepth}% subsubsection and lower unnumbered
\renewcommand\chapterformat{%
\raisebox{-6pt}{\colorbox{mybluei}{%
\parbox[b][60pt]{45pt}{\centering%
{\usekomafont{chaptername}{\chaptername}}%
\vfill{\usekomafont{chapternumber}{\thechapter\autodot}}%
\vspace{6pt}%
}}}\enskip}
\renewcommand\sectionformat{%
\setlength\fboxsep{5pt}%
\colorbox{mybluei}{%
\parbox{40pt}{\centering\usekomafont{sectionnumber}{\thesection\autodot}}}%
\quad%
}
\renewcommand\subsectionformat{%
\setlength\fboxsep{5pt}%
\colorbox{mybluei}{%
\parbox{60pt}{\centering\usekomafont{subsectionnumber}{\thesubsection\autodot}}}%
\quad%
}
\makeatletter
\renewcommand\sectionlinesformat[4]{%
\@hangfrom{\hspace*{#2}#3}{#4}%
\ifstr{#1}{section}{%
\par\nobreak%
\ifstr{#3}{}{%
\rule[\dp\strutbox]{\textwidth}{1pt}}{%
\hspace*{50pt}\rule[\dp\strutbox]{\dimexpr\textwidth-50pt}{1pt}}%
}{}%
\ifstr{#1}{subsection}{%
\par\nobreak%
\ifstr{#3}{}{%
\rule[\dp\strutbox]{\textwidth}{1pt}}{%
\hspace*{70pt}\rule[\dp\strutbox]{\dimexpr\textwidth-70pt}{1pt}}%
}{}%
}
\makeatother
% **** Defining chapter style end ****
% Define an own layer page style for the title page
\DeclareNewLayer[
background,
head,
addvoffset=\headsep,
height=1.5cm,
addheight=\dp\strutbox,
contents={%
\includegraphics[height=1.5cm]{figures/ETH_logo.pdf}%
\hfill%
\includegraphics[height=1.4cm]{figures/CGL_logo.pdf}%
}
]{titlepage.head}
\DeclareNewPageStyleByLayers{titlepage}{titlepage.head}
\usepackage{times}
\usepackage{helvet}
\usepackage[T1]{fontenc}
\ifpdfoutput{%
\usepackage[pdftex,
bookmarks,
bookmarksopen=true,
bookmarksnumbered=true,
pdfauthor={Rafael Wampfler},
pdftitle={Engagement Detector: Modelling engagement dynamics in virtual environments},
pdfsubject={The report of the master thesis about the modelling engagement dynamics in virtual environments.},
pdfkeywords={machine learning, engagement dynamics, classification, virtual environments, calcularis, learning, minecraft},
colorlinks=false,
linkcolor=black,
citecolor=black,
filecolor=black,
urlcolor=black,
anchorcolor=black,
menucolor=black,
breaklinks=true,
pageanchor=true,
plainpages=false,
linkbordercolor=red,
citebordercolor=red,
urlbordercolor=red,
pdfpagelabels=true]{hyperref}
}{}
\ifpdfoutput{%
\pdfcompresslevel=9
\pdfoutput=1
\DeclareGraphicsExtensions{.pdf,.png}
}{}
\bibliographystyle{alpha}
\topmargin -0.5in
\textheight 9.3in
\textwidth 6.3in
\oddsidemargin 0.18in
\evensidemargin -0.22in
\parskip 0.1in
\parindent 0in
\renewcommand{\arraystretch}{1.5}
\renewcommand{\baselinestretch}{1}
\begin{document}
%% Define leading chapter pages
%
\input{studchapter}
\newpagestyle{mychapterpagestyle}{{\protect\mychpstyleintl}{\protect\mychpstyleintl}}{}
\newpagestyle{myappendixpagestyle}{{\protect\mychpstyleintl}{\protect\mychpstyleintl}}{}
%%
\hypersetup{pageanchor=false}
\hypersetup{pageanchor=true}
\pagenumbering{roman}
\setcounter{page}{1}
%\include{abstract}
%\include{acknowledgment}
\tableofcontents
\cleardoublepage
\addcontentsline{toc}{chapter}{List of Figures}
\listoffigures
\cleardoublepage
\addcontentsline{toc}{chapter}{List of Tables}
\listoftables
\cleardoublepage
\pagenumbering{arabic}
\renewcommand*{\chapterpagestyle}{mychapterpagestyle}
\renewcommand*{\chapterformat}{} % show chapter titles only (no numbers)
% ---- MAIN PART ----
\chapter{Chapter Title}
\section{Section Title}
\blindtext
\addsec{Unnumbered Section Title}
\blindtext
\subsection{Subsection Title}
\blindtext
\subsubsection{Subsubsection Title}
\blindtext
\blinddocument
% ---- END MAIN PART ----
\appendix
\clearpage
\renewcommand*{\chapterpagestyle}{myappendixpagestyle}
%\include{appendix}
\clearpage
\renewcommand*{\chapterpagestyle}{empty}
\addcontentsline{toc}{chapter}{Bibliography}
\bibliography{references}
\end{document}
studchapter.tex
\renewcommand*{\chapterheadstartvskip}{\vspace*{215pt}}
\def\mychpstyleintl{%
{\noindent\setlength{\tabcolsep}{0pt}\setlength{\arrayrulewidth}{2pt}%
\begin{tabular}{c}
\\[100pt]
\begin{tabular}{lr}
\begin{tabular}{p{0.6\linewidth}}
\\
\end{tabular}
&
\begin{tabular}{p{0.4\linewidth}}
\rightline{{%
\sffamily%
\fontseries{bx}%
\fontshape{n}%
\fontsize{100}{120}%choose baselineskip to be 1.2 times font size
\selectfont
\thechapter}}
\end{tabular}
\end{tabular}\\[300pt]
\end{tabular}
}}