This solution sets up \hypertargets in the toc by renewing the \contentsline command. It links back to the toc by setting the section headings as \hyperlinks using the titlesec package. Note that each of the new \hypertarget start with the word 'toc'
You can easily copy this approach for chapters etc.
\documentclass{article} \usepackage{lipsum} % sample text \usepackage[explicit]{titlesec} % to change headings \usepackage{hyperref} % renew \contentsline for toc to include hypertarget \let\oldcontentsline\contentsline% \renewcommand\contentsline[4]{% \hypertarget{toc#4}{}% \oldcontentsline{#1}{#2}{#3}{#4}} % renew \section to link to the toc \titleformat{\section} {\normalfont\Large\bf} {{\thesection} \hyperlink{tocsection.\thesection}{#1}} {1pc} {} % renew \subsection to link to the toc \titleformat{\subsection} {\normalfont\bf} {{\thesection} \hyperlink{tocsubsection.\thesubsection}{#1}} {1pc} {} \begin{document} \tableofcontents \clearpage \section{First section} \lipsum[1] \subsection{my sub section} \lipsum[1] \section{Second section} \lipsum[2] \clearpage \section{Third section} \lipsum[3] \end{document}
Explanation
Note that if you look at the .toc file for the above example you'll see the following entries
\contentsline {section}{\numberline {1}First section}{2}{section.1} \contentsline {subsection}{\numberline {1.1}my sub section}{2}{subsection.1.1} \contentsline {section}{\numberline {2}Second section}{2}{section.2} \contentsline {section}{\numberline {3}Third section}{3}{section.3}
The \contentsline takes four arguments, the fourth of which will uniquely identify each entry. I used this unique entry combined with the string 'toc' as the \hypertarget{toc#4}{}; it would not work without the additional string 'toc' (or something similar), as it would result in a duplicated identifier which would be ignored.