My document is failing to generate a table of contents.
This is the latest MWE suggested by Nickie (perhaps messed up in translation, I don't know). When I compile this in TeXworks using pdflatex, it does not generate a table of contents. I put in some sample text to test that features I was using still work (like links), and they do. But the table of contents still does not display.
\documentclass[12pt]{book}
\usepackage[usenames,dvipsnames]{color}
\usepackage{titlesec}
\definecolor{DeepPink}{rgb}{0.8,0,0.4}
\definecolor{DarkRed}{rgb}{0.5,0,0}
\definecolor{DarkBlue}{rgb}{0,0,0.5}
\titleformat{\chapter}
{\normalfont\LARGE\bfseries\color{DarkBlue}}{\thechapter.}{1em}{}
\makeatletter
% copied from mwe
\renewcommand\chapter{\if@openright\cleardoublepage\else\clearpage\fi
\thispagestyle{plain}%
\global\@topnum\z@
\@afterindentfalse
\secdef\@chapter\@schapter}
% copied from book.cls and modified
\def\@chapter[#1]#2{%
\ifnum \c@secnumdepth >\m@ne
\if@mainmatter
\refstepcounter{chapter}%
\typeout{\@chapapp\space\thechapter.}%
\addtocontents{toc}{\string\contentsline {chapter}%
{\hbox to .65in{Chapter}\protect\numberline{\thechapter}#1}{\thepage}}%
\else
\addtocontents{toc}{\string\contentsline {chapter}%
{\hbox to .65in{Chapter}\protect\numberline{\thechapter}#1}{\thepage}}%
\fi
\else
\addtocontents{toc}{\string\contentsline {chapter}%
{\hbox to .65in{Chapter}\protect\numberline{\thechapter}#1}{\thepage}}%
\fi
\chaptermark{#1}%
\addtocontents{lof}{\protect\addvspace{10\p@}}%
\addtocontents{lot}{\protect\addvspace{10\p@}}%
\if@twocolumn
\@topnewpage[\@makechapterhead{#2}]%
\else
\@makechapterhead{#2}%
\@afterheading
\fi}
\makeatother
\usepackage[colorlinks,citecolor=DeepPink,linkcolor=DarkRed,urlcolor=DarkBlue]{hyperref}
\begin{document}
\frontmatter
\tableofcontents
\mainmatter
\chapter{C++ First Blood}
This is a test.
Review Questions
\begin{enumerate}
\item What color is George Washington's white horse?
\item What function is the entry point to every C++ program?
\end{enumerate}
\href{http://en.wikipedia.org/wiki/Graph_theory}{Graph Theory}
\chapter{Java: More Delicious than C++}
\chapter{Python Swallows Those other Languages, Whole}
\chapter{D for Those who Cannot Spell C++}
\end{document}
pdflatex
) see my addition (third paragraph from the end of my answer).\usepackage[linktocpage=true]{hyperref}