Search code examples
imagelayoutlatexfigure

How to force two figures to stay on the same page in LaTeX?


I have two images that I want to display on a page as figures. Each eats up little less than half of the space available so there's not much room for any other stuff on that page, but I know there is enough space for both of the figures. I tried to place the figures with [ht] and [hb], both [h] and both [ht] but still I can't get those two images on the same page but instead at least few paragraphs between them.

How do I force those two figures to stay on the same page?


Solution

  • You can put two figures inside one figure environment. For example:

    \begin{figure}[p]
    \centering
    \includegraphics{fig1}
    \caption{Caption 1}
    \includegraphics{fig2}
    \caption{Caption 2}
    \end{figure}
    

    Each caption will generate a separate figure number.