Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I don't want to ask questions in my edits or comments so I am posting my question freshly. The solution that was given for the problem Modifying the header in fancyhdr.

I want the chapter name to appear on the header without numbering. What should I do? I tried removing the section mark but it doesn't just work?

It works in a separate code. Now If I am embedding it in original code it doesn't work or rather the output expected doesn't come.

I want to achieve the following:

  1. Chapter 1 or similar should not appear in the heading of the chapter so I used chapter*
  2. In header only chapter name should appear without numbering but section names are also appearing.

Here is the code:

%Template for Technical Document
\documentclass{book}
\usepackage{graphicx}
\usepackage[explicit]{titlesec}
\usepackage{tikz}
\usepackage{suffix}
\usepackage[a4paper,margin=1in,bindingoffset=0.2in,centering,headheight=0.3in,heightrounded]{geometry}
%\renewcommand{\chaptername}{Article}
\usepackage{fancyhdr}
\usepackage[a4paper,margin=1in,bindingoffset=0.2in,centering,headheight=0.3in,heightrounded]{geometry}
% Can also use centering, or hcentering

\usetikzlibrary{shapes.misc,arrows}
\newcommand\titlebar{%
\tikz[baseline,trim left=0.5cm,trim right=2.5cm] {%
    \node [
        text = red!70!green,
        anchor= base east,
        minimum height=3.5ex] (a) at (2.5cm,0.6ex) {%
    };
   \path[fill=red!70!blue] (a.east) circle (.5ex);
   \draw[color=red!70!blue, thick,rounded corners=1ex] (a.east) |- (\textwidth+3cm,-0.75ex);
}%
}

\newcommand\subtitlebar{%
\tikz[baseline,trim left=1cm,trim right=3.05cm] {%
    \node[
        text = red!70!green,
        anchor= base east,
        minimum height=3.5ex] (b) at (3.05cm,0.6ex) {%
    };
   \path[fill=red!70!blue] (b.east) circle (.5ex);
   \draw[color=red!70!blue, thick,rounded corners=1ex] (b.east) |- (\textwidth+2cm,-0.75ex);
}%
}

\titleformat{\subsection}{\normalfont\sf}{\subtitlebar}{0.2cm}{\textcolor{blue!60!green}{#1}}
\titlespacing*{\subsection}{-2cm}{3.5ex plus 1ex minus .2ex}{2.3ex plus .2ex}
\titlespacing*{name=\subsection,numberless}{0cm}{3.5ex plus 1ex minus .2ex}{2.3ex plus .2ex}
\renewcommand*{\thesubsection}{\arabic{subsection}}


\titleformat{\section}{\large\sf}{\titlebar}{0.25cm}{\textcolor{blue!60!green}{#1}}
\titlespacing*{\section}{-2.15cm}{3.5ex plus 1ex minus .2ex}{2.3ex plus .2ex}
\titlespacing*{name=\section,numberless}{0cm}{3.5ex plus 1ex minus .2ex}{2.3ex plus .2ex}
\renewcommand*{\thesection}{\arabic{section}}

\newcommand\chapterauthor[1]{\authortoc{#1}\printchapterauthor{#1}}
\WithSuffix\newcommand\chapterauthor*[1]{\printchapterauthor{#1}}
\makeatletter
\newcommand{\printchapterauthor}[1]{%
  {\parindent0pt\vspace*{-25pt}%
  \linespread{1.5}\large\scshape\filcenter #1%
  \par\nobreak\vspace*{35pt}}
  \@afterheading%
}
\newcommand{\authortoc}[1]{%
  \addtocontents{toc}{\vskip-10pt}%
  \addtocontents{toc}{%
    \protect\contentsline{chapter}%
    {\hskip1.3em\mdseries\scshape\protect\scriptsize#1}{}{}}
  \addtocontents{toc}{\vskip5pt}%
}
\makeatother

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

\fancypagestyle{myfancy}{
\fancyhf{}
\fancyhead[LE,RO]{\slshape\nouppercase{\rightmark}}
\fancyhead[LO,RE]{\slshape\nouppercase{\leftmark}}
\fancyfoot[LE,RO]{\thepage}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
}


\usepackage{microtype}

\usepackage{afterpage}
\let\oldcleardoublepage\cleardoublepage
\renewcommand{\cleardoublepage}{\afterpage{\thispagestyle{empty}}\oldcleardoublepage}

\pagestyle{myfancy}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{#1}}


\begin{document}
\chapter{Install Backtrack on an Android Device}
\chapterauthor*{K.DINESH KUMAR \par II Year B.Tech CSE}
\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
\section{Security Tools in Backtrack}
BackTrack includes many well known security tools including:
\begin{itemize}
    \item Metasploit for integration
    \item Wi-Fi drivers supporting monitor mode (rfmon mode) and packet injection
    \item Aircrack-ng
    \item Gerix Wifi Cracker
    \item Kismet
    \item Nmap
    \item Ophcrack
    \item Ettercap
    \item Wireshark (formerly known as Ethereal)
    \item BeEF (Browser Exploitation Framework)
    \item Hydra
    \item OWASP Mantra Security Framework, a collection of hacking tools, add-ons and scripts based on FirefoX.
    \item Cisco OCS Mass Scanner, a very reliable and fast scanner for Cisco routers with telnet and enabling of a default password.
\end{itemize}

\section{Installing Backtrack on Android Device}
\subsection{Tools Required}
\begin{enumerate}
\item Backtrack 5 ARM.\\
Download Backtrack 5 ARM from Backtrack official site. Backtrack with ARM architecture only on Backtrack 5 version. ARM architecture not available for Backtrack 5 R1, Backtrack 5 R2, and Backtrack 5 R3.
\item Rooted android device \\
Why rooted android device ? Because we need install some application that need Android to be root
\item Busybox, Superuser, Terminal Emulator, and AndroidVNC. \\
You can download search and all of them on Google Play. BusyBox is installer and uninstaller Android program, Superuser is superuser rights manager for Android, Terminal Emulator is Android's built-in Linux command line shell program, and AndroidVNC is a VNC viewer for Android.
\end{enumerate}
\subsection{Installation}
\begin{enumerate}
\item Extract BT5-GNOME-ARM.7z to folder, for example "BT5" folder and then put on device root directory.
\item Open Terminal Emulator on device then go to BT5 folder using the command \verb+ cd sdcard/BT5 +
\item Then run this following command \verb+ su + and \verb+ sh bootbt + and you will see \verb+ root@localhost +
\item Now lets run Backtrack GUI with VNC viewer \verb+startvnc+
\item To connect wth VNC we must know the port where VNC listening. Run \verb+netstat -anpt+ and remember the port where VNC listening. In this case the port is 59016. Open AndroidVNC and fill the form like this: \\
Nickname : BT5\\
Password : toortoor\\
Address  : 127.0.0.1\\
Port     : 5901 \\
\item Connect it and you will see Backtrack 5 interface \par
\textit{Remember! Some of the Backtrack tools can't work properly and do it for your own risk. I hope you can Install Backtrack on Android device without any problems, tell me if you get problems.}
\end{enumerate}
\end{document} 
share|improve this question
    
So you don't want the name of sections in the header at all? –  Gonzalo Medina Feb 1 at 14:38
    
Yes .. no section names at all –  subham soni Feb 1 at 14:39

1 Answer 1

up vote 4 down vote accepted

Here are some settings that will give you what you described:

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

\fancypagestyle{myfancy}{
  \fancyhf{}
  \fancyhead[LE,RO]{\slshape\nouppercase{\leftmark}}
  \fancyfoot[LE,RO]{\thepage}
  \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}
share|improve this answer
    
Everything is fine except for "Chapter 1" –  subham soni Feb 1 at 14:42
    
@subhamsoni that's the job of titlesec and has nothing to do with headers. I added an example to my answer takes some code form another question of yours. –  Gonzalo Medina Feb 1 at 14:43
    
@subhamsoni All you need is to suppress the relevant parts from the \titleformat command; see my edited answer. –  Gonzalo Medina Feb 1 at 14:46
    
Yup Got it :-).. –  subham soni Feb 1 at 14:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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