[Tex/LaTex] Force placement of currently unplaced figures before a certain block of text

floatspositioningtwo-column

A paper I am writing is quite figure-heavy, and one of my sections has more figures than text. Unfortunately, because of this, the figures get spread out through the rest of my paper and even end up on several pages after the end of my text. I would like to avoid this behavior by making sure the figures all get placed before a certain spot in my paper, towards the end (like my references section). Is there a command that forces LaTeX to place all the figures not yet placed by a certain spot in the text at that spot in the text?

I wish to emphasize that it is not my desire to use the [H] specifier. I am just fine with LaTeX positioning my figures for me, I just want them to all be placed before a certain spot in my paper.

Also please note that \newpage and \clearpage are not options for me. I don't want to force a page break; I would like the subsequent text to follow the figures naturally without a page break between the figures and the following text. I basically want the float-placing behavior of \newpage without actually making a new page.

Here is a minimum working example to try and explain what I am talking about. Currently, this code places all the text on the first page interspersed with all the figures, and the two-column wide figure* gets placed on the second page. What I was is the text of the first section to appear on the first page with as many figures as possible (the normal LaTeX thing to do), and then the second page to get all the leftover figures (the larger figure* in this case) and for the second section's text to appear after that figure and not as a new page, but on the same page as that figure.

\documentclass[twocolumn]{article}
\usepackage{lipsum} %used to generate filler text

 \usepackage[demo]{graphicx}

\begin{document}

\section{Section with figures}
\lipsum[66]

\begin{figure*}
\includegraphics[width=\linewidth]{}
\end{figure*}
Some more text.
\begin{figure}
\includegraphics[width=\linewidth]{}
\end{figure}
\begin{figure}
\includegraphics[width=\linewidth]{}
\end{figure}
\begin{figure}
\includegraphics[width=\linewidth]{}
\end{figure}
Some more text yet again.
\begin{figure}
\includegraphics[width=\linewidth]{}
\end{figure}
And, yet again, more text.
\begin{figure}
\includegraphics[width=\linewidth]{}
\end{figure}

\section{After figures}
I want this text to appear {\bf after} all the figures above, but not
simply on a fresh page after the last figure.  I would like it to
start running after the last figure.  For instance, if the last figure
takes a page, I would like this text to continue right after it
such that the figure is on the top half and this text is on the bottom
half of the page.

\lipsum[66]

\end{document}

Best Answer

You mention no concern about float numbering, so my suggestion would be to forego any kind of floating for the single-column figures. For this, use the [H] float specifier:

enter image description here

\documentclass[twocolumn]{article}
\usepackage{lipsum} %used to generate filler text

\usepackage{afterpage,float}
\usepackage[demo]{graphicx}

\begin{document}

\section{Section with figures}
\lipsum[66]

\begin{figure*}
  \includegraphics[width=\linewidth]{}
\end{figure*}

Some more text.

\begin{figure}[H]
\includegraphics[width=\linewidth]{}
\end{figure}

\begin{figure}[H]
\includegraphics[width=\linewidth]{}
\end{figure}

\begin{figure}[H]
\includegraphics[width=\linewidth]{}
\end{figure}

Some more text yet again.

\begin{figure}[H]
\includegraphics[width=\linewidth]{}
\end{figure}

And, yet again, more text.

\begin{figure}[H]
\includegraphics[width=\linewidth]{}
\end{figure}

\newpage

\section{After figures}
I want this text to appear \textbf{after} all the figures above, but not
simply on a fresh page after the last figure.  I would like it to
start running after the last figure.  For instance, if the last figure
takes a page, I would like this text to continue right after it
such that the figure is on the top half and this text is on the bottom
half of the page.

\lipsum[66]

\end{document}

The two-column figure* is placed after a \newpage. However, you can play around with the placement of this float without your actual document text (again, ignoring float numbering).

Related Question