[Tex/LaTex] Insert date set with \date command

datetimetitles

I searched all morning to do this.

I want to insert in my custom title page the date, author, title set with the following commands

\date{The date}
\author{Me \and Other}
\title{the document title}

I want to insert those in my document anywhere (and my custom title page)


Solution

\makeatletter
\@date
\@title
\makeatother

For the authors you put it in a tabular

\begin{tabular}[t]{c}\@author \end{tabular}

Best Answer

It is not quite clear what exactly do you want to do. Usually the title is created by using \maketitle at the point of the document where you want to insert it. However it will be formatted whichever way your documentclass defines it. Redefining it is, of course, possible: you have to define \@maketitle appropriately, in which you can refer to \@title, etc.

However if you are not writing your own class, there might not be much of a point doing this. If you just want a title page, you don't have to use the \title etc commands, just put in the title whichever way you want. There is also a \begin{titlepage} - \end{titlepage} environment for creating a custom titlepage, but again, it does not use the \title command.

EDIT:

Yet another indirect option (along the lines of Andrea R's solution): define your own \thedate, \thetitle, etc commands using \newcommand, and then just use it in the titlepage:

\newcommand{\thedate}{\today}
\newcommand{\thetitle}{Your title}
...
\begin{titlepage}
   \centering\textbf{\thetitle}
\end{titlepage}
Related Question