57

I am making my own title page. I'd like Latex to display the date automatically using \date{\today} but this does not work, since I am not doing \maketitle

So instead of setting the date manually myself and worry about updating it, is there a way to make Latex use \date{\today} in my own title page?

MWE

\documentclass[12pt,notitlepage]{article}%
%\usepackage{datetime} did not help
\newcommand*{\myTitle}{\begingroup 
\centering 
\vspace*{\baselineskip} 

{\LARGE My Title}% Title
\vspace*{1\baselineskip}    
\scshape % Small caps
My project    
\vspace*{1\baselineskip}
University of Main Street\\[\baselineskip]

\vspace*{5\baselineskip} 

Written by \\[\baselineskip]
{\Large John Due\par}     
\vspace*{1\baselineskip}
\scshape
\date{\today}
%\date{\currenttime}  does not work     
\endgroup}

\begin{document}
\pagestyle{empty} 
\myTitle
\clearpage

This is my report
\end{document}

Mathematica graphics

I googled and gave up after 15 minutes search.

  • @GonzaloMedina I get an error when I do that. Paragraph ended before \date was complete \myTitle – Nasser Mar 17 '14 at 3:49
  • Sorry. I meant \today, as in my answer. – Gonzalo Medina Mar 17 '14 at 3:50
  • I appreciate the use of the name John Due – Anonymous Dec 12 '17 at 23:01
75

Simply use \today:

\documentclass[12pt,notitlepage]{article}%
%\usepackage{datetime} did not help
\newcommand*{\myTitle}{\begingroup 
\centering 
\vspace*{\baselineskip} 


{\LARGE My Title}% Title
\vspace*{1\baselineskip}

\scshape % Small caps
My prject

\vspace*{1\baselineskip}
University of Main Street\\[\baselineskip]


\vspace*{5\baselineskip} 

Written by \\[\baselineskip]
{\Large John Due\par} 

\vspace*{1\baselineskip}
\today

\endgroup\clearpage}

\begin{document}
\pagestyle{empty} 
\myTitle

This is my report
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.