General ⇒ Dealing with tons of floats
-
- Posts: 6
- Joined: Fri Apr 04, 2008 10:17 pm
Dealing with tons of floats
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
Dealing with tons of floats
Code: Select all
\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}