Problem: I am trying to put a table of contents into a table so that an agenda tick list can be automatically generated from sections/subsections titles that have been defined in another file. Redefining\cftsecafterpnum
and \cftsubsecafterpnum
to include horizontal lines is starting the line at the section/subsection indent and not the left border of the table.
What I have tried: I tried setting \setlength\cftsecindent{(value)}
and \setlength\cftsubsecindent{(value)}
to negative values so as to bring the horizontal line over to the left border of the table but naturally it moved the section/subsection headings to the left too. Using \renewcommand{\cftsecafterpnum}
with \hrule
threw an error and \hrulefill
produced lines only underneath the entries indent and not spanning the table like this:
MWE:
\documentclass{article}
\usepackage[a4paper,inner=2.3cm,outer=2.3cm,top=3cm,bottom=3cm]{geometry}
\usepackage{tocloft}
\setlength\cftbeforetoctitleskip{-16pt}
\renewcommand{\contentsname}{}
\renewcommand{\cftsecafterpnum}{%
\vskip0.2cm \line(1,0){15cm}
}
\renewcommand{\cftsubsecafterpnum}{%
\vskip0.2cm \line(1,0){14cm}
}
\begin{document}
\section{Section}
\subsection{Subsection}
\section{Section}
\subsection{Subsection}
\newpage
\def\arraystretch{2}
\begin{tabular}{ |p{6.8cm}|p{1.8cm}|p{1.5cm}|p{1.1cm}|p{2.2cm}| }
\multicolumn{5}{c}{\Large\bfseries Title} \\
\hline
\hfil\textbf{Section}\hfil & \textbf{Decisions?} & \textbf{Actions?} & \textbf{Dates?} & \textbf{Completed?}\\
\hline
\tableofcontents & & & &\\
\end{tabular}
\end{document}
It currently looks like this:
The formatting of the entries doesn't look good as I stripped out all the formatting commands for the MWE so please ignore the entries aesthetics. I would like for there to be horizontal lines that span the entire table from left to right border after TOC entries and for the extra space underneath 2.1 Subsection to be removed. I couldn't find an option in tocloft
for removing space after the TOC if it is even a tocloft
setting, I am not sure what is causing that space underneath 2.1 Subsection.