Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

share|improve this question
1  
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
add comment

1 Answer

up vote 5 down vote accepted

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.

enter image description here

\documentclass{article}

\usepackage{flafter}

\begin{document}

\listoffigures

\section{Red}


abc
\begin{figure}\addtocontents{lof}{\protect\subsection*{Red}}
\caption{aaa}\end{figure}
abc
\begin{figure}\caption{bbb}\end{figure}

\section{Blue}

abc
\begin{figure}\addtocontents{lof}{\protect\subsection*{Blue}}
\caption{cc}\end{figure}
abc
\begin{figure}\caption{dd}\end{figure}

\end{document}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.