0

I put two images in header with fancy but it removes the footer on all the pages except the table of contents page. If I remove the header configuration, the footer come back.

I have an error message about the first picture in my header in latex logs :

\openout4 = `"Name of file.toc"'.
<first_picture.png, id=140, 581.17125pt x 153.57375pt>
File: first_picture.png Graphic file (type png)
<use first_picture.png>
Package pdftex.def Info: first_picture.png used on input line 79.
(pdftex.def) Requested size: 174.35272pt x 46.07246pt.
<second_picture.png, id=141, 190.7125pt x 85.31876pt>
File: second_picture.png Graphic file (type png)
<use second_picture.png>
Package pdftex.def Info: second_picture.png used on input line 79.
(pdftex.def) Requested size: 95.356pt x 42.65926pt.
Package Fancyhdr Warning: \headheight is too small (12.0pt):
Make it at least 49.6725pt.
We now make it that large for the rest of the document.
This may cause the page layout to be inconsistent, however.
[2 <./first_picture.png> <./second_picture.png>]
Underfull \hbox (badness 10000) in paragraph at lines 84--90
[]
File: first_picture.png Graphic file (type png)
<use first_picture.png>
Package pdftex.def Info: first_picture.png used on input line 98.
(pdftex.def) Requested size: 174.35272pt x 46.07246pt.
File: second_picture.png Graphic file (type png)
<use second_picture.png>
Package pdftex.def Info: second_picture.png used on input line 98.
(pdftex.def) Requested size: 95.356pt x 42.65926pt.

What sould I do ?

    \documentclass{article}
    \usepackage[french]{babel}
    \usepackage[utf8]{inputenc}
    \usepackage{fancyhdr}
    \usepackage{lastpage}
    \usepackage{graphicx}
    \usepackage{listings,xcolor}
    \usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
    \usepackage[hidelinks]{hyperref}
    \pagestyle{fancy}
    \fancyhf{}
    \renewcommand\headrulewidth{1pt}
    \fancyhead[L]{\includegraphics[scale=0.3]{first_picture.png}}
    \fancyhead[R]{\includegraphics[scale=0.5]{second_picture.png}}
    \fancyfoot[C]{COntent which disapears}
    \title{The title}
    \author{The authors}
    \begin{document}
    \clearpage\maketitle
    \thispagestyle{empty}
    \vfill
    \begin{center} \includegraphics[scale=0.4]{A picture.png} \end{center}
    \vfill
    % Saut de page
    \newpage
    \
    % Table des matières
    \tableofcontents
    % Saut de page

    \newpage

    \section{A section}
    Lorem ipsum dolor sit amet, id eum tollit expetendis, impedit maiorum et qui.
    \subsection{A subsection}
    Lorem ipsum dolor sit amet, id eum tollit expetendis, impedit maiorum et qui.\\
    \begin{itemize}
    \item Lorem ipsum 
    \item tollit expetendis
    \item mea cu option
    \end{itemize}
    \subsection{A second subsection}
    Vim elit sonet an, eum velit possim nostrud cu. Rebum praesent mea ne, an eos autem mazim.
    \newpage
\end{document}

It works, I changed the headheight geometry parameters :

\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm,headheight=35pt]{geometry}
5
  • 1
    Welcome, can you try to make the code a little bit more minimal? That means, deleting everything that isn't directly related to the problem.
    – Johannes_B
    Commented Mar 16, 2017 at 17:31
  • Hint: Package blindtext even has some dummy text for you in store.
    – Johannes_B
    Commented Mar 16, 2017 at 17:32
  • 2
    Read the console output. Does fancyhdr say that your header height is too small? If so, it will tell you how bit to make it. Make it at least that big by adding headheight=<whatever> to the options you give geometry.
    – cfr
    Commented Mar 16, 2017 at 17:35
  • 2
    @cfr Would you like to convert your mind reading abilities into an answer? Commented Mar 16, 2017 at 18:21
  • 1
    @samcarter Or remote console reading abilities aka guessing?
    – cfr
    Commented Mar 17, 2017 at 2:14

1 Answer 1

1

If the image in the header is larger than the header height, then it may push the footer off the bottom of the page, making it seem to have disappeared although it is really there, but invisible.

When the header height is too small for the content, fancyhdr prints a warning on the console complaining and telling you how big it needs to be. Pick a value at least this large and add

headheight=<whatever>

to the options you pass geometry.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .