-1

My graphic appears on the next page. How to make the figure appear on the current page?

I insert \includegraphic{X} but the picture does not appear on the same page as the rest of my text.

I vaguely remember some solutions but haven't used \includegraphicfor 10-11 years. What is the best or easiest way to control the distance between the figure and its above or below?

Ingmar
  • 6,690
  • 5
  • 26
  • 47
  • 2
    please show the actual command you used (\includegraphics most likely) \includegraphics makes a box that never moves it is just inserted like a big letter at the current point, although if it does not fit on the page it will page break before that line. – David Carlisle Jun 26 '21 at 16:41
  • if you use text\includegraphics{figure} then it will appear on the same lione as text there is no "space above" – David Carlisle Jun 26 '21 at 16:43

1 Answers1

0

There are two ways you can tackle the problem here. If you don't want the image to float, then you should resize the image by using \includegraphics[width=x,height=y]{figure} where x and y are values with consistent units preferably in for inch or cm for centimeter. Another way is using scale as \includegraphics[scale=x]{figure} where it will scale in percentage ratio where 1 means 100 percent the original size, 0.5 means 50 percent and so on.

The second approach and recommended is to allow the figure to float. And the best way to do this is use [htbp!] as the float specifier. Another good thing is that you can label the figure and then reference it back. Example:

\begin{figure}[htbp!]
\includegraphics[scale=0.5]{figure}
\caption{some caption} %<---- If this is the first figure captioned, then it will be Figure 1
\label{fig1}
\end{figure}

And then you write some text say I am referring to figure~\ref{fig1}. This will render the text as I am referring to figure 1.

SolidMark
  • 1,389
  • Do you recommend using htbp! over H ? I've been using H all the time. Is there any difference between these two? I remember using htbp! long time ago but I remember now changing to H for some reason, which I do not remember what it was. Its been years. – Nasser Jun 26 '21 at 17:26
  • 1
    Yes. It's not that you shouldn't use H. It's that you should use only when it is too necessary. Using [H] everywhere will leave too much vertical spaces. You will notice it when you alternately insert text and figures. If you use [H] all the time, this is where you will see it's drawback. – SolidMark Jun 27 '21 at 04:55