5

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

enter image description here

How can I achieve this in LaTeX?

0

1 Answer 1

7

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

enter image description here

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .