[Tex/LaTex] How to access the currently specified date in \rfoot

header-footertitles

I'm using \date to specify my document's date for \maketitle. I would like to use the same date in my footer. Currently I have to enter the date twice: once in \date and once in \rfoot. Is there a way I can enter the date a single time and have \maketitle and \rfoot both use the same date?

Here's an excerpt from my original document:

\date{December 12, 2012}

\rfoot{December 12, 2012}

\begin{document}

\maketitle

I found a related question: How can I use @author, @date, and @title after maketitle? so I tried this:

\date{December 12, 2012} \let\Date\@date

\rfoot{\Date}

\begin{document}

\maketitle  

But that gives me an error:

./MyDoc.tex:45: LaTeX Error: Missing \begin{document}
.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.45 \date{December 12, 2012} \let\Date\@d
                                          ate

Best Answer

You have to use makeatletter and makeatother as in this code:

\documentclass{article}
\usepackage{fancyhdr,lipsum}

\makeatletter
\title{This is title}\let\Title\@title
\author{Your name}          \let\Author\@author
\date{December 12, 2012}           \let\Date\@date
\makeatother

\pagestyle{fancy}
\fancyhf{}
\rfoot{\Date}

\begin{document}

\maketitle

\lipsum

\end{document}
Related Question