I'm trying to set my table of contents using the tocloft
package (using this question as a guide) to get something like this:
And this is what I've done so far
\documentclass[10pt]{book}
\usepackage[utf8]{inputenc}
\usepackage[paperheight=210mm,paperwidth=170mm,left=2cm,right=1.78cm,top=2.03cm,bottom=1.95cm,heightrounded]{geometry}
\usepackage{tocloft}
\makeatletter
\let\stdl@chapter\l@chapter
\renewcommand*{\l@chapter}[1]{\stdl@chapter{\hfill\underline{#1}}{}}
\makeatother
\setcounter{tocdepth}{2}
\begin{document}
\tableofcontents
\chapter{Hello}
\section{Hi}
\chapter{Goodbye}
\section{See you soon}
\end{document}
Best Answer
The following does what I think you want.
You could, perhaps, make the user interface a little simpler, but that is up to you.
EDIT If you wanted dot leaders between the chapter titles and page numbers then add
\renewcommand{\cftchapdotsep}{\cftdotsep}
into your preamble.