0

I am using LaTeX on overleaf.com.

I am putting in pictures as follows:

\usepackage{graphicx}
\usepackage{caption}
\usepackage{float}

% ..

\begin{figure}[H]
  \centering
  \captionsetup{font={small,it}}
  \includegraphics[width=10cm]{Photo1}
  \caption*{A caption here.}
\end{figure}

The figure and caption show up just fine.

In main.tex (before the figure), I put:

% ...
\frontmatter

\input{titlepage}

\tableofcontents

\input{glossary}

\renewcommand{\listfigurename}{List of Photos}
\listoffigures

\input{prologue}

\mainmatter

% ...

Everything compiles, no errors. The title page, glossary, table of contents, prologue, all render just fine. There is a heading that says "List of Photos" as I'd expect, in the right place. However, there is no list of captions from the figures. It's just blank.

I have read that you might have to compile twice to get figure captions that are after \listoffigures, but I don't know how to do that on Overleaf.

Suggestions to fix this?

1 Answer 1

2

The list appears empty due to the use of \caption*{ which suppresses the word Figure, the figure number and the entry to the LoF.

If you want to add the figures to the LoF and at the same time remove the word "Figure" and the figure number from the caption, use \caption{ and also declare and use an empty caption format style like

\DeclareCaptionLabelFormat{nonehere}{} and then use

\captionsetup{font={small,it}, labelformat=nonehere}.

A

\documentclass[12pt,a4paper]{article}

\usepackage{graphicx}
\usepackage{caption}

\DeclareCaptionLabelFormat{nonehere}{} % added <<<<<<<<<<<

\begin{document}
    \renewcommand{\listfigurename}{List of Photos}
    \listoffigures
    
    \begin{figure}[htp!]
        \centering
        \captionsetup{font={small,it}, labelformat=nonehere}% changed <<<<<<<<<<<<<<<<
        \includegraphics[width=10cm]{example-image-a}
        \caption{A caption here A.}
    \end{figure}

    \begin{figure}[htp!]
       \centering
       \captionsetup{font={small,it}, labelformat=nonehere}% changed <<<<<<<<<<<<<<<<
       \includegraphics[width=10cm]{example-image-b}
       \caption{A caption here B.}
    \end{figure}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .