I'm bit lost with the content of titletoc.sty
. I'd like to access toc entries, meaning chapter title, section title and so on to put them in a colorbox. I think it is somewhere in the \def\ttl@tocentry
and I'd like to be able to write something like:
\titlecontents{chapter}[0pc]
{\colorbox{red}{chapter title}}
{}
{}
{}%
EDIT: MWE:
\documentclass[12pt]{report}
\usepackage{xcolor}
\usepackage{titletoc}
\titlecontents{chapter}%section
[0pc]%left
{}%above
{}%before with label
{}%before without label
{}%filler and page
[]%after
\begin{document}
\tableofcontents
\chapter{chapter title}
\end{document}
Best Answer
As explained in the manual: "As in \titleformat, the last command can take an argument with the title". So: