# memoir marginfigure captions extending into footer

I use marginfigure so that small figures can be right by the text referring to them. But I can't stop the captions extending into the footer.

Here's an example:

\documentclass{memoir}

\usepackage{graphicx}

% let's get that page number across to the figure
\pagestyle{ruled}

\begin{document}

\section{Introduction}

Use \textbackslash{}vfill to quickly get near the bottom of the page.

\vspace{6.5in}

Aaaand we're back. Now let's add the margin figure. Works best with a tall/portrait image.

\begin{marginfigure}
\includegraphics[width=\marginparwidth]{awkward}
\caption{A long, but not unreasonably long, figure caption that extends into the footer and depending on your pagestyle can overwrite the page number (which looks weird, a number floating in your caption).}
\end{marginfigure}

\end{document}


It looks like the marginfigure is vertically centered, but without restriction on how far the caption text extends down.

Can I stop this from happening, or is it on me to insert a bunch of page breaks?

(Disclaimer: I'm relatively new to latex)

The marginfigure and its caption are set in a minipage with its default center positioning, which will not break across pages.
You can either put the marginfigure higher on the page or ask Lars Madsen (daleif@math.au.dk), the maintainer of memoir to do something like enabling the minipage bandt options.
In any case you, on occasions, will have to manually control the result --- marginfigure too low with default or t option will extend below the normal text or marginfigure too high with default or b option will extend above the normal text.
• A marginfigure is not a float and to make it into one would take a lot of work for, in my view, no good purpose. Have you contacted Lars Madsen? – Peter Wilson Oct 7 '20 at 17:18
• But - the documentation says it is a float. (It's in "10.1.1 Margin floats" in the memoir docs.) But whether it is or not isn't the point, the question is why it can extend down past the limit if it was say a figure. I'll ping Lars. – Doug Oct 7 '20 at 19:45
• @Doug It is a float in the sense that \marginpar generates a float in the margin. The implemtation used here is equivalent to \marginpar{\parbox{4cm}{\rule{4cm}{4cm}\par some text}} instead of your marginfigure. Try adding that to an article based document and you'll get the same result, extending below the bottom. – daleif Oct 8 '20 at 13:51
• @Doug the placement gets even worse if you remove the \parbox and just use text, for example \kant*[1] from the kantlipsum` package – daleif Oct 8 '20 at 13:54