Page Layoutfancyhdr | Missing Headers and Footers in Report

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
zigou
Posts: 3
Joined: Mon Dec 10, 2012 2:39 am

fancyhdr | Missing Headers and Footers in Report

Post by zigou »

Hi everybody,

I've been struggling for quite a long time now trying to understand what's wrong, I tried searching online but I didn't find any solutions. So I'm asking your help to get me through that problem.

So I'm writing a document using the report class, I would like to have headers and footers on my document using the fancyhdr package. But so far I don't get any headers or footer whatsoever, except on a page where I've included a picture. What's more intriguing is that when I use either the book or article class the headers and footers appear correctly. I am completely lost, so if anyone of you has an idea...

PS: I'm using TeXmaker and MikTeX

Thank you all for any help you could provide me

Code: Select all

Code, edit and compile here:
\documentclass[a4paper,11pt,twoside]{report}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[frenchb]{babel}
\usepackage[colorlinks,linkcolor=black]{hyperref}
\usepackage{url}
\usepackage[draft]{graphics}
\usepackage{pdfpages}
\usepackage{eurosym}
\usepackage{fancyhdr}
\usepackage{multirow}
\usepackage[french]{varioref}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{fancybox}
\usepackage{xcolor}
\usepackage[cc]{titlepic}
\pagestyle{fancy}
\fancyfoot[C]{\thepage}
\lfoot{}\cfoot{- \thepage ~-}{\rfoot{}
\lhead{Business plan}
\rhead{\includegraphics[height=1cm]{logoismans.jpg}}
\lfoot{} %pied de page gauche
\rfoot{Année 2012-2013}
\addtolength{\hoffset}{-1cm}
\addtolength{\textwidth}{2cm}
\addtolength{\voffset}{-1cm}
\setlength{\headheight}{20pt}
\DeclareGraphicsExtensions{.png,.jpg,.pdf}
\begin{document}
\renewcommand{\contentsname}{Sommaire}
\renewcommand{\refname}{Bibliographie}
 
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Recommended reading 2024:

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

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

Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

fancyhdr | Missing Headers and Footers in Report

Post by Stefan Kottwitz »

Hi zigou,

welcome to the board!

Very good that you posted a complete example for checking the issue. It would be great if you would make it smaller next time, just removing not relevant packages and content, as long as the problem is visible.

Her you can see the default behavior of LaTeX: pages where chapters start, have the page style plain. That's also because of the big headings, and their special status. For example, it's not meaningful to have a running page header with chapter or section title at a page where the big chapter title itself is displayed in the heading in the text body. Your document mainly consists of chapter starting pages, that's why you think nearly all pages would be affected. You would better see it after you added more content. And have a look at books: chapter starting pages are very often different, i.e. without a header.

You can change it though, for example by

Code: Select all

\fancypagestyle{plain}{}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
in your preamble.

Stefan
LaTeX.org admin
zigou
Posts: 3
Joined: Mon Dec 10, 2012 2:39 am

Re: fancyhdr | Missing Headers and Footers in Report

Post by zigou »

Danke Schön Stefan_K for your quick answer :D
SO in fact everything was in order, i was just worrying for somethign that was normal. I did cleaned my code supressed my comments and stuff but next time i'll clean it more to ease your work.

Thanks again.

Tim

ps: Thank you for editing my post.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

fancyhdr | Missing Headers and Footers in Report

Post by Stefan Kottwitz »

Hi Tim,

posting a complete preamble can lead to suggestions though. ;-)

For example
  • \usepackage[draft]{graphics} can be omitted since you load graphicx later, which is better, and required for key=value options. Btw. the draft option suppresses loading of images.
  • \addtolength{\hoffset}{-1cm} etc.: I would use the geometry package instead: you can specify page dimensions via options, geometry calculates missing dimensions automatically so that it fits. It's easier and safer.
  • \DeclareGraphicsExtensions{.png,.jpg,.pdf} should not be necessary.
  • \renewcommand{\contentsname}{Sommaire} etc. can be done in the preamble by \addto{\captionsfrenchb}{\renewcommand{\contentsname}{Sommaire}...}.
Perhaps something of this is helpful.

Stefan
LaTeX.org admin
zigou
Posts: 3
Joined: Mon Dec 10, 2012 2:39 am

fancyhdr | Missing Headers and Footers in Report

Post by zigou »

Thank you verymuch for these suggestions, i'm hapy i've posted my entire preamble then !
I have two more questions, the code you can find under:

Code: Select all

Code, edit and compile here:
\fancyfoot[C]{\thepage}
\lfoot{}\cfoot{- \thepage ~-}{\rfoot{}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
I've used it to put the page number surrounded by "-" but then if i get you right on chapter pages it shouldnt work so is there a way to male it work through the entire document ?

I also have remarked that page number on chapter page and on "regular" pages are not horizontally aligned the same, do you have an idea ?

Anyway a big thanks already for all your answers.

Tim
Post Reply