0

In my memoir LuaLaTeX document, I have two figure floats that fit together on a single page if there is no other text.

\begin{figure}\centering%
    \includegraphics{fig_a.png}%
    \caption{My caption}%
    \label{fig:fig-a}%
\end{figure}%
\begin{figure}\centering%
    \includegraphics{fig_b.png}%
    \caption{My caption}%
    \label{fig:fig-b}%
\end{figure}%

For pedagogical reason, I'd like these two appear on the same page. Sometimes they do, but only if I'm lucky with LaTeX's decisions. Is there any way I can force these figures to appear on the same page, without messing up other parts of the typesetting?

I can't make them subfigures, as they are too different semantically.

I tried simply putting them in the same figure environment:

\begin{figure}\centering%
    \includegraphics{fig_a.png}%
    \caption{My caption}%
    \label{fig:fig-a}
    \includegraphics{fig_b.png}%
    \caption{My caption}%
    \label{fig:fig-b}%
\end{figure}%

And this appears to work, except that there is too little vertical spacing between the figures, compared to what LaTeX would have produced by itself. I'm also worried about subverting the figure environment to have two figures in it, would that have any other unintended consequences?

Anna
  • 811

1 Answers1

4

The figure environment is (despite its name) unrelated to image inclusion or counting of figures, which are handled by \includegraphics and \caption respectively. It's only purpose is to mark a block of the document that should be taken out of the document flow and re-inserted as a unit at a suitable place to help with page bresking.

So your suggestion of using two \caption in one figure is the intended use, you can use \vspace{\floatsep} (or any suitable length) after the first caption.

David Carlisle
  • 757,742