I use the hyperref package. However, the link in the table of content (toc) of "List of figures" (lof) leads to the toc instead of the lof. I have the \addcontentsline command before \listoffigures. Swapping them, I get the correct link but wrong page numbers in the toc. It seem to be only a problem if the lof is longer than one page. Does anybody how to get both the link and the number right?

Here is a minimum working example.

\documentclass[10pt]{article}

\usepackage{graphicx}
\usepackage{lipsum,forloop}
\usepackage[]{hyperref}

\begin{document}
\tableofcontents
\clearpage
\listoffigures

\newcounter{ct}
\forloop{ct}{1}{\value{ct} < 25}%
{
\clearpage
\section{Another section}

\lipsum[1]
\begin{figure}[htb]
\centering
\includegraphics[width=0.2\linewidth]{example-image}
\caption{Example}
\end{figure}

\subsection{Another subsection}

\lipsum[1]
\begin{figure}[htb]
\centering
\includegraphics[width=0.2\linewidth]{example-image}
\caption{Example}
\end{figure}
}
\end{document}


## closed as off-topic by user31729, Stefan Pinnow, Werner, barbara beeton, MenschDec 29 '17 at 0:16

• This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

• workaround: remove \addcontentsline and add \usepackage{tocbibind}. – Marijn Oct 2 '17 at 9:57
• Nothing wrong with tocbibind, but for a general way to tell hyperref where to jump, look at tex.stackexchange.com/questions/44088/… – Michael Palmer Oct 2 '17 at 17:46
• @JK19 if you have found a solution please provide an answer with a mwe. – user4686 Oct 2 '17 at 22:04
• Sorry for the late response. I omitted \addcontents line and added \usepackage[nottoc]{tocbibind} – JK19 Nov 3 '17 at 14:49
• I'm voting to close this question as off-topic because it could be solved in comments – user31729 Dec 28 '17 at 22:56