2

I'm putting a figure in the header of my article, but the text is getting superimposed in the header only on the first page. I think that the problem is with the figure because when I remove it, the problem disappears.

I tried this answer but it did not help me with the problem

The code is above this line:

\documentclass[]{article}
\usepackage[utf8]{inputenc}
\usepackage[a4paper,margin=1in,headheight=.4in,headsep=12pt,heightrounded]{geometry}
\usepackage{graphicx}
\usepackage{lipsum}
\usepackage{subfig}% http://ctan.org/pkg/subfig
\usepackage{fancyhdr}

\pagestyle{fancy}
\fancyhf{}
\chead{\includegraphics[scale=.11]{cortada.jpg}\\
SERVIÇO PUBLICO FEDERAL\\
UNIVERSIDADE FEDERAL DE SERIGPE\\
PRO-REITORIA DE POS-GRADUACAO E PESQUISA}
\setlength{\headsep}{0.2cm}
\title{[RASCUNHO] Brincando com cabeçalhos}
\author{José Joaquim Andrade}
\date{November 2018}

\setlength{\parindent}{1.5cm}
\setlength{\parskip}{0.2cm}
\makeindex

\begin{document}

% \maketitle

\section{First Section}

\lipsum
\lipsum[3-16]

\newpage

\section{Second Section}
\lipsum
\section{Second Section}

\lipsum

\end{document}

To clarify my question, a print screen of the problem is presented below:

Figure with the text superimposed in the header

  • Welcome to TeX.SE! How do you think anyone can resolve the clash between the tiny headheight=.4in and your bulky header? – user121799 Nov 29 '18 at 21:14
2

The headheight is too small. To increase it with \setlength{\headheight}{...}

The necessary size will depend on the image and can be found as a warning in the .log file of your document. For a dummy image I used I for example got

Package Fancyhdr Warning: \headheight is too small (28.90755pt): 
 Make it at least 66.0991pt.
 We now make it that large for the rest of the document.
 This may cause the page layout to be inconsistent, however.

so I rounded up and used \setlength{\headheight}{67pt}

\documentclass[]{article}
\usepackage[utf8]{inputenc}
\usepackage[a4paper,margin=1in,headheight=.4in,headsep=12pt,heightrounded]{geometry}
\usepackage{graphicx}
\usepackage{lipsum}
\usepackage{subfig}% http://ctan.org/pkg/subfig
\usepackage{fancyhdr}

\pagestyle{fancy}
\fancyhf{}
\chead{\includegraphics[scale=.11]{example-image}\\
SERVIÇO PUBLICO FEDERAL\\
UNIVERSIDADE FEDERAL DE SERIGPE\\
PRO-REITORIA DE POS-GRADUACAO E PESQUISA}
\setlength{\headsep}{0.2cm}
\title{[RASCUNHO] Brincando com cabeçalhos}
\author{José Joaquim Andrade}
\date{November 2018}

\setlength{\parindent}{1.5cm}
\setlength{\parskip}{0.2cm}
\makeindex

\setlength{\headheight}{67pt}

\begin{document}

% \maketitle

\section{First Section}

\lipsum
\lipsum[3-16]

\newpage

\section{Second Section}
\lipsum
\section{Second Section}

\lipsum

\end{document}

enter image description here

  • Actually, I've tried this strategy, but because of the margins, I thought that I was in the wrong direction. To set the margins, I'm using \usepackage[a4paper,left=3cm,right=3cm,top=2.5cm,bottom=2.5cm,headheight=.4in,headsep=12pt,heightrounded]{geometry}, but I'm can't see any difference. Is it related to the header? – José Joaquim Nov 29 '18 at 21:22
  • @JoséJoaquim You make the headheight veryyyyyyyyy small. Best is to read your .log file, it clearly says what to do – book Nov 29 '18 at 21:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.