Do not use titlesec
together with a KOMA-Script class.
With KOMA-Version 3.19 or newer it is possible to insert title rules by redefining \chapterlineswithprefixformat
:
\newcommand\titlerule[1][.4pt]{\rule[.5\baselineskip]{\textwidth}{#1}}
\renewcommand\chapterlineswithprefixformat[3]{%
{\raggedleft#2}\nobreak%
\ifstr{#2}{}{\kern-.5\baselineskip}{}%
\titlerule\\*%
\kern-.5ex%
#3\par\nobreak%
\kern1.75ex%
\titlerule%
}
To change the skips before and after the chapter title and also between the chapterprefix and the title you can use RedeclareSectionCommand
.
\documentclass[
headings=chapterprefix
]{scrbook}[2015/10/03]
\usepackage[T1]{fontenc}
\usepackage[scaled]{beramono}
\addtokomafont{chapterprefix}{\Large}
\addtokomafont{disposition}{\rmfamily}
\RedeclareSectionCommand[%
beforeskip=\dimexpr4.6\baselineskip+\parskip\relax,
innerskip=0pt,
afterskip=1.5\baselineskip plus .115\baselineskip minus .192\baselineskip
]{chapter}
\newcommand\titlerule[1][.4pt]{\rule[.5\baselineskip]{\textwidth}{#1}}
\renewcommand\chapterlineswithprefixformat[3]{%
{\raggedleft#2}\nobreak%
\ifstr{#2}{}{\kern-.5\baselineskip}{}%
\titlerule\\*%
\kern-.5ex%
#3\par\nobreak%
\kern1.75ex%
\titlerule%
}
\usepackage{blindtext}% only for dummy text
\begin{document}
\chapter{Test}
\blindtext
\addchap{Test the second}
\blindtext
\end{document}
If the lines should be also there without option headings=chapterprefix
add a redefinition of chapterlinesformat
:
\makeatletter
\renewcommand\chapterlinesformat[3]{%
\titlerule\\*%
\kern-.5ex%
\@hangfrom{#2}{#3}\par\nobreak%
\kern1.75ex%
\titlerule%
}
\makeatother
Code:
\documentclass[
%headings=chapterprefix
]{scrbook}[2015/10/03]
\usepackage[T1]{fontenc}
\usepackage[scaled]{beramono}
\addtokomafont{chapterprefix}{\Large}
\addtokomafont{disposition}{\rmfamily}
\RedeclareSectionCommand[%
beforeskip=\dimexpr4.6\baselineskip+\parskip\relax,
innerskip=0pt,
afterskip=1.5\baselineskip plus .115\baselineskip minus .192\baselineskip
]{chapter}
\newcommand\titlerule[1][.4pt]{\rule[.5\baselineskip]{\textwidth}{#1}}
\renewcommand\chapterlineswithprefixformat[3]{%
{\raggedleft#2}\nobreak%
\ifstr{#2}{}{\kern-.5\baselineskip}{}%
\titlerule\\*%
\kern-.5ex%
#3\par\nobreak%
\kern1.75ex%
\titlerule%
}
\makeatletter
\renewcommand\chapterlinesformat[3]{%
\titlerule\\*%
\kern-.5ex%
\@hangfrom{#2}{#3}\par\nobreak%
\kern1.75ex%
\titlerule%
}
\makeatother
\usepackage{blindtext}% only for dummy text
\begin{document}
\chapter{Test}
\blindtext
\addchap{Test the second}
\blindtext
\end{document}
\documentclass... \end{document}
such that, when we copy-paste-compile, we can reproduce the problem you want help with.