I work in a simple document which contains text then a figure. It happened that there is not enough space after the text to fit the figure in the first page. Latex placed the figure in page 2 and placed the References at the bottom of page 1. It is not right for me to see the References before the figure. I want to References to be always at the end. However, in future when I expand the document, if it is normal text (non References) I want Latex to place the text in the empty space if the figure can not fit in that space. How to do this?
2 Answers
You can use \FloatBarrier
from the placeins
package. It prevents your floats from being moved behind this barrier.
Example:
\documentclass{article}
\usepackage{placeins}
\begin{document}
Some dummy text
Image
\FloatBarrier
More Text or your references
\end{document}
You could use the H
option for float placement from the float package, which forces the float to be placed right where you positioned it in your code.
Example:
\documentclass{article}
\usepackage{float}
\begin{document}
Lorem ipsum...
\begin{figure}[H]
the figures content
\end{figure}
\end{document}
\clearpage
just before the bibliography or you can use theplaceins
package and the\FloatBarrier
command just before the bibliography