\addcontentsline{toc}{section}{from there}
no text

\addcontentsline{toc}{section}{to here}
some text

\addcontentsline{toc}{subsection}{and here}
still more text

\addcontentsline{toc}{subsection}{not here}
or maybe less text

\addcontentsline{toc}{section}{also here}
and more text

\addcontentsline{toc}{subsection}{maybe here}
and still more text

  • Why do you use \addcontentsline here at all? Let \section etc. do this job and the links anchors and positions are correct!
    – user31729
    Sep 6, 2017 at 6:34

1 Answer 1


\addcontentsline does not create an anchor, it uses the anchor, that is created before, even if the anchor belongs to one of the previous pages. This is by design, it allows, e.g.:


If \addcontentsline would create an anchor, then it would point below the section title.

The solution here is to use \phantomsection, which creates the needed anchor:

\addcontentsline ...

You must log in to answer this question.

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