The code \vskip\baselineskip\addvspace{0.5\baselineskip} produces a vertical space equal to \baselineskip, as it should.
However, when I add \addcontentsline in the middle, I get a bigger space:
\vskip\baselineskip%
\addcontentsline{toc}{section}{}%
\addvspace{0.5\baselineskip}
How can I fix this?
Full MWE:
\documentclass{article}
\usepackage{hyperref}
\setlength{\parskip}{0mm}
\begin{document}
\begin{minipage}{0.5cm}
A
\vskip\baselineskip
\addvspace{0.5\baselineskip}
b
\end{minipage}%
\begin{minipage}{0.5cm}
A
\vskip\baselineskip%
\addcontentsline{toc}{section}{}%
\addvspace{0.5\baselineskip}
b
\end{minipage}%
\begin{minipage}{0.5cm}
A
\vspace{\baselineskip}
b
\end{minipage}
\end{document}


\addtocontents{toc}{\protect\contentsline{section}{SomethingA}{SomethingB}{}}%, but nothing changed – Michael Fraiman Mar 17 '23 at 13:37\addvspaceis actually ignored (commenting it out doesn't change the output, effectively turning it into the rightmost minipage) but in the middle one\addcontentslineintroduces all kinds of grouping and phantomsections etc. that allows\addvspaceto take effect. – Marijn Mar 17 '23 at 13:43