1

I am really confused. In the original document , I had a header that collides with the body of the document. Now for preparing the MWE , I removed the unnecessary packages and code segments. I found that the collision has gone. Please help me out. And secondly , I want to reduce the gap in the header and starting of document. I am attaching both the documents. Sorry for the lengthy question but can't help it out.

\documentclass[12pt]{book}
\usepackage{graphicx}
\usepackage[explicit]{titlesec}
\usepackage{tikz}
\usepackage{suffix}
\usepackage{fancyhdr}
\usepackage[a4paper,margin=1in,includefoot,footskip=1in,bindingoffset=0.2in,centering,headheight=0.3in,heightrounded]{geometry}
\usepackage[printwatermark]{xwatermark}
\usepackage{xcolor}
\usepackage{transparent}
\usepackage{filecontents}
\usepackage[T1]{fontenc}
\usepackage{everypage}
\usepackage{datatool}
\usepackage{microtype}
\usepackage{afterpage}
\usepackage{background}
\usepackage{pgfornament}
\usepackage{ifoddpage}
\usepackage{wrapfig}
\usepackage{wallpaper}

\begin{filecontents}{quotations.csv}
I\space think everybody in this country should learn how to program a computer because it teaches you how to think.; Steve Jobs
Computer Science is no more about computers than astronomy is about telescopes.; Edsger W. Dijkstra
The computer was born to solve problems that did not exist before.; Bill Gates
A\space computer would deserve to be called intelligent if it could deceive a human into believing that it was human.; Alan Turing
UNIX is basically a simple operating system but you have to be a genius to understand the simplicity.; Dennis Ritchie
Imagination is more important than knowledge.  For knowledge is limited, whereas imagination embraces the entire world, stimulating progress, giving birth to evolution.; Albert Einstein
The greatest enemy of knowledge is not ignorance, it is the illusion of knowledge.; Stephen Hawking
The more you know, the more you realize you know nothing.; Socrates
Tell me and I forget.  Teach me and I remember.  Involve me and I learn.; Benjamin Franklin
Real knowledge is to know the extent of one's ignorance.; Confucius
I~do not fear computers. I fear lack of them.; Isaac Asimov
\end{filecontents}
\DTLsetseparator{;}
\DTLloaddb[noheader,keys={quote,author}]{quotes}{quotations.csv}

\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\large\sffamily}{}{0cm}{\textcolor{blue!60!green}{#1}}
\titlespacing*{\subsection}{0cm}{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\sffamily}{}{0cm}{\textcolor{blue!60!green}{#1}}
\titlespacing*{\section}{0cm}{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}
  {\vspace{1ex}\filcenter #1}
  [\vspace{1ex}]

\usetikzlibrary{calc}

\fancypagestyle{plain}{
  \fancyhf{}
 \fancyfoot[LE,RO]{\tikz[baseline={(0,0)},anchor=center] \node[draw,inner sep=0pt,
    outer sep=0pt,label={[xshift=-.10cm,yshift=0cm]center:\footnotesize\thepage}]
    {\includegraphics[scale=.15]{logo1}};}%
 \fancyhead[C]{\includegraphics[scale=.85]{border}}    
  \renewcommand{\footrulewidth}{0.4pt}
  \renewcommand{\headrulewidth}{0.0pt}
}


\fancypagestyle{myfancy}{
\fancyhf{}
\fancyhead[C]{\includegraphics[scale=.85]{border}}    
\fancyfoot[LE,RO]{\tikz[baseline={(0,0)},anchor=center] \node[draw,inner sep=0pt,
    outer sep=0pt,label={[xshift=-.10cm,yshift=0cm]center:\footnotesize\thepage}]
    {\includegraphics[scale=.15]{logo1}};}%
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
}
\newcounter{thepagenum}
\setcounter{thepagenum}{0}

% Set highest row number to access
% '11' here because there are 11 rows in the .csv
\def\pagelimit{11}

\newcommand{\setquoteandauthor}{%
  \parbox[c][0.9cm][b]{\dimexpr\textwidth-4.5cm\relax}{%\centering
    \emph{\QValue} \hfill --- \AValue}}%

\AddEverypageHook{%
  \ifnum\pdfstrcmp{\arabic{thepagenum}}{\pagelimit}=0
  \setcounter{thepagenum}{0}%
  \else
  \fi
  \stepcounter{thepagenum}
  \DTLgetvalue{\QValue}{quotes}{\arabic{thepagenum}}{1}%
  % Author info too?
  \DTLgetvalue{\AValue}{quotes}{\arabic{thepagenum}}{2}%
%  \fancyfoot[cf]{``\QValue'' --- \AValue}%
  \fancyfoot[cf]{\setquoteandauthor}}



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

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

%\newwatermark[allpages,color=red!50,scale=3,xpos=0,ypos=0]{\transparent{0.2}\includegraphics[scale=.25]{logo}}

\tikzset{mynode/.style={anchor=center,text=black,font=\fontfamily{pzc}\LARGE\selectfont,scale=1.5,inner
           sep=2pt,minimum width=0.6cm}}

\usetikzlibrary{calc,chains,positioning}           
\newsavebox\mybox
\savebox\mybox{%
\begin{tikzpicture}[node distance=.1cm]
    \node[mynode] (c) {C};
    \node[mynode,below=of c] (y1) {Y};
    \node[mynode,below=of y1] (b) {B};
    \node[mynode,below=of b] (y2) {Y};
    \node[mynode,below=of y2] (r) {R};
    \node[mynode,below=of r] (u) {U};
    \node[mynode,below=of u] (s) {S};
    \node[mynode,below=of s] (1) {1};
    \node[mynode,below=of 1] (4) {4};
    \end{tikzpicture}%
}
\backgroundsetup{
scale=1,
opacity=1,
angle=0,
color=black,
contents={%
 \checkoddpage
  \ifoddpage
\begin{tikzpicture}[remember picture,overlay]
  \node at ($(current page.east)+(-0.5in,0)$) {\usebox\mybox};
\end{tikzpicture}%
\else
\begin{tikzpicture}[remember picture,overlay]
  \node at ($(current page.west)+(0.5in,0)$) {\usebox\mybox};
\end{tikzpicture}%
  \fi
}
}


\begin{document}
\input{./../Articles/Technical/backtrack/backtrack_linux}
\end{document}

The logo and the border:

enter image description here enter image description here

quotations.csv:

%% LaTeX2e file `quotations.csv'
%% generated by the `filecontents' environment
%% from source `document' on 2014/02/16.
%%
I\space think everybody in this country should learn how to program a computer because it teaches you how to think.; Steve Jobs
Computer Science is no more about computers than astronomy is about telescopes.; Edsger W. Dijkstra
The computer was born to solve problems that did not exist before.; Bill Gates
A\space computer would deserve to be called intelligent if it could deceive a human into believing that it was human.; Alan Turing
UNIX is basically a simple operating system but you have to be a genius to understand the simplicity.; Dennis Ritchie
Imagination is more important than knowledge.  For knowledge is limited, whereas imagination embraces the entire world, stimulating progress, giving birth to evolution.; Albert Einstein
The greatest enemy of knowledge is not ignorance, it is the illusion of knowledge.; Stephen Hawking
The more you know, the more you realize you know nothing.; Socrates
Tell me and I forget.  Teach me and I remember.  Involve me and I learn.; Benjamin Franklin
Real knowledge is to know the extent of one's ignorance.; Confucius
I~do not fear computers. I fear lack of them.; Isaac Asimov

The backtrack_linux.tex file is the same as in the second code from \begin{document} and \end{document}

\documentclass[12pt]{book}
\usepackage{graphicx}
\usepackage[explicit]{titlesec}
\usepackage{fancyhdr}
\usepackage[a4paper,margin=1in,includefoot,footskip=1in,bindingoffset=0.2in,centering,headheight=0.3in,heightrounded]{geometry}
\usepackage{filecontents}
\usepackage[T1]{fontenc}
\usepackage{everypage}
\usepackage{datatool}
\usepackage{microtype}
\usepackage{afterpage}
\usepackage{ifoddpage}
\usepackage{suffix}
\usepackage{tikz}

\begin{filecontents}{quotations.csv}
I\space think everybody in this country should learn how to program a computer because it teaches you how to think.; Steve Jobs
Computer Science is no more about computers than astronomy is about telescopes.; Edsger W. Dijkstra
The computer was born to solve problems that did not exist before.; Bill Gates
A\space computer would deserve to be called intelligent if it could deceive a human into believing that it was human.; Alan Turing
UNIX is basically a simple operating system but you have to be a genius to understand the simplicity.; Dennis Ritchie
Imagination is more important than knowledge.  For knowledge is limited, whereas imagination embraces the entire world, stimulating progress, giving birth to evolution.; Albert Einstein
The greatest enemy of knowledge is not ignorance, it is the illusion of knowledge.; Stephen Hawking
The more you know, the more you realize you know nothing.; Socrates
Tell me and I forget.  Teach me and I remember.  Involve me and I learn.; Benjamin Franklin
Real knowledge is to know the extent of one's ignorance.; Confucius
I~do not fear computers. I fear lack of them.; Isaac Asimov
\end{filecontents}
\DTLsetseparator{;}
\DTLloaddb[noheader,keys={quote,author}]{quotes}{quotations.csv}

\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%
}
\makeatother

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

\usetikzlibrary{calc}

\fancypagestyle{plain}{
  \fancyhf{}
 \fancyfoot[LE,RO]{\tikz[baseline={(0,0)},anchor=center] \node[draw,inner sep=0pt,
    outer sep=0pt,label={[xshift=-.10cm,yshift=0cm]center:\footnotesize\thepage}]
    {\includegraphics[scale=.15]{logo1}};}%
 \fancyhead[C]{\includegraphics[scale=.85]{border}}    
  \renewcommand{\footrulewidth}{0.4pt}
  \renewcommand{\headrulewidth}{0.0pt}
}


\fancypagestyle{myfancy}{
\fancyhf{}
\fancyhead[C]{\includegraphics[scale=.85]{border}}    
\fancyfoot[LE,RO]{\tikz[baseline={(0,0)},anchor=center] \node[draw,inner sep=0pt,
    outer sep=0pt,label={[xshift=-.10cm,yshift=0cm]center:\footnotesize\thepage}]
    {\includegraphics[scale=.15]{logo1}};}%
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
}
\newcounter{thepagenum}
\setcounter{thepagenum}{0}

% Set highest row number to access
% '11' here because there are 11 rows in the .csv
\def\pagelimit{11}

\newcommand{\setquoteandauthor}{%
  \parbox[c][0.9cm][b]{\dimexpr\textwidth-4.5cm\relax}{%\centering
    \emph{\QValue} \hfill --- \AValue}}%

\AddEverypageHook{%
  \ifnum\pdfstrcmp{\arabic{thepagenum}}{\pagelimit}=0
  \setcounter{thepagenum}{0}%
  \else
  \fi
  \stepcounter{thepagenum}
  \DTLgetvalue{\QValue}{quotes}{\arabic{thepagenum}}{1}%
  % Author info too?
  \DTLgetvalue{\AValue}{quotes}{\arabic{thepagenum}}{2}%
%  \fancyfoot[cf]{``\QValue'' --- \AValue}%
  \fancyfoot[cf]{\setquoteandauthor}}



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

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

%\newwatermark[allpages,color=red!50,scale=3,xpos=0,ypos=0]{\transparent{0.2}\includegraphics[scale=.25]{logo}}


\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}

The outputs:

enter image description here

enter image description here

enter image description here

3

As we prefer only one question per post, I will answer only one for now.

Choice 1:

You can reduce the space between your chapter heading and the pictures by modifying

\newcommand{\mychapter}[1]{
\chapter{#1}
\AddToShipoutPicture*{%
\put(80,700){\includegraphics[scale=.85]{border}}
}}

Simply change (80,700) to (98,670).

\newcommand{\mychapter}[1]{
\chapter{#1}
\AddToShipoutPicture*{%
\put(80,670){\includegraphics[scale=.85]{border}}
}}

enter image description here

Change these dimensions accordingly.

Choice 2:

Another option is to redefine the chapter page style and include a header with the image instead of adding it yourself using \AddToShipoutPicture*.

Code (MWE)

\documentclass[12pt,oneside]{book}
\usepackage{graphicx}
\usepackage[explicit]{titlesec}
\usepackage{tikz}
\usepackage{suffix}
\usepackage{fancyhdr}
\usepackage[a4paper,margin=1in,includefoot,footskip=1in,bindingoffset=0.2in,centering,headheight=0.3in,heightrounded]{geometry}
\usepackage{xcolor}
\usepackage[T1]{fontenc}

\titleformat{\subsection}{\normalfont\large\sffamily}{}{0cm}{\textcolor{blue!60!green}{#1}}
\titlespacing*{\subsection}{0cm}{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\sffamily}{}{0cm}{\textcolor{blue!60!green}{#1}}
\titlespacing*{\section}{0cm}{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}
  {\vspace{1ex}\filcenter #1}
  [\vspace{1ex}]
\titlespacing*{\chapter}{0cm}{-8ex plus 1ex minus .2ex}{5ex plus .2ex}   %% this is newly added

\fancypagestyle{plain}{
  \fancyhf{}
  \fancyhead[C]{\includegraphics[scale=.85]{border12}}  %% newly added. change border12 back to border.
  \fancyfoot[R]{\tikz[baseline={(0,0)},anchor=center] \node[draw,inner sep=0pt,
    outer sep=0pt,label={[xshift=-.13cm,yshift=0.1cm]center:\footnotesize\thepage}]
    {\includegraphics[scale=.15]{logo}};}%
  \renewcommand{\footrulewidth}{0.0pt} %was 0.4pt
  \renewcommand{\headrulewidth}{0.0pt}
}


\fancypagestyle{myfancy}{
    \fancyhf{}
    \fancyhead[C]{\includegraphics[scale=.85]{border}}
    \fancyfoot[R]{\tikz[baseline={(0,0)},anchor=center] \node[draw,inner sep=0pt,
       outer sep=0pt,label={[xshift=-.13cm,yshift=0.1cm]center:\footnotesize\thepage}]
       {\includegraphics[scale=.15]{logo}};}%
    \fancyheadoffset{5in}
    \renewcommand{\headrulewidth}{0.0pt}
    \renewcommand{\footrulewidth}{0.0pt} %was 0.4pt
}

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

%% retain this as you have already used this macr.
\newcommand{\mychapter}[1]{
\chapter{#1}
%\AddToShipoutPicture*{%
%\put(98,670){\includegraphics[scale=.85]{border}}
%}
}

\begin{document}
\mychapter{INSTALL BACKTRACK ON AN ANDROID DEVICE}
\chapterauthor*{K.DINESH KUMAR \par II Year B.\,Tech. CSE}
\section{What is Backtrack?}
\begin{center}
\includegraphics[scale=0.5]{example-image-a}
\end{center}
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:


\end{document}

enter image description here

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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