# Space between two consecutive headings with titlesec option largestsep

To format headings I am using the titlesec package. I need 12 pt space before each heading and 6 pt after. If there are consecutive headings (i.e. heading directly followed by subheading) I need 12 pt space between them. Therefore, I use the package option largestsep. However, the space between two headings is more than 12 pt. Am I missing something?

Quote from the titlesec documentation: "By default, when there are two consecutive titles the aftersep space from the first one is used between them. […] With largestsep the largest of them is used.”)

MWE:

\documentclass{article}
\usepackage{lipsum}
\usepackage[largestsep]{titlesec}
\titlespacing {\section} {0pt} {12pt} {6pt}
\titlespacing {\subsection} {0pt} {12pt} {6pt}
\begin{document}
\section{Section}
\subsection{Subsection}
\lipsum
\end{document}


You are right in saying this doesn't work. It looks like a bug to me. Adding \unskip after the first title restores the behaviour, removing a spurious vertical skip of zero size that is inserted in the output and preventing the internal \addvspace having any effect. I don't know where this extra zero space is generated.

In the code below, \showoutput tells us that the \unskip variant results in

...\glue 6.0
...\glue -6.0
...\glue 12.0


as desired, whereas without the \unskip we get

...\glue 6.0
...\glue 0.0
...\glue 12.0


\documentclass{article}

\usepackage{lipsum}
\usepackage[largestsep]{titlesec}
\titlespacing{\section}{0pt}{12pt}{6pt}
\titlespacing{\subsection}{0pt}{12pt}{6pt}

\begin{document}
\showoutput
\section{Section}\unskip
\subsection{Subsection}
\lipsum[1]
\section{Section}
\subsection{Subsection}
\lipsum[2]
\end{document}

• Thx! Any idea for a global workaround? – Janine Oct 8 '15 at 10:00
• Not currently, I have not yet tracked down the source of the extra zero skip. – Andrew Swann Oct 8 '15 at 16:13
• any new on this? – Janine Dec 11 '15 at 15:38
• Sorry, no. Have you tried sending a bug report to the titlesec author? – Andrew Swann Dec 12 '15 at 15:03
• I've tried twice but got no response. – Janine Dec 14 '15 at 9:23