I'm writing my thesis with the \documentclass{book}.

All worked like a charm until I added a few lines of text to the first section of one of the chapters.

From that moment on, I've got the following error:

! LaTeX Error: Float(s) lost.
! LaTeX Error: This may be a LaTeX bug.

pointing to an \end{figure} that is located (after several sections) in the same chapter, and the figure is not present anymore in the produced pdf.

This chapter contains several large figures that fill an entire page each one. This is one of them.

  • If I comment this figure, the error moves to the next large figure.
  • If I comment the two figures, then the document compiles correctly.
  • If I comment the lines I added in the first section of the chapter and uncomment both the figures, the document compiles correctly.

I checked many questions about the same error but none of them provides a solution for my specific case. Also,

  • my figures are NOT in a minipage, neither is any of the figures in the whole document
  • I'm NOT using \afterpagehere
  • I'm NOT using any [h] or [htbp] to force the position of my figures (I also tried adding these options to see if something changed, all stayed the same)

My figures are as simple as this:


The only difference between the working/not working code is the little text added in the first section.

I really can't figure out the problem and, as you can imagine, I'd like to keep both the new text and the two figures in my thesis :)

MWE (OP kindly sent a full document off line, this MWE reproduces the issue, further analysis still needed) [David Carlisle]

MWE reduced further thanks to Dai Bowen



\geometry{left=3.0cm, right=2.5cm, top=2.5cm,bottom=2.5cm}%, includeheadfoot







  • 1
    Welcome to TeX.SX! It seems like you've already done a great deal of detective work to identify which parts of your code are causing the error, if you could distill that into a minimal working example (MWE) which we can compile to replicate your error that will be helpful (and potentially necessary) for us to find out what is going amiss. Reproducing the problem and finding out what the issue is will be much easier with compilable code, starting \documentclass{...} and ending \end{document}.
    – Dai Bowen
    Nov 5 '16 at 22:11
  • Yes, you're right, but the problem was to make it minimal... In the meantime I found the work around
    – aglaja
    Nov 5 '16 at 22:14
  • 3
    If you still can reproduce the "may be a latex bug error" we'd be interested to see a test case (no need to be minimal if that's hard to do) you could send a zip file to me (google for my gmail address) or the official latex bug address latex-project.org/bugs Nov 5 '16 at 23:38
  • 2
    @DaiBowen I can reproduce but test file is very large and includes half of ctan, most attempts to cut it down make the problem go, I've tried every now and then but nothing much to report so far.... (gets the usual fancyhdr warning about bad headheight, not sure if that's all that's wrong, will try to isolate) Nov 25 '16 at 14:51
  • 2
    Note you say in the question that you are not using afterpage but the test file was using that (and almost certainly that's the culprit) afterpage is a very dangerous and fragile beast to use on a real document... Nov 25 '16 at 21:39

I'm experiencing the same problem with one of my documents. The bug disappears as soon as I remove all \afterpage commands.

I have not found the solution, but I could find a "tricky and dirty" workaround: I added a vertical space by using \vskip{5cm} (for instance) to force LaTeX to move the text after the floats that I wanted to flush.

Of course, the main problem is that if you insert some text before, you may be obliged to revise manually each \vskip command to fix the way LaTeX places floatings. Anyway, for my personal purposes it is working fine.

  • 2
    I agree. I had immumerable intermittent problems with lost floats. Everything had to do with the use of the afterpage package (not the mis-use of that package). With much regret, I abandoned afterpage for all purposes. Apr 28 '17 at 10:44

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.