Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

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

1 Answer 1

up vote 4 down vote accepted

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

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.