Joseph Wright's CV source contains a snippet of code that produces an offset color block behind section titles using the titlesec
package, like so:
\documentclass[11pt]{article}
\usepackage{lipsum,xcolor}
\usepackage{titlesec}
\titleformat{\section}{\Large}{}{0 em}
{%
\begingroup
\color{gray!30}%
\titleline{\leaders\hrule height 0.6 em\hfill\kern 0 pt\relax}%
\endgroup
\nobreak
\vspace{-1.2 em}%
\nobreak
}
\begin{document}
\section{Lorem Ipsum}
\lipsum[6]
\end{document}
However, when section numbering is added via \thesection
in the \titleformat
command, this nice effect seems to break:
How could this code be modified such that section numbering doesn't cause any alignment issues? It'd be nice if this could be achieved while still using the titlesec
package.