# Move chapter preamble before Chapter headline

I would like to insert silly quotes before the chapter headline. I am using scrbook / KOMAScript -- unfortunately in version 3.17a (texlive 2015).

I would also like to insert a rule below the chapter headline.

This is a small example:

\documentclass[chapterprefix=true]{scrbook}
\usepackage{blindtext}
\usepackage{scrhack}

\begin{document}

\setchapterpreamble{
\begin{flushright}
MySillyQuote
\end{flushright}}

\chapter{MyChapter}

\Blinddocument

\end{document}


What I would like to have is something like this:

The preamble should be moved up (red) and there should be a line (highlighted in green, but should be regular black). Only chapters that have chapter-prefixes have chapter-preambles in my document and those chapters without prefixes should not reserve extra space for a preamble. For the remaining chapters it would be OK to hard-code the space for the chapter-preamble to e.g. 3 lines (although dynamic fit would obviously be preferable).

I have tried a few things using \chapterformat but they don't seem to work, because my KOMAScript is too old.

EDIT: no longer interested in the rule.

• If memory serves (can't test now): \setchapterpreamble[o]{...}? – campa Feb 17 at 14:39
• That was a lot easier than I had expected, I should have just RTFM. Thanks! I can even add a box above and below. However, if I add the box below with a \rule there is too much spacing between headline and rule... anyway to change that? – h-2 Feb 17 at 15:11

As the comment by @campa indicated [o] is sufficient to move the preamble up. Also \dictum helps with the quote:

\documentclass[chapterprefix=true]{scrbook}
\usepackage{blindtext}
\usepackage{scrhack}

\begin{document}

\setchapterpreamble[o]{
\dictum[Author]{quote}}

\chapter{MyChapter}

\Blinddocument

\end{document}


I have decided to not add the bar below for now and will open a separate question if necessary.

As an answer to the general question there is the epigraph package that can be used with any class which enables an epigraph (silly quote) to be inserted wherever in the document. Here is an example of putting an epigraph before a chapter title:

\documentclass{book}
\usepackage{epigraph}
\begin{document}

To put the epigraph after the chapter title don't use \epigraphhead simply
\chapter*{Celestial navigation}