Adding word "Chapter" into Table of Contents for only numbered chapter entries
You are not using \addcontentsline
in the correct way.
Instead of
\addcontentsline{toc}{chapter}{\numberline{}Abstract}
you have to use
\addcontentsline{toc}{chapter}{Abstract}
and the result will be good.
Also notice that \bfseries
can be specified in the first mandatory argument, so not to be repeated in the others:
\titlecontents{chapter}% <section-type>
[0pt]% <left>
{\bfseries}% <above-code>
{\chaptername\ \thecontentslabel:\quad}% <numbered-entry-format>
{}% <numberless-entry-format>
{\hfill\contentspage}% <filler-page-format>
MWE:
\documentclass[12pt]{report}
\usepackage[utf8]{inputenc}
\usepackage{titletoc}%
\titlecontents{chapter}% <section-type>
[0pt]% <left>
{\bfseries}% <above-code>
{\chaptername\ \thecontentslabel:\quad}% <numbered-entry-format>
{}% <numberless-entry-format>
{\hfill\contentspage}% <filler-page-format>
\usepackage{lipsum}
\usepackage{setspace}
\begin{document}
\pagenumbering{roman}
\clearpage
\setcounter{page}{2}
\chapter*{Abstract}
\addcontentsline{toc}{chapter}{Abstract}
\lipsum[1]
\chapter*{Acknowledgements}
\addcontentsline{toc}{chapter}{Acknowledgements}
\lipsum[1]
\begin{doublespace}
\renewcommand*{\contentsname}{Table of Contents}
\tableofcontents
\addcontentsline{toc}{chapter}{Table of Contents}
\end{doublespace}
\pagenumbering{arabic}
%\setcounter{page}{255} % % Uncomment to see \hbox warnings due to long TOC page number
\chapter{Introduction}
\lipsum[1]
\section{Section one}
\lipsum[1]
\chapter{Second Chapter}
\lipsum[1]
\section{Another section}
\lipsum[1]
\end{document}
In regards of the Overfull \hbox
warnings, I don't know a good way to solve it with titletoc
, but I know a better way with tocloft
, which works much better than titletoc
.
So, you can replace the titletoc
stuff
\usepackage{titletoc}%
\titlecontents{chapter}% <section-type>
[0pt]% <left>
{\bfseries}% <above-code>
{\chaptername\ \thecontentslabel:\quad}% <numbered-entry-format>
{}% <numberless-entry-format>
{\hfill\contentspage}% <filler-page-format>
with
\usepackage[titles]{tocloft}
\newlength\mylength
\renewcommand\cftchappresnum{\chaptername~}
\renewcommand\cftchapaftersnum{:}
\settowidth\mylength{\cftchappresnum\cftchapaftersnum\quad}
\addtolength\cftchapnumwidth{\mylength}
and the following MWE
\documentclass[12pt]{report}
\usepackage[utf8]{inputenc}
\usepackage[titles]{tocloft}
\newlength\mylength
\renewcommand\cftchappresnum{\chaptername~}
\renewcommand\cftchapaftersnum{:}
\settowidth\mylength{\cftchappresnum\cftchapaftersnum\quad}
\addtolength\cftchapnumwidth{\mylength}
\usepackage{lipsum}
\usepackage{setspace}
\begin{document}
\pagenumbering{roman}
\clearpage
\setcounter{page}{2}
\chapter*{Abstract}
\addcontentsline{toc}{chapter}{Abstract}
\lipsum[1]
\chapter*{Acknowledgements}
\addcontentsline{toc}{chapter}{Acknowledgements}
\lipsum[1]
\begin{doublespace}
\renewcommand*{\contentsname}{Table of Contents}
\tableofcontents
\addcontentsline{toc}{chapter}{Table of Contents}
\end{doublespace}
\pagenumbering{arabic}
\setcounter{page}{255} % % Uncomment to see \hbox warnings due to long TOC page number
\chapter{Introduction}
\lipsum[1]
\section{Section one}
\lipsum[1]
\chapter{Second Chapter}
\lipsum[1]
\section{Another section}
\lipsum[1]
\end{document}
will give you the following result
The following works for me (based on your MWE), but it's a bit of a hack though.
\usepackage{titletoc}%
\titlecontents{chapter}% <section-type>
[0pt]% <left>
{}% <above-code>
{\bfseries\chaptername\ \thecontentslabel:\quad}% <numbered-entry-format>
{\bfseries\raggedright\hspace{-0.575\linewidth}}% <numberless-entry-format>
{\bfseries\hfill\contentspage}% <filler-page-format>
The hbox warnings look like they are caused by the page numbers being boldface for chapters (but not sections). Do you want it that way, or do you want all page numbers in the same (non-bold) font?