[Tex/LaTex] Fancy Chapter Headings – onesided version

sectioning

I would like to create titles of my single sided thesis like the one given in books (and can be seen in the following link), I tried to change the code given by Martin in the following link, but didn't get the desired output

Fancy Chapter Headings

This is Martin's code:

\documentclass{book}
\usepackage{graphics}

\usepackage{titlesec}
\titleformat{\chapter}[display]
  {\normalfont\Large\raggedleft}
  {\MakeUppercase{\chaptertitlename}%
    \rlap{ \resizebox{!}{1.5cm}{\thechapter} \rule{5cm}{1.5cm}}}
  {10pt}{\Huge}
\titlespacing*{\chapter}{0pt}{30pt}{20pt}

\usepackage{lipsum}
\setcounter{chapter}{2}
\begin{document}

\chapter{Implementation}
\lipsum
\end{document}

Here is what it currently looks like:

enter image description here

I am trying to change the printed output from right to left side, how should i modify the code? I just want to write the black box then chapter number, ENTER then Chapter Name in Centre.

Best Answer

Here you go.

\documentclass[oneside]{book}
\usepackage{graphics}

\usepackage{titlesec}
\titleformat{\chapter}[display]
  {\normalfont\Large\raggedright}
  {\hspace{0cm}\llap{%
    \rule{5cm}{1.5cm}\hspace{0.2cm}\resizebox{!}{1.5cm}{\thechapter}\hspace{0.2cm}}%
    \MakeUppercase{\chaptertitlename}}
  {10pt}{\Huge}
\titlespacing*{\chapter}{0pt}{30pt}{20pt}

\usepackage{lipsum}
\setcounter{chapter}{2}
\begin{document}

\chapter{Implementation}
\lipsum
\end{document}

enter image description here