I have a confusion in the toc between the title and the dots.
\documentclass[oneside]{book}
\usepackage{color, xcolor}
\newcommand{\mysection}[2]{
\setcounter{section}{#1}
\setcounter{section}{0}
\chapter*{#2}
\addcontentsline{toc}{section}
{\protect\numberline{\hspace{-1.15cm}%
\colorbox{blue!50}{\color{blue}\string\parbox[c][.72em]{1em}
{\strut\protect}}%
\hspace{1em}\bfseries\sffamily \MakeUppercase{#2}\protect}}
}
\begin{document}
\tableofcontents
\frontmatter
\mysection{1}{Introduction}
\mysection{0}{Acknowledgments}
\mainmatter
\end{document}
\colorbox
leaks into the title region, as far as I can see. There are better ways to achieve such things withtocloft
, for example\section
-like interface yet you're setting a\chapter
... Could you elaborate?