1

I'm trying to create a document in Latex which satisfies the following features:

  1. First page of each chapter, without header-body.
  2. All other pages, with its respective header and footer.

But the following code, only satisfies first feature, and I want 1 and 2 at the same time. What I am doing wrong?

\documentclass[12pt,a4paper,twoside]{book}

\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}
\usepackage{blindtext}

\usepackage{graphicx}
\usepackage{makeidx}
\usepackage{appendix}
\usepackage{float}
\usepackage{listings}
\usepackage{acronym}
\usepackage{eurosym}

\usepackage[bookmarks=true, pdfborder={0 0 0}]{hyperref}

\usepackage[usenames,dvipsnames]{color}
\usepackage{xcolor}

\usepackage{fancyhdr}

% First page of each chapter
\fancypagestyle{plain}{
\fancyhead[L]{}
\fancyhead[C]{}
\fancyhead[R]{}
\fancyfoot[L]{}
\fancyfoot[C]{}
\fancyfoot[R]{}
\renewcommand{\headrulewidth}{0pt}
}

\fancyhf{}
\fancyhead[LO]{\rightmark}
\fancyhead[RO]{\thepage}
\fancyhead[LE]{\thepage}
\fancyhead[RE]{\leftmark}

\pagestyle{fancy}

\title{Test 1}

\author{Just me\\ \texttt{justme@gmail.com}}

\oddsidemargin=15pt

\evensidemargin=15pt

\setlength{\textwidth}{5.7in}

\setcounter{secnumdepth}{5}
\setcounter{tocdepth}{5}

\begin{document}

\renewcommand{\bibname}{bibliography}

\include{p1}

    \newpage{\pagestyle{empty}\cleardoublepage}

\include{thanks}

    \newpage{\pagestyle{empty}\cleardoublepage}

\include{summary}

  \tableofcontents
   \thispagestyle{empty}

  \listoffigures
   \thispagestyle{empty}
   \cleardoublepage

\include{p2}

 \newpage{\pagestyle{empty}\cleardoublepage}

\renewcommand{\baselinestretch}{1}

\renewcommand{\appendixname}{Anexo}
\renewcommand{\appendixtocname}{Anexo}
\renewcommand{\appendixpagename}{Anexo}

\lhead[\thepage]{CHAPTER \thechapter. \rightmark}
\rhead[CHAPTER \thechapter. \leftmark]{\thepage}

\include{ch1}
\include{ch2}

\end{document}

Thank you very much for your help. Regards.

Edit: code of 'p1'

% p1
\pagestyle{empty}
\renewcommand{\baselinestretch}{1.3}
\begin{center}

\large \textbf{\textcolor{BrickRed}{some title}}\\ \textbf{\textcolor{Sepia}{type of project}}\\ \huge \textbf{\textcolor{NavyBlue}{Wonderful Project Name}} \normalsize \begin{figure}[H] \centering \includegraphics[scale=0.08]{figures/logo1.png} \label{uv} \end{figure} \textbf{AUTHOR: \textcolor{Blue}{Just me}} \textbf{TUTORING: \textcolor{Blue}{Charles Parrish, Maximum Codus Serratus}} \large \textbf{2015} \begin{figure}[H] \centering \includegraphics[scale=0.5]{figures/school1.png} \label{school} \end{figure}

\end{center}

closed as off-topic by Johannes_B, darthbith, user31729, Zarko, Stefan Pinnow Jul 18 '16 at 15:34

  • This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • When I clean down your code to minimal working example (MWE), everything works fine as you want in your both points... – Pouya Nov 13 '14 at 12:42
  • Hi and welcome, isn't that the standard setting? – Johannes_B Nov 13 '14 at 14:46
  • @Johannes_B Hi, thank you! What do you mean with "standard setting"? I found documentation for fancyhdr here FancyhdrDoc and I tried to use the easier form :) – Jorge ZM Nov 13 '14 at 18:25
  • @Pouya Hi, thank you for your answer. Yes, I know, it is really strange, because a minimal example works for me too. But the code I posted before, doesn't work properly (fails in point 2). – Jorge ZM Nov 13 '14 at 18:29
  • 4
    I'm voting to close this question as off-topic because the odd behaviour of empty header/footer was suprisingly caused by \pagestyle{empty}. – Johannes_B Jul 18 '16 at 13:58