88

Using the LaTeX command \today, I can insert the current date. Is there any way to insert the current year with a simple command? All I want is the simple 4 digit year that shows up in \today.

Display Name
  • 46,933
Amandasaurus
  • 2,501
  • 3
  • 14
  • 9

3 Answers3

119
\the\year{}

Here \year represents a number and \the lets you output it as a text.

mdeff
  • 125
abenthy
  • 1,291
14

For the sake of Geoff's question above, here is some short code to only get the year, without changing any of the build-in macros.

\documentclass{article}
\makeatletter
\def\Year#1{%
  \def\yy@##1##2##3##4;{##3##4}%
  \expandafter\yy@#1;
}
\makeatother
\begin{document}
\Year{\the\year}
\end{document}
yannisl
  • 117,160
5
\documentclass{article}

\def\Year{\expandafter\YEAR\the\year}
\def\YEAR#1#2#3#4{#3#4}

\begin{document}
\Year 
\end{document}