I'm trying to format the title of the table of contents using the tocloft
package. It inserts code that looks like the following.
\par
\vspace*{\cftbeforetoctitleskip}%
% code to typeset \contentsname
The \vspace*
is adding unwanted space. Here's a minimal example demonstrating the problem.
\documentclass{article}
\usepackage{showframe}
\begin{document}
\vspace*{0pt}%
ASDF
\end{document}
Compare that to \vspace{0pt}
(or simply omitting the \vspace
line altogether).
The difference between \vspace
and \vspace*
is clear. With the star, it expands to
\dimen@\prevdepth
\hrule \@height\z@
\nobreak
\vskip#1%
\vskip\z@skip
\prevdepth\dimen@
and without the star, it expands to just the two \vskips
.
Why is there the extra space? (And bonus question: Doesn't this make \vspace*
sort of worthless since the star only has a use when TeX is discarding items?)
Edit:
I was able to fix my real problem (with the table of contents) by using \patchcmd
from etoolbox
.
\topskip
as explained here tex.stackexchange.com/questions/7286/…