I'm trying to change the background color of the chapter headings. I'd like the full top part of the page, including top and right margins to turn gray until the titlerule.
Currently they look like this:
\documentclass[10pt,twoside,openright]{book}
\usepackage{titlesec}
\titleformat{\chapter}[display]{\LARGE\sffamily\bfseries\raggedright}
{\leftskip2cm {\Large\textmd{\chaptertitlename~\thechapter}}}
{0cm}{\leftskip2cm}[\vspace{4mm} {\color{dgray}\titlerule[.6mm]} \enlargethispage{-\parskip}]
The \enlargethispage
is used to make some extra space for the title number, which appears at the bottom of the page only at the first page of the chapter. My attempts with using the framed
environment or colorbox
have so far not been successful.
Best Answer
Because there were quite a lot of changes following your request from my other answer, I decided to write a new one instead of editing my old answer. Here you go.
I took the macro definitions of
\blap
and\tlap
from here: google-groups