# changing formatting for section headers

I would like my document to have section headings that look like this:

How can I achieve this in LaTeX?

For your final solution define the dark red color as desired and replace it with 'red' in my proposal. Note that in the below example the given design is also apllied to the section format.

## The Code

\documentclass[11pt]{article}
\usepackage{lipsum}
\usepackage{xcolor}
\usepackage{titlesec}
\titleformat{\section}
{\normalfont\Large\itshape\color{red}}{%
\hspace*{-4.5em}\rule[-1.35mm]{4.5em}{1.25em}
{\color{white}\hspace{-1cm}\normalfont\thesection\hspace{5pt}}
}{1em}{}
\titleformat{\subsection}
{\normalfont\large\itshape\color{red}}{%
\hspace*{-4.5em}\rule[-1.35mm]{4.5em}{1.25em}
{\color{white}\hspace{-1cm}\normalfont\thesubsection\hspace{5pt}}
}{1em}{}

\begin{document}
\section{Introduction}
\lipsum[1]
\subsection{Laplace Transformation}
\lipsum[2-4]
\end{document}


## Output

• Hey thanks so much for your answer, this is exactly what I was looking for! – Slugger Dec 23 '13 at 0:06
• Glad to hear this. Note the minimal edit. I guess it is closer to your source of inspiration. (?) – Ruben Dec 23 '13 at 0:10