2

I have a small problem. I'm writing my PhD thesis (that's not the problem) and I want my images to be where I want them to be. I manage to do that using

\begin{figure}[H]
\end{figure}

but often the pictures goes on the next page. I really don't mind but the text is then spread out all over the page. I can fix the problem localy by adding \clearpage but I'm feeling using microsoft Word when I do so and of course when I add some text I have to change the position of the clearpage commands.

Do you know how to help me?

Thanks!

Fabien
  • 191
  • 3
    using H is a request to get unpleasant white space in your document it is an explicit instruction to disable the float mechanism which is there to avoid white spaces. Perhaps you want \raggedbottom rather that \flushbottom so the space comes at the end of the page, but not using H is usually better. – David Carlisle Oct 15 '14 at 09:46
  • Thanks a lot. '\raggedbottom' works very well. Do you have other solution than using H? To me, having the images where you want in a document is a minimum, no? – Fabien Oct 15 '14 at 09:58
  • 2
    In traditional printing you would not get a choice: the whole reason for the convention of tables and figures to be separate captioned items is to allow the (human) typesetter to fit them in to a place that works with the page breaking. LaTeX is only a program not a person, so if you choose to argue with it you can always win, but choosing not to argue could be a possibility to consider, – David Carlisle Oct 15 '14 at 10:22
  • With the needspace package, you can request a vertain amount of vertical space in advance. If not available, it will clear the page. For example, try \documentclass{article} \usepackage{lipsum,needspace} \begin{document} \lipsum[1-4] \needspace{1.5in} \begin{figure}[ht] \centering \rule{1in}{1in} \caption{This is my caption} \end{figure} \lipsum[5-8] \end{document} – Steven B. Segletes Oct 15 '14 at 11:31
  • you could "abandon" the figure environment, and instead use a separate package, like captionof to set the captions. it might be necessary to pack the graphic and the caption together in a minipage if they would otherwise be separated by a page break. plus \raggedbottom as mentioned by david carlisle. – barbara beeton Oct 15 '14 at 13:14
  • 1
    Always "where you want" without wasting space is simply impossible, whatever you do. Best approach is "here if possible, less harmful place otherwise". This is possible with wise control of options and floats rules. See here about float algorithm parameters. However, IMHO figures between text disrupt the lecture more than using top/bottom/page positions, so use [H] sparingly, only if you want stop the lecture at this point even at the cost of worse page layouts. – Fran Oct 16 '14 at 04:47

1 Answers1

1

You can get rid of the floating environment and use the caption package:

\usepackage{caption}

and then

some text some text some text some text 
\noindent\begin{minipage}{\textwidth}
\captionsetup{type=figure}
\centering
\includegraphics{your-figure-here}
\caption{caption goes here}
\end{minipage}
other text other text other text other text 

Anyway, I second the comment of David Carlisle, and strongly recommend to use floats and let LaTeX do the page composition (possibly using only the [tb] placing options).

  • This is a well-known equivalent alternative to using a (non-) floating object with the Hspecifier; it doesn’t solve the spacing issue, though. – GuM Oct 13 '17 at 14:55