1

I admit, that I'm a beginner, so I'm asking your help for headers on title page. I would like to put an image as header on the title page and for the other pages an another header and footer. For now the header and footer that I set it works, but I don't know how to do for the title page. How can I do it? Here's the code

\documentclass{article}

\usepackage[italian]{babel}
\usepackage[paper=a4paper, top=3cm, bottom=2.5cm, left=2.5cm, right=2cm]{geometry}
\usepackage{graphicx}
\usepackage{float}
\usepackage{afterpage}
\usepackage{fancyhdr}
\usepackage[utf8]{inputenc}
\usepackage{hyperref}
\usepackage{enumitem}
\usepackage{wrapfig}
\usepackage{lastpage}

\pagestyle{fancy}

\fancyhead{}
\fancyfoot{}
\fancyhead[L]{\includegraphics[width=2cm]{logo.png}}
\fancyfoot[R]{Page \thepage~of \pageref{LastPage}}
\fancyfoot[L]{John Doe}
\fancyfoot[C]{E1A}

\renewcommand{\headrulewidth}{1pt}
\renewcommand{\footrulewidth}{1pt}

\newcommand\blankpage{
    \null
    \thispagestyle{empty}
    \addtocounter{page}{-1}
    \newpage
    }   

\begin{document}
    \begin{titlepage}
    \fancyhead{\lhead{\includegraphics[width=2cm]{logo.png}}}
    \begin{center}
    \vspace*{3cm}

    \rule{\textwidth}{1.6pt}\vspace*{-\baselineskip}\vspace*{3.5pt}
    \rule{\textwidth}{0.4pt}

    \vspace{2\baselineskip}

    {\Huge Electric and hybrid,\\the future\\}
    \vspace{2\baselineskip}

    \rule{\textwidth}{0.4pt}\vspace*{-\baselineskip}\vspace{3.5pt}
    \rule{\textwidth}{1.6pt}

    \vspace{2\baselineskip}

    \vspace{2\baselineskip}
    {\LARGE  John Doe \\}
    \vspace{0.5\baselineskip}
    \end{center}

    \begin{large}

\end{titlepage}

\end{document}
4
  • Off-topic: You're loading hyperref too early. Put it at the end of the preamble
    – user31729
    Commented Feb 24, 2018 at 13:42
  • Welcome to TeX.SX! I don't think you really need fancyhdr for this.
    – egreg
    Commented Feb 24, 2018 at 13:47
  • Define two different styles. Use one in title page and another for the rest.
    – Say OL
    Commented Feb 24, 2018 at 16:18
  • Don't use a header footer package for an image on the titlepage. You can have a look at tex.stackexchange.com/questions/209993/… (which could be a duplicate)
    – Johannes_B
    Commented Feb 24, 2018 at 16:34

1 Answer 1

2
\documentclass{article}

\usepackage[italian]{babel}
\usepackage[paper=a4paper, top=4cm, bottom=2.5cm, left=2.5cm, right=2cm]{geometry}
\usepackage{graphicx}
\usepackage{float}
\usepackage{afterpage}
\usepackage{fancyhdr}
\usepackage[utf8]{inputenc}
\usepackage{hyperref}
\usepackage{enumitem}
\usepackage{wrapfig}
\usepackage{lastpage}

\usepackage{lipsum}
\usepackage{tikz}
\usepackage{tikzpagenodes}

\pagestyle{fancy}

\newcommand{\headerpic}[1]{%
  \begin{tikzpicture}[remember picture,overlay]
    \node [anchor=south west,inner sep=0] at (current page header area.north west) 
    {\includegraphics[height=2cm]{#1}}; 
  \end{tikzpicture}
}

\fancyhead{}
\fancyfoot{}
\fancyhead[L]{\headerpic{example-image-b}}
\fancyfoot[R]{Page \thepage~of \pageref{LastPage}}
\fancyfoot[L]{John Doe}
\fancyfoot[C]{E1A}

\renewcommand{\headrulewidth}{1pt}
\renewcommand{\footrulewidth}{1pt}

\newcommand\blankpage{
    \null
    \thispagestyle{empty}
    \addtocounter{page}{-1}
    \newpage
    }   

\begin{document}
\begin{titlepage}
  \headerpic{example-image-a}
  \begin{center}
    \vspace*{3cm}

    \rule{\textwidth}{1.6pt}\vspace*{-\baselineskip}\vspace*{3.5pt}
    \rule{\textwidth}{0.4pt}

    \vspace{2\baselineskip}

    {\Huge Electric and hybrid,\\the future\\}
    \vspace{2\baselineskip}

    \rule{\textwidth}{0.4pt}\vspace*{-\baselineskip}\vspace{3.5pt}
    \rule{\textwidth}{1.6pt}

    \vspace{2\baselineskip}

    \vspace{2\baselineskip}
    {\LARGE  John Doe \\}
    \vspace{0.5\baselineskip}
  \end{center}

  %\begin{large}

  \end{titlepage}

\lipsum[1-8]
\lipsum[1-8]


\end{document}

enter image description here

You must log in to answer this question.

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