10

How can I get the list of figures as a section in an article document, so it will be listed in the table of contents? At the moment it's listed in the ToC, but without number.

3
  • Welcome to Tex! Why don't you try something like \section{List of Figures}\lofwithouttitle\addcontentsline{toc}{section}{List o Figures}
    – Thanos
    Nov 11, 2012 at 16:22
  • 1
    @Thanos: You would also need \makeatletter\newcommand{\lofwithouttitle}{\@starttoc{lof}}\makeatother.
    – Werner
    Nov 11, 2012 at 16:34
  • @Werner:Yeas you are right...I forgot to copy it...Thank's and sorry for the inconvinience...
    – Thanos
    Nov 11, 2012 at 16:36

2 Answers 2

7

In the default article document class \listoffigures is set as \section*, thereby removing it from being displayed in the ToC:

\newcommand\listoffigures{%
    \section*{\listfigurename}%
      \@mkboth{\MakeUppercase\listfigurename}%
              {\MakeUppercase\listfigurename}%
    \@starttoc{lof}%
    }

Modifying this to actually use \section instead inserts the appropriate numbering:

enter image description here

\documentclass{article}
\newcommand{\insertfigure}{\begin{figure}\caption{A figure caption}\end{figure}}
\makeatletter
\renewcommand\listoffigures{%
    \section{\listfigurename}% Used to be \section*{\listfigurename}
      \@mkboth{\MakeUppercase\listfigurename}%
              {\MakeUppercase\listfigurename}%
    \@starttoc{lof}%
    }
\makeatother
\begin{document}
\tableofcontents
\listoffigures
\section{A section}\insertfigure\insertfigure\insertfigure
\section{A section}\insertfigure\insertfigure\insertfigure
\section{A section}\insertfigure\insertfigure\insertfigure
\section{A section}\insertfigure\insertfigure\insertfigure
\section{A section}\insertfigure\insertfigure\insertfigure
\section{A section}\insertfigure\insertfigure\insertfigure
\end{document}
1
  • Great! Also works when replacing section by chapter, for example for books.
    – AstroFloyd
    Sep 9, 2020 at 8:13
4

With the KOMA-Script classes, simply use the class option listof=totocnumbered.

\documentclass[listof=totocnumbered]{scrartcl}

\begin{document}

\tableofcontents

\listoffigures

\section{foo}

\begin{figure}[h]
\centering
\rule{1cm}{1cm}
\caption{A figure}
\end{figure}

\end{document}

enter image description here

1
  • Which package do I need to use? Oct 12, 2021 at 8:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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