# How can I use @author, @date, and @title after maketitle?

I want to include the values of author, date, and title in my use of fancyhdr in a document that uses \maketitle. Googling about, I saw that @date, etc. can access the date, etc., values set in the document preamble. It works fine, provided \maketitle is not used. Here's a minimal working example:

\documentclass{article}

\author{Someone}
\date{Somewhen}

\begin{document}

%\maketitle  %Toggle comment and:

Now you see them, now you don't.

\makeatletter
\@date
\@author
\@title
\makeatother

\end{document}


So, 1) why does the use of \maketitle cause subsequent invocation of @date, etc. to yield nothing, and 2) how can I access the value of \date, etc after the use of \maketitle?

-
To answer 1) the normal \maketitle macro resets all of these macros: \global \let \@author \@empty \global \let \@date \@empty \global \let \@title \@empty –  Martin Scharrer Sep 6 '11 at 23:01
@Alan I don't think so. I did link to that other question in the answer that I gave below, but I could well imagine that someone might run into the difficulty that I did without having the interest in producing a custom title page. I added my question despite the existence of that one as mine seems to represent a distinct (way of arriving at the) problem. But, if the community disagrees, so be it :-) –  vanden Sep 7 '11 at 6:27

\documentclass{article}

\makeatletter
\author{Someone}          \let\Author\@author
\date{Somewhen}           \let\Date\@date
\makeatother

\begin{document}

\maketitle

Now you see them
\Date
\Author
\Title

\end{document}

-

Use the titling package, which provides \thedate, \theauthor, \thetitle even after you've called \maketitle.

It's as simple as adding the package, and instead of calling \@date you call \thedate (which also avoids requiring \makeatletter and \makeatother).

\documentclass{article}

\usepackage{titling}

\author{Someone}
\date{Somewhen}

\begin{document}

\maketitle

Now you still see them.

\thedate
\theauthor
\thetitle

\end{document}

-

Checking this site before I posted this question, I saw that this earlier question yielded the answer "use the titling package". That seems to work. But, I'd also come up with putting

\newcommand{\setdocdata}{
\author{Someone}
\date{Somewhen}
}
\setdocdata{}


in my preamble and then using

\maketitle\setdocdata


which works, too, and might appeal to those who prefer to use as few packages as necessary.

(I still would like to know why, for the love of puppies, \maketitle was coded to blank the date, etc values.)

-