# Break up \listoftables and \listoffigures by adding section names

Is it possible to use \listoftables and \listoffigures, but to have the lists divided by sections, similar to how the table of contents works?

-
What do you mean by "divided by section"? Do you want to insert a space between the figures/tables at every section? Also, what \documentclass are you using, since \listoftables and \listoffigures are class-dependent? –  Werner Dec 7 '12 at 16:58
David Carlisle below got what I meant. I want to have a section header before the figures / tables that are in that section. The document class is article. –  TARehman Dec 7 '12 at 19:03

It's easy to write to the file but you have to get the timing right so the heading comes in the logical place, easiest to put the heading in the first float of each section rather than at the heading.

\documentclass{article}

\usepackage{flafter}

\begin{document}

\listoffigures

\section{Red}

abc
\caption{aaa}\end{figure}
abc
\begin{figure}\caption{bbb}\end{figure}

\section{Blue}

abc