[Tex/LaTex] Clickable Link back to the Table of Contents

back-referencinghyperreftable of contents

There are many questions and answers surrounding how to make the Table of Contents content clickable. I am wondering how to make a reference to the Table of Contents and create a link elsewhere in the document to click on and go back to the table of contents.

I have tried giving the Table of Contents its own label via \tableofcontents\label{toc} and then using a reference link \ref{toc} but this produces the error: ./project.tex:133: Package hyperref Warning: Suppressing empty link on input line 133.

Best Answer

This can be done with hypertarget and hyperlink from the hyperref package. See the example below:

\documentclass{article}
\usepackage{hyperref}

\begin{document}
Title Page\newpage

% Add a link target to the TOC itself
\addtocontents{toc}{\protect\hypertarget{toc}{}}

% Print the TOC
\tableofcontents
\newpage

% Sections with a hyperlink to TOC
\section[One]{One. Go to \hyperlink{toc}{TOC}}
Text that points to \hyperlink{toc}{Table of Contents}.

\end{document}
Related Question