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
\renewcommand*{\chapterheadstartvskip}{\vspace*{-4\topskip}}
\renewcommand*{\chapterheadendvskip}{}
\usepackage[]{titlesec}
\titleformat{\chapter}[hang]{\huge\sffamily\bfseries}{}{0pt}{}[\hrule\vspace*{-24pt}]
\begin{document}
\chapter{Foobar}
\blindtext
\end{document}
Best Answer
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.