I have a two-column document that uses the titlesec
package with the compact
option. This mostly produces the spacing that I like, but it doesn't give enough stretchability above the section titles which leads to underfull vboxes and spaces between paragraphs. It is especially noticeable in pages that have full-width floats and only one column of text has a heading (e.g., \paragraph
).
Is there any easy way to increase the stretchability without just guessing values for \titlespacing
?
Minimal example.
\documentclass{article}
\usepackage[compact]{titlesec}
\usepackage{lipsum}
\beforetitleunit=1in % lockstep's suggestion (more or less)
\begin{document}
\section{A}
\lipsum[1]
\subsection{B}
\lipsum[2]
\subsubsection{C}
\lipsum[3]
\paragraph{D}
\lipsum[4]
\end{document}
Best Answer
Looking into
titlesec.sty
, the following code lines seem to define a "building block" for the spacing before and after headings (the actual spacing is determined by applying a multiplier):So try to double the stretchability before headings by adding the following to your preamble:
EDIT: It seems that one must add
\titlespacing
in order to implement the changes to\beforetitleunit
. The following should work and produce "compact" spacing with double stretchability: