Page Layoutfancyhdr | Page Numbers of Pages 1-3 still show up

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
hello108
Posts: 1
Joined: Wed Oct 26, 2011 2:55 pm

fancyhdr | Page Numbers of Pages 1-3 still show up

Post by hello108 »

Hi

For some reason, page number 1-3 shows up on my output PDF file although i use the fancyhdr package including the \fancyfoot{} command.
I try to get the \fancyfoot[LE,RO]{\thepage} to work on the first three pages also but somehow, it doesn't work.

Mininum working example:

Code: Select all

\documentclass[12pt, twoside]{report}
\usepackage{fancyhdr}
\setlength{\headheight}{15pt}
\pagestyle{fancy}

\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}}
\renewcommand{\chaptermark}[1]{\markboth{\textbf{\thechapter.\ #1}}{}}

\usepackage[top=3cm, bottom=3cm, left=2cm, right=2cm, a4paper]{geometry}

%\setkomafont{disposition}{\normalfont\bfseries}
% if i want to use it \addtokomafont{sectioning}{\color{cyan}}

\usepackage{titlesec}
\titleformat{\chapter}[hang]{\bf\huge}{\thechapter}{2pc}{}

\usepackage{cite}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{mathpazo, textcomp, varioref}
\usepackage{url}
\usepackage{hyperref}
\hypersetup{colorlinks=true, linkcolor=black, citecolor=blue}
\tolerance = 5000
\usepackage{multirow}
\usepackage{subfig}
\usepackage{xfrac}
\usepackage{graphicx}

\usepackage[font=small,format=plain,labelfont=bf]{caption}

\setlength{\headwidth}{\textwidth}

\fancyhead{}
\fancyfoot{}
\fancyhead[RO]{\footnotesize \slshape \rightmark}
\fancyhead[LE]{\footnotesize \slshape \leftmark}
\fancyfoot[LE,RO]{\thepage}

\renewcommand{\bibname}{References}
\renewcommand{\contentsname}{Table of Contents}

\setlength{\parindent}{0pt}
\setlength{\parskip}{\baselineskip}
\setlength{\intextsep}{12pt}

\begin{document}

\setcounter{page}{1}

\tableofcontents

\newpage
\pagebreak

\chapter{Summary}
so summary will be written here

\newpage
\pagebreak

\chapter{Chapter one}

\section{section 1}

\newpage
\pagebreak

\subsection{subsection 1}
\end{document}
Please help me to sort out this problem

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

5gon12eder
Posts: 126
Joined: Sun Feb 13, 2011 8:36 pm

fancyhdr | Page Numbers of Pages 1-3 still show up

Post by 5gon12eder »

This is because the \chapter command invokes \thispagestyle{plain}. Section 7 of the fancyhdr manual gets you where you want.

By the way: It is much easier for others to help you if you try to make your examples as minimal as possible. In your particular case, the following example would have done:

Code: Select all

\documentclass{report}
\usepackage{fancyhdr}
\pagestyle{fancy}

\begin{document}
  \chapter{Lorem Ipsum}
  some text\dots
  \newpage
  some more text\dots
\end{document}
It might be a little more work for you to boil down your problem that way but it dramatically increases your chances of getting a profound answer.

Your particular code doesn't even typeset on my system due to an option clash for the caption package which I didn't investigate any further.

Best
I'm using pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian).
Post Reply