Graphics, Figures & Tables\listoffigures with \captionof{figure}

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Michael_590
Posts: 51
Joined: Wed Aug 06, 2014 6:59 pm

\listoffigures with \captionof{figure}

Post by Michael_590 »

How can I get a list of figures if I use the following code:

Code: Select all

    \documentclass{article}
    \usepackage{caption}
    \usepackage{graphicx}
    \begin{document}
    \listoffigures

    \bigbreak

    \begin{minipage}{\linewidth}
            \begin{center}
                    \includegraphics[width=\textwidth]{example-image}
                    \captionof{figure}{this is my caption}
            \end{center}
    \end{minipage}
    \end{document}
\listoffigures doesn't appear to work.

Thank you,

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: \listoffigures with \captionof{figure}

Post by Johannes_B »

You can always run your own code or any other code her at LaTeX-community) by clicking on »open in writelatex«.
As you can see, your code is fine. You just have to remember to compile the document twice.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Re: \listoffigures with \captionof{figure}

Post by cgnieder »

Your example works for me. If you click on “open in WriteLaTeX” above your code example you can see this for yourself.

Regards
site moderator & package author
Michael_590
Posts: 51
Joined: Wed Aug 06, 2014 6:59 pm

Re: \listoffigures with \captionof{figure}

Post by Michael_590 »

When I moved "\listoffigures" to the end of the document, it works well. I guess I can live with this.

If I were to put "\listoffigures" directly after the "\tableofcontents" I get a lot of pages that can't be displayed. And, I get error messages when I tried to view the figure pages.

If I want to try and find the problem I could create smaller and smaller documents until I find the problem.

Thanks,
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

\listoffigures with \captionof{figure}

Post by cgnieder »

Michael_590 wrote:When I moved "\listoffigures" to the end of the document, it works well. I guess I can live with this.
It also works at the beginning of the document. You just need to compile at least twice! (You need to do that anyway for \listoffigures.)

Regards
site moderator & package author
Post Reply