[Tex/LaTex] Numbering the list of figures in the table of contents

numberingtable of contentstocbibind

So I'm having a slight problem with the \listoffigures command and the way LaTeX makes the table of contents. In my preamble I'm using \usepackage[nottoc,numbib]{tocbibind}
because I want to include the bibliography in the ToC (and with a section-number as well). However, I can't seem to figure out how to do the same for list of figures. The package tocbibind sadly don't have an option like numlof and all results on google either don't give me a working result or has something to do with "how to manually add an item in the ToC", which isn't really what I'm looking for.

In short, how do I add the listoffigures in the ToC with a number attached to it.

Just to add, I can add the list of figures in the ToC without problems, but I'd like a section-number as well. I'm using the article class by the way.

EDIT: Silly me, I was also using the tocloftpackage, in order to make a way to list the source of a bunch of images. The process is described at List of figures: source below image caption?

It seems the two methods conflict each other. I'd really like to have both the numbered LoF in the ToC and a way to list the source of each figure.

Best Answer

This can be done adding the following lines to your preamble:

\renewcommand{\listoffigures}{\begingroup
\tocsection
\tocfile{\listfigurename}{lof}
\endgroup}

MWE:

\documentclass{article}
\usepackage[nottoc,numbib]{tocbibind}

\renewcommand{\listoffigures}{\begingroup
\tocsection
\tocfile{\listfigurename}{lof}
\endgroup}

\begin{document}

\tableofcontents
\newpage

\listoffigures
\newpage

\section{test}

\end{document} 

Output (ToC):

enter image description here


EDIT

If you are also using tocloft, you have to inform tocloft that you want to use your custom titles by passing the option titles when loading it:

\usepackage[titles]{tocloft}

Complete MWE

\documentclass{article}
\usepackage[titles]{tocloft}
\usepackage[nottoc,numbib]{tocbibind}

\renewcommand{\listoffigures}{\begingroup
\tocsection
\tocfile{\listfigurename}{lof}
\endgroup}

\makeatletter
\newcommand{\figsourcefont}{\footnotesize}
\newcommand{\figsource}[1]{%
  \addtocontents{lof}{%
    {\leftskip\cftfigindent
     \advance\leftskip\cftfignumwidth
     \rightskip\@tocrmarg
     \figsourcefont#1\protect\par}%
  }%
 }
\makeatother

\begin{document}

\tableofcontents
\newpage

\listoffigures
\newpage

\section{test}

\begin{figure}
    \caption{World Targets in Megadeaths}
    \figsource{BLAND Corporation}
\end{figure}

\end{document} 

Output:

enter image description here

Related Question