[Tex/LaTex] Toggle border links in table of contents

colorhyperreftable of contents

I'm using the amsart class and would like to know how to

  1. in the "Contents" output, to only have sections' page numbers with clickable colored borders and the sections' names completely neutral (i.e. no colors, no hyperlinking on section names); and also
  2. have "colorlinks = false" for everything else.

Here is a sample:

\documentclass[a4paper, 12pt]{amsart}


\usepackage{hyperref, xcolor}
\usepackage{cite}

\hypersetup{backref, colorlinks=false, 
linkcolor=red, 
linkbordercolor = red,          
citebordercolor = green, 
pdfborder = {0 0 1 [1 0] }}


\begin{document}
\title{test}            

\maketitle

\tableofcontents

\section{Introduction}

In \cite[Thm 1]{work}...see section \S\ref{next} next

\section{Next}\label{next}


\begin{thebibliography}{99}
\bibitem[work]{work} \textit{July, 2013}
\end{thebibliography}

\end{document}

So in the output of the above example, I want the red boxes not over the sections' names, only their page number. The following post almost answers my question, but the sections in toc are not neutral: coloring the page numbers in the table of contents

Best Answer

Using linktoc=page or linktocpage, in the hyperref setup, allows you get sections' page numbers with red colored borders while the section name remains plain text.

This option doesn't change the rest of the document.

\documentclass[a4paper, 12pt]{amsart}
\usepackage{hyperref, xcolor}
\usepackage{cite}
\hypersetup{
    backref,
    colorlinks=false,
    linktocpage,
    pdfborder = {0 0 1 [1 0] }
    }

\begin{document}
\title{test}            

\maketitle

\tableofcontents

\section{Introduction}

In \cite[Thm 1]{work}...see section \S\ref{next} next

\section{Next}\label{next}

\begin{thebibliography}{99}
\bibitem[work]{work} \textit{July, 2013}
\end{thebibliography}
\end{document}

desc

Related Question