2

I have a latex document in overleaf where I use the following to display an image on the top of my page:

\fancyhead[C]{\includegraphics[width=12cm]{itu.jpeg}}

This is nice, and does what I want, but the issue is that I only want this to happen on my first page.

This question has to some extent been answered before here and here, and I will now go through the two proposed solutions for these questions, and talk about them.

1

The first question has this snippet as a solution:

\fancypagestyle{firststyle}
{
   \fancyhf{}
   \fancyfoot[C]{\footnotesize Page \thepage\ of \pageref{LastPage}}
}

I try just to naively combine this with what I already have, so it looks like so:

\fancypagestyle{firststyle}
{
\fancyhead[C]{\includegraphics[width=12cm]{itu.jpeg}}
   \fancyhf{}
   \fancyfoot[C]{\footnotesize Page \thepage\ of \pageref{LastPage}}
}

Now my image is'nt displayed anywhere. Even the footer stuff seems to have no effect. Also overleaf doesnt reckonize "firststyle".

2

The second question has a very similar answer:

\fancypagestyle{empty}{%
  \fancyhf{}% Clear header/footer
  \fancyhead[L]{Scientific Paper}% Your journal/note
  \fancyhead[R]{\rule{100pt}{30pt}}% Your logo/image
}

And I try to integrate:

\fancypagestyle{empty}{%
  \fancyhf{}
  \fancyhead[C]{\includegraphics[width=12cm]{itu.jpeg}}
  \fancyhead[R]{\rule{100pt}{30pt}}
}

This has the same effect as before, image is not shown.

How do I get my image only displayed on the first page, and what am I doing wrong in these fixes?

EDIT

I have my text here, I am not exactly sure what to do about dependencies:

\documentclass[12pt]{article}

\usepackage{template_wete} \usepackage{ifthen}

\usepackage{fancyhdr} \usepackage[utf8]{inputenc} \usepackage{amsmath} \usepackage{float} \usepackage{parskip} \usepackage{fancyhdr} \pagestyle{fancyplain} \usepackage[alf]{abntex2cite}

\renewcommand\plainheadrulewidth{.4pt} \fancyhf{}

\fancyfoot[C]{\thepage}

\sloppy \title{Project agreement - Research project fall 2021}

\author{Ask H. Sejsbo, David M. Carl}

\address{ Instituto Nacional de Pesquisas Espaciais, São José dos Campos, SP, Brasil \ Aluno de Mestrado do curso de Ciência e Tecnologia de Materiais e Sensores - CMS. \nextinstitute Instituto Tecnológico da Aeronáutica, São José dos Campos, SP, Brasil \email{asse@itu.dk & } }

\renewcommand{\headrulewidth}{0pt}

\begin{document}

\maketitle

\begin{resumo} Apresentação concisa do trabalho, com descrição de suas principais características, principais objetivos, metodologia utilizada e os resultados alcançados. Deve conter entre 50 e 150 palavras, formato justificado; fonte Times tamanho 12; espaço simples. \end{resumo} \hrulefill

\bibliography{referencias}

\end{document}

1 Answers1

1

First, don't use \pagestyle{fancyplain}; it is deprecated.

Then, your definition

\fancypagestyle{firststyle}
{
\fancyhead[C]{\includegraphics[width=12cm]{itu.jpeg}}
   \fancyhf{}
   \fancyfoot[C]{\footnotesize Page \thepage\ of \pageref{LastPage}}
}

The \fancyhf{} deletes the definition of the previous line; the order should be reversed:

\fancypagestyle{firststyle}
{
  \fancyhf{}
  \fancyhead[C]{\includegraphics[width=12cm]{itu.jpeg}}
  \fancyhf{}
  \fancyfoot[C]{\footnotesize Page \thepage\ of \pageref{LastPage}}
}

And you will have to give \thispagestyle{firststyle} after the \begin{document} to make it effective.

A better solution

Usually if you want to have a picture in the header on the first page, it means that the header is also taller than on other pages. This makes it complicated. It is almost always easier to just put the picture as the first item in the text and leave the header empty (for example with \thispagestyle{plain}). And probably put some \vspace{...} after it.

(P.S. I visited São José dos Campos three years ago.)