0

I wanted to know if it is possible to have the table of contents in black like it appears in the picture: enter image description here

And also make the sections appears in blue when referencing them:

enter image description here

This is my current set up:

\hypersetup{
    colorlinks=true,
    linkcolor=black,
    filecolor=blue,      
    urlcolor=blue,
    citecolor=blue,
    %pdfpagemode=FullScreen,
}
  • Do you mean that you want hyperlinks in the table of contents boxed, but the hyperlinks for cross references coloured? – David Purton May 23 at 2:52
  • Not boxed, only black. And the hyperlinks for cross references blue coloured! – user189304 May 23 at 3:02
  • So just different styles. See tex.stackexchange.com/questions/88400/… – David Purton May 23 at 3:05
  • Basically you want: {\hypersetup{linkcolor=black}\tableofcontents} – David Purton May 23 at 3:05
  • Let my try it and I'll tell you. I want to keep the blue hyperlinks for cross references colored – user189304 May 23 at 3:07
2

Something like this will do what you want:

\documentclass{article}

\usepackage{hyperref}
\hypersetup{
    colorlinks=true,
    allcolors=blue
}

\begin{document}

{\hypersetup{hidelinks}
\tableofcontents
}

\section{Section heading}
\label{sec}

Filler text.

\section{Another section heading}
\label{anothersec}

Filler text. §\ref{sec}. Filler text. §\ref{anothersec}.

\end{document}

output

  • Wow!!! You did it! Such a wonderful job! It works but, I have the preamble, meaning, all the packages, separated from the main.tex file. I can only alter the document from the preamble. By putting {\hypersetup{hidelinks} \tableofcontents below \begin{document} the table of contents appears in the first page and then comes the title page. How can we fix that? } – user189304 May 23 at 3:19
  • @Delan, you must have an existing \tableofcontents somewhere in your document. Just replace that line with {\hypersetup{hidelinks}\tableofcontents} – David Purton May 23 at 3:20
  • I want to alter the whole document, yes! I am trying to find where \tableofcontents is. I am seeing that I have it like \input{tableofcontents} – user189304 May 23 at 3:23
  • Or you could use {\hypersetup{hidelinks}\input{tableofcontents}} – David Purton May 23 at 3:25
  • 1
    @Delan. Same way. Just surround you list of figure and list of tables with {\hypersetup{hidelinks}…}. – David Purton May 23 at 3:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy