# Placing marginal label within multiline heading

I want to make section headings in an article-class document both multiline and having lables on thier margins.

I'm using two boxes: one for a label and another one for text to force it to split.

\documentclass[a4paper,11pt]{article}
\usepackage[explicit]{titlesec}
\titleformat{\section}
{\makebox[0pt][r]{%
{0pt}
{\makebox[\dimexpr\linewidth][l]{%
\parbox{\dimexpr\textwidth+\marginparwidth+\marginparsep\relax}
{\raggedright #1}}}


This code works well but has one loose end: a section label is placed in the center of a heading box instead of its top.

Would appreciate any ideas.

Use \parbox[t]. Don't use the explicit option to titlesec, you'll regret it, one day: it's much cleaner to define a separate macro than clobbering the last argument of \titleformat.

\documentclass[a4paper,11pt]{article}
\usepackage{titlesec}

\titleformat{\section}
{0pt}
{\printsectiontitle}

\newcommand{\printsectiontitle}[1]{%
\makebox[\dimexpr\linewidth][l]{%
\parbox[t]{\dimexpr\textwidth+\marginparwidth+\marginparsep\relax}
{\raggedright #1}%
}%
}

\let\headingfont\selectfont % just for the example