[Tex/LaTex] Chapter Title adjusting with koma-script

koma-scriptsectioningtitlesec

The following minimal working example is not giving me the desired results. I would like to keep the chapter titles layout, but without using the titlesec package. The titlesec package is interfering with the option headings=optiontotoc. This becomes visible in the table of contents by showing empty entries instead of leaving them away.

Unfortunately my koma-script skills are strongly limited. Does anybody have an idea how to create the desired chapter titles layout with code only?

I also tried the loadonly option provided by the titlesec package, which is producing errors.

Here is the minimal working example:

\documentclass[11pt,numbers=noenddot,headings=optiontotoc]{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}

\renewcommand{\sffamily}{\rmfamily}

\usepackage{titlesec}
\titleformat{\chapter}[display]{\usekomafont{chapter}\bfseries\raggedleft}{\vspace{-3em} \textsc{Kapitel} \thechapter \vspace{1.5em}}{.5 em}{\vspace{-1em} \titlerule  \vspace{.5em}}[\vspace{.5em} \titlerule]

\begin{document}
\tableofcontents

\chapter{Chapter}

\section{Section}  
Hier folgt dann der Text

\subsection{Subsection}  
Hier folgt dann der Text

\subsection{Subsection 2}  
Hier folgt dann der Text

\chapter[]{Nullchapter}
Und hier folgt dann der Text

\section[]{Nullsection} 
Und hier folgt dann der Text

\subsection[]{Nullsubsection} 
Und hier folgt dann der Text

\end{document}

Desired Chapter Title Layout:

chapter title

Empty Entries in TOC because of the titlesec package:
toc

Best Answer

I found a working solution through: http://www.latex-community.org/forum/viewtopic.php?f=5&p=53313. The command @makechapterhead is used for all numbered titles and @makeschapterhead for all unnumbered titles.

A full working minimal example looks like this:

\documentclass[11pt,numbers=noenddot,headings=optiontotoc,chapterprefix]{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}

\renewcommand{\sffamily}{\rmfamily}

\makeatletter

\def\@makechapterhead#1{%
    \vspace*{10\p@}%
    {\parindent \z@ \raggedleft \reset@font
        \huge \scshape \@chapapp{}  \thechapter\vspace*{-15\p@}
        \par\nobreak
        \interlinepenalty\@M\hrulefill\newline\vspace*{-5\p@}
        \huge \bfseries #1\par\nobreak
        \vspace*{-8\p@}%
        \hrulefill
        \par\nobreak
        \vskip 30\p@
}}

\def\@makeschapterhead#1{%
    \vspace*{4\p@}%
    {\parindent \z@ \raggedleft \reset@font
        \scshape
        \interlinepenalty\@M\hrulefill\newline\vspace*{-5\p@}
        \huge \bfseries #1\par\nobreak
        \vspace*{-8\p@}%
        \hrulefill
        \par\nobreak
        \vskip 30\p@
}}

\makeatother

\begin{document}

\tableofcontents
\listoffigures
\listoftables

\chapter{Chapter}

\section{Section}  
Hier folgt dann der Text

\subsection{Subsection}  
Hier folgt dann der Text

\subsection{Subsection 2}  
Hier folgt dann der Text

\chapter[]{Nullchapter}
Und hier folgt dann der Text

\section[]{Nullsection 2} 
Und hier folgt dann der Text

\subsection[]{Nullsubsection} 
Und hier folgt dann der Text

\end{document}

Thank you @ChristianHupfer for all your suggestions and patience.

Related Question