Calculate Age Automatically in LaTEX Document

Source

I use this to minimize the effort in updating my CV.

 

\documentclass{article}

...

\usepackage{datenumber, fp}
\newcounter{birthday}
\newcounter{today}
\setmydatenumber{birthday}{1988}{02}{29}
\setmydatenumber{today}{\the\year}{\the\month}{\the\day}
\FPsub\result{\thetoday}{\thebirthday}
\FPdiv\myage{\result}{365.2425}
\FPround\myage{\myage}{0}

...

\begin{document}

Hello, I am \myage years old.

\end{document}
Advertisements
Leave a comment

1 Comment

  1. Darek

     /  April 24, 2015

    Thanks. Great.

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: