81

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.

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

1 Answer 1

112

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .