[Tex/LaTex] Recreating the fancy chapter style of a textbook

book-designchapters

I was wondering if someone could help reproduce the style of chapter shown in this image:
enter image description here

Specifically, just the small grey strip containing "CHAPTER" and the large chapter number (which is 14 in this case)

I am using the following document as a starting point:

\documentclass[11pt,a4paper]{book}

\usepackage{fontspec}
\usepackage{titlesec}
\usepackage{xcolor}
\usepackage{amsmath,array}
\usepackage{lipsum}
\usepackage[
  top=3cm,
  bottom=2.8cm,
  left=2.5cm,
  right=2.5cm,
  marginparwidth=0cm,
  marginparsep=0cm,
  headheight=13.6pt]{geometry}
\usepackage{fancyhdr}

\newcommand{\chapnumfont}{
  \fontsize{144}{0}
  \selectfont
}

\colorlet{chapnumcol}{black!55}

\titleformat{\chapter}[display]
{\bfseries}
{\begin{center}
    \begin{tabular}{r!{$$}r}
    & \hspace*{\fill}\makebox[14.71cm][r]{\chapnumfont\textcolor{chapnumcol}{\thechapter}}  \\
    \end{tabular}    
\end{center}}
{0pt}
{\Huge}

\begin{document}
\sloppy
\chapter{A chapter}
\lipsum
\lipsum
\end{document}

Best Answer

A solution might be to use TikZ (if you are ok with that). Here is a code that can perform what you ask, though not very elegant :

\documentclass[11pt,a4paper]{book}

\usepackage{fontspec}
\usepackage{titlesec}
\usepackage{xcolor}
\usepackage{amsmath,array}
\usepackage{lipsum}
\usepackage{tikz}
\usepackage[
  top=3cm,
  bottom=2.8cm,
  left=2.5cm,
  right=2.5cm,
  marginparwidth=0cm,
  marginparsep=0cm,
  headheight=13.6pt]{geometry}
\usepackage{fancyhdr}


\newcommand{\chapnumfont}{
  \fontsize{144}{0}
  \selectfont
}

\colorlet{chapnumcol}{black!55}

\titleformat{\chapter}[display]
{\bfseries}
{\begin{tikzpicture}
  \node[minimum width=\textwidth, text=black!25, fill=black!25, inner sep=1, outer sep=0, anchor=south] (rectinit) {\huge CHAPTER};
  \node[minimum width=.8\textwidth, text=white, inner sep=1, outer sep=0, anchor=south west, text width=.8\textwidth, align=right] at (rectinit.south west) (chapname) {\huge CHAPTER~~};
  \node[minimum width=.2\textwidth, inner sep=0, outer sep=0, anchor=south west, text width=.2\textwidth, align=left] at (chapname.south east) {\chapnumfont\textcolor{chapnumcol}{\thechapter}};
\end{tikzpicture}}
{0pt}
{\Huge}

\begin{document}
\sloppy
\chapter{A chapter}
\lipsum
\lipsum
\end{document}

The result obtained with it (I keep your parameters for colors) :

enter image description here

I hope it may help you.

Related Question