Typevia
Figures and Images

Understanding the List of Figures

In long documents like theses, technical reports, or books, a List of Figures (LoF) serves as a specialized table of contents specifically for your visual elements. It provides readers with a quick reference to find maps, charts, photographs, or diagrams by their title and page number.

In LaTeX, generating this list is remarkably efficient. Instead of manually tracking page numbers and titles—which would be a nightmare if you move an image—LaTeX automates the entire process. As long as you use the standard figure environment and captions, LaTeX will handle the numbering and referencing for you.

Basic Implementation

The most basic way to generate a List of Figures is to use a single command, usually placed right after your Table of Contents.

The \listoffigures Command

To tell LaTeX to compile the list, simply place this command in your document preamble (usually after \tableofcontents):

\documentclass{report}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}

\begin{document}

\tableofcontents
\listoffigures % This command generates the list

\newpage

\section{Introduction}
See the following images for details.

\end{document}

Note: Just like the Table of Contents, the List of Figures requires two compilations. During the first pass, LaTeX collects the figure information into a temporary file (extension .lof). During the second pass, it reads that file to print the actual list. If you see a blank page or missing entries, try compiling your document again.

Adding Figures to the List

For an image to appear in the List of Figures, it must be wrapped in a figure environment and contain a \caption command. LaTeX uses the text inside the \caption{} braces as the entry for the list.

Example: A Standard Figure Entry

\begin{figure}[h]
    \centering
    \includegraphics[width=0.5\textwidth]{ocean_view.jpg}
    \caption{A photograph of the Pacific Ocean coastline during sunset.}
    \label{fig:ocean}
\end{figure}

In this example, the text "A photograph of the Pacific Ocean coastline during sunset" will appear in the List of Figures alongside its corresponding figure number and page number.

Using Short Captions for Long Descriptions

A common issue in academic writing is that figure captions can be quite long, often containing detailed explanations of the data shown. If you use a long paragraph as a caption, your List of Figures will look cluttered and difficult to read.

LaTeX solves this by providing an optional argument for the \caption command.

Syntax:

\caption[Short Title for List]{Long Description for Document Body}

Example:

\begin{figure}[h]
    \centering
    \includegraphics[width=0.8\textwidth]{graph.png}
    \caption[Annual Revenue Growth 2020-2023]{Annual revenue growth from 2020 to 2023, showing a significant spike in Q3 of 2021 due to the expansion into European markets.}
    \label{fig:revenue}
\end{figure}

What happens here:

  1. In the List of Figures: Only "Annual Revenue Growth 2020-2023" appears.
  2. Under the Image: The full description about the European markets appears.

Best Practice: Always use the optional "short title" argument if your main caption is longer than a single line. This keeps your List of Figures professional and easy to scan.

Customizing the List Appearance

By default, LaTeX titles the list as "List of Figures." Depending on your language or document requirements, you may need to change this title or adjust how it looks.

Changing the Title

To rename the List of Figures (for example, to "Index of Images"), you can redefine the \listfigurename command in your preamble:

\renewcommand{\listfigurename}{Index of Illustrations}

Using the tocloft Package

If you need more control over the spacing, font, or indentation of the entries in your list, the tocloft package is the industry standard.

\usepackage{tocloft}

% Add "Fig." before the number in the List of Figures
\renewcommand{\cftfigpresnum}{Fig. }
\setlength{\cftfignumwidth}{3.5em} % Adjust width to fit "Fig."

Including the List of Figures in the Table of Contents

By default, LaTeX does not include the "List of Figures" itself as an entry in the Table of Contents. If your publisher or university requires it to be listed, you have two main options.

Option 1: The Manual Way

Add this command immediately after the \listoffigures command:

\listoffigures
\addcontentsline{toc}{chapter}{\listfigurename}

Option 2: The tocbibind Package

A cleaner way is to use a package that automatically adds lists (LoF, LoT, Bibliography) to the Table of Contents:

\usepackage[nottoc]{tocbibind}
% 'nottoc' prevents the Table of Contents from listing itself

Troubleshooting and Common Pitfalls

1. The "Figure numbers are ????" Problem

If your list shows "???" instead of page numbers, or if the list is completely empty, you simply need to re-compile. LaTeX creates an auxiliary file (.lof) to track figures; it can only read that file once it has been fully generated by a previous run.

2. Figures Not Appearing

If a figure is missing from the list, check two things:

  • Did you include a \caption{}? (Figures without captions are ignored by the LoF).
  • Is the \caption inside the \figure environment?

3. Captions Above or Below?

Standard practice is to place captions below figures. While LaTeX allows you to put the \caption command before the \includegraphics, it is visually conventional to place it after.

\begin{figure}
    \centering
    \includegraphics{chart.pdf}
    \caption{This is the standard placement.}
\end{figure}

4. Fragile Commands in Captions

If you use math symbols ($x^2$) or formatting commands like \textbf{} inside a caption, they can sometimes "break" when LaTeX tries to move them to the List of Figures. This is because captions are "moving arguments."

  • Solution: Use the \protect command before the fragile command, e.g., \caption{A graph of \protect\boldmath $x^2$}. However, in modern LaTeX, this is rarely necessary unless using very complex custom commands.

Summary Checklist

  • Use \listoffigures where you want the list to appear.
  • Ensure every image is in a \begin{figure} environment.
  • Use \caption[Short title]{Long title} for clean list formatting.
  • Compile your document twice to update the list.
  • Use the tocloft package if you need to customize the spacing or labels.