# trying to set text where section header has different margin and textwidth from section text

i am trying to set some text where the section header has a different margin and textwidth from the section text.

the screenshot shows a mockup of how i would like the final layout to look (including some of the section text layout usecases). section headers are in sans serif.

any advice on how best to implement this without resorting to tables? the easiest and cleanest thing would be to define separate geometry for section headers and section text? is this possible?

-

You can use the titlesec package to change the sectional unit formatting. A little example in which a \parbox was used to control the width of the text area reserved for the title and a negative length was used as the first argument of \titlespacing* to get the hanging title. The explicit option was used just to get explicit access to the titles:

\documentclass{article}
\usepackage[explicit]{titlesec}
\usepackage{lipsum}

\titleformat{\section}[block]
{\normalfont\sffamily}
{\thesection}{.5em}{\parbox[t]{3.7cm}{\centering\MakeUppercase{#1}}\filright}
\titlespacing*{\section}
{-4pc}{2.5ex plus .1ex minus .2ex}{0.5pc}

\begin{document}

\section*{The Processional Experience}
\lipsum[2]

\end{document}


Of course, feel free to change the settings according to your needs.

-
i'll try this -- thank you for the very clear instructions –  Vaughn Tan Jul 24 '12 at 2:04
thanks for this. it eventually worked after a bunch of tweaks (there was other formatting i didn't know was needed at the time) -- i wouldn't have been able to do it without your chunk of working code though. much appreciated. –  Vaughn Tan Jul 28 '12 at 23:54
@VaughnTan You're welcome! I'm glad my example was useful. –  Gonzalo Medina Jul 29 '12 at 0:14