# Setting the upper margin of chapter titles in scrbook

In a scrbook document I need to set the chapter titles close to the upper page margin, without leading number and with a \hrule afterwards. Redefining \chapterheadstartvskip does the trick with the margin but won't do the hrule and omits the number. With titlesec I can set the \hrule and number, but can't get the title move to the upper. Do I miss something in the titlesec setting?

\documentclass[]{scrbook}
\usepackage[a5paper]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{booktabs}
\usepackage[]{blindtext}

% is ignored when titlesec is used

\usepackage[]{titlesec}
\titleformat{\chapter}[hang]{\huge\sffamily\bfseries}{}{0pt}{}[\hrule\vspace*{-24pt}]

\begin{document}
\chapter{Foobar}
\blindtext

\end{document}


-
You can use \renewcommand*{\chapterheadendvskip}{\noindent\hrulefill\par\kern1cm} -- so you don't need any titlesec –  Marco Daniel May 17 '12 at 20:21
An addition for later readers: About KOMA-Script and titlesec incompatibility. –  Speravir May 17 '12 at 22:24

Like Marco Daniel said in his comment: you don't need titlesec. By redefing \chapterheadendvskip you can get the rule and by redefining \chapterformat you can also get rid of the number.

\documentclass[a5paper]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[]{blindtext}
\usepackage{xcolor}

\vskip-.5\baselineskip
\noindent
{\color{gray}\rule{\linewidth}{2pt}}%
\par}
\renewcommand*\chapterformat{}

\begin{document}
\chapter{Foobar}
\blindtext

\chapter{Blah}
\blindtext

\end{document}


-
Or alternative: \addchap ;-) –  Marco Daniel May 17 '12 at 22:17
@MarcoDaniel Yes, of course :) I tend to forget about the \add<sth> commands... –  clemens May 17 '12 at 22:19