[Tex/LaTex] Rotate section headings

rotatingsectioningsectsty

I'm trying to create a document according some brand guidelines which require the use of angled and coloured section headings.

I have the colours working using the xcolor and sectsty packages, but cannot find how to rotate the headings.

I've also tried using the rotating package. It works fine for ordinary text, but it throws an error when I try to use it for a section.

Here's my working example:

\documentclass{article}

\usepackage{helvet}
\usepackage{xcolor}
    \definecolor{my-green}{RGB}{134,162,11}

% Section Styling
\usepackage{sectsty}
    \sectionfont{\huge \color{my-green}}

\begin{document}
    \section{I'd like to rotate this}
\end{document}

EDIT

Based on the answers below, here is the code I eventually used to solve the problem:

\documentclass{article}
\usepackage[a4paper]{geometry}
\usepackage[explicit]{titlesec}
\usepackage{graphicx}

\usepackage{xcolor}
    \definecolor{scout-green}{RGB}{134,162,11}
    \definecolor{scout-purple}{RGB}{77,33,119}

\newif\ifwithrotation

\newcommand \basictitlebeforecode[1] {
    \parbox[t]{\dimexpr\textwidth\relax}{\raggedright#1}
}

\newcommand \fulltitlebeforecode[1] {
    \ifwithrotation
        \rotatebox{6}{\basictitlebeforecode{#1}}
    \else
        \basictitlebeforecode{#1}
    \fi
}

\usepackage[explicit]{titlesec}
    \titleformat{\section}[hang]
        {\Huge\sffamily\bfseries\color{scout-green}}
        {}{0em}
        {\fulltitlebeforecode{#1}}

    \titleformat{\subsection}[hang]
        {\LARGE\sffamily\bfseries\color{scout-purple}}
        {}{0em}
        {\fulltitlebeforecode{#1}}

\begin{document}

    \section{Ordinary Short Section}
    \subsection{Ordinary Short Subsection}

    \withrotationtrue
        \section{Rotated Short Section}
        \subsection{Rotated Short Subsection}
    \withrotationfalse

    \section{This is a purposely long section title that extends on more than one line}
    \subsection{This is a purposely long subsection title that extends on more than one line}

    \withrotationtrue
        \section{This is a purposely long rotated section title that extends on more than one line}
        \subsection{This is a purposely long rotated subsection title that extends on more than one line}
    \withrotationfalse

\end{document}

enter image description here

Best Answer

Here is an example of what can be done using titlesecand graphicx. See the documentation of titlesec, in particular for spacing.

\documentclass{book}
\usepackage[a4paper, showframe]{geometry}
\usepackage[explicit]{titlesec}
\usepackage{graphicx}

\usepackage{xcolor}
    \definecolor{my-green}{RGB}{134,162,11}

\usepackage{mathtools}

\titleformat{\section}[hang]{\huge\sffamily\bfseries\color{my-green}}{}{0em}{\rotatebox{9}{\arabic{section}.\enspace\parbox[t]%
{\dimexpr\linewidth-2em\relax}{\raggedright#1}}}
\pagestyle{plain}

\begin{document}

  \section{This is a short title}
  This is a paragraph.

  \section{This is a purposely long title that extends on more than one line}
  This is a paragraph.

\end{document} 

enter image description here