I thought that someone must have asked this, but my searches didn't find it.
I am looking to refer back to the table of contents from places in my document. How can I do this?
I thought that someone must have asked this, but my searches didn't find it.
I am looking to refer back to the table of contents from places in my document. How can I do this?
Since you are using hyperref you can simply add a \label to the \tableofcontents command and then refer to it with \hyperref.
MWE:
\documentclass{article}
\usepackage{hyperref}
\begin{document}
\tableofcontents\label{toc}
\clearpage
\section{A section}
Here is a link to the \hyperref[toc]{Table of Contents}.
\end{document}

The normal reference system of LaTeX can be used including packages such as hyperref/nameref, titleref, ...
The tricky part is put \label at the right place. hyperref likes it right after the title, then the anchor of the \label remains the title. Also putting \label at the end of the \tableofcontents has the risk for a wrong page reference, if the table of contents is more than one page long.
The following example uses an indirect, defensive approach. \label is put right at the beginning of the .toc file via \addtocontents. In the first run, the \label goes into the .toc file, then in the next run it is propagated to the .aux file and in the third LaTeX run the reference is available. Therefore three LaTeX runs are needed:
\documentclass{article}
\AtBeginDocument{%
\addtocontents{toc}{\protect\label{toc}}%
}
\begin{document}
\tableofcontents
\section{Hello World}
See table of contents on page \pageref{toc}.
\end{document}
The .toc file:
\label {toc}
\contentsline {section}{\numberline {1}Hello World}{1}
Result:
The counter toclabel is defined and used to generate several label names, e.g. toc1, toc2, toc3:
\documentclass{article}
\newcounter{toclabel}
\AtBeginDocument{%
\addtocontents{toc}{\protect\stepcounter{toclabel}}%
\addtocontents{toc}{\protect\label{toc\protect\thetoclabel}}%
}
\begin{document}
\section*{First table of contents}
\input{\jobname.toc}
\newpage
\section*{Second table of contents}
\input{\jobname.toc}
\newpage
\tableofcontents
\section{Hello World}
First table of contents on page \pageref{toc1}\\
Second table of contents on page \pageref{toc2}\\
Third table of contents on page \pageref{toc3}
\end{document}
table of contents from the .toc file, which admittedly is not the case with the standard classes (and excluding toc-devoted packages).
–
Mar 07 '14 at 16:39
A further improved version that will put two links in every page and links point to the TOC.
\documentclass{article}
\usepackage{blindtext}
\usepackage{eso-pic}
\usepackage{hyperref}
\usepackage{ifthen}
\newboolean{linktoc}
\setboolean{linktoc}{true} %%% uncomment to show answers properly
%\setboolean{linktoc}{false} %%% comment to show answers properly
\newcommand\AtPageUpperRight[1]{\AtPageUpperLeft{%
\put(\LenToUnit{\paperwidth},\LenToUnit{-0.3\paperheight}){#1}%
}}%
\newcommand\AtPageLowerRight[1]{\AtPageLowerLeft{%
\put(\LenToUnit{\paperwidth},\LenToUnit{0.3\paperheight}){#1}%
}}%
\ifthenelse{\boolean{linktoc}}%
{%
\AddToShipoutPictureBG{%
\AtPageUpperRight{\put(-70,0){\hyperref[toc]{Go to TOC}}}
\AtPageLowerRight{\put(-70,0){\hyperref[toc]{Go to TOC}}}
}%
}%
{}%
\begin{document}
\tableofcontents\label{toc}
\Blinddocument
\end{document}

If you don't want to display the links (you will in the final document), you can disable them by switching the boolean:
%\setboolean{linktoc}{true} %%% comment to hide links
\setboolean{linktoc}{false} %%% uncomment to hide links
You get

Assuming you want a page reference, and you are using a standard class, I would do the following:
\documentclass{article}
\let\oldcontentsname\contentsname
\renewcommand{\contentsname}{\oldcontentsname\label{contents}}
\begin{document}
\tableofcontents
\clearpage
\section{Section 1}
Here is some text for section 1. It refers back to the table of contents
on page \pageref{contents}.
\clearpage
\section{Section 2}
And here is some more text, also referring to the table of contents on
\pageref{contents}.
\end{document}
If \tableofcontents doesn't start a new page, you could just issue the \label immediately before it, but doing it this way makes sure the label ends up in the right place if a new page is started with the title.
With etoc this works out of the box, with or without hyperref:

\documentclass{article}
\usepackage{hyperref}
\usepackage{etoc}
\begin{document}
\tableofcontents\label{toc}
\clearpage
\newcount\cnta
\loop
\advance\cnta 1
\ifnum\cnta<100
\section{A section}
Here is a link to the \hyperref[toc]{Table of Contents} on page \pageref{toc}.
\repeat
\end{document}
Note that without etoc the page reference will be wrong (with or without hyperref, the page will be 4 and not the correct 1). Here is what happens then:

:). [release 1.07k just to be issued fixes compatibility with tocloft]
–
Mar 07 '14 at 16:48
\pagerefdoes not work correctly if the table of contents extend on more than one page... – Mar 07 '14 at 16:22\pageref.\hyperrefworks correctly in any case. – karlkoeller Mar 07 '14 at 16:38\pageref! I was dissuaded from posting an answer when I saw yours, as I thought it nailed it, but then realized about the\pagerefissue. The OP was not specific and\pagerefis mentioned in the other answers. – Mar 07 '14 at 16:44