33

When there are only floats on page, I get the following message: "warning: Text page X contains only floats.". I'd like to suppress this warning. I know that I could use p parameter: \begin{table}[!htp], but I still want the whole page to be handled like normal text page, not like page of floats. Any ideas?

  • 1
    apart from having floats in what way do you not want the page to be a float page, by default page style etc are identical. – David Carlisle Jan 14 '15 at 17:22
  • The message is not coming from a macro but is directly coded in the tokens in the \output register so you would need to copy that omitting the warning. – David Carlisle Jan 14 '15 at 17:24

3 Answers3

16

The problem is explained here http://aty.sdsu.edu/bibliog/latex/floats.html. You may find that simply adding

\clearpage

before you begin with your figures will get rid of the warning.

Tina
  • 758
  • 3
    Worth noting that this solution forces a page break before the image. Without the \clearpage, the text flow continues and the image is included as soon as the next page break (naturally) happens. – Dinei Nov 01 '20 at 19:38
  • 1
    The link does not say why there is a warning and how to get rid of it. – jarauh Oct 19 '21 at 14:43
  • @jaruah, the link leads to a document that not only explains the problem, but also talks about the solution I mentioned above, see 4th section beginning with "If you find that liberal values of the float parameters still are causing trouble, you can try forcing a float page with \clearpage to disgorge the accumulated blockage." – Tina Oct 19 '21 at 15:24
9

If you want to get rid of the warning, you can use the silence package:

\usepackage{silence}
\WarningFilter{latex}{Text page 8 contains only floats}

replace 8 with the actual page number appearing in the warning message. You could also use

\usepackage{silence}
\WarningFilter{latex}{Text page}

to suppress all warnings beginning with the string Text page.

Or, better yet, you can use \WarningFilter* (note the star) to silence the messages by the way they are constructed:

\WarningFilter*{latex}{Text page \thepage\space contains only floats}

The following example document

\documentclass{article}
\usepackage{graphicx}
\usepackage{silence}
\usepackage{lipsum}% just to generate some text

%\WarningFilter*{latex}{Text page \thepage\space contains only floats}

\begin{document}

\lipsum[4] \begin{figure}[!ht] \includegraphics{example-image-a} \end{figure}

\begin{figure}[!ht] \includegraphics{example-image-a} \end{figure}

\begin{figure}[!hb] \includegraphics{example-image-a} \end{figure}

\begin{figure}[!hb] \includegraphics{example-image-a} \end{figure}

\begin{figure}[!hb] \includegraphics{example-image-a} \end{figure}

\begin{figure}[!hb] \includegraphics{example-image-a} \end{figure}

\begin{figure}[!hb] \includegraphics{example-image-a} \end{figure}

\lipsum[4]

\begin{figure}[!ht] \includegraphics{example-image-a} \end{figure}

\begin{figure}[!hb] \includegraphics[height=7cm]{example-image-a} \end{figure}

\begin{figure}[!ht] \includegraphics{example-image-a} \end{figure}

\begin{figure}[!ht] \includegraphics{example-image-a} \end{figure}

\begin{figure}[!ht] \includegraphics{example-image-a} \end{figure}

\begin{figure}[!ht] \includegraphics{example-image-a} \end{figure}

\begin{figure}[!ht] \includegraphics{example-image-a} \end{figure}

\lipsum[2-40]

\end{document}

gives the warning

LaTeX Warning: Text page 8 contains only floats.

uncomment the line with the \WarningFilter* command and the warning will vanish.

You can also check the silence package documentation for more info.

Dinei
  • 103
  • 4
Gonzalo Medina
  • 505,128
  • 8
    This does solve the problem of silencing the warning. However, this does not explain the nature of said warning, which could have roots on a problem with the code itself. – Eduardo J. Sanchez Dec 18 '15 at 13:28
4

(Not enough reputation to comment.) I just had the same problem, and removing the location specifiers (e.g. [!tb]) solved the issue for me.

Using \clearpage as mentioned in other answers resulted in a large undesired white space.