Putting a LaTeX header on top of your manuscript

If you’re like me, you’ll have a lot of draft versions of your documents that you print out, and then you lose track of which version is the latest one. Wouldn’t it be nice to have the date and time of your document on the top of each page?

Using LaTeX’s fancyhdr package, as well as the time package, it’s pretty easy to put in a header the date and time at which the document was generated at the top of every page. Use the code below at the top of your document.

Just make sure you comment out the appropriate lines (\pagestyle{fancy} and \thispagestyle{fancy} before you make a camera-ready version.

\usepackage{fancyhdr}
\usepackage{time}

%-------------------------------------------------------------------------
% take the % away on next line to produce the final camera-ready version
% Be sure to remove \thispagestyle{fancy} as well after the \maketitle.
%\pagestyle{empty}
\pagestyle{fancy}

\newcommand\myTime{\now}
\fancyhead{}
\fancyhead[CO, CE]{\texttt{-Manuscript Draft-}}
\fancyhead[RO, RE]{\texttt{\today, \myTime}}
\setlength{\headheight}{2\baselineskip}
\renewcommand{\headrulewidth}{0pt}
%-------------------------------------------------------------------------

\begin{document}
\title{My paper's title}
\author{Author's name}
\maketitle

% You need this here, or else the first page won't have a header.
\thispagestyle{fancy}

\begin{abstract}
Abstract goes here
\end{abstract}
Advertisement

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s