Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
    
Does an explicit \titlespacing{\section}{big stretchy}{big stretchy} not work? (with appropriate values substituted for "big stretchy") –  Seamus Feb 9 '11 at 10:57
    
@Seamus: It most likely would, but then I'd have to figure out what the default spacing actually and then modify that. That's what I'm trying to avoid. In the end, it may be what I have to do. –  TH. Feb 9 '11 at 11:07
    
The last page of titlesec manual gives you the defaults... –  Seamus Feb 9 '11 at 11:36

1 Answer 1

up vote 4 down vote accepted

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):

\newskip\beforetitleunit
\beforetitleunit=1ex\@plus.3ex\@minus.06ex
\newskip\aftertitleunit
\aftertitleunit=1ex\@plus.1ex

So try to double the stretchability before headings by adding the following to your preamble:

\makeatletter
\beforetitleunit=1ex\@plus.6ex\@minus.12ex
\makeatother

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:

\documentclass{article}
\usepackage[compact]{titlesec}
\makeatletter
\beforetitleunit=1ex\@plus.6ex\@minus.12ex
\makeatother
\titlespacing*{\section}{0pt}{*1}{*1}
\usepackage{lipsum}
\begin{document}
\section{A}
\lipsum[1]
\section{B}
\lipsum[1]
\subsection{Ba}
\lipsum[1]
\end{document}
share|improve this answer
    
I wasn't able to get any change by changing that value. See my edit where I added a ridiculous \beforetitleunit value to no effect. –  TH. Feb 9 '11 at 10:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.