Using the memoir
class, it appears that if I have a figure that is close enough to chapter heading, and big enough that it has to be placed on the next page, the chapter heading placement gets messed up. For example, I expect to see:
but get instead:
Here is a standalone repro of the effect. I've replaced the image with a box so that no external files are included. Note that if the box dimensions are halfed, allowing the figure and the text and the chapter heading to all fit in one page, then the chapter headings end up in the expected positions.
\documentclass[12pt,openany]{memoir}
\usepackage{caption}
\newcommand{\imageCentered}[4]{%
\begin{center}%
\captionsetup{type=figure}%
% \includegraphics[totalheight=#4\textheight]{#1}%
\rule{350pt}{300pt} \par
\caption{#2}%
\label{#3}%
\end{center}%
}
\begin{document}
\chapterstyle{ell}
\chapter{foo}
\section{foo.}
aa'aa aaaaaaa aaaaaa aaa aa aaa aaaaaaa aa aaaaaaaaaaa aa a aaaa. aaaa aa a aaaaaa aaaaaaaaa aaaaaaaaaa, aaa aa aaaaaa aaa aa aaaaaaaaaaa aa aaaaaaaaaa aaa aaaaaa aaaa aaa aaa aaaaaa aaaa aaa aaaaaaaa aaaaaaaaaaaaa. a aaaaaaaaaaaa aaaaaaaaa aa aaaa aaaaaaaaaa aaaaa aa aa aaaa. a aaaaa aaaaaaaaaaa aa aa aaaaaa aaaa aaaaaaaa aaaaaaa aa aa, aa, aaa aa aa aaaaaaaaaaa aa aaaaaa (aaa{aaa:aaaaaa:aaaaaaaaa1}), aaaaa aaa aaaaaaaa aaaaaaaa aaa aaaaaaa aa aa', aa', aaa aa'.
\imageCentered{figures/strainFig1}{caption text}{fig:1}{0.5}
\end{document}
Any idea how this occurs, and how to prevent it?
EDIT: For reference, the reason that I'd not used \begin{figure} ... \end{figure} is because this doesn't work within an exercise environment (see: How to use figure inside a exercise environment?). So once I knew the solution to that problem, I just changed all my figure commands once and for all to avoid that issue.