I'm trying to build custom section headings, which have the text in the top of a coloured box of a specified height, with another coloured box of a specified height beneath. Much like this:
The closest I've got is the following:
from using this code
\documentclass[a4paper]{article}
\usepackage{xcolor,lipsum}
\usepackage{titlesec}
\titleformat{name=\section}[block]
{\sffamily\LARGE\color{white}}
{}
{} % distance from left hand side
{\colorsection}
\titlespacing*{\section}
{} % distance from the left
{\baselineskip}
{\baselineskip}
\newcommand{\colorsection}[1]{%
\colorbox{blue!70}
{\parbox
{\dimexpr\textwidth\fboxsep}
{\thesection\ #1}}
\colorbox{blue!50}
{\parbox[][30pt][]
{\pagewidth}
{}}
}
\begin{document}
paragraph text
\section{This is the title}
paragraph text
\end{document}
\parbox[][30pt][]
appears to specify the height of the box, but setting this wipes the text out which then kills the width, which I would like to be full page. Is it parbox that I need to edit or something else?