How can I add a footer and header just on the first page of a two column scientific article of type \documentclass[conference]{IEEEtran}
and/or \documentclass{article}
?
[Tex/LaTex] Footer/Header for first page of two column article
articleheader-footerieeetran
Related Solutions
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}
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}
Some general remarks:
- The
demo
option forgraphicx
was only used to replace the actual image with a black rectangle; do not use that option in your actual code. - 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. - Most probably you will have to adjust the position of the logo through
\SetBgVshift
and also of the top margin. - It was not clear why you were using the
titlepage
environment so I removed it from my examples.
You need to set the page style to plain
after redefining it using fancyhdr
's \fancypagestyle{plain}{...}
command. This is described in the fancyhdr
documentation (section 7 Redefining plain
style, p 7-8):
\usepackage{fancyhdr,graphicx,lastpage}% http://ctan.org/pkg/{fancyhdr,graphicx,lastpage}
\fancypagestyle{plain}{
\fancyhf{}% Clear header/footer
\fancyhead[R]{\includegraphics[width=\linewidth,height=5pt]{example-image-a}}% Right header
\fancyfoot[L]{Name Firstname - v1.0 \\ Date}% Left footer
\fancyfoot[R]{\thepage\ / \pageref{LastPage}}% Right footer
}
\pagestyle{plain}% Set page style to plain.
This should set the page style to plain
for the entire document, including the first page of \chapter
s.
If you wish to have certain chapters to have a different (empty
, say) page style, you would have to set this manually. For the \tableofcontents
though, this is a bit tricky, since using
\thispagestyle{empty}\tableofcontents
or
\tableofcontents\thispagestyle{empty}
would set it to empty
either too early, or perhaps too late, depending on the choice. This is because of the construction of the command \tableofcontents
(from report.cls
- your document class):
\newcommand\tableofcontents{%
\if@twocolumn
\@restonecoltrue\onecolumn
\else
\@restonecolfalse
\fi
\chapter*{\contentsname
\@mkboth{%
\MakeUppercase\contentsname}{\MakeUppercase\contentsname}}%
\@starttoc{toc}%
\if@restonecol\twocolumn\fi
}
Note that \tableofcontents
executes \chapter*
, which in itself initiates a page break via \clearpage
(or \cleardoublepage
, depending on your document class options, like openright
). So one would have to insert the page style somewhere around the place where the ToC is being built... in this case, at \@starttoc{toc}
. You can do this with an etoolbox
patch (there are other ways as well):
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\makeatletter
\patchcmd{\tableofcontents}% <cmd>
{\@starttoc}% <search>
{\thispagestyle{empty}\@starttoc}
{}{}% <success><failure>
\makeatother
Taking all of this into consideration, you might be after the following setup:
\documentclass[twoside,openright]{report}
\usepackage{fancyhdr,lipsum}% http://ctan.org/pkg/{fancyhdr,lipsum}
\usepackage{graphicx,lastpage}% http://ctan.org/pkg/{graphicx,lastpage}
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\fancypagestyle{plain}{
\fancyhf{}% Clear header/footer
\fancyhead[R]{\includegraphics[width=\linewidth,height=5pt]{example-image-a.pdf}}% Right header
\fancyfoot[L]{Name Firstname - v1.0 \\ Date}% Left footer
\fancyfoot[R]{\thepage\ / \pageref{LastPage}}% Right footer
}
\pagestyle{plain}
\makeatletter
\patchcmd{\tableofcontents}% <cmd>
{\@starttoc}% <search>
{\thispagestyle{empty}\@starttoc}
{}{}% <success><failure>
\makeatother
\begin{document}
\tableofcontents
\chapter{A chapter}\lipsum[1-5]
\end{document}
Of course, this could be changed (even improved) if you don't have a title, or if there was more information on your document structure.
Some references regarding the above usages:
- What do
\makeatletter
and\makeatother
do? etoolbox
documentation regarding command patching via\patchcmd
(section 3.4 Patching, p 11)
Some other things to consider:
- Using
\linewidth
if you wish to have a header image that spans the entire width of the text block (rather than8cm
). - Using the
pageslts
package which provides aVeryLastPage
label, depending on whether or not you have unprocessed floats at the end of your report.
Best Answer
Use
fancyhdr
to create afirstpage
page style and apply it after\maketitle
using\thispagestyle{firstpage}
: