0

Best way to demonstrate this problem is with a screenshot. I've had to blank out the content for security reasons.Screenshot

As you can see, I have a page with some text which contains 1 complete section and the start of another.

On the next page is a table with each cell filled with an \includegraphics statement. There is a caption below the table. On the next page there is another graph. But for some reason, this graph has been allocated an entire page to itself. On the final page is a block of text and another new section which should really be able to fit on the previous page with the graph.

A subtlty of this is that both the table and the graph are part of the section 6 "Future Extensions". Perhaps this is a cause of the problem?

Here is the latex code:

BLOCK OF TEXT is numbered according to the block of text you see blanked out.

\newpage
\section{Future Extensions}
\label{sec:future}

BLOCK OF TEXT 1 - PARAGRAPH 1

BLOCK OF TEXT 1 - PARAGRAPH 2

\begin{table}
    \caption[text]{text}
    \centering
    \begin{tabular}{ccc}
        \includegraphics[width=.30\textwidth]{./graphs-transition-matrix/g1.png}&
        \includegraphics[width=.30\textwidth]{./graphs-transition-matrix/g2.png}&
        \includegraphics[width=.30\textwidth]{./graphs-transition-matrix/g3.png}\\
        \includegraphics[width=.30\textwidth]{./graphs-transition-matrix/g4.png}&
        \includegraphics[width=.30\textwidth]{./graphs-transition-matrix/g5.png}&
        \includegraphics[width=.30\textwidth]{./graphs-transition-matrix/g6.png}\\
        \includegraphics[width=.30\textwidth]{./graphs-transition-matrix/g7.png}&
        \includegraphics[width=.30\textwidth]{./graphs-transition-matrix/g8.png}&
        \includegraphics[width=.30\textwidth]{./graphs-transition-matrix/g9.png}\\
        \includegraphics[width=.30\textwidth]{./graphs-transition-matrix/g11.png}&
        \includegraphics[width=.30\textwidth]{./graphs-transition-matrix/g12.png}&
        \includegraphics[width=.30\textwidth]{./graphs-transition-matrix/g15.png}\\
    \end{tabular}
    \caption*{caption text}
    \label{tab:pmatrix}
\end{table}

BLOCK OF TEXT 1 - PARAGRAPH 3

BLOCK OF TEXT 1 - PARAGRAPH 4

\begin{figure}
    \includegraphics[width=\textwidth]{./graphs-strobe/strobe.eps}
    \caption[text]{text}
    \label{fig:strobe}
\end{figure}    

\section{Conclusion}
\label{sec:conclusion}

BLOCK OF TEXT 2

BLOCK OF TEXT 3 - PARAGRAPH 1

BLOCK OF TEXT 3 - PARAGRAPH 2

BLOCK OF TEXT 3 - PARAGRAPH 3

\section*{Acknowledgements}
Thanks to ...

So you can see that the problem is that BLOCK OF TEXT 3 isn't on the same page as the final figure for some reason. At least SOME of it should be there, surely? How can I make all this content fit on 3 pages?

Solution:

The solution I used in the end for anyone reading this in the future was to move the code for including the figure into the Conclusion section. I know that makes no logical sense, but it was the only way I could get the text to join on that page. The other suggested answers didn't work.

user3728501
  • 1,021
  • The thing is, you have fallen into one of the biggest gaps in understanding LaTeX. LaTeX is in charge of positioning figures and tables, i.e. they float. You said so by using the environment. Packages like float provide the Hammermethod, meaning you are in charge completely with respect to positioning. – Johannes_B Jan 09 '16 at 14:34
  • @Johannes_B That's not the issue here - I don't want to use H and force the figure to go somewhere else, I want the text which has spilled over onto the next page to come back to the page where there is a figure and no text currently. – user3728501 Jan 09 '16 at 15:18
  • @Johannes_B I think I could do what you're suggesting if I move the figure into a different section, but that doesn't make any sense. The last figure is not part of the conclusion, it is part of the "future extensions" section. – user3728501 Jan 09 '16 at 15:19
  • The table seemst to be to big. See How to influence the position of float environments like figure and table in LaTeX? to learn ho you can tweak stuff. – Johannes_B Jan 09 '16 at 15:22

1 Answers1

1

It would really be better to provide an example code, you don't need to post your real words just xyz and \rule{1cm}{1cm} instead of graphics is enough, but anyway...

At the point that the third page is about to start, latex has the pending figure and it has to decide whether to output it at that point on a float page (which it has done) or to hold it back hoping to find more text to make up a text page where it will fit. essentially the only criterion used at that point is if the pending floats will fill up "enough" of a page, then a float page is made. Specifically if the float is bigger than \floatpagefraction (which is 0.5 in the standard classes).

So if you do not like the result you could increase \floatpagefraction to say 0.7 in which case it is more likely that floats are held back (and also of course more likely that no good setting can be found and they all go to the end) or you could use an option such as [htb] just on that float, which would prevent it using p ie a float page.

David Carlisle
  • 757,742