I’m writing a document that uses a rather small text block (\textwidth), with the margin holding footnotes, figures and various other material. Because of the narrow text block, section headings frequently span two lines. However, they can often physically fit on one line – if they are allowed to extend into the marginal area.
So, how do I get the headings to extend into the margins (while still being broken if they extend too much, i.e., more than \marginparsep + \marginparwidth)? I’m using the Memoir class.
Here’s a simple example:
\documentclass[11pt,oneside,article]{memoir} \setlrmarginsandblock{3cm}{9cm}{*} \setmarginnotes{1.5em}{5.5cm}{\onelineskip} \checkandfixthelayout[nearest] \usepackage{lipsum} \begin{document} \chapter{Chapter heading} \section{This heading is too long to fit on one line} Foo. \marginpar{\lipsum[4]}\lipsum[1-3] \end{document} 
twoside+ some magic to make it mostly act like a one-sided document, but that’s not important here.)xparseto redefine\sectionand friends (xparsemakes it easy to still have the extra arguments), and then use this to combine it with\makeboxconstruction Gonzalo use in thetitlesecsolution. (untested)