98

I'm trying to a large number of figures. The code is

\begin{figure}
\includegraphics[scale=0.5]{m2T4.pdf}
\caption{M2T, Problem Size 513}
\end{figure}

I'm not able to compile, I get the error

! LaTeX Error: Too many unprocessed floats.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.113 \includegraphics
[scale=0.5]{m2T4.pdf}
You've lost some text. Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! Undefined control sequence.
\@float@Hx ...ltovf \fi \global \setbox \@currbox
\color@vbox \normalcolor \...
l.113 \includegraphics
[scale=0.5]{m2T4.pdf}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
! Missing number, treated as zero.
<to be read again>
\vbox
l.113 \includegraphics
[scale=0.5]{m2T4.pdf}
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
pdfTeX warning: pdflatex (file ./m2T4.pdf): PDF inclusion: found PDF version <1
.5>, but at most version <1.4> allowed
<m2T4.pdf, id=1121, 538.28104pt x 212.1526pt>
File: m2T4.pdf Graphic file (type pdf)
<use m2T4.pdf>
1

5 Answers 5

118

You can use the command \clearpage. This prints all floats that are not yet placed and starts a new page.

3
  • 3
    Hi, where is supposed I must put the \clearpage command.
    – slackmart
    Jan 30, 2014 at 19:56
  • 8
    where do you put \clearpage ?
    – cmo
    Feb 26, 2014 at 15:36
  • @cmo, somewhere in your document where it would make sense to start a new page (it's really up to you). Aug 20, 2015 at 23:11
44

Try the morefloats package. From the README:

LaTeX can, by default, only cope with 18 outstanding floats; any more, and you get the error "too many unprocessed floats". This package releases the limit; TeX itself imposes limits (which are interdependent of the help offered by e-TeX). However, if your floats can’t be placed anywhere, extending the number of floats merely delays the arrival of the inevitable error message.

2
  • 1
    Can there be any adverse consequence from using this package? Jan 6, 2020 at 14:37
  • @DaneelOlivaw the package has been essentially obsolete since 2015, latex has built in features now. Sep 17, 2022 at 12:20
29

For LaTeX releases from 2015/01/01 onwards you can allocate more (several thousand more) floats than the standard 18, using a command such as

\extrafloats{100}

in the preamble. As this mechanism uses the etex extended box registers it can allocate many more float boxes than the morefloats package mechanism (which uses \newinsert and is thus restricted to the classic TeX registers 0-255).

If for some reason you are using a LaTeX format built on tex rather than etex, \extrafloats is still defined, but falls back to using \newinsert so fewer float boxes are available.

Edit, from the 2015/10/01 LaTeX release the default number of floats is increased from 18 to 52, and these reserved floats may also be used by \newinsert once the classic TeX registers run out.

4
  • 2
    After using \extrafloats{100} I got a message ! Output loop---100 consecutive dead cycles.
    – Viesturs
    Jan 3, 2018 at 1:41
  • @Viesturs then some document that you have not shown has an error. If you need help with that then ask a question with a small example that shows the error. Jan 3, 2018 at 1:46
  • Adding \extrafloats{200}, then got the message ! Output loop---100 consecutive dead cycles, then I added \maxdeadcycles=500, it worked for me. I'm using tufte-handout Bible text annotations, I use too many \footnote which causes the problems. It seems morefloats didn't work for my situation. It might be better than use \clearpage from time to time. But I need a programming solution, that I cannot afford to add such manually.
    – Yu Shen
    Jan 11, 2020 at 16:24
  • @YuShen (late response, sorry). \footnote are not floats so are not related to this message. Sep 27 at 7:05
5

I would suggest using the float package and then the [H] option for your figure.

\usepackage{float}

...

\begin{figure}[H]
\centering
\includegraphics{slike/visina8}
\caption{Write some caption here}\label{visina8}
\end{figure}
1
  • 2
    Welcome to TeX.SE. Can you think of any potentially serious downsides to the method you've proposed? If so, you should probably mention them so that readers who come across your posting are fully aware of the pros and cons of the solution you're proposing.
    – Mico
    Aug 6, 2015 at 11:35
0

Another solution, which can also help you control where your figures end up in relation to your text, is to us a \FloatBarrier. As the name suggests, it prevents floats from crossing the barrier such that all of your figures above the barrier will be above that point in the document and all of the figures below will be below.

\usepackage[section]{placeins} %Float Barriers
\FloatBarrier

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .