I'm using KOMA-Script and I want to add a line above and below the chapter title. So the upper line should be between the "Chapter" and the title. I did this with
\documentclass{scrbook}
\KOMAoptions{headings=chapterprefix}
\usepackage{etoolbox}
\usepackage{blindtext}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Adding lines above and below the chapter head
%
%%%%%%%% BEFORE HEADING
% \appto\chapterheadstartvskip{%
% {%
% \noindent\rule{\linewidth}{1pt}\par%
% }%
% }
%%%%%%%% AFTER HEADING
\preto\chapterheadendvskip{%
{%
\noindent\rule{\linewidth}{1pt}\par%
}%
}
%%%%%%%% BETWEEN LABEL AND HEADING
\renewcommand*{\chapterheadmidvskip}{%
{%
\vspace{-.3\baselineskip}%
\par\noindent%
\noindent\rule{\linewidth}{1pt}
}%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\chapter{Test}
\blindtext
\chapter*{Test the second}
\blindtext
\end{document}
The problem is with the \chapter*. It doesn't have the line above. If I include the first part of the code in the example that is now commented, I get the line above \chapter*, but also a third line above \chapter.
Is there anyway to define the \chapterheadstartvskip separately for chapter and chapter*? Or is there anything like \isThisAChapterWithAsteriks

