[comp.text.tex] Problem with too many floats.

james@abby.chem.ucla.edu (James Wilkinson) (07/28/90)

  I have a user who needs to put all of her figure captions at the end of her
LaTeX document.  She has about twenty-five captions in a row, all of the form:

\begin{figure}
 \caption[title]{text...}
 \label{labelname}
\end{figure}

The caption texts average around fifty words each.  LaTeXing such a file
induces the LaTeX error:

!  Too many unprocesed floats.

Ok, so I look in Chapter 6 of the LaTeX book, and it refers to logjams and
such.  So I move the offending figure to the beginning of the text, but I
still receive the same error on the same line of the LaTeX file.

So is there some upper limit on how many figures may be placed in a row in a
LaTeX document?  Is there a way to get around this?  Her publishing
requirements necessitate placing all captions together.  Perhaps she shouldn't
use the figure environment, but simply make the captions independent of the
figure environment?  Thanks in advance.

JaW

James Wilkinson                            Phone: 1-213-206-5104
Department of Chemistry and Biochemistry     FAX: 1-213-206-5381
University of California, Los Angeles     BITNET: JAMES@UCLACH
405 Hilgard Avenue                      Internet: JAMES@ABBY.CHEM.UCLA.EDU
Los Angeles, California  90024-1569         SPAN: ABBY::JAMES or 5882::JAMES

dhosek@sif.claremont.edu (Hosek, Donald A.) (07/28/90)

In article <0093A4F7.248A7EC0@WIFFIN.CHEM.UCLA.EDU>, james@abby.chem.ucla.edu (James Wilkinson) writes...

>  I have a user who needs to put all of her figure captions at the end of her
>LaTeX document.  She has about twenty-five captions in a row, all of the form:

>\begin{figure}
> \caption[title]{text...}
> \label{labelname}
>\end{figure}

>The caption texts average around fifty words each.  LaTeXing such a file
>induces the LaTeX error:

>!  Too many unprocesed floats.

>Ok, so I look in Chapter 6 of the LaTeX book, and it refers to logjams and
>such.  So I move the offending figure to the beginning of the text, but I
>still receive the same error on the same line of the LaTeX file.

>So is there some upper limit on how many figures may be placed in a row in a
>LaTeX document?  Is there a way to get around this?  Her publishing
>requirements necessitate placing all captions together.  Perhaps she shouldn't
>use the figure environment, but simply make the captions independent of the
>figure environment?  Thanks in advance.

Well first, shouldn't she be leaving some space for the pasted-in
figures? (my personal recommendation is to use the picture
environment to grab the space rather than \vspace. The former is
somewhat more indicative of what the space is for and also makes
it easier to position electronicly pasted figures, e.g.,
\begin{center}
\begin{picture}(200,100) % Inserted picture 200pts by 100pts
\put(0,0)}{\special{include,format=epsf,file=foo.ps}}
\end{picture}
\end{center}
(think about it)).

But back to the problem at hand, too many unprocessed floats. The
problem here is that LaTeX holds all the floats in memory until
it decides that it's a good time to output the floats. Normally,
this happens when LaTeX hits the end of a page or the end of a
document. From your description, it sounds like your user just
has a list of floats at the end of the document, so LaTeX
dutifully stores up the floats until it can't store any more. As
you can imagine, this is can cause problems.

In particular, LaTeX only has provisions to store 18 floats by
default, which is seven fewer than you have. A kind of hacky way
would be to insert \clearpage periodically among the floats; but
if more than one float is desired per page, this could result in
underfilled pages.

Another approach would be to allow LaTeX to hold more floats in
memory. The style option below will allow up to 36 floats to
be held in memory (although many TeX implementations will run out
of TeX memory before that limit is reached).

Homework:

1. (For beginners) Suppose only one float is desired per page
containing only floats. How can this be done? (it's in the LaTeX
book.)

2. (For low-level wizards) Why is \@currlist defined with \gdef
below?

3. (For high-level wizards) Define a macro \clearfloats which
will take all floats to appear so far in the LaTeX file and print
them with as many floats as LaTeX will allow per page. If the
last page could possibly have at least one more float on it, then
those floats should be held over until the next time LaTeX
attempts to print floats. \clearfloats may assume that it will
only appear in long stretches of floats which are preceeded by
\clearpage.

% \iffalse
%% This is morefloats.sty as of 27-July-1990
%% Don Hosek, Quixote <dhosek@ymir.claremont.edu>
% \fi
%
% The task at hand is to increase \LaTeX's current limit of 18 unprocessed 
% floats in memory at once to 36. An examination of latex.tex reveals that
% this is accomplished by allocating an insert register for each unprocessed 
% float. A quick check of lplain.lis reveals that there is room, in fact, 
% for 230 additional unprocessed floats, but \TeX's main memory would be 
% exhausted long before that happened.
%
% First we allocate the additional insert registers needed:
%    \begin{macrocode}
\newinsert\bxS
\newinsert\bxT
\newinsert\bxU
\newinsert\bxV
\newinsert\bxW
\newinsert\bxX
\newinsert\bxY
\newinsert\bxZ
\newinsert\bxAA
\newinsert\bxBB
\newinsert\bxCC
\newinsert\bxDD
\newinsert\bxEE
\newinsert\bxFF
\newinsert\bxGG
\newinsert\bxHH
\newinsert\bxII
\newinsert\bxJJ
%    \end{macrocode}
%
% That accomplished, the next step is to define the macro \verb+\@freelist+
% which is merely a list of the box registers each preceded by \verb+\@elt+.
% This approach allows processing of the list to be done far more efficiently.
% A similar approach is used by Mittelbach \& Sch\"opf's {\tt doc.sty} to
% keep track of control sequences which should not be indexed.
%    \begin{macrocode}
\gdef\@freelist{\@elt\bx@A\@elt\bx@B\@elt\bx@C\@elt\bx@D\@elt\bx@E
               \@elt\bx@F\@elt\bx@G\@elt\bx@H\@elt\bx@I\@elt\bx@J
                \@elt\bx@K\@elt\bx@L\@elt\bx@M\@elt\bx@N
                \@elt\bx@O\@elt\bx@P\@elt\bx@Q\@elt\bx@R
                \@elt\bx@S\@elt\bx@T\@elt\bx@U\@elt\bx@V
                \@elt\bx@W\@elt\bx@X\@elt\bx@Y\@elt\bx@Z
                \@elt\bx@AA\@elt\bx@BB\@elt\bx@CC\@elt\bx@DD
                \@elt\bx@EE\@elt\bx@FF\@elt\bx@GG\@elt\bx@HH
                \@elt\bx@II\@elt\bx@JJ}
%    \end{macrocode}
\endinput



---
Don Hosek                         TeX, LaTeX, and Metafont Consulting and
dhosek@ymir.claremont.edu         production work. Free Estimates.
dhosek@ymir.bitnet                
uunet!jarthur!ymir                Phone: 714-625-0147

guy@physics (Guy Metcalfe) (07/29/90)

In article <7972@jarthur.Claremont.EDU> dhosek@sif.claremont.edu writes:
>In article <0093A4F7.248A7EC0@WIFFIN.CHEM.UCLA.EDU>, james@abby.chem.ucla.edu (James Wilkinson) writes...
>
>>  I have a user who needs to put all of her figure captions at the end of her
>>LaTeX document.  She has about twenty-five captions in a row, all of the form
>
>Well first, shouldn't she be leaving some space for the pasted-in
>figures? (my personal recommendation is to use the picture...
>(think about it)).
>

Dhosek may be missing the point here.  Many physics and chemistry
journals require that figures be bundled together at the end of a
paper with the figure captions listed together on a separate page or
pages.  Since the original question came from a chemistry dept, I
suspect (but don't know) that this may be the requirment.  In which
case using the aip document style (probably available on ymir) may be
the simpler answer.  
--
	Guy Metcalfe				
	Duke University Dept. of Physics	guy@phy.duke.edu
	& Center for Nonlinear Studies		guy@physics.phy.duke.edu
	Durham, N.C.      27706			guy%phy.duke.edu@cs.duke.edu

gilmore@vax1.acs.udel.EDU (Scott Gilmore) (07/29/90)

In article <21081@duke.cs.duke.edu> guy@physics.phy.duke.edu (Guy Metcalfe) writes:
>....  Many physics and chemistry journals require that figures be bundled 
>together at the end of a paper with the figure captions listed together on a 
>separate page or pages.  ...  In which case using the aip document style 
>(probably available on ymir) may be the simpler answer.  

Why not just put \listoffigures at the end of the document to produce the
caption list?  This is what I did for an ASME (mechanical engineering) journal.
Of course, you also must set the appropriate LaTeX parameters to hold all 
floats to the end of the document.
-- 
Scott Gilmore                                       gilmore@vax1.udel.edu
Mechanical Engineering and Center for Composite Materials, U. of Delaware