1

I have a series of 8 figures, approximately 2 per page. I want them to be positioned contiguously starting on the first page after the first reference to the first figure. I don't want to use clearpage. The text should continue from the bottom of the page preceding these figures to the top of the page that follows the last figure. Is there a way to accomplish this?

I don't want to use the flafter package because I have gotten some very strange results, e.g., text flowing right off the bottom of some pages.

I've included a MWE that seems to work, but I wonder if it is enough to ensure the contiguousness of the figures. The amount of text between figure references will be highly varied in the actual situation.

\documentclass{article}
\usepackage{adjustbox}
\usepackage{lipsum}

\begin{document}

\section{This is Section 1}

Here I refere to Figure \ref{Dummy1}.
There could be a lot or a little bit of text here.
Even multiple paragraphs.

\begin{figure}[t]
    \centering
    \adjustbox{margin=1em,width=\textwidth,set height=4cm,
               set depth=4cm,frame,center}{Dummy1}
    \caption{Dummy1.\label{Dummy1}}
\end{figure}
\begin{figure}
    \centering
    \adjustbox{margin=1em,width=\textwidth,set height=4cm,
               set depth=4cm,frame,center}{Dummy2}
    \caption{Dummy2.\label{Dummy2}}
\end{figure}
\begin{figure}[t]
    \centering
    \adjustbox{margin=1em,width=\textwidth,set height=4cm,
               set depth=4cm,frame,center}{Dummy3}
    \caption{Dummy3.\label{Dummy3}}
\end{figure}
\begin{figure}
    \centering
    \adjustbox{margin=1em,width=\textwidth,set height=4cm,
               set depth=4cm,frame,center}{Dummy4}
    \caption{Dummy4.\label{Dummy4}}
\end{figure}
\begin{figure}[t]
    \centering
    \adjustbox{margin=1em,width=\textwidth,set height=4cm,
               set depth=4cm,frame,center}{Dummy5}
    \caption{Dummy5.\label{Dummy5}}
\end{figure}
\begin{figure}
    \centering
    \adjustbox{margin=1em,width=\textwidth,set height=4cm,
               set depth=4cm,frame,center}{Dummy6}
    \caption{Dummy6.\label{Dummy6}}
\end{figure}
\begin{figure}[t]
    \centering
    \adjustbox{margin=1em,width=\textwidth,set height=4cm,
               set depth=4cm,frame,center}{Dummy7}
    \caption{Dummy7.\label{Dummy7}}
\end{figure}
\begin{figure}
    \centering
    \adjustbox{margin=1em,width=\textwidth,set height=4cm,
               set depth=4cm,frame,center}{Dummy8}
    \caption{Dummy8}.\label{Dummy8}
\end{figure}

Here I refere to Figure \ref{Dummy2}.
There could be a lot or a little bit of text here.
Even multiple paragraphs.

Here I refere to Figure \ref{Dummy3}.
There could be a lot or a little bit of text here.
Even multiple paragraphs.

Here I refere to Figure \ref{Dummy4}.
There could be a lot or a little bit of text here.
Even multiple paragraphs.

Here I refere to Figure \ref{Dummy5}.
There could be a lot or a little bit of text here.
Even multiple paragraphs.

Here I refere to Figure \ref{Dummy6}.
There could be a lot or a little bit of text here.
Even multiple paragraphs.

Here I refere to Figure \ref{Dummy7}.
There could be a lot or a little bit of text here.
Even multiple paragraphs.

Here I refere to Figure \ref{Dummy8}.

\lipsum

\section{This is Section 2}

\lipsum

\end{document}
4
  • The way you have the text and figures arranged, the first one won't start until all the text has been set. That could be quite some distance from the reference. The figures shouldn't get out of order. Since you have them conceptually grouped in twos by specifying the [t] option with the odd-numbered figures, I would be inclined to place each figure in the input at the first paragraph break after its reference. Jul 16, 2021 at 23:56
  • Sorry, I didn't provide a good example that shows how hard it is to force contiguousness. I've updated the LaTeX code to show this. Jul 17, 2021 at 0:33
  • Do you really want the possibility that a figure might appear on a page before the page on which its reference appears? The revised example definitely permits that possibility. The answer that groups multiple graphics in one float is a good suggestion. Jul 17, 2021 at 1:03
  • No, I don't want the images to start before the first reference to the first image, even if it's on the same page as the first reference. My past "solution" has been to use flafter, but it created some real doozers like having text run off the bottom of some pages. Mico's answer seems to work quite well. Jul 17, 2021 at 18:55

1 Answer 1

3

I'd like to suggest that you use the p ("page") positioning specifier and that you include two [2] adjustbox environments per figure environment. In short, something like this:

\begin{figure}[p]
    \centering
    \adjustbox{margin=1em,width=\textwidth,set height=4cm,
               set depth=4cm,frame,center}{Dummy1}
    \caption{Dummy1.\label{Dummy1}}

\vspace{1.5cm}
    \adjustbox{margin=1em,width=\textwidth,set height=4cm,
               set depth=4cm,frame,center}{Dummy2}
    \caption{Dummy2.\label{Dummy2}}
\end{figure}

\begin{figure}[p]
    \centering
    \adjustbox{margin=1em,width=\textwidth,set height=4cm,
               set depth=4cm,frame,center}{Dummy3}
    \caption{Dummy3.\label{Dummy3}}

\vspace{1.5cm}
    \adjustbox{margin=1em,width=\textwidth,set height=4cm,
               set depth=4cm,frame,center}{Dummy4}
    \caption{Dummy4.\label{Dummy4}}
\end{figure}

\begin{figure}[p]
    \centering
    \adjustbox{margin=1em,width=\textwidth,set height=4cm,
               set depth=4cm,frame,center}{Dummy5}
    \caption{Dummy5.\label{Dummy5}}

\vspace{1.5cm}
    \adjustbox{margin=1em,width=\textwidth,set height=4cm,
               set depth=4cm,frame,center}{Dummy6}
    \caption{Dummy6.\label{Dummy6}}
\end{figure}

\begin{figure}[p]
    \centering
    \adjustbox{margin=1em,width=\textwidth,set height=4cm,
               set depth=4cm,frame,center}{Dummy7}
    \caption{Dummy7.\label{Dummy7}}

\vspace{1.5cm}
    \adjustbox{margin=1em,width=\textwidth,set height=4cm,
               set depth=4cm,frame,center}{Dummy8}
    \caption{Dummy8}.\label{Dummy8}
\end{figure}
1
  • That seems to solve the problem. Thanks! Jul 17, 2021 at 0:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.