[Tex/LaTex] Adding header and footer to the front page (and other pages) of an article

articlefancyhdrheader-footer

I am beginner in LaTeX, and I have been unable to find a solution to what looks a simple problem.

I use the article class for a paper. I have received a rectangular logo, about 40 mm high and as wide as the text, to be placed on top of every page for the conference. Also every page should have a "RESTRICTED DISTRIBUTION" and a page number at the bottom.

The following code adds neither header nor footer, but the text of the front page is OK. If I remove the \maketitle, the header appears (but not the footer) and the title is removed….

Other attempts add the header and footer, but move all the text, abstract, etc to the second page. I have been trying a number of things.

What it the correct solution?

\documentclass[11pt, a4paper, english]{article}
\usepackage[top=20mm, bottom=30mm, left=18mm, right=18mm]{geometry} %Layout of page
\usepackage[english]{babel}
\usepackage{fancyhdr, lipsum}
\usepackage[draft]{graphicx}%

\fancypagestyle{titlepage}{
\setlength{\headheight}{175pt}
\fancyhf{}
\centering
\fancyhead[C]{\includegraphics[width= \textwidth]{AbstractHeader.jpg}}
\fancyfoot[R]{\bfseries{\thepage}}
\fancyfoot[C]{RESTRICTED DISTRIBUTION}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
} %
\begin{document}
\begin{titlepage}
\thispagestyle{titlepage}

\title{Using \LaTeX for industrial documents}
\author{Do \underline{\large{NOT}} list authors in this document}
\maketitle 
\begin{abstract} 
\lipsum[1]
\end{abstract}
\section{Background}
\lipsum[2]
\end{titlepage}
\end{document}

Best Answer

All you have to do is to redefine the plain page style (internally issued by the \maketitle command) to be the fancy style you defined:

\documentclass[11pt, a4paper, english]{article}
\usepackage[top=20mm, bottom=70mm, left=18mm, right=18mm]{geometry}
\usepackage[english]{babel}
\usepackage{fancyhdr, lipsum}
\usepackage[demo]{graphicx}% remove the demo option

\fancyhf{}
\fancyhead[C]{\includegraphics[height=40mm,width= \textwidth]{AbstractHeader.jpg}}
\fancyfoot[R]{\bfseries{\thepage}}
\fancyfoot[C]{RESTRICTED DISTRIBUTION}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\setlength\headheight{117.89105pt}

\pagestyle{fancy}

\makeatletter
\let\ps@plain\ps@fancy 
\makeatother

\begin{document}
\title{Using \LaTeX for industrial documents}
\author{Do \underline{\large{NOT}} list authors in this document}
\maketitle 
\begin{abstract} 
\lipsum[1]
\end{abstract}
\section{Background}
\lipsum[1-20]
\end{document}

enter image description here

As azetina mentions in a comment, another option would be to use the background package to place the logo and the footer in all the pages of your document. A little example:

\documentclass[11pt, a4paper, english]{article}
\usepackage[top=70mm, bottom=30mm, left=18mm, right=18mm]{geometry}
\usepackage[english]{babel}
\usepackage{lipsum}
\usepackage[demo]{graphicx}% remove the demo option
\usepackage{background}

\newcommand\Footer{%
\noindent\parbox{.33\textwidth}{\mbox{}}\parbox{.33\textwidth}{RESTRICTED DISTRIBUTION}\parbox{.33\textwidth}{\hfill\bfseries\thepage}}

\SetBgColor{black}
\SetBgScale{1}
\SetBgOpacity{1}
\SetBgAngle{0}
\SetBgContents{%
\begin{tikzpicture}[remember picture,overlay]
\node at (0,0.6\textheight) {\includegraphics[height=40mm,width= \textwidth]{AbstractHeader.jpg}};
\node at (0,-0.68\textheight) {\Footer};
\end{tikzpicture}}

\pagestyle{empty}

\begin{document}
\title{Using \LaTeX for industrial documents}
\author{Do \underline{\large{NOT}} list authors in this document}
\maketitle 
\thispagestyle{empty}

\begin{abstract} 
\lipsum[1]
\end{abstract}
\section{Background}
\lipsum[1-20]
\end{document}

enter image description here

Some general remarks:

  1. The demo option for graphicx was only used to replace the actual image with a black rectangle; do not use that option in your actual code.
  2. I used height=40mm as an option for \includegraphics to simulate the actual size of the logo; probably you won't need to set that option explicitly.
  3. Most probably you will have to adjust the position of the logo through \SetBgVshift and also of the top margin.
  4. It was not clear why you were using the titlepage environment so I removed it from my examples.
Related Question