[Tex/LaTex] Chapter Name not appearing

chapterssectioningtitlesec

I wanted to style the chapter name. I referred the following link :
how-to-create-specific-chapter-style-in-book-documentclass

Here is my code:

%Template for Technical Document
\documentclass{book}
\usepackage[explicit]{titlesec}
\usepackage{titlesec}
% Can also use centering, or hcentering

\titleformat{\chapter}[display]
  {\bfseries\Large}
  {\filright\MakeUppercase{\chaptertitlename}\Huge\thechapter}
  {1ex}
  {\titlerule\vspace{1ex}\filleft}
  [\vspace{1ex}\titlerule]

\begin{document}
\chapter{Install Backtrack on an Android Device}
\section{What is Backtrack?}
BackTrack is a distribution designed by Jason Dennis based on the Ubuntu Linux distribution aimed at digital forensics and penetration testing use. BackTrack provides users with easy access to a comprehensive and large collection of security-related tools ranging from port scanners to Security Audit. Support for Live CD and Live USB functionality allows users to boot BackTrack directly from portable media without requiring installation, though permanent installation to hard disk and network is also an option.\par
\end{document} 

I get the following output:
enter image description here

After using the explicit option in titlesec and numbering the chapter as per the solution given, I get this output:

enter image description here

Best Answer

You're loading the titlesec package twice- only the first instance actually counts, the second one is ignored.

When you use the explicit option for the titlesec package, you have to specify the heading title using #1.

As such, you could use, for example,

\titleformat{\chapter}[display]
  {\bfseries\Large}
  {\filright\MakeUppercase{\chaptertitlename}\Huge\thechapter}
  {1ex}
  {\titlerule\vspace{1ex}\filleft #1}
  [\vspace{1ex}\titlerule]

or else remove the explicit option and simply load the titlesec package using

\usepackage{titlesec}

in which case, you can stick with your original code.

Related Question