In my document, I have figures that have a rather long caption. The code I use to include them looks like this:

    \caption[Short caption]{Fairly long text...}

For some of the figures, I keep getting warnings like this one:

LaTeX Warning: Float too large for page by 2.38557pt on input line 339.

I can't see anything wrong with the figures in the output document, but it makes the compilation output harder to read because it is full of such warnings.

What am I doing wrong, and how can I get rid of these warnings?

  • 1
    I was struggling a lot with different solutions including playing with \vspace{-Xmm}. Until I came up with this solution that perfectly works for huge images/tables: stackoverflow.com/a/44439837/2961878 – Alisa Jun 8 '17 at 15:31

The warnings tell you that the float (figure and caption) are too long for staying in a page. You will get rid of many of those warnings if you avoid the center environment:

  \caption[Short caption]{Fairly long text...}

(it should be avoided anyway, see Should I use center or centering for figures and tables?).

For pretty high figures you might also want to shorten their width, say 0.95\textwidth or less. LaTeX won't apply such a transformation for you: the warning simply tells that a float needs attention, but how to solve the problem depends on factors that only a human can evaluate properly.

| improve this answer | |
  • How could one suppress this warning but not change the page layout or the size of the figure? – lblb Apr 23 '18 at 14:38
  • @lblb Why would you suppress the warning? – egreg Apr 23 '18 at 16:51
  • @egreg: I get this warning myself and I just want to leave the offending figure exactly as it is. It's likely both too wide and too long for the page. To be clear I only want to suppress the one warning for the one figure, not all warnings of this kind. – lblb Apr 23 '18 at 20:29
  • @lblb This mostly depend on the actual code and why you don't care about the excess height. – egreg Apr 23 '18 at 20:31
  • @egreg: I found a solution for my case: tex.stackexchange.com/questions/404301/… \enlargethispage didn't work for the float page. – lblb Apr 23 '18 at 20:38

If the overfullness is not actually a problem: it worked for me to add \vspace{-Xpt} before the \end{figure}.

In my case the complaint was about an utterly inconsequential 0.04999pt and so I did not want to split the figure or do anything else to the input, just get the useless-in-this-case warning to go away.

| improve this answer | |
  • 1
    Great! I added the same \vspace{-Xpt} before the end of the table and it worked. I had a long table though, and I needed to use top and bottom margins. – Alisa May 19 '17 at 18:29
  • This worked like a a charm! – Panos Kal. May 15 '19 at 9:59

In case one has figures boxed (e.g. with the floatrow package) the \vspace solution disrupts the boxing (i.e. the box will cut the figure at \textheight). The problem can be fixed by extending the text area of the floatpage.

  \clearpage % finish last page and flush previous floats
  % save current textheight
  % extend textheight and recompute internal float parameters
  \setlength{\textheight}{\textheight + #1}
  \global\@colht\textheight % reset \@colht 
  \global\@colroom\textheight % reset \@colroom
  % force float to appear at top of page
  \clearpage % flush the float
  % restore textheight and all
  \setlength{\@fptop}{0pt plus 1fill}

The solution to your problem then becomes:

\begin{largefigure}[3pt] % extend text area by 3pt
  \caption[Short caption]{Fairly long text...}
| improve this answer | |

In contrast to actually changing the dimensions of an offending image or float, which is too tall and/or too wide for the text area, I personally often work with carefully scaled graphics that only overshoot the margins by a few millimeters. I would employ these two techniques to silence these warnings gracefully:




% image too wide
    \makebox[\textwidth][c]{% fix, centers image in textblock

% image too tall
    \vspace{-60pt} % fix


screenshot of MWE

The first one handles bad box warnings and places the image inside a \makebox, which will here center the image on the text area no matter how wide it is. The second example deals with too high images: \enlargethispage doesn't work with float environments (see \enlargethispage command inside a float), so we need to insert a negive height at the end of the figure environment contents to fool LaTeX successfully.

| improve this answer | |

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.