Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
    
Welcome to TeX.sx! I took the liberty to rephrase your title in order to reflect the actual question. I also changed the body because of this. I hope you don't mind. –  Martin Scharrer May 9 '12 at 20:58
    
If you only want to typeset an URL without making it a real hyperlink all you need is the url package which gives you \url. –  Martin Scharrer May 9 '12 at 21:01
    
Thank you, can I add the words instead of the link showing up like you would in the \href{linkto go to}{this is the text} –  StudentRik May 9 '12 at 21:07
1  
No, \url is just for URLs, not for hyperlinks. I'm afraid you need hyperref for links like this. I checked the manual but couldn't find an option to disable TOC links. –  Martin Scharrer May 9 '12 at 21:11
1  
you could use something like \hypersetup{linkcolor=black} immediately before your toc and then change it immediately afterwards –  cmhughes May 9 '12 at 21:16

2 Answers 2

up vote 13 down vote accepted

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}
share|improve this answer
4  
A "somewhat under-documented switch": this must be the understatement of the year! :-) –  Mico May 9 '12 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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.