# Plain footer goes over the edge with fancyhdr

I am using fancydhr for my title page to display logos on its header and footer. For the rest of my report I use \pagestyle{plain} to get the standard footer with only the page number. But using the \pagestyle{fancy} on the first page causes the entire document to be like shifted down, and the page numbering disappears. I can only recover it by increasing the bottom margin up to 6 cm but it keeps a 6 cm space between the end of the text and the end of the page, so this solution does not suit me well.

Here is my code with my desired margins :

\documentclass[11pt,a4paper]{report}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[french]{babel}
\usepackage{ragged2e}

\usepackage{graphicx}
\usepackage{esint}
\usepackage{gensymb}
\usepackage{lipsum}

\usepackage{fancyhdr}
\usepackage{titlesec}
\usepackage[pdfa]{hyperref}

\setlength{\parindent}{4ex} % alinea size
\hypersetup{linkbordercolor=1 1 1, urlbordercolor=1 1 1}

% ============================  Header with logo ===============================

% -----------------------------------
\fancyhf{}
% ------------- Footer --------------
\fancyfoot[L]{\includegraphics[width=4.5cm]{example-image-b}}
\fancyfoot[R]{\includegraphics[width=4.5cm]{example-image-b}}
% -----------------------------------
\pagestyle{plain}

% ==============================================================================
% ================================= DOCUMENT ===================================
% ==============================================================================
\begin{document}

% Title Page
\thispagestyle{fancy}
\vspace*{3cm}
\begin{center}
\Huge \textsc{Rapport de stage}\\
\vspace{10mm}
\large \textit{présenté par}\\
\vspace{5mm}
\Large \textbf{Anderson DA SILVA} \\
\vspace{7mm}
\hrulefill \\
\vspace{0,5cm}
\Huge \textbf{Étude de la couche limite atmosphérique en Atlantique tropical dans le cadre de la campagne EUREC$^4$A}\\
\hrulefill \\
\vspace{10mm}

\large Stage effectué au LATMOS du \textit{19 avril 2021} au \textit{19 juillet 2021}.\\
Sous la direction et la tutelle de \textbf{Richard WILSON} et de \textbf{Hugo BELLENGER}.\\ \vspace{1cm}
\newpage

\end{center}

% -------------- Document corps ----------------
\lipsum[1-24]

\end{document}


• Don't you get an error message when you compile? I get the message that \hypersetup{linkbordercolor=1 1 1, urlbordercolor=1 1 1} is an undefined control sequence. Disactivating this line for me makes the file compilable (except for not having your images). Jun 6 at 17:12
• When I add \usepackage[pdfa]{hyperref} (found on tex.stackexchange.com/questions/498987/…) the error message disappears. Please adapt your file by inserting example logos and have a look whether the problem is solved. Jun 6 at 17:36

The .log file says you have to increase \headheight and \footskip. Do this by including headheight=...,footskip=... in the geometry line. Use the numbers as given in the warnings (or rounded up).

And good advice: always check the .log file

Edit : Then, for the rest of the document with no header, set a newgeometry with \newgeometry{left=2.5cm, right=2.5cm, top=2cm, bottom=2cm, includefoot, heightrounded, footskip=30pt} for example.

• I've added the example images, and modified the geometry package options but nothing really changed. I've tried different lengths for footskip and headheight but it only acts like changing the bottom margin. Jun 6 at 19:25
• The .log file says headheight should be at least 57.42738pt and footskip at least 100.11116pt. You didn't do that. Jun 6 at 20:33
• You're right, my bad. I didn't read the right values in the .log. But what about the blank space on every pages that seems to be kept in case I would like to draw my header and footer on them ? I want the text to begin at the distance decided by the top margin, and to end at the distance told by the bottom margin Jun 6 at 21:17
• You can put at the beginning of the next page, after the \newpage, which by the way should be AFTER the \end{center}: \newgeometry{includeheadfoot, headheight=12pt, footskip=30pt} Jun 6 at 21:52
• And if you don't know where the next page begins, for example if the text continues at the page break: \usepackage{afterpage} ... \afterpage{\globaldefs=1 \newgeometry{includeheadfoot, headheight=12pt, footskip=30pt}} before \begin{document} Jun 6 at 21:54

I'd use a different approach: the images at top and bottom aren't really headers and footers.

\documentclass[11pt,a4paper]{report}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[french]{babel}
\usepackage{ragged2e}

\usepackage{graphicx}
\usepackage{esint}
\usepackage{gensymb}
\usepackage{lipsum}

\usepackage[
left=2.5cm,
right=2.5cm,
top=2cm,
bottom=2cm,
includefoot,
heightrounded,
footskip=30pt,
]{geometry}
\usepackage{titlesec}
\usepackage[pdfa]{hyperref}

\setlength{\parindent}{4ex} % alinea size
\hypersetup{linkbordercolor=1 1 1, urlbordercolor=1 1 1}

\raisebox{-\height}[0pt][0pt]{%
\includegraphics[#1]{#2}%
}%
}
\newcommand{\footimage}[2][]{%
\raisebox{0pt}[0pt][0pt]{%
\includegraphics[#1]{#2}%
}%
}

\pagestyle{plain}

% ==============================================================================
% ================================= DOCUMENT ===================================
% ==============================================================================
\begin{document}

% Title Page
\thispagestyle{empty}

\begin{center}

\vspace*{\stretch{1}}

{\Huge\scshape Rapport de stage\\}

{\large\itshape présenté par\\}

{\Large\bfseries Anderson DA SILVA\\}

\hrulefill \\

\vspace{0,5cm}

{\Huge\bfseries Étude de la couche limite atmosphérique en Atlantique
tropical dans le cadre de la campagne EUREC$^4$A\\}

\vspace{0,5cm}

\hrulefill \\

\vspace{10mm}

{\large Stage effectué au LATMOS du \textit{19 avril 2021} au \textit{19 juillet 2021}.\\
Sous la direction et la tutelle de \textbf{Richard WILSON} et de \textbf{Hugo BELLENGER}.\\}

\vspace*{\stretch{2}}

\footimage[width=4.5cm]{example-image-b}\hfill
\footimage[width=4.5cm]{example-image-b}