As described in this question I'm using the tocloft package to customize the table of contents.
We are putting a horizontal line under the whole section text up to the page number. Therefore we cannot just use \underline for the section text (because this would only affect the text) but have to use \rule to put the underlining.
However, the underlining for the chapter numbers can just be placed with \underline because we want to have a gap btw. the underlining of the chapter number and the underlining of the chapter title+page.
As you can see in the following snippet, the line is currently positioned with [-0.5mm] ...
\usepackage{tocloft}
\renewcommand{\cftchappresnum}{\underline} % chapter numbers are underlined
\renewcommand{\cftchapaftersnumb}{\rlap{\rule[-0.5mm]{0.96\textwidth}{.4pt}\hss}} % chapter entries are underlined as well
... however this does not correctly align with the previous underline.
I think the question is now: What would be the correct length (in ex?) to move the line so that it aligns with an underline on the same line?
Also: What would be the correct thickness so it's the same as for the underline?