I'm using the hyperref
package because I have a link in my document, but do not want to have the TOC as links. How can this be done?
3 Answers
Hyperref
has a somewhat under-documented switch for this:
\documentclass{article}
\usepackage{hyperref}
\makeatletter
\let\Hy@linktoc\Hy@linktoc@none
\makeatother
\begin{document}
\tableofcontents
\section{aaa}
aaa
\section{bbb}
bbb
\end{document}
-
8A "somewhat under-documented switch": this must be the understatement of the year! :-)– MicoCommented May 9, 2012 at 22:42
There is the option linktocpage
for hyperref; it defaults to 'false', while:
\usepackage[linktocpage=true]{hyperref}
will make the page numbers rather than the text of the ToC the active link. This, along with the suggestion of @cmhughes will minimize how 'clickable' your ToC is and even make it look like there are no links to click on.
Modern versions of hyperref
also have the linktoc
option which supports section
, page
, both
, or none
. If you want to remove all links then none
is the option you want.
\usepackage[linktoc=none]{hyperref}
url
package which gives you\url
.\url
is just for URLs, not for hyperlinks. I'm afraid you needhyperref
for links like this. I checked the manual but couldn't find an option to disable TOC links.\hypersetup{linkcolor=black}
immediately before yourtoc
and then change it immediately afterwards