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

Viewed 173901

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?

8 Answers

I had this problem while trying to mix figures and text. What worked for me was the 'H' option without the '!' option. \begin{figure}[H]
'H' tries to forces the figure to be exactly where you put it in the code. This requires you include \usepackage{float}

The options are explained here

Sometimes we want to put only one caption for two or three related images, and then again, we have two or three associated charts with one caption (for some journals, this style is necessary. In this case, subfloat or other similar environments does not help since they only allow one caption per subfloat, not a cation for all subfloats like the following:

|------|   |------|   |------|
|image1|   |image2|   |image3|
|______|   |______|   |______|
Figure 1. cation for all of the 
subfloats 

|------|   |------|   |------|     
|image1|   |image2|   |image3|   
|______|   |______|   |______|   
Figure 2. cation for all of the 
subfloats 

content of the article,    content of the article
content of the article    content of the article

To produce such a style, I used the following snippet:

\begin{figure}[t]
  \subfloat[]{}
  \subfloat[]{}
  \subfloat[]{}
\end{figure}
\begin{figure}[t!]
  \subfloat[]{}
  \subfloat[]{}
  \subfloat[]{}
\end{figure}
\begin{figure}[t!]
  \subfloat[]{}
  \subfloat[]{}
  \subfloat[]{}
\end{figure}
Related