Could someone help me, please ?

I would like coloring dots as Red and Bold (not normal and Black like in the photo).

Any help is highly appreciated.

\documentclass{report}

%%%%% Format font + page + langue
\usepackage[utf8x]{inputenc}

\usepackage[french]{babel}
\FrenchFootnotes
\usepackage[T1]{fontenc}
\setlength{\parindent}{0cm}
\setlength{\parskip}{1em}
\renewcommand{\baselinestretch}{1}
\usepackage[titletoc]{appendix}

\setcounter{secnumdepth}{5} % seting level of numbering

\usepackage{tocloft}
\renewcommand{\cftchapfont}{\Color{red}\large\bfseries}
\renewcommand{\cftsecfont}{\Color{blue}}
\renewcommand{\cftsubsecfont}{\Color{black}}
\renewcommand{\cftsubsubsecfont}{\Color{green}}
\renewcommand{\cftchappagefont}{\large\bfseries\Color{red}}
\renewcommand{\cftsecpagefont}{\Color{blue}}
\renewcommand{\cftsubsecpagefont}{\Color{black}}
\renewcommand{\cftsubsubsecpagefont}{\Color{green}}

\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}

%%%%% Indentfirst
\usepackage{indentfirst}
\setlength{\parindent}{1cm}

\usepackage{libertine}

\usepackage{lmodern}

\begin{document}
\tableofcontents

\chapter{name of chapter 1}
\section{section 1}
\subsection{subsection 1}
\subsubsection{sub sub section 1}
\section{section 2}

\newpage
\chapter{name of chapter 2}
\section{section 21}
\subsection{sub sec 2}
\section{section 22}

\end{document}


• Could you post a full, minimal code of what you've tried? – Bernard Aug 4 '18 at 19:47
• @Bernard I just edited. – Dg PHAM Aug 4 '18 at 19:49
• This is not exactly a full code: which document class do you use? Where's \begin{document}, \end{document}? – Bernard Aug 4 '18 at 19:53
• @Bernard Ok, I posted the full code. – Dg PHAM Aug 4 '18 at 20:01

(updated code and screenshot after OP modified his/her own code and query)

I believe you should provide visual clarity to your readers as to (a) which colors are used for sectioning headers within in the ToC and (b) which color is used for hyperlinks.

I thus suggest you load the hyperref package with the option linktocpage, which makes just the pages numbers in the ToC into hypertargets, and (b) use a hyperlink color that's different from any of the colors already used in the ToC red, blue, black, green). Indigo, maybe? Choose a color that's suitable for all links within the document, not just for those shown in the ToC.

• Basically, you should do everything in your power to help your readers develop a strong Pavlovian reflex: Each time they see an object colored in the "link color", they should want to click on it with their mouse. If there's just one color that shouts "I'm a hyperlink", the Pavlovian reflex will be much stronger.

• Conversely, if you let lots of different colors (including black in some cases) be compatible with an object being a hyperlink, your readers will learn much more slowly what and where the hypertargets are. Put differently: "If everything is special, then nothing is special". Be very deliberate in how you deploy colors to convey meaning.

Incidentally, the hyperref package should be loaded after the tocloft and xcolor packages.

\documentclass{report}
\usepackage[a4paper,top=3cm,bottom=2.5cm,left=2.5cm,
right=2cm,marginparwidth=1.75cm,

\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage[svgnames]{xcolor} % for 'DarkGreen' color
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}

\usepackage{tocloft}
\renewcommand{\cftchapfont}{\color{red}\large\bfseries}
\renewcommand{\cftsecfont}{\color{blue}}
\renewcommand{\cftsubsecfont}{\color{black}}
\renewcommand{\cftsubsubsecfont}{\color{DarkGreen}}

\renewcommand{\cftchappagefont}{\color{red}%\large\bfseries
}
%\renewcommand{\cftsecpagefont}{\color{blue}}
%\renewcommand{\cftsubsecpagefont}{\color{black}}
%\renewcommand{\cftsubsubsecpagefont}{\color{DarkGreen}}

linkcolor=Indigo, % or some other suitable color

\begin{document}
\tableofcontents

\chapter{Thoughts}
\section{Hello}
\subsection{World}
\subsubsection{Really!}
\end{document}

• @marmot - I always appreciate upvotes. :-) (I've upvoted your answer too, by the way.) I fully realize that the OP would like the page numbers to have the same colors as the headers and leaders. However, as I've tried to explain in my answer (and speaking more as a document designer than as a LaTeX programmer), I think it's a highly questionable to let a whole bunch of colors be compatible with the corresponding objects being hypertargets. (Aside: I can't say I "get" what exactly the OP is trying to achieve by making the ToC look like a wildly over-decorated Christmas tree...) – Mico Aug 4 '18 at 21:47
• I agree with all your statements. ;-) – marmot Aug 4 '18 at 21:49

Thanks for the MWE! You need to use the tricks of this answer, I think.

\documentclass{report}

%%%%% Format font + page + langue
\usepackage[utf8x]{inputenc}

\usepackage[french]{babel}
\FrenchFootnotes
\usepackage[T1]{fontenc}
\setlength{\parindent}{0cm}
\setlength{\parskip}{1em}
\renewcommand{\baselinestretch}{1}
\usepackage[titletoc]{appendix}

\setcounter{secnumdepth}{5} % seting level of numbering
\setcounter{tocdepth}{5}
\usepackage{tocloft}
\renewcommand{\cftchapfont}{\Color{black}\large\bfseries}
\renewcommand{\cftsecfont}{\Color{blue}}
\renewcommand{\cftsubsecfont}{\Color{red}}
\renewcommand{\cftsubsubsecfont}{\Color{green}}
\renewcommand{\cftchappagefont}{\Color{black}}
\renewcommand{\cftsecpagefont}{\Color{blue}}
\renewcommand{\cftsubsecpagefont}{\Color{red}}
\renewcommand{\cftsubsubsecpagefont}{\Color{green}}
\renewcommand{\cftchappagefont}{\large\bfseries}
\hypersetup{%
filecolor=magenta,% color of links to external files
urlcolor=red,% color to external URLs
}
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}

%%%%% Indentfirst
\usepackage{indentfirst}
\setlength{\parindent}{1cm}

\usepackage{libertine}

\usepackage{lmodern}
%   uncomment these if you want to have the actual chapter font larger
%   \usepackage{titlesec}
%   \titleformat{\chapter}
%   {\normalfont\Huge\bfseries}{\thechapter}{1em}{}
\begin{document}
\tableofcontents

\chapter{name of chapter 1}
\section{section 1}
\subsection{subsection 1}
\subsubsection{sub sub section 1}
\section{section 2}

\newpage
\chapter{name of chapter 2}
\section{section 21}
\subsection{sub sec 2}
\section{section 22}

\end{document}


• thank you so much. Just a little problem. I add also a subsubsection, but it doesn't appear in the table of contents. Could you solve this ? – Dg PHAM Aug 4 '18 at 20:03
• @DgPHAM Just add \setcounter{tocdepth}{5}. I updated the answer accordingly. – marmot Aug 4 '18 at 20:05
• perfect. Thank you. Could we make the titles of the chapters bigger and bold ? – Dg PHAM Aug 4 '18 at 20:07
• I need also dots ... connecting between the name of chapter and the Page. Could you help me, please? – Dg PHAM Aug 4 '18 at 20:09
• as you see in the sample photo in my question, the font of chapters is bigger and bold. I would like to do that in the table of contents. – Dg PHAM Aug 4 '18 at 20:12