The book I am republishing contains the transcriptions of lectures given at a certain date. In the table of content, I need an additional column after the title of the lecture (chapter title), where the date of the lecture is called.
I've tried to use some of the answers here (Add extra columns to table of contents) but that didn't answer my question.
I was trying to figure this out with the tocloft
package but not sure how I'm going to get there. I'd like to call the following an MWE, but it's not really working for me so far …
\documentclass{book}
\usepackage[utf8]{inputenc}
\title{test}
\author{name}
\date{now}
\usepackage{tocloft}
\renewcommand{\cftchappresnum}{input?}
\begin{document}
\renewcommand\cftchapdotsep{\cftdotsep}
\tableofcontents
\chapter*{first lecture title}
\addcontentsline{toc}{chapter}{first lecture title}
\chapter*{second lecture title}
\addcontentsline{toc}{chapter}{second lecture title}
\chapter*{third lecture title}
\addcontentsline{toc}{chapter}{third lecture title}
\end{document}
What I'm trying to produce is a ToC like this:
I'm at the beginning of this project so happy to also get related advice re structuring/document class use/anything that can get me started in the right direction.
Best Answer
Welcome to TeX.SX! If you are fine with using
\addcontentsline
to manually insert the entries to your table of contents (as was suggested in your question), you are quite free to insert line breaks and alignments into this macro. For example like this (without thetocloft
package actually):As the dates in the added column are aligned to the name of the month, I came up with a solution that allows you to add stuff to the left and to the right of an imaginary vertical line that runs through the table of contents.
For example,
\toclineinsert{4 }{January}
would place a 4 and a space (the space is needed) to the left of this line and the word January to the right. The space before the 4 and after January is filled with dots.The
\dotfill
macro in gerenal inserts as many dots as needed to shift the stuff that comes next to the very right end of the current line. It functions quite similar to a right-aligned tab stop. If you use this multiple times in the same line, the stuff before, after and between these macros will be spread in such a way that the distances are equal.The
\makebox
macro adds a box with a specified width to the output. By default, this width is set to 25mm in the\toclineinsert
macro, but you can override this by entering, for example,\toclineinsert[30mm]{4 }{January}
. This would shift the word January a bit to the left, but only for this entry, of course.The red line in the following image is, of course, not part of the output and only illustrates the alignment.