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?
- 511
3 Answers
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.
- 758
-
3Worth 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
-
@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
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.
- 103
- 4
- 505,128
-
8This 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
(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.
- 71
\outputregister so you would need to copy that omitting the warning. – David Carlisle Jan 14 '15 at 17:24