I am trying to find a way to draw a line below the chapter title including the chapter number. The solution proposed here KOMA-Script line above and below chapter title except that in my case the chapter number is in the margin. The solution should work with latexmk and pdflatexmk.
So is there an easy way to extend the line to include the chapter number?
Here is my MWE:
\documentclass{scrbook}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{blindtext}
\usepackage[default, scale=.90]{opensans} % police Open Sans
%% Chapter number in the margin
\renewcommand*{\chapterformat}{%
\llap{\thechapter\autodot\enskip}%
}
%% Draw a rule of size \textwidth
%% Modification of https://tex.stackexchange.com/questions/273343/koma-script-line-above-and-below-chapter-title
\newcommand\titlerule[1][1pt]{\rule{\textwidth}{#1}}
\renewcommand\chapterlineswithprefixformat[3]{%
#2\nobreak%
\Ifstr{#2}{}{}{\kern-\dp\strutbox}%
\titlerule\par\nobreak%
#3%
\par\nobreak\titlerule%
}
\makeatletter
\renewcommand\chapterlinesformat[3]{%
@hangfrom{#2}{#3}%
\par\nobreak\titlerule%
}
\makeatother
\begin{document}
\blinddocument
\end{document}
