Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
    
@GonzaloMedina I get an error when I do that. Paragraph ended before \date was complete \myTitle –  Nasser Mar 17 at 3:49
    
Sorry. I meant \today, as in my answer. –  Gonzalo Medina Mar 17 at 3:50
add comment

1 Answer 1

up vote 5 down vote accepted

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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