Featured Book

LaTeX Beginners Guide

Who is online

In total there are 23 users online :: 1 registered, 0 hidden and 22 guests (based on users active over the past 5 minutes)
Most users ever online was 1327 on Tue Nov 05, 2013 7:11 pm

Users browsing this forum: Google [Bot] and 22 guests

Partner Sites

TeXwelt - Fragen und Antworten goLaTeX
TeXblog
TeXnicCenter
TeXample

Dealing with tons of floats

Add tags LaTeX specific issues not fitting into one of the other forums of this category.

Dealing with tons of floats

Postby Andre Smit on Tue Nov 11th, 2008

I'm putting together a report that contains hundreds of tables and figures that I've dumped into Appendices at the end of the document. One appendix, for example, consists only of tables, another only photos with no text between these tables or figures. As expected I'm running into the "too many unprocessed floats" error. Yep, I can *fix* this with a \clearpage but this is very tedious i.e. compile -> error -> insert \clearpage -> compile -> error etc. Another problem with the \clearpage approach is that it breaks the consistency of float placement - sometimes I get two - other times three tables on a page. The {morefloats} package simply delays the errors and I've had no luck with setting the float parameters floatpagefraction, [htbp], [!p], etc. No luck with the {float} package either - unless I'm missing something. The {endfloat} package was interesting in that it dumps all the floats to the end of the document without complaining but not quite what I'm looking for. Does anyone know of a package (or method) that can handle tons of floats as described. TIA.
Andre Smit
 
Posts: 6
Joined: Fri Apr 4th, 2008

Re: Dealing with tons of floats

Postby phi on Tue Nov 11th, 2008

The best thing would be to avoid all those floats (i.e., converting them to simple text elements). If that is impossible, you can try to increase the number of possible floats, using eTeX and a technique similar to morefloats. The following hack places 1000 floats on 268 pages. It needs several minutes to compile, so you will probably choose not to use it if you have so many floats, but for 200 floats, it's still quite fast.
Code: Select all  •  Open in writeLaTeX
\documentclass{article}

\usepackage{lipsum
}


\makeatletter

\newcount\ExtraInsertCount
\ExtraInsertCount10000

% no checks, we just hope that there are no allocations starting from 10000
\newcommand*\AllocateExtraFloat{%
  \advance\ExtraInsertCount1%
  \allocationnumber\ExtraInsertCount
  \edef\ExtraFloatCommand{\expandafter\noexpand\csname bx@extra@\number\ExtraInsertCount\endcsname}%
  \expandafter\mathchardef\ExtraFloatCommand\allocationnumber
  \edef\@freelist{\unexpanded\expandafter{\@freelist\@elt}\expandafter\noexpand\ExtraFloatCommand}%
}

\newcommand*\Repeat[2]{%
  \ifnum\numexpr#2>0%
    #1%
    \expandafter\Repeat\expandafter#1\expandafter{\number\numexpr#2-1\expandafter}%
  \fi
}

\newcommand*\AllocateExtraFloats{%
  \Repeat\AllocateExtraFloat
}

\newcount\LipsumParagraph
\LipsumParagraph0

\newcommand*\PlaceFloat{%
  \begin{figure}%
    \global\advance\LipsumParagraph1%
    \ifnum\LipsumParagraph>149\global\LipsumParagraph1\fi
    \lipsum[\LipsumParagraph]%
    \caption{\Roman{figure}}%
  \end{figure}%
}

\AllocateExtraFloats{1000}

\maxdeadcycles2000

\makeatother


\begin{document}

\Repeat\PlaceFloat{1000}

\end{document
}
phi
 
Posts: 578
Joined: Tue Oct 21st, 2008


Return to General

Who is online

Users browsing this forum: Google [Bot] and 22 guests