FAQ overflow

Great Answers to Questions About Everything

QUESTION

I was wondering if it was possible to section the LoF (and similarly LoT) by Parts and/or Chapters.

Currently, I have :

List of Figures

1.1 blablabla

1.2 blablabla

1.3 blablabla

2.1 blablabla

2.2 blablabla

1.1 blablabla

1.2 blablabla

And I'd like to obtain :

Part 1

Chapter 1

1.1 blablabla

1.2 blablabla

1.3 blablabla

Chapter 2

2.1 blablabla

2.2 blablabla

Part 2

Chapter 1

1.1 blablabla

1.2 blablabla

ANSWER

You can insert part, chapter or any other references in a table of contents, list of figures or list of tables with \addcontentsline{ext}{type}{text} where ext is the extension of auxiliar file (usually toc, lof, lot), type specifies type of contents and text what you want to be shown in the list. Here you have a simple example.

\documentclass{book}

\begin{document}
\tableofcontents
\listoffigures
\part{A}
\addcontentsline{lof}{part}{Part A}
\chapter{A1}
\addcontentsline{lof}{chapter}{Chapter A1}
\section{A11}
\begin{figure}
\caption{FigA1}
\end{figure}
\begin{figure}
\caption{FigA2}
\end{figure}
\chapter{A2}
\addcontentsline{lof}{chapter}{Chapter A2}
\begin{figure}
\caption{FigA21}
\end{figure}
\part{B}

\end{document}



The result is

The package tocloft allows you to define or change the format of a table of contents but I've never used it. You can read its introduction and will learn how ToC works in LaTeX.

EDIT: You can avoid typing twice chapter names and part names if you declare your own commands. Look at the example \mypart command contains \part and \addcontentsline. This way, parts and chapters in lof will look the same as in toc.

\documentclass{book}
\newcommand{\mypart}[1]{%
\part{#1}
\addcontentsline{lof}{part}{\thepart\hspace{1em}#1}
}

\newcommand{\mychapter}[1]{%
\chapter{#1}
\addcontentsline{lof}{chapter}{\numberline{\thechapter}#1}
}

\begin{document}
\tableofcontents
\listoffigures
\mypart{A}
\mychapter{A1}
\section{A11}
\begin{figure}
\caption{FigA1}
\end{figure}
\begin{figure}
\caption{FigA2}
\end{figure}
\mychapter{A2}
\begin{figure}
\caption{FigA21}
\end{figure}
\mypart{B}

\end{document}