[Tex/LaTex] Include figure on the same page above \chapter

chaptersfloatspositioning

In a book, with the book documentclass, I'm typesetting I want to include a figure above the \chapter title. This however has turned out to be hard. With the following code:

\chapter{Uppväxt}

\begin{figure}[ht]
\includegraphics[width=\textwidth]{bilder/hus.jpg}
\end{figure}

\noindent
\lipsum

Produces the following result:
A figure underneath a chapter.

Placing \figure above \chapter results in the image being put on the previous page due to the \clearduble command of \chapter, which is desirable for the rest of the book. Changing the options of \figure to [t] results in the figure being included on the next page. It seems like no other combination of positioning options seems to help either.

Can anyone think up a way of placing the figure above the chapter?

Best Answer

The image appears to be part of the chapter head design so the most natural place to add it is in \@makechapterhead (or equivalent command in other classes.

enter image description here

This adds an image with name \chappic if that command is non empty.

\documentclass{book}
\usepackage{graphicx}
\makeatletter

\def\@makechapterhead#1{%
  \ifx\chappic\@empty
  \vspace*{50\p@}%
\else
  \vspace*{5\p@}% was 5
    \centerline{\includegraphics{\chappic}}%<<<<
\fi
  {\parindent \z@ \raggedright \normalfont
    \ifnum \c@secnumdepth >\m@ne
      \if@mainmatter
        \huge\bfseries \@chapapp\space \thechapter
        \par\nobreak
        \vskip 20\p@
      \fi
    \fi
    \interlinepenalty\@M
    \Huge \bfseries #1\par\nobreak
    \vskip 40\p@
  }}
\makeatother
\newcommand*\chappic{}

\begin{document}

\renewcommand*\chappic{house}
\chapter{house}

text ... text ... text ... text ... text ... text ... text ... text ... 
text ... text ... text ... text ... text ... text ... text ... text ... 
text ... text ... text ... text ... text ... text ... text ... text ... 

\renewcommand*\chappic{}
\chapter{no house}

text ... text ... text ... text ... text ... text ... text ... text ... 
text ... text ... text ... text ... text ... text ... text ... text ... 
text ... text ... text ... text ... text ... text ... text ... text ... 


\end{document}