# Adding header and footer to the front page (and other pages) of an article

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}{
\fancyhf{}
\centering
\fancyfoot[R]{\bfseries{\thepage}}
\fancyfoot[C]{RESTRICTED DISTRIBUTION}
\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}

-
Sometimes I use the background package for this sort of things, especially if I want the school logo or copyright stuff to appear in all of the pages I am writing. –  azetina Apr 2 '12 at 21:33

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{}
\fancyfoot[R]{\bfseries{\thepage}}
\fancyfoot[C]{RESTRICTED DISTRIBUTION}
\renewcommand{\footrulewidth}{0pt}

\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}


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.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}


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.
-
Many thanks for help. Could you pls indicate why such a high value of "bottom=70mm", is required in the first example? I cannot relate these 70 mm to a parameter of the page. Also what does excatly the line \let\ps@plain\ps@fancy do? I had copied the "title page" code from a sample code trying to solve the same problem... –  Yves Apr 3 '12 at 10:58
@Yves: You're welcome. Since the \headheight value has to be increased to make room for the logo, the text will be pushed down so the bottom margin has to be increased also to compensate. The line \let\ps@plain\ps@fancy simply makes the plain page style to be an exact copy of the fancy page style. –  Gonzalo Medina Apr 3 '12 at 15:23
Thanks. I had trouble understanding the need to increase the bottom margin, to accomodate text moving to the bottom. My first idea would have been to reduce it! (I may confuse bottom margin and room for footer..) Also, did you adjust the header value to align manually the "restricted distribution" of page one to the location of page 2? I initially (with the real logo) had a difference of height, but finally managed to adjust. All considered, what option (1 or 2) is the most advisable? –  Yves Apr 3 '12 at 19:20
@Yves: You're welcome. For simple documents, both options are usable and both approaches are flexible. Perhaps in some specific cases one would be preferable over the other, but this will depend on knowing the exact specifications for the document to be produced. –  Gonzalo Medina Apr 4 '12 at 0:45