6

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}

unfinished layout

2

1 Answer 1

5

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}

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

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

\chapter{Blah}
\blindtext

\end{document}

enter image description here

2
  • 1
    Or alternative: \addchap ;-) May 17, 2012 at 22:17
  • @MarcoDaniel Yes, of course :) I tend to forget about the \add<sth> commands...
    – cgnieder
    May 17, 2012 at 22:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .