I try to color the page numbers of my table of contents.
I'm using the package hyperref along with the options :
\hypersetup{
colorlinks,
linkcolor=wine-stain % custom color
}
Here's the output :
The numbers remain black..
What should I do so the numbers become the same color as defined for the sections ?
I tried to \color{wine-stain}{\tableofcontents}
but still that doesn't work since "Contents" is also colorized and the subsection numbers are remaining black.
Best Answer
This happens because the links are only the titles of entries in the ToC. The page numbers themselves are not hyperlinked. Add the option
to your set of
hyperref
options, which should link both the section names as well as the page number.Adding
linktocpage
is not sufficient, since the sectional units are then not hyperlinked. Unless, of course, this is what you're after in the first place. That is, if used, it provides a mutually exclusive switch between hyperlinking in the ToC. In fact, options related to hyperlinking from the ToC include:linktoc=none
: No hyperlinking in the ToC;linktoc=section
: Only the section titles are hyperlinked;linktoc=page
: Only the page numbers are hyperlinked;linktoc=all
: Both section titles and page numbers are hyperlinked;linktocpage
: Similar tolinktoc=page
The
linktoc
key-value is undocumented, but stem from the following code inhyperref.dtx
: