My minimal document looks like this
This colors the numbers in the table of contents, and in the section. How can i color the page number in the table of contents as well?
I tried using tocloft and to redefine \cftXpagefont as it said in the manual, alas this did not change anything. I do not have to use tocloft any package that can solve my problem is more than welcome.
Code
\documentclass{article}
\usepackage{color,tocloft}
\newcommand{\cftXpagefont}{\color{red}}
\renewcommand\thesection{\textcolor{red}{\arabic{section}}}
\begin{document}
\tableofcontents
\section{a} \newpage \section{b} \newpage \section{c}
\end{document}


hyperref. I was able to get the correct output using\renewcommand{\cftsecpagefont}{\color{red}\hypersetup{linkcolor=red}} \renewcommand{\cftsecaftersnum}{\hypersetup{linkcolor=black}}. Is this ok, or is there a better solution? ` – N3buchadnezzar Sep 17 '19 at 07:11linktocpageto make it work (see Table of content: link at the page number instead of the section body). This will switch the linking from the titles to the page number. – Werner Sep 17 '19 at 15:53