[Tex/LaTex] Chapter heading KOMA script

chapterskoma-scripttitlesec

I'm using cleanthesis template and have trouble in to compile since KOMA-script and titlesec are not compatible

Then, the idea would be to "translate" the titlesec section:

\titleformat{\chapter}[display]%
{\usekomafont{chapter}}%
{\vspace{-8em}\raggedleft{%
    {\color{ctcolorchapterline}%
        \rule[-5pt]{2pt}{5cm}}\quad% Line
    {\color{ctcolorchapternum}
        \fontsize{60}{60}\selectfont\thechapter}% Chapter number
    }%
}%
{-2.1em}%
{\ctformatchapter}%
[\phantomsection]

into a KOMA-script one, that I tried:

\renewcommand*{\chapterformat}{%
\vspace{-8em}\raggedleft{%
        {\color{ctcolorchapterline}%
            \rule[-5pt]{2pt}{5cm}}\quad%
        {\color{ctcolorchapternum}
            \fontsize{60}{60}\selectfont \thechapter \autodot\endskip}% Chapter number
        }%
}

What I would like is:
enter image description here

What I have:
enter image description here

Thank you.

Best Answer

The linked cleanthesis package uses KOMA-Script commands. So it should be used with a KOMA-Script class but it breaks many of their features. For example listof=totoc does not work with cleanthesis.

\documentclass{scrbook}[2015/10/03]
\usepackage{lmodern}
\usepackage{xcolor}
\definecolor{ctcolorchapternum}{cmyk}{.48, .05, .91, 0}
\colorlet{ctcolorchapterline}{ctcolorchapternum}

\RedeclareSectionCommand[
    beforeskip=1sp,
    font=\huge\mdseries
]{chapter}

\renewcommand*\chapterformat{%
    \smash{\textcolor{ctcolorchapterline}{\rule[-5pt]{2pt}{10cm}}}%
    \quad
    \textcolor{ctcolorchapternum}{\fontsize{60pt}{60pt}\selectfont\thechapter}%
}%

\renewcommand*\chapterlinesformat[3]{%
    \parbox[t]{\dimexpr\textwidth-2em\relax}{\raggedchapter #3}%
    \hfill
    \makebox[0pt][l]{#2}%
}

\usepackage{blindtext}
\begin{document}
\tableofcontents
\blinddocument
\chapter{This is a really long chapter title, so there is a line break}
\end{document}

enter image description here

enter image description here

Or if you use option b instead t for \parbox:

enter image description here


If you really want to use classicthesis you can add the following code between \usepackage{classicthesis} and \begin{document} in the file thesis-example.tex of your linked example:

\KOMAoptions{chapterprefix=false}
\RedeclareSectionCommand[
    beforeskip=1sp,
    font=\huge\mdseries
]{chapter}

\renewcommand*\chapterformat{%
    \smash{\textcolor{ctcolorchapterline}{\rule[-5pt]{2pt}{10cm}}}%
    \quad
    \textcolor{ctcolorchapternum}{\fontsize{60pt}{60pt}\selectfont\thechapter}%
}

\renewcommand*\chapterlinesformat[3]{%
    \parbox[t]{\dimexpr\textwidth-2em\relax}{\raggedchapter #3}%
    \hfill
    \makebox[0pt][l]{#2}%
}

Note that you also can simple remove chapterprefix=true from the class options instead using \KOMAoptions{chapterprefix=false}.

enter image description here

enter image description here