1
\fancypagestyle{myfancy}{
\fancyhf{}
\fancyhead[LE,RO]{\slshape\nouppercase{\leftmark}}
\fancyfoot[LE,RO]{\tikz[baseline={(0,0)},anchor=center] \node[label={center:\thepage}]{\includegraphics[scale=.25]{apple}};}%
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
}

The above code generates the following output for chapters and sections (if needed):

First is header and second is footer

header footer

However, when initializing a new chapter, these setting don't appear. I don't want the header to appear but the footer is compulsory. How do I add the footer when starting a new chapter as shown?

2

Since the first page of a chapter uses (by design) the plain style, you need to redefine this style:

\documentclass{book}
\usepackage[explicit]{titlesec}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{fancyhdr}
\usepackage{lipsum}

\fancypagestyle{plain}{
  \fancyhf{}
  \fancyfoot[LE,RO]{\tikz[baseline={(0,0)},anchor=center] 
    \node[label={center:\thepage}]{\includegraphics[scale=.25]{apple}};}%
  \renewcommand{\footrulewidth}{0.4pt}
  \renewcommand{\headrulewidth}{0.0pt}
}

\fancypagestyle{myfancy}{
  \fancyhf{}
  \fancyhead[LE,RO]{\slshape\nouppercase{\leftmark}}
  \fancyfoot[LE,RO]{\tikz[baseline={(0,0)},anchor=center] 
    \node[label={center:\thepage}]{\includegraphics[scale=.25]{apple}};}%
  \renewcommand{\headrulewidth}{0.4pt}
  \renewcommand{\footrulewidth}{0.4pt}
}
\pagestyle{myfancy}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}

\titleformat{\chapter}[display]
  {\bfseries\Large}
  {}
  {1ex}
  {\titlerule\vspace{1ex}\filleft#1}
  [\vspace{1ex}\titlerule]

\begin{document}

\chapter{Install Backtrack on an Android Device}
\section{What is Backtrack?}
\lipsum[1-40]

\end{document}
|improve this answer|||||
  • There is a horizontal line at the top , how to remove it? – subham soni Feb 1 '14 at 15:37
  • @subhamsoni Sorry about that. Please see my updated answer. – Gonzalo Medina Feb 1 '14 at 15:39

Not the answer you're looking for?Browse other questions tagged or ask your own question.